<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>welefen的随笔</title>
	<atom:link href="http://www.welefen.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.welefen.com</link>
	<description>welefen的前端技术博客，关注前后端等各方面的技术</description>
	<lastBuildDate>Fri, 11 May 2012 12:35:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>KeymapManager增加检测快捷键冲突的功能</title>
		<link>http://www.welefen.com/keymapmanager-add-check-plugins-keymap-conflict-feature.html</link>
		<comments>http://www.welefen.com/keymapmanager-add-check-plugins-keymap-conflict-feature.html#comments</comments>
		<pubDate>Fri, 11 May 2012 12:35:57 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[SublimeText插件]]></category>
		<category><![CDATA[软件工具]]></category>
		<category><![CDATA[conflict]]></category>
		<category><![CDATA[keymap]]></category>
		<category><![CDATA[sublime text2]]></category>
		<category><![CDATA[sublimetext]]></category>
		<category><![CDATA[快捷键冲突]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=1368</guid>
		<description><![CDATA[Sublime Text的QQ群里（193076432）一直有同学对插件的快捷键有抱怨，经常遇到快捷键冲突的问题。目前还没有一个比较好的方案解决这个问题。基于前段时间开发的管理插件快捷键的插件KeymapManager，遂在这个插件上增加了个检测插件快捷键冲突的功能。 安装或者更新 如果你还没有安装，请在Package Control里搜索KeymapManager直接安装。 如果你之前安装过，需要对KeymapManager更新，更新方式如下： 通过shift+ctrl+p打开Command Palette&#8230;， 输入upgrade，执行 Package Control: Upgrade/Override All Packages，等待更新完成。 使用方式 通过Ctrl + Alt + k 打开KeymapManager, 拉到最后一项KeymapConflict（可以通过键盘向上按钮快速找到），点击后就弹出当前已经发生冲突的快捷键，并提示快捷键在哪些命令下发生了冲突，如图： 这样就很清楚的列出了哪些快捷键有冲突了，如果冲突的快捷键影响到了功能的使用，你就可以进行对应的插件目录去修改了。并且可以对修改后的快捷键再次检测是否有冲突。 代码维护 代码始终放在github上进行维护，项目地址： https://github.com/welefen/KeymapManager &#160; 相关文章 使用KeymapManager管理Sublime Text2插件的快捷键 如何开发Sublime Text2插件]]></description>
			<content:encoded><![CDATA[<p>Sublime Text的QQ群里（193076432）一直有同学对插件的快捷键有抱怨，经常遇到快捷键冲突的问题。目前还没有一个比较好的方案解决这个问题。基于前段时间开发的管理插件快捷键的插件KeymapManager，遂在这个插件上增加了个检测插件快捷键冲突的功能。</p>
<h2>安装或者更新</h2>
<p>如果你还没有安装，请在Package Control里搜索KeymapManager直接安装。</p>
<p>如果你之前安装过，需要对KeymapManager更新，更新方式如下：</p>
<p>通过shift+ctrl+p打开Command Palette&#8230;， 输入upgrade，执行 Package Control: Upgrade/Override All Packages，等待更新完成。</p>
<p><img class="alignnone size-full wp-image-1372" title="upgrade" src="http://www.welefen.com/wp-content/uploads/2012/05/upgrade.png" alt="" width="641" height="117" /></p>
<h2>使用方式</h2>
<p>通过Ctrl + Alt + k 打开KeymapManager, 拉到最后一项KeymapConflict（可以通过键盘向上按钮快速找到），点击后就弹出当前已经发生冲突的快捷键，并提示快捷键在哪些命令下发生了冲突，如图：</p>
<p><img class="alignnone size-full wp-image-1371" title="keymap conflict" src="http://www.welefen.com/wp-content/uploads/2012/05/keymap-conflict.png" alt="" width="487" height="296" /></p>
<p>这样就很清楚的列出了哪些快捷键有冲突了，如果冲突的快捷键影响到了功能的使用，你就可以进行对应的插件目录去修改了。并且可以对修改后的快捷键再次检测是否有冲突。</p>
<h2>代码维护</h2>
<p>代码始终放在github上进行维护，项目地址： <a href="https://github.com/welefen/KeymapManager">https://github.com/welefen/KeymapManager</a></p>
<p>&nbsp;<br />
<h3 class='related_post_title'>相关文章</h3>
<ul class='related_post'>
<li><a href='http://www.welefen.com/manager-sublime-text-2-plugin-hot-key-with-keymapmanager.html' title='使用KeymapManager管理Sublime Text2插件的快捷键'>使用KeymapManager管理Sublime Text2插件的快捷键</a></li>
<li><a href='http://www.welefen.com/how-to-develop-sublime-text-plugin.html' title='如何开发Sublime Text2插件'>如何开发Sublime Text2插件</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.welefen.com/keymapmanager-add-check-plugins-keymap-conflict-feature.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gplus主题发布v1.5版</title>
		<link>http://www.welefen.com/gplus-v1-5.html</link>
		<comments>http://www.welefen.com/gplus-v1-5.html#comments</comments>
		<pubDate>Tue, 08 May 2012 11:15:44 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[wordpress主题]]></category>
		<category><![CDATA[软件工具]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google plus]]></category>
		<category><![CDATA[gplus]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=1352</guid>
		<description><![CDATA[经过1个多月的时间对v1.4版本进行bug修复和新增一些功能后，决定发布gplus v1.5版。v1.5版新增的功能和修复的bug主要如下： 修复的bug 1、修复了顶部自定义添加的导航item不能active的bug 2、修复了右侧最新评论点击后在新页面点击书签标题不正确的bug 3、修复了调用widget方式在sinaapp下报错的bug 4、修复了jquery下点击链接页面跳到顶部的动画丢失的bug 新增的功能 1、给评论的用户名和邮箱添加了必填的* 2、给评论的邮箱和URL增加了ime-mode:disabled，IE和FF浏览器禁止直接输入非英文字符 3、优化了评论列表样式 4、优化了详细页展现，去除了日期的突出显示 5、增加了友情链接页面 查看效果 6、增加了日志归档页面 查看效果 友情链接和日志归档页面可以在后台的页面中添加，在右侧模版中选择links和archive即可，然后可以添加到顶部菜单中。 下载和安装 本地下载： 1、v1.5压缩版本 2、v1.5不压缩版本 github下载： 1、v1.5压缩版本 2、v1.5不压缩版本 安装方式： 将下载的zip文件解压后拷贝到wp-content/themes/下，在后台启用gplus主题即可。如果是主题更新的话直接覆盖即可。 代码维护始终放在https://github.com/welefen/gplus 相关文章 gplus主题发布v1.4版 发布一款Google+版wordpress主题 gplus主题发布1.3版 发布gplus主题1.1版 velocity性能大会总结]]></description>
			<content:encoded><![CDATA[<p>经过1个多月的时间对v1.4版本进行bug修复和新增一些功能后，决定发布gplus v1.5版。v1.5版新增的功能和修复的bug主要如下：</p>
<h2>修复的bug</h2>
<p>1、修复了顶部自定义添加的导航item不能active的bug</p>
<p>2、修复了右侧最新评论点击后在新页面点击书签标题不正确的bug</p>
<p>3、修复了调用widget方式在sinaapp下报错的bug</p>
<p>4、修复了jquery下点击链接页面跳到顶部的动画丢失的bug</p>
<h2>新增的功能</h2>
<p>1、给评论的用户名和邮箱添加了必填的*</p>
<p>2、给评论的邮箱和URL增加了ime-mode:disabled，IE和FF浏览器禁止直接输入非英文字符</p>
<p>3、优化了评论列表样式</p>
<p>4、优化了详细页展现，去除了日期的突出显示</p>
<p>5、增加了友情链接页面 <a href="http://www.welefen.com/links">查看效果</a></p>
<p>6、增加了日志归档页面 <a href="http://www.welefen.com/archive">查看效果</a></p>
<p>友情链接和日志归档页面可以在后台的页面中添加，在右侧模版中选择links和archive即可，然后可以添加到顶部菜单中。</p>
<p><span id="more-1352"></span></p>
<h2>下载和安装</h2>
<p><strong>本地下载：</strong></p>
<p>1、<a href="http://www.welefen.com/wp-content/themes/gplus_1.5.zip" target="_blank">v1.5压缩版本</a></p>
<p>2、<a href="http://www.welefen.com/wp-content/themes/gplus_1.5.uncompress.zip" target="_blank">v1.5不压缩版本</a></p>
<p><strong>github下载：</strong></p>
<p>1、<a href="https://github.com/welefen/gplus/blob/master/download/gplus_1.5.zip?raw=true" target="_blank">v1.5压缩版本</a></p>
<p>2、<a href="https://github.com/welefen/gplus/blob/master/download/gplus_1.5.uncompress.zip?raw=true" target="_blank">v1.5不压缩版本</a></p>
<p>安装方式： 将下载的zip文件解压后拷贝到wp-content/themes/下，在后台启用gplus主题即可。如果是主题更新的话直接覆盖即可。</p>
<p>代码维护始终放在<a href="https://github.com/welefen/gplus">https://github.com/welefen/gplus</a><br />
<h3 class='related_post_title'>相关文章</h3>
<ul class='related_post'>
<li><a href='http://www.welefen.com/gplus-v1-4.html' title='gplus主题发布v1.4版'>gplus主题发布v1.4版</a></li>
<li><a href='http://www.welefen.com/google-plus-for-wordpress-theme.html' title='发布一款Google+版wordpress主题'>发布一款Google+版wordpress主题</a></li>
<li><a href='http://www.welefen.com/gplus-v1-3.html' title='gplus主题发布1.3版'>gplus主题发布1.3版</a></li>
<li><a href='http://www.welefen.com/gplus-1-1-version.html' title='发布gplus主题1.1版'>发布gplus主题1.1版</a></li>
<li><a href='http://www.welefen.com/velocity-conf.html' title='velocity性能大会总结'>velocity性能大会总结</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.welefen.com/gplus-v1-5.html/feed</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>百度新首页也被山寨了一把</title>
		<link>http://www.welefen.com/%e7%99%be%e5%ba%a6%e6%96%b0%e9%a6%96%e9%a1%b5%e4%b9%9f%e8%a2%ab%e5%b1%b1%e5%af%a8%e4%ba%86%e4%b8%80%e6%8a%8a.html</link>
		<comments>http://www.welefen.com/%e7%99%be%e5%ba%a6%e6%96%b0%e9%a6%96%e9%a1%b5%e4%b9%9f%e8%a2%ab%e5%b1%b1%e5%af%a8%e4%ba%86%e4%b8%80%e6%8a%8a.html#comments</comments>
		<pubDate>Fri, 13 Apr 2012 03:52:51 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[我的生活]]></category>
		<category><![CDATA[山寨]]></category>
		<category><![CDATA[新首页]]></category>
		<category><![CDATA[百度]]></category>
		<category><![CDATA[百度新首页]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=1325</guid>
		<description><![CDATA[用过百度新首页的同学应该知道新首页有个导航的模块，这个模块可以根据你的浏览信息推荐一个写导航给你。具体如图： 编辑模式下如图： 访问了www.yisou.com这个网站，发现页面如图： 它的编辑模式下： 除了编辑模式下把添加导航和导航列表换了下位置，其他样式上几乎完全一样啊。不过功能上现在还很弱。 从源代码和域名相关信息发现是阿里他们家的，呵呵。。。 &#160; 相关文章 百度新首页性能优化 前端交流会 续: 如何减少代码上线过程中对服务的影响 新百度首页 发放10个百度统计热力图的邀请码]]></description>
			<content:encoded><![CDATA[<p>用过百度新首页的同学应该知道新首页有个导航的模块，这个模块可以根据你的浏览信息推荐一个写导航给你。具体如图：</p>
<p><img class="alignnone size-full wp-image-1327" title="2012-04-13_114614" src="http://www.welefen.com/wp-content/uploads/2012/04/2012-04-13_114614.png" alt="" width="737" /></p>
<p>编辑模式下如图：</p>
<p><img class="alignnone size-full wp-image-1328" title="2012-04-13_114721" src="http://www.welefen.com/wp-content/uploads/2012/04/2012-04-13_114721.png" alt="" width="738"  /></p>
<p><span id="more-1325"></span></p>
<p>访问了<a href="http://yisou.com/" target="_blank">www.yisou.com</a>这个网站，发现页面如图：</p>
<p><img class="alignnone size-full wp-image-1329" title="2012-04-13_114834" src="http://www.welefen.com/wp-content/uploads/2012/04/2012-04-13_114834.png" alt="" width="745"  /></p>
<p>它的编辑模式下：</p>
<p><img class="alignnone size-full wp-image-1330" title="2012-04-13_114923" src="http://www.welefen.com/wp-content/uploads/2012/04/2012-04-13_114923.png" alt="" width="708"  /></p>
<p>除了编辑模式下把添加导航和导航列表换了下位置，其他样式上几乎完全一样啊。不过功能上现在还很弱。</p>
<p>从源代码和域名相关信息发现是阿里他们家的，呵呵。。。</p>
<p>&nbsp;<br />
<h3 class='related_post_title'>相关文章</h3>
<ul class='related_post'>
<li><a href='http://www.welefen.com/baidu-new-homepage-performance.html' title='百度新首页性能优化'>百度新首页性能优化</a></li>
<li><a href='http://www.welefen.com/%e5%89%8d%e7%ab%af%e4%ba%a4%e6%b5%81%e4%bc%9a.html' title='前端交流会'>前端交流会</a></li>
<li><a href='http://www.welefen.com/how-to-reduce-bad-service-on-code-update.html' title='续: 如何减少代码上线过程中对服务的影响'>续: 如何减少代码上线过程中对服务的影响</a></li>
<li><a href='http://www.welefen.com/new-baidu-home.html' title='新百度首页'>新百度首页</a></li>
<li><a href='http://www.welefen.com/baidu-tongji-invitation-code.html' title='发放10个百度统计热力图的邀请码'>发放10个百度统计热力图的邀请码</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.welefen.com/%e7%99%be%e5%ba%a6%e6%96%b0%e9%a6%96%e9%a1%b5%e4%b9%9f%e8%a2%ab%e5%b1%b1%e5%af%a8%e4%ba%86%e4%b8%80%e6%8a%8a.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>gplus主题发布v1.4版</title>
		<link>http://www.welefen.com/gplus-v1-4.html</link>
		<comments>http://www.welefen.com/gplus-v1-4.html#comments</comments>
		<pubDate>Thu, 29 Mar 2012 12:40:53 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[wordpress主题]]></category>
		<category><![CDATA[软件工具]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google plus]]></category>
		<category><![CDATA[gplus]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=1316</guid>
		<description><![CDATA[经过对大家反馈的一些问题进行评估和修复后，决定发布gplus 1.4版本。该版本新增的功能和修复的bug具体如下： 新增的功能 1、增加了对第三方评论插件的支持，如使用友言评论插件，需要在主题设置里开启 2、增加了优化版的Wp SyntaxHighlighter，相对于插件减少了很多HTTP请求，提升前端性能。同时解决了使用pjax后，返回内容中含有代码不能正常高亮的问题。需要在主题设置里开启并关闭wp SyntaxHighlighter这个插件。 3、评论内容增加了对换行的支持 4、增加了对分页插件wp paginate的支持 5、页面顶部增加了rss的链接 6、增加了对大屏幕的支持，大屏幕下会显示更大的宽度。是转向响应式布局的第一步 7、使用了更好的文件组织结构 8、应大家的要求，增加了未压缩版本 修复的bug 1、修复了发布评论后再访问当前页评论列表没有更新的bug 2、修复了使用pjax后返回内容语法高亮的bug，修复方式见新增功能的第2项。 3、修复了使用kissy js框架在文章列表页会有JS报错的bug 4、其他一些小问题的修复 下载和安装 本地下载： 1、v1.4压缩版本 2、v1.4不压缩版本 github下载： 1、v1.4压缩版本 2、v1.4不压缩版本 安装方式： 将下载的zip文件解压后拷贝到wp-content/themes/下，在后台启用gplus主题即可。如果是主题更新的话直接覆盖即可。 代码维护始终放在https://github.com/welefen/gplus 相关文章 gplus主题发布v1.5版 发布一款Google+版wordpress主题 gplus主题发布1.3版 发布gplus主题1.1版 velocity性能大会总结]]></description>
			<content:encoded><![CDATA[<p>经过对大家反馈的一些问题进行评估和修复后，决定发布gplus 1.4版本。该版本新增的功能和修复的bug具体如下：</p>
<h2>新增的功能</h2>
<p>1、增加了对第三方评论插件的支持，如使用友言评论插件，需要在主题设置里开启</p>
<p>2、增加了优化版的Wp SyntaxHighlighter，相对于插件减少了很多HTTP请求，提升前端性能。同时解决了使用pjax后，返回内容中含有代码不能正常高亮的问题。需要在主题设置里开启并关闭wp SyntaxHighlighter这个插件。</p>
<p>3、评论内容增加了对换行的支持</p>
<p>4、增加了对分页插件wp paginate的支持</p>
<p>5、页面顶部增加了rss的链接</p>
<p>6、增加了对大屏幕的支持，大屏幕下会显示更大的宽度。是转向响应式布局的第一步</p>
<p>7、使用了更好的文件组织结构</p>
<p>8、应大家的要求，增加了未压缩版本</p>
<p><span id="more-1316"></span></p>
<h2>修复的bug</h2>
<p>1、修复了发布评论后再访问当前页评论列表没有更新的bug</p>
<p>2、修复了使用pjax后返回内容语法高亮的bug，修复方式见新增功能的第2项。</p>
<p>3、修复了使用kissy js框架在文章列表页会有JS报错的bug</p>
<p>4、其他一些小问题的修复</p>
<h2>下载和安装</h2>
<p><strong>本地下载：</strong></p>
<p>1、<a href="http://www.welefen.com/wp-content/themes/gplus_1.4.zip" target="_blank">v1.4压缩版本</a></p>
<p>2、<a href="http://www.welefen.com/wp-content/themes/gplus_1.4.uncompress.zip" target="_blank">v1.4不压缩版本</a></p>
<p><strong>github下载：</strong></p>
<p>1、<a href="https://github.com/welefen/gplus/blob/master/download/gplus_1.4.zip?raw=true" target="_blank">v1.4压缩版本</a></p>
<p>2、<a href="https://github.com/welefen/gplus/blob/master/download/gplus_1.4.uncompress.zip?raw=true" target="_blank">v1.4不压缩版本</a></p>
<p>安装方式： 将下载的zip文件解压后拷贝到wp-content/themes/下，在后台启用gplus主题即可。如果是主题更新的话直接覆盖即可。</p>
<p>代码维护始终放在<a href="https://github.com/welefen/gplus">https://github.com/welefen/gplus</a><br />
<h3 class='related_post_title'>相关文章</h3>
<ul class='related_post'>
<li><a href='http://www.welefen.com/gplus-v1-5.html' title='gplus主题发布v1.5版'>gplus主题发布v1.5版</a></li>
<li><a href='http://www.welefen.com/google-plus-for-wordpress-theme.html' title='发布一款Google+版wordpress主题'>发布一款Google+版wordpress主题</a></li>
<li><a href='http://www.welefen.com/gplus-v1-3.html' title='gplus主题发布1.3版'>gplus主题发布1.3版</a></li>
<li><a href='http://www.welefen.com/gplus-1-1-version.html' title='发布gplus主题1.1版'>发布gplus主题1.1版</a></li>
<li><a href='http://www.welefen.com/velocity-conf.html' title='velocity性能大会总结'>velocity性能大会总结</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.welefen.com/gplus-v1-4.html/feed</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
		<item>
		<title>chrome扩展对页面性能的影响</title>
		<link>http://www.welefen.com/chrome-addons-can-reduce-page-speed.html</link>
		<comments>http://www.welefen.com/chrome-addons-can-reduce-page-speed.html#comments</comments>
		<pubDate>Sat, 24 Mar 2012 02:00:38 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[Chrome扩展]]></category>
		<category><![CDATA[前端技术]]></category>
		<category><![CDATA[性能优化]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[扩展]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=1266</guid>
		<description><![CDATA[chrome一直是高性能著称，并且市场占有率也越来越大。同时扩展功能也带来了很大的便利，但也发现用户安装的扩展可能会对页面的性能有影响。本文讨论下chrome扩展如何影响页面的性能以及一些解决办法。 百度新首页实例 下面我们对照看下没有安装任何扩展的chrome和安装了一些chrome扩展后访问百度新首页的瀑布流。 这是没有安装任何chrome扩展的瀑布流，效果还是非常不错的。 下面我们一些常用的chrome扩展，如：adblock, 音乐电台，截图，lastpass, 代理等，如： 安装了这些扩展后，我们在看下现在的瀑布流是什么样的： 从这个瀑布流里可以看到，中间有很多断的地方，直接导致了加载时间要长很多。 原因分析 那是为啥装了些扩展后就会页面的加载速度呢？ 熟悉chrome扩展开发的同学应该知道，chrome扩展是允许向页面里植入CSS和JS的，并且CSS和JS的植入可能还会引起一些图片等资源的下载。 具体的配置在manifest.json里的Content Scripts，如： &#34;content_scripts&#34;: [ { &#34;matches&#34;: [&#34;http://www.google.com/*&#34;], &#34;css&#34;: [&#34;mystyles.css&#34;], &#34;js&#34;: [&#34;jquery.js&#34;, &#34;myscript.js&#34;], &#34;run_at&#34;: &#34;document_end&#34; } ] 这个表示向http://www.google.com/下所有页面植入mystyles.css和jquery.js和myscript.js这3个文件，并且植入时段是在document_end。run_at有3个属性值，分别对应： document_start 在页面CSS加载完成之后，DOM结构构造完成和Script执行之前加载 document_end 在DOM结构完成之后，图片或者iframe等资源之前 document_idle 在document_end和window.onload找个空闲时候触发 从3个run_at值来看，如果植入的脚本在document_start，那对页面的影响是非常大的。虽然这些资源在本地，没什么网络传输时间，但还是有解析和执行时间。 并且一个扩展可以植入多个资源或者脚本，如果扩展安装比较多的话，对页面性能的影响就非常大了。 如何知道用户安装了哪些扩展 当然获取用户安装了哪些扩展会侵犯了用户的隐私，但如果知道用户装了哪些扩展，并且知道这些扩展植入了哪些资源，那对分析页面性能的影响帮助还是非常大的。 如果你去chrome webstore里安装扩展的话，细心的你会发现webstore是知道哪些扩展是安装了的。如图： 通过分析页面里的JS发现，是使用了chrome.*的API进行的，这个API就是chrome浏览器暴露给扩展的API。 在https://chrome.google.com/webstore/search/%E7%94%B5%E5%8F%B0页面的Console里，执行chrome，发现chrome有如下的属性和方法： 但在其他非chrome.google.com的域名下执行chrome,只有下面的属性和方法： 也就是说chrome.*下的很多API只给chrome.google.com开了白名单。 那有没有其他办法拿到用户装了哪些扩展呢？ 波兰安全研究员Krzysztof Kotowicz通过一个简单粗暴可依赖的办法，只要很短的JS代码就能知道用户安装了哪些扩展，见测试DEMO页，代码如下： var detect = function(base, if_installed, if_not_installed) { [...]]]></description>
			<content:encoded><![CDATA[<p>chrome一直是高性能著称，并且市场占有率也越来越大。同时扩展功能也带来了很大的便利，但也发现用户安装的扩展可能会对页面的性能有影响。本文讨论下chrome扩展如何影响页面的性能以及一些解决办法。</p>
<h2>百度新首页实例</h2>
<p>下面我们对照看下没有安装任何扩展的chrome和安装了一些chrome扩展后访问百度新首页的瀑布流。</p>
<p><img class="alignnone size-full wp-image-1279" title="Screenshot-2" src="http://www.welefen.com/wp-content/uploads/2012/03/Screenshot-2.png" alt="" width="615"  /></p>
<p>这是没有安装任何chrome扩展的瀑布流，效果还是非常不错的。</p>
<p><span id="more-1266"></span></p>
<p>下面我们一些常用的chrome扩展，如：adblock, 音乐电台，截图，lastpass, 代理等，如：</p>
<p><img class="alignnone size-full wp-image-1280" title="Screenshot" src="http://www.welefen.com/wp-content/uploads/2012/03/Screenshot.png" alt="" width="776"  /></p>
<p>安装了这些扩展后，我们在看下现在的瀑布流是什么样的：</p>
<p><img class="alignnone size-full wp-image-1281" title="Screenshot-3" src="http://www.welefen.com/wp-content/uploads/2012/03/Screenshot-3.png" alt="" width="797"  /></p>
<p>从这个瀑布流里可以看到，中间有很多断的地方，直接导致了加载时间要长很多。</p>
<h2>原因分析</h2>
<p>那是为啥装了些扩展后就会页面的加载速度呢？</p>
<p>熟悉chrome扩展开发的同学应该知道，<a href="http://code.google.com/chrome/extensions/devguide.html" target="_blank">chrome扩展</a>是允许向页面里植入CSS和JS的，并且CSS和JS的植入可能还会引起一些图片等资源的下载。</p>
<p>具体的配置在manifest.json里的<a href="http://code.google.com/chrome/extensions/content_scripts.html" target="_blank">Content Scripts</a>，如：</p>
<pre class="brush: javascript; gutter: true">&quot;content_scripts&quot;: [
 {
     &quot;matches&quot;: [&quot;http://www.google.com/*&quot;],
     &quot;css&quot;: [&quot;mystyles.css&quot;],
     &quot;js&quot;: [&quot;jquery.js&quot;, &quot;myscript.js&quot;],
     &quot;run_at&quot;: &quot;document_end&quot;
 }
 ]</pre>
<p>这个表示向http://www.google.com/下所有页面植入mystyles.css和jquery.js和myscript.js这3个文件，并且植入时段是在document_end。run_at有3个属性值，分别对应：</p>
<ul>
<li>document_start 在页面CSS加载完成之后，DOM结构构造完成和Script执行之前加载</li>
<li>document_end 在DOM结构完成之后，图片或者iframe等资源之前</li>
<li>document_idle 在document_end和window.onload找个空闲时候触发</li>
</ul>
<p>从3个run_at值来看，如果植入的脚本在document_start，那对页面的影响是非常大的。虽然这些资源在本地，没什么网络传输时间，但还是有解析和执行时间。</p>
<p>并且一个扩展可以植入多个资源或者脚本，如果扩展安装比较多的话，对页面性能的影响就非常大了。</p>
<h2>如何知道用户安装了哪些扩展</h2>
<p>当然获取用户安装了哪些扩展会侵犯了用户的隐私，但如果知道用户装了哪些扩展，并且知道这些扩展植入了哪些资源，那对分析页面性能的影响帮助还是非常大的。</p>
<p>如果你去<a href="https://chrome.google.com/webstore/category/home" target="_blank">chrome webstore</a>里安装扩展的话，细心的你会发现webstore是知道哪些扩展是安装了的。如图：</p>
<p><img class="alignnone size-full wp-image-1284" title="Screenshot-1" src="http://www.welefen.com/wp-content/uploads/2012/03/Screenshot-1.png" alt="" width="918"  /></p>
<p>通过分析页面里的JS发现，是使用了chrome.*的API进行的，这个API就是chrome浏览器暴露给扩展的API。</p>
<p>在<a href="https://chrome.google.com/webstore/search/%E7%94%B5%E5%8F%B0">https://chrome.google.com/webstore/search/%E7%94%B5%E5%8F%B0</a>页面的Console里，执行chrome，发现chrome有如下的属性和方法：</p>
<p><img class="alignnone size-full wp-image-1285" title="Screenshot-4" src="http://www.welefen.com/wp-content/uploads/2012/03/Screenshot-4.png" alt="" width="643"  /></p>
<p>但在其他非chrome.google.com的域名下执行chrome,只有下面的属性和方法：</p>
<p><img class="alignnone size-full wp-image-1286" title="Screenshot-5" src="http://www.welefen.com/wp-content/uploads/2012/03/Screenshot-5.png" alt="" width="611" height="153" /></p>
<p>也就是说chrome.*下的很多API只给chrome.google.com开了白名单。</p>
<p>那有没有其他办法拿到用户装了哪些扩展呢？</p>
<p>波兰安全研究员Krzysztof Kotowicz通过一个简单粗暴可依赖的办法，只要很短的JS代码就能知道用户安装了哪些扩展，见<a href="http://koto.github.com/blog-kotowicz-net-examples/chrome-addons/enumerate.html" target="_blank">测试DEMO页</a>，代码如下：</p>
<pre class="brush: javascript; gutter: true">var detect = function(base, if_installed, if_not_installed) {
    var s = document.createElement(&#039;script&#039;);
    s.onerror = if_not_installed;
    s.onload = if_installed;
    document.body.appendChild(s);
    s.src = base + &#039;/manifest.json&#039;;
}
var log = function(msg) {
    document.getElementById(&#039;log&#039;).value += &#039;[*] &#039; + msg + &#039;\n&#039;;
}

function logme(i, id) {
    return function() {
        log(&#039;Detected addon: &#039; + i + &#039; (&#039; + id + &#039;)&#039;);
    }
}

window.onload = function() {
    var xhr = new XMLHttpRequest();
    xhr.open(&#039;GET&#039;, &#039;addons.json&#039;, false);
    xhr.onreadystatechange = function() {
      if (xhr.readyState == 4) {
         var addons = JSON.parse(xhr.responseText);
         for (var i in addons) {
            if (addons.hasOwnProperty(i)) {
                detect(&#039;chrome-extension://&#039; + i,logme(addons[i], i));
            }
         }

      }
    }
    xhr.send(null);
}</pre>
<p>实现原理看懂了其实比较简单，通过下面几个步骤：<br />
1、手工维护一个manifest.json，这个文件列举了webstore下扩展列表。当然webstore如果有扩展添加的话，需要手工更新这个列表</p>
<p>2、循环执行manifest.json这个列表，因为每个扩展都有manifest.json这个文件，所以通过script方法加载这个manifest.json文件，地址为：chrome-extention://扩展id/manifest.json</p>
<p>3、如果这个manifest.json存在，则表明安装了这个扩展</p>
<p>这种方式目前一个比较大的问题的是因为要循环那个大列表，所以有点耗时。当然这样方式chrome浏览器后续可能会fixed掉。</p>
<p>还有一种方式就是开发一个扩展，专门用来测试用户安装了哪些插件，以及这些插件有没有植入css和JS，并且植入的CSS和JS是否对当前页面有影响。当然这种方式需要用户的配合才能进行。</p>
<p>如果你有其他更好的方式，欢迎一起讨论。</p>
<h3 class='related_post_title'>相关文章</h3>
<ul class='related_post'>
<li><a href='http://www.welefen.com/use-cdn-upgrade-performance.html' title='如何利用CDN进行全网加速'>如何利用CDN进行全网加速</a></li>
<li><a href='http://www.welefen.com/baidu-new-homepage-performance.html' title='百度新首页性能优化'>百度新首页性能优化</a></li>
<li><a href='http://www.welefen.com/chrome-music-plugin.html' title='音乐电台chrome插件(包含豆瓣、人人等14个电台)'>音乐电台chrome插件(包含豆瓣、人人等14个电台)</a></li>
<li><a href='http://www.welefen.com/velocity-conf.html' title='velocity性能大会总结'>velocity性能大会总结</a></li>
<li><a href='http://www.welefen.com/smarty3-optimizer-tools.html' title='Smarty3性能优化工具'>Smarty3性能优化工具</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.welefen.com/chrome-addons-can-reduce-page-speed.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>悲催的回武汉办身份证经历</title>
		<link>http://www.welefen.com/%e6%82%b2%e5%82%ac%e7%9a%84%e5%9b%9e%e6%ad%a6%e6%b1%89%e5%8a%9e%e8%ba%ab%e4%bb%bd%e8%af%81%e7%bb%8f%e5%8e%86.html</link>
		<comments>http://www.welefen.com/%e6%82%b2%e5%82%ac%e7%9a%84%e5%9b%9e%e6%ad%a6%e6%b1%89%e5%8a%9e%e8%ba%ab%e4%bb%bd%e8%af%81%e7%bb%8f%e5%8e%86.html#comments</comments>
		<pubDate>Fri, 23 Mar 2012 01:32:25 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[我的生活]]></category>
		<category><![CDATA[居住证]]></category>
		<category><![CDATA[户口]]></category>
		<category><![CDATA[毕业2年]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=1268</guid>
		<description><![CDATA[最近在准备办理工作居住证，花了很久时间准备好了材料。当把所有的材料交到HR那里的时候被告知身份证不合格，需要重办，原因是身份证上的地址还是学校的，但已经毕业超过2年了，学校只能保留2年的户口，所以只能回武汉重办身份证。 查了很多关于毕业后户口在哪里的资料，最终获得的结果应该是在湖北省高校毕业生就业指导服务中心。买了20号晚上的车票，带好了所有的材料，包括各种证件的复印件，登上了去武汉的火车。 21号早上7点到了武昌火车站，打车直奔湖北省高校毕业生就业指导服务中心，他们8：30才开门，等的过程中和一个从宜昌敢过来给儿子办理结婚证明的叔叔闲聊，了解到一些关于户口更多的细节。开门后，拿着户档托管表（必须是户档托管表或者毕业证，不能是身份证）给工作人员借户口档案页，却被告知只有档案在他们那里，户口不在他们那里。 后来打车去湖北省人才市场，户口也不在那里。去了附近的派出所，让他们帮忙查了下，户口还在学校。 去了学校的毕业生就业指导中心，查不到相关的记录。 后来又去了学校的保卫处，告知他们户口还在学校后，得知毕业超过2年学校无法再托管户口，必须要打回原籍，但周五（3.23）才有结果。没办法，只好找了同学的师弟帮忙，让他周五去取结果，然后把材料在快递给我。 拿到材料后确定打回原籍的话，一个月内还必须要回家一趟。 中国的户籍制度啊，我反正到现在还是不太明白。 这里提醒下毕业后没管户口的同学，赶紧查查自己的户口在哪里，如果还在学校的话，赶紧迁回家吧。即使现在不弄，以后办理居住证、护照、开结婚证明的时候都要弄，那个时候在急着办，以那些人的办事效率来说，是很悲剧的。 小提示： 查自己的户口在哪里可以不用去学校，直接找个派出所拿身份证就可以查，都是联网的。 @update 2012.03.25 拿到了从武汉快递过来的户口迁移证，定了3.30晚上的火车回家。  @update 2012.04.09 请了3.31和4.1号2天假，买了3.30号晚上的车票,3.31号下午到了我们那里河鹏证的派出所。出示了户口迁移证和身份证后被告知需要所在的乡证开具介绍信。幸好姐夫有车，找了熟人去开了介绍信。然后花了差不多一个小时将户口、临时身份证、身份证给办好了。 本来临时身份证需要3天才能拿到，并且需要到县城的公安局去拿。最后只好又托了关系，第二天下午去县城拿到了。 在中国还是有关系号使，罪过罪过。 相关文章 No Related Posts]]></description>
			<content:encoded><![CDATA[<p>最近在准备办理工作居住证，花了很久时间准备好了材料。当把所有的材料交到HR那里的时候被告知身份证不合格，需要重办，原因是身份证上的地址还是学校的，但已经毕业超过2年了，学校只能保留2年的户口，所以只能回武汉重办身份证。</p>
<p>查了很多关于毕业后户口在哪里的资料，最终获得的结果应该是在湖北省高校毕业生就业指导服务中心。买了20号晚上的车票，带好了所有的材料，包括各种证件的复印件，登上了去武汉的火车。</p>
<p>21号早上7点到了武昌火车站，打车直奔湖北省高校毕业生就业指导服务中心，他们8：30才开门，等的过程中和一个从宜昌敢过来给儿子办理结婚证明的叔叔闲聊，了解到一些关于户口更多的细节。开门后，拿着户档托管表（必须是户档托管表或者毕业证，不能是身份证）给工作人员借户口档案页，却被告知只有档案在他们那里，户口不在他们那里。</p>
<p>后来打车去湖北省人才市场，户口也不在那里。去了附近的派出所，让他们帮忙查了下，户口还在学校。</p>
<p>去了学校的毕业生就业指导中心，查不到相关的记录。</p>
<p>后来又去了学校的保卫处，告知他们户口还在学校后，得知毕业超过2年学校无法再托管户口，必须要打回原籍，但周五（3.23）才有结果。没办法，只好找了同学的师弟帮忙，让他周五去取结果，然后把材料在快递给我。</p>
<p>拿到材料后确定打回原籍的话，一个月内还必须要回家一趟。</p>
<p>中国的户籍制度啊，我反正到现在还是不太明白。</p>
<p>这里提醒下毕业后没管户口的同学，赶紧查查自己的户口在哪里，如果还在学校的话，赶紧迁回家吧。即使现在不弄，以后办理居住证、护照、开结婚证明的时候都要弄，那个时候在急着办，以那些人的办事效率来说，是很悲剧的。</p>
<p><span style="color: red;">小提示： 查自己的户口在哪里可以不用去学校，直接找个派出所拿身份证就可以查，都是联网的。</span></p>
<p><strong>@update 2012.03.25</strong></p>
<p>拿到了从武汉快递过来的户口迁移证，定了3.30晚上的火车回家。</p>
<p><strong> @update 2012.04.09</strong></p>
<p>请了3.31和4.1号2天假，买了3.30号晚上的车票,3.31号下午到了我们那里河鹏证的派出所。出示了户口迁移证和身份证后被告知需要所在的乡证开具介绍信。幸好姐夫有车，找了熟人去开了介绍信。然后花了差不多一个小时将户口、临时身份证、身份证给办好了。</p>
<p>本来临时身份证需要3天才能拿到，并且需要到县城的公安局去拿。最后只好又托了关系，第二天下午去县城拿到了。</p>
<p>在中国还是有关系号使，罪过罪过。<br />
<h3 class='related_post_title'>相关文章</h3>
<ul class='related_post'>
<li>No Related Posts</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.welefen.com/%e6%82%b2%e5%82%ac%e7%9a%84%e5%9b%9e%e6%ad%a6%e6%b1%89%e5%8a%9e%e8%ba%ab%e4%bb%bd%e8%af%81%e7%bb%8f%e5%8e%86.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>将vps迁移到了日本机房</title>
		<link>http://www.welefen.com/transfer-vps-to-tokyo.html</link>
		<comments>http://www.welefen.com/transfer-vps-to-tokyo.html#comments</comments>
		<pubDate>Tue, 20 Mar 2012 02:54:31 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[我的生活]]></category>
		<category><![CDATA[linode]]></category>
		<category><![CDATA[tokyo]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[日本]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=1260</guid>
		<description><![CDATA[去年买的linode上512M内存的VPS，那个时候还没有日本的机房，所以机房选在了Fremont, CA。 现在增加了日本的机房，速度相当于Fremont, CA要快一些，所以昨天晚上花了点时间将vps迁移到了日本的机房。 迁移步骤 1、登录linode，进入Support，点击“Open a new Support Ticket”增加一个Ticket。内容可以填为：change vps location to Tokyo, Japan。提交之后，他们的工作人员差不多会在1分钟之内做出响应。 2、等他们回复后，进入vps管理页，关闭当前的vps。 3、点击migrate button就开始进行迁移了。 4、然后就是等待数据传输了，10-15分钟差不多可以传输1G，具体要多长时间就要看vps里有多大东西了。 5、迁移完成后，启动vps。然后会分配一个新的IP给你，这时候需要将域名的DNS改成新的IP 如果你是新注册linode可以直接选择日本的机房，你可以通过这个链接进行注册：http://www.linode.com/?r=e2270fdd2ac60cd7d3f852c0cb3f1977eb70e53e &#160; 迁移到日本机房后，使用监控宝大致看了下，差不多可以提速400ms，效果还是非常明显的。 ps: 弄完后也顺便重新编译了下PHP，增加了exif模块的支持。 相关文章 No Related Posts]]></description>
			<content:encoded><![CDATA[<p>去年买的linode上512M内存的VPS，那个时候还没有日本的机房，所以机房选在了Fremont, CA。</p>
<p>现在增加了日本的机房，速度相当于Fremont, CA要快一些，所以昨天晚上花了点时间将vps迁移到了日本的机房。</p>
<h2>迁移步骤</h2>
<p>1、登录linode，进入Support，点击“Open a new Support Ticket”增加一个Ticket。内容可以填为：change vps location to Tokyo, Japan。提交之后，他们的工作人员差不多会在1分钟之内做出响应。</p>
<p>2、等他们回复后，进入vps管理页，关闭当前的vps。</p>
<p>3、点击migrate button就开始进行迁移了。</p>
<p>4、然后就是等待数据传输了，10-15分钟差不多可以传输1G，具体要多长时间就要看vps里有多大东西了。</p>
<p>5、迁移完成后，启动vps。然后会分配一个新的IP给你，这时候需要将域名的DNS改成新的IP</p>
<p>如果你是新注册linode可以直接选择日本的机房，你可以通过这个链接进行注册：<a href="http://www.linode.com/?r=e2270fdd2ac60cd7d3f852c0cb3f1977eb70e53e">http://www.linode.com/?r=e2270fdd2ac60cd7d3f852c0cb3f1977eb70e53e</a></p>
<p>&nbsp;</p>
<p>迁移到日本机房后，使用监控宝大致看了下，差不多可以提速400ms，效果还是非常明显的。</p>
<p>ps: 弄完后也顺便重新编译了下PHP，增加了exif模块的支持。<br />
<h3 class='related_post_title'>相关文章</h3>
<ul class='related_post'>
<li>No Related Posts</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.welefen.com/transfer-vps-to-tokyo.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>使用KeymapManager管理Sublime Text2插件的快捷键</title>
		<link>http://www.welefen.com/manager-sublime-text-2-plugin-hot-key-with-keymapmanager.html</link>
		<comments>http://www.welefen.com/manager-sublime-text-2-plugin-hot-key-with-keymapmanager.html#comments</comments>
		<pubDate>Fri, 16 Mar 2012 04:32:51 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[SublimeText插件]]></category>
		<category><![CDATA[软件工具]]></category>
		<category><![CDATA[keymapmanager]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sublime]]></category>
		<category><![CDATA[sublime text2]]></category>
		<category><![CDATA[插件快捷键]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=1250</guid>
		<description><![CDATA[使用Sublime Text2编辑器的同学应该都知道，几乎所有的功能都可以通过快捷键进行。系统默认的快捷键可以通过Preferences -&#62; Key Bindings &#8211; Default查看。但对于插件的快捷键查看就没这么简单了，有些插件将一些信息写到Sublime-Menu下还可以方便查看，但很多插件都没写Sublime Menu的信息，这个时候如果忘记了快捷键，那只能找到对应的插件目录，打开对应的文件查看了。 为了解决这个问题，让所有安装的插件可以很方便的管理，开发了KeymapManager这个插件。 安装KeymapManager 可以通过Packages Control进行安装，搜索keymapmanager即可。 如果你还没有安装Packages Control，建议先安装Packages Control在安装KeymapManager。或者你也可以从https://github.com/welefen/keymapmanager下载安装。 使用方式 通过ctrl + alt + k 或者通过顶部菜单 View -&#62; Keymap Manager打开Pannel。如： 这样就可以很快搜索到你需要使用的插件了，并且enter就执行那个插件的命令。 源代码简单分析 import sublime, sublime_plugin import sublime, sublime_plugin import os import json settings = sublime.load_settings(&#34;KeymapManager.sublime-settings&#34;) class KeymapManagerCommand(sublime_plugin.TextCommand): &#34;&#34;&#34; keymap manager for plugins &#34;&#34;&#34; #add some default very usefull commands [...]]]></description>
			<content:encoded><![CDATA[<p>使用Sublime Text2编辑器的同学应该都知道，几乎所有的功能都可以通过快捷键进行。系统默认的快捷键可以通过Preferences -&gt; Key Bindings &#8211; Default查看。但对于插件的快捷键查看就没这么简单了，有些插件将一些信息写到Sublime-Menu下还可以方便查看，但很多插件都没写Sublime Menu的信息，这个时候如果忘记了快捷键，那只能找到对应的插件目录，打开对应的文件查看了。</p>
<p>为了解决这个问题，让所有安装的插件可以很方便的管理，开发了KeymapManager这个插件。</p>
<p><span id="more-1250"></span></p>
<h2>安装KeymapManager</h2>
<p>可以通过Packages Control进行安装，搜索keymapmanager即可。</p>
<p>如果你还没有安装Packages Control，建议先安装Packages Control在安装KeymapManager。或者你也可以从<a href="https://github.com/welefen/keymapmanager">https://github.com/welefen/keymapmanager</a>下载安装。</p>
<h2>使用方式</h2>
<p>通过ctrl + alt + k 或者通过顶部菜单 View -&gt; Keymap Manager打开Pannel。如：</p>
<p><img class="alignnone size-full wp-image-1256" title="keymapmanager" src="http://www.welefen.com/wp-content/uploads/2012/03/keymapmanager.png" alt="" width="534" height="437" /></p>
<p>这样就可以很快搜索到你需要使用的插件了，并且enter就执行那个插件的命令。</p>
<h2>源代码简单分析</h2>
<pre class="brush: python; gutter: true">import sublime, sublime_plugin

import sublime, sublime_plugin
import os
import json
settings = sublime.load_settings(&quot;KeymapManager.sublime-settings&quot;)
class KeymapManagerCommand(sublime_plugin.TextCommand):
	&quot;&quot;&quot;
	keymap manager for plugins
	&quot;&quot;&quot;
	#add some default very usefull commands
	defaultCommand = [
		{&quot;name&quot;: &quot;Goto Anything...&quot;, &quot;keys&quot;: [&quot;ctrl+p&quot;], &quot;command&quot;: &quot;show_overlay&quot;, &quot;args&quot;: {&quot;overlay&quot;: &quot;goto&quot;, &quot;show_files&quot;: True} },
		{&quot;name&quot;: &quot;Command Palette&quot;, &quot;keys&quot;: [&quot;ctrl+shift+p&quot;], &quot;command&quot;: &quot;show_overlay&quot;, &quot;args&quot;: {&quot;overlay&quot;: &quot;command_palette&quot;} },
		{&quot;name&quot;: &quot;Goto Symbol...&quot;, &quot;keys&quot;: [&quot;ctrl+r&quot;], &quot;command&quot;: &quot;show_overlay&quot;, &quot;args&quot;: {&quot;overlay&quot;: &quot;goto&quot;, &quot;text&quot;: &quot;@&quot;} },
		{&quot;name&quot;: &quot;Goto Line...&quot;,  &quot;keys&quot;: [&quot;ctrl+g&quot;], &quot;command&quot;: &quot;show_overlay&quot;, &quot;args&quot;: {&quot;overlay&quot;: &quot;goto&quot;, &quot;text&quot;: &quot;:&quot;} },
		{&quot;name&quot;: &quot;Search Keywords&quot;, &quot;keys&quot;: [&quot;ctrl+;&quot;], &quot;command&quot;: &quot;show_overlay&quot;, &quot;args&quot;: {&quot;overlay&quot;: &quot;goto&quot;, &quot;text&quot;: &quot;#&quot;} },
		{&quot;name&quot;: &quot;Show Console&quot;,  &quot;keys&quot;: [&quot;ctrl+`&quot;],  &quot;command&quot;: &quot;show_panel&quot;, &quot;args&quot;: {&quot;panel&quot;: &quot;console&quot;, &quot;toggle&quot;: True} }
	]
	#installed plugins list
	plugins = None
	def run(self, edit):
		self.defaultCommand.sort(key=lambda x: x[&quot;name&quot;].lower())
		if self.plugins == None:
			self.plugins = []
		path = sublime.packages_path()
		dirs = os.listdir(path)
		#sort with insensitive
		dirs.sort(key=lambda x: x.lower())
		plugins = []
		ignored_packages = settings.get(&quot;ignored_packages&quot;)
		for name in dirs:
			if name in ignored_packages:
				continue
			dir = path + &#039;/&#039; + name + &#039;/&#039;
			if not os.path.isdir(dir):
				continue
			platform = sublime.platform()
			platform = platform[0].upper() + platform[1:].lower()
			keymapFile = dir + &quot;Default (&quot; + platform + &quot;).sublime-keymap&quot;
			if not os.path.isfile(keymapFile):
				continue
			#plugins.append(keymapFile)
			with open(keymapFile) as f:
				content = open(keymapFile).read()
			try:
				jsonData = json.loads(content)
			except (ValueError):
				continue
			if not isinstance(jsonData, list):
				continue
			i = 0
			for item in jsonData:
				#only show 3 items if num max than 3
				if i &gt;= 3:
					break
				if &quot;keys&quot; not in item or &quot;command&quot; not in item:
					continue
				keys = item[&quot;keys&quot;]
				if isinstance(keys, list):
					keys = &quot;, &quot; . join(keys)
				command = item[&quot;command&quot;]
				item[&quot;name&quot;] = name
				plugins.append([name, command + &quot; : &quot; +  keys])
				self.plugins.append(item)
				i += 1
		for item in self.defaultCommand:
			plugins.append([item[&#039;name&#039;], item[&#039;command&#039;] + &quot; : &quot; +  &quot;,&quot;.join(item[&#039;keys&#039;])])
			self.plugins.append(item)
		self.view.window().show_quick_panel(plugins, self.panel_done)
	#panel done
	def panel_done(self, picked):
		if picked == -1:
			return
		item = self.plugins[picked]
		if self.checkContext(item) == False:
			return
		args = {}
		if &quot;args&quot; in item:
			args = item[&#039;args&#039;]
		#thanks wuliang
		self.view.run_command(item[&#039;command&#039;], args)
		self.view.window().run_command(item[&#039;command&#039;], args)
		sublime.run_command(item[&#039;command&#039;], args)
	#check context condition
	def checkContext(self, plugin):
		return True
		if &quot;context&quot; not in plugin:
			return True
		if &quot;window&quot; in plugin and plugin[&quot;window&quot;]:
			return True
		context = plugin[&quot;context&quot;]
		name = plugin[&quot;name&quot;]
		path = path = sublime.packages_path() + &#039;/&#039; + name + &#039;/&#039;
		import glob
		pyFiles = glob.glob(&quot;*.py&quot;)
		sublime.status_message(&quot;,&quot;.join(pyFiles))
		return True</pre>
<h3 class='related_post_title'>相关文章</h3>
<ul class='related_post'>
<li><a href='http://www.welefen.com/keymapmanager-add-check-plugins-keymap-conflict-feature.html' title='KeymapManager增加检测快捷键冲突的功能'>KeymapManager增加检测快捷键冲突的功能</a></li>
<li><a href='http://www.welefen.com/how-to-develop-sublime-text-plugin.html' title='如何开发Sublime Text2插件'>如何开发Sublime Text2插件</a></li>
<li><a href='http://www.welefen.com/json2html-for-python.html' title='发布python版的json2html'>发布python版的json2html</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.welefen.com/manager-sublime-text-2-plugin-hot-key-with-keymapmanager.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>gplus主题发布1.3版</title>
		<link>http://www.welefen.com/gplus-v1-3.html</link>
		<comments>http://www.welefen.com/gplus-v1-3.html#comments</comments>
		<pubDate>Tue, 13 Mar 2012 14:28:55 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[wordpress主题]]></category>
		<category><![CDATA[软件工具]]></category>
		<category><![CDATA[gplus]]></category>
		<category><![CDATA[pjax]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=1220</guid>
		<description><![CDATA[继上次发布1.1版本后，收到了很多反馈，中间也升级了很多版本，如：1.2.1 &#8211; 1.2.5。经过对一些大的需求进行开发后，决定发布1.3版本，主要更新的功能如下： 新增功能 1、新增了最近评论的小工具 由于系统自带的最近评论显示效果非常差，所以可能有部分同学用了一些最近评论的插件，现在gplus主题也默认支持了友好评论展现的小工具，在后台 -&#62; 外观 -&#62; 小工具 开发即可。效果如下： 2、新增了多级评论的功能 之前的版本只支持一级评论，如果管理员想对评论进行回复的话，需要对管理后台才能进行。这个版本在前台就支持了这个功能。效果如下： 点击某条评论后面的[回复]，将会跳转到评论输入框，并且在输入框上面提示当前回复了哪条评论。 修复功能 1、文章二级分类的展现 之前的版本如果文章分类有二级，在前端页面展现的时候会有一些问题，这个版本修复了此问题。效果如下： 2、pjax的bug修复 之前的pjax或多或少都有一些bug，细心的同学可能会发现了我的博客有段时间关闭了pjax的功能，这次对pjax功能进行了全面的修复，虽然还有极少一些不好修复的瑕疵外，暂时基本没上面问题了。 3、其他一些小细节的调整 下载地址： 1、本博客下载地址 2、github上下载的地址 你可以通过上面2个地址下面,gplus主题会始终在github上维护，地址为： https://github.com/welefen/gplus/，欢迎大家关注。 相关文章 发布一款Google+版wordpress主题 gplus主题发布v1.5版 gplus主题发布v1.4版 发布gplus主题1.1版 发布pjax1.1版，包含kissy版本]]></description>
			<content:encoded><![CDATA[<p>继上次发布<a href="http://www.welefen.com/gplus-1-1-version.html">1.1版本</a>后，收到了很多反馈，中间也升级了很多版本，如：1.2.1 &#8211; 1.2.5。经过对一些大的需求进行开发后，决定发布1.3版本，主要更新的功能如下：</p>
<h2>新增功能</h2>
<p>1、新增了最近评论的小工具</p>
<p>由于系统自带的最近评论显示效果非常差，所以可能有部分同学用了一些最近评论的插件，现在gplus主题也默认支持了友好评论展现的小工具，在后台 -&gt; 外观 -&gt; 小工具 开发即可。效果如下：</p>
<p><span id="more-1220"></span></p>
<p><img class="alignnone size-full wp-image-1233" title="comment" src="http://www.welefen.com/wp-content/uploads/2012/03/comment.png" alt="" width="292" height="365" /></p>
<p>2、新增了多级评论的功能</p>
<p>之前的版本只支持一级评论，如果管理员想对评论进行回复的话，需要对管理后台才能进行。这个版本在前台就支持了这个功能。效果如下：</p>
<p><img class="alignnone size-full wp-image-1234" title="re-comment" src="http://www.welefen.com/wp-content/uploads/2012/03/re-comment.png" alt="" width="720" height="217" /></p>
<p>点击某条评论后面的[回复]，将会跳转到评论输入框，并且在输入框上面提示当前回复了哪条评论。</p>
<h2>修复功能</h2>
<p>1、文章二级分类的展现</p>
<p>之前的版本如果文章分类有二级，在前端页面展现的时候会有一些问题，这个版本修复了此问题。效果如下：</p>
<p><img title="cat" src="http://www.welefen.com/wp-content/uploads/2012/03/cat.png" alt="" width="254" height="333" /></p>
<p>2、pjax的bug修复</p>
<p>之前的pjax或多或少都有一些bug，细心的同学可能会发现了我的博客有段时间关闭了pjax的功能，这次对pjax功能进行了全面的修复，虽然还有极少一些不好修复的瑕疵外，暂时基本没上面问题了。</p>
<p>3、其他一些小细节的调整</p>
<h2>下载地址：</h2>
<p>1、<a href="http://www.welefen.com/wp-content/themes/gplus_1.3.zip" target="_blank">本博客下载地址</a></p>
<p>2、<a href="https://github.com/welefen/gplus/blob/master/download/gplus_1.3.zip?raw=true" target="_blank">github上下载的地址</a></p>
<p>你可以通过上面2个地址下面,gplus主题会始终在github上维护，地址为： <a href="https://github.com/welefen/gplus/">https://github.com/welefen/gplus/</a>，欢迎大家关注。<br />
<h3 class='related_post_title'>相关文章</h3>
<ul class='related_post'>
<li><a href='http://www.welefen.com/google-plus-for-wordpress-theme.html' title='发布一款Google+版wordpress主题'>发布一款Google+版wordpress主题</a></li>
<li><a href='http://www.welefen.com/gplus-v1-5.html' title='gplus主题发布v1.5版'>gplus主题发布v1.5版</a></li>
<li><a href='http://www.welefen.com/gplus-v1-4.html' title='gplus主题发布v1.4版'>gplus主题发布v1.4版</a></li>
<li><a href='http://www.welefen.com/gplus-1-1-version.html' title='发布gplus主题1.1版'>发布gplus主题1.1版</a></li>
<li><a href='http://www.welefen.com/pjax-version-1-1-and-contain-kissy.html' title='发布pjax1.1版，包含kissy版本'>发布pjax1.1版，包含kissy版本</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.welefen.com/gplus-v1-3.html/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>如何开发Sublime Text2插件</title>
		<link>http://www.welefen.com/how-to-develop-sublime-text-plugin.html</link>
		<comments>http://www.welefen.com/how-to-develop-sublime-text-plugin.html#comments</comments>
		<pubDate>Sat, 10 Mar 2012 00:44:08 +0000</pubDate>
		<dc:creator>welefen</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[SublimeText插件]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[sublimetext]]></category>
		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false">http://www.welefen.com/?p=1201</guid>
		<description><![CDATA[SublimeText是一个超赞的编辑器，具体有跨平台（window/linux/mac）和高性能等诸多特点，使用python开发，安装包10M都不到。如果你对SublimeText还不够了解，请阅读Sublime Text 2 入门及技巧，Sublime Text2：超赞的现代编辑器等文章。本文简单介绍如何使用python进行Sublime Text插件的开发。 其实官方已经有了一篇文章来介绍如何开发Sublime Text插件，并且文本是使用Prefixr这个插件进行举例， 需要看的请移步到这里How to Create a Sublime Text 2 Plugin 插件制作步骤 1、通过Tools -&#62; New Plugin&#8230;来打开一个初始化的插件编辑文件，它将有如下的内容： import sublime, sublime_plugin class ExampleCommand(sublime_plugin.TextCommand): def run(self, edit): self.view.insert(edit, 0, &#34;Hello, World!&#34;) 2、通过Preferences -&#62; Browse Packages&#8230;打开Packages文件夹，在该文件夹下建立个子文件夹，名字为你想开发的插件名字，如：KeymapManager。回到插件开发的初始化编辑器页面，通过ctrl+s (Windows/Linux) orcmd+s (OS X)保存这个文件，并放到你建立的子文件夹下，文件名如：KeymapManager.py 3、通过ctrl+`快捷键打开SublimeText的控制台，执行如下的命令： view.run_command(&#039;example&#039;) 如果你在当前文件最前面看到插入了Hello, Word!，那表明插件执行成功了。 4、ExampleCommand名字改为你想要的插件名字，如： KeymapmanagerCommand，然后就可以开发该插件对应的功能了。 5、通过官方的API文档查找你需要的接口，文档见：http://www.sublimetext.com/docs/2/api_reference.html 6、插件开发完成后，下面就需要给插件绑定快捷键了，在你的插件目录下建立Default (Windows).sublime-keymap, Default (Linux).sublime-keymap and Default (OSX).sublime-keymap文件，他们分别是给不同的平台使用的。内容大致如下： [ { &#34;keys&#34;: [&#34;ctrl+alt+k&#34;], &#34;command&#34;: [...]]]></description>
			<content:encoded><![CDATA[<p>SublimeText是一个超赞的编辑器，具体有跨平台（window/linux/mac）和高性能等诸多特点，使用python开发，安装包10M都不到。如果你对SublimeText还不够了解，请阅读<a href="http://lucifr.com/139225/sublime-text-2-tricks-and-tips/">Sublime Text 2 入门及技巧</a>，<a href="http://www.imququ.com/post/i_love_sublime-text-2.html">Sublime Text2：超赞的现代编辑器</a>等文章。本文简单介绍如何使用python进行Sublime Text插件的开发。</p>
<p>其实官方已经有了一篇文章来介绍如何开发Sublime Text插件，并且文本是使用Prefixr这个插件进行举例， 需要看的请移步到这里<a href="http://net.tutsplus.com/tutorials/python-tutorials/how-to-create-a-sublime-text-2-plugin/">How to Create a Sublime Text 2 Plugin</a></p>
<p><span id="more-1201"></span></p>
<h2>插件制作步骤</h2>
<p>1、通过Tools -&gt; New Plugin&#8230;来打开一个初始化的插件编辑文件，它将有如下的内容：</p>
<pre class="brush: python; gutter: true">import sublime, sublime_plugin
class ExampleCommand(sublime_plugin.TextCommand):
 def run(self, edit):
 self.view.insert(edit, 0, &quot;Hello, World!&quot;)</pre>
<p>2、通过Preferences -&gt; Browse Packages&#8230;打开Packages文件夹，在该文件夹下建立个子文件夹，名字为你想开发的插件名字，如：KeymapManager。回到插件开发的初始化编辑器页面，通过<strong>ctrl+s</strong> (Windows/Linux) or<strong>cmd+s</strong> (OS X)保存这个文件，并放到你建立的子文件夹下，文件名如：KeymapManager.py</p>
<p>3、通过<strong>ctrl+`</strong>快捷键打开SublimeText的控制台，执行如下的命令：</p>
<pre class="brush: python; gutter: true">view.run_command(&#039;example&#039;)</pre>
<p>如果你在当前文件最前面看到插入了Hello, Word!，那表明插件执行成功了。</p>
<p>4、ExampleCommand名字改为你想要的插件名字，如： KeymapmanagerCommand，然后就可以开发该插件对应的功能了。</p>
<p>5、通过官方的API文档查找你需要的接口，文档见：<a href="http://www.sublimetext.com/docs/2/api_reference.html">http://www.sublimetext.com/docs/2/api_reference.html</a></p>
<p>6、插件开发完成后，下面就需要给插件绑定快捷键了，在你的插件目录下建立<code>Default (Windows).sublime-keymap</code>, <code>Default (Linux).sublime-keymap</code> and <code>Default (OSX).sublime-keymap文件，他们分别是给不同的平台使用的。内容大致如下：</code></p>
<pre class="brush: python; gutter: true">[
 {
 &quot;keys&quot;: [&quot;ctrl+alt+k&quot;],
 &quot;command&quot;: &quot;keymapmanager&quot;
 }
]</pre>
<p>这个文件完全是个JSON格式，ctrl+alt+k就表示这个插件的快捷键了，当然这个快捷键最好不要跟其他插件的快捷键冲突了。</p>
<p>7、如果你想把你的插件植入到顶部菜单或者右键菜单里，你可以通过建立下面的文件方式进行：</p>
<ul>
<li>Main.sublime-menu 顶部菜单</li>
<li>Side Bar.sublime-menu  右键操作左侧Side Bar菜单</li>
<li><code>Context.sublime-menu</code> controls 右键操作文件菜单</li>
</ul>
<p>文件内容也是个JSON个是，如：我想把插件植入到顶部菜单View下，可以通过下面的配置进行:</p>
<pre class="brush: python; gutter: true">[
 {
 &quot;id&quot;: &quot;view&quot;,
 &quot;children&quot;:
 [
 {
 &quot;caption&quot;: &quot;Keymap Manager&quot;,
 &quot;id&quot;: &quot;keymap-manager&quot;,
 &quot;command&quot;: &quot;keymapmanager&quot;
 }
 ]
 }
]</pre>
<p>8、这样下来一个插件差不多就开发完了，你可以将插件文件夹打包发给需要安装的同学。当然这种方式太麻烦了，现在有各Package Control的插件，专门来管理插件安装的，相信你已经安装了。可以通过下面的步骤进行：</p>
<ol>
<li>你需要有个github帐号，并fork <a href="https://github.com/wbond/package_control_channel">https://github.com/wbond/package_control_channel</a></li>
<li>通过git clone命令下载你fork完的地址，如: git@github.com:welefen/package_control_channel.git</li>
<li>修改<a id="9f49fc6883b1a727b5df2713abd674fca39383d2" href="https://github.com/welefen/package_control_channel/blob/master/repositories.json">repositories.json</a>这个文件，把你的插件名称和对应的github项目地址添加进去</li>
<li>ci并push到你的package ctrol里，然后通过pull request推到官方的github里，如果他们审批通过了，那么你的插件就会放到package control里，别人就可以通过install直接安装了</li>
</ol>
<p>9、最后推荐几个国人写的几个比较好的插件</p>
<ul>
<li>GBK Encoding Support，月影大大的作品，可以通过package control执行安装。让Sublime Text执行GBK编码</li>
<li>sublime-view-in-browser，ququ的作品，用于浏览器预览当前文件，喜欢Editplus预览功能的强烈推荐，<a href="https://github.com/qgy18/sublime-view-in-browser">从这里下载</a></li>
<li>KeymapManager, 哈哈，这个是我写的，用来管理所有插件的快捷键的。如果不能记住所有插件快捷键的话，可以通过这个插件快速搜索出来，<a href="https://github.com/welefen/KeymapManager">对应的github地址</a></li>
</ul>
<p>最后为了方便Sublime Text的交流，和月影、ququ、a4等几位大大一起建立了个QQ群：193076432，欢迎大家加入。<br />
<h3 class='related_post_title'>相关文章</h3>
<ul class='related_post'>
<li><a href='http://www.welefen.com/keymapmanager-add-check-plugins-keymap-conflict-feature.html' title='KeymapManager增加检测快捷键冲突的功能'>KeymapManager增加检测快捷键冲突的功能</a></li>
<li><a href='http://www.welefen.com/manager-sublime-text-2-plugin-hot-key-with-keymapmanager.html' title='使用KeymapManager管理Sublime Text2插件的快捷键'>使用KeymapManager管理Sublime Text2插件的快捷键</a></li>
<li><a href='http://www.welefen.com/chrome-music-plugin.html' title='音乐电台chrome插件(包含豆瓣、人人等14个电台)'>音乐电台chrome插件(包含豆瓣、人人等14个电台)</a></li>
<li><a href='http://www.welefen.com/chrome-plugin-for-baidu-soucang.html' title='百度搜藏chrome插件'>百度搜藏chrome插件</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.welefen.com/how-to-develop-sublime-text-plugin.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using eaccelerator
Database Caching using disk: basic
Object Caching 756/870 objects using disk: basic

Served from: welefen.com @ 2012-05-19 01:55:27 -->
