<?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>islighting</title>
	<atom:link href="http://www.islighting.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.islighting.com</link>
	<description>又一个 WordPress Blog</description>
	<lastBuildDate>Wed, 20 Jan 2010 06:31:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>动态载入/删除/更新外部 JavaScript/CSS (转)</title>
		<link>http://www.islighting.com/archives/141</link>
		<comments>http://www.islighting.com/archives/141#comments</comments>
		<pubDate>Wed, 20 Jan 2010 06:31:26 +0000</pubDate>
		<dc:creator>Bentz</dc:creator>
				<category><![CDATA[devs]]></category>

		<guid isPermaLink="false">http://www.islighting.com/?p=141</guid>
		<description><![CDATA[动态载入 JavaScript/Css 文件
    传统加载外部JavaScript(*.js) 或者 Css(*.css)文件的方法是直接在标签里面进行添加:
12&#160; &#160; &#160; &#60;script src=&#34;myscript.js&#34; type=&#34;text/javascript&#34;&#62;&#60;/script&#62;
&#160; &#160; &#160; &#160; &#60;link href=&#34;main.css&#34; type=&#34;text/css&#34; rel=&#34;stylesheet&#34; /&#62;
这些文件用这种方式会同步加载到当前这个页面。
现在用动态的方式载入JavaScript/Css文件：

用 DOM  createElement 方法创建一个 “script” 或者 ”link” 元素
设置相应的属性
使用 appendChild 方法, 把创建的元素插入到 head 标签的末尾

1234567891011121314151617181920212223function loadjscssfile&#40;filename, filetype&#41;&#123;
&#160;//如果文件类型为 .js ,则创建 script 标签，并设置相应属性
&#160;if &#40;filetype==&#34;js&#34;&#41;&#123;
&#160; var fileref=document.createElement&#40;'script'&#41;;
&#160; fileref.setAttribute&#40;&#34;type&#34;,&#34;text/javascript&#34;&#41;;
&#160; fileref.setAttribute&#40;&#34;src&#34;, filename&#41;;
&#160;&#125;
&#160;//如果文件类型为 .css ,则创建 script 标签，并设置相应属性
&#160;else if &#40;filetype==&#34;css&#34;&#41;&#123;
&#160; var fileref=document.createElement&#40;&#34;link&#34;&#41;;
&#160; [...]]]></description>
			<content:encoded><![CDATA[<h4>动态载入 JavaScript/Css 文件</h4>
<p>    传统加载外部JavaScript(*.js) 或者 Css(*.css)文件的方法是直接在<head>标签里面进行添加:</p>
<div class="codecolorer-container html4strict blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;myscript.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/link.html"><span style="color: #000000; font-weight: bold;">link</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;main.css&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></div></td></tr></tbody></table></div>
<p>这些文件用这种方式会同步加载到当前这个页面。</p>
<p>现在用动态的方式载入JavaScript/Css文件：</p>
<ul>
<li>用 DOM  createElement 方法创建一个 “script” 或者 ”link” 元素</li>
<li>设置相应的属性</li>
<li>使用 appendChild 方法, 把创建的元素插入到 head 标签的末尾</li>
</ul>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">function</span> loadjscssfile<span style="color: #009900;">&#40;</span>filename<span style="color: #339933;">,</span> filetype<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp;<span style="color: #006600; font-style: italic;">//如果文件类型为 .js ,则创建 script 标签，并设置相应属性</span><br />
&nbsp;<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #003366; font-weight: bold;">var</span> fileref<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; fileref.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;type&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; fileref.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;src&quot;</span><span style="color: #339933;">,</span> filename<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp;<span style="color: #006600; font-style: italic;">//如果文件类型为 .css ,则创建 script 标签，并设置相应属性</span><br />
&nbsp;<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #003366; font-weight: bold;">var</span> fileref<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;link&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; fileref.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;rel&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;stylesheet&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; fileref.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;type&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;text/css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; fileref.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #339933;">,</span> filename<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp;<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> fileref<span style="color: #339933;">!=</span><span style="color: #3366CC;">&quot;undefined&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;head&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span>0<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>fileref<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #006600; font-style: italic;">//动态添加一个.js 文件</span><br />
loadjscssfile<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;myscript.js&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">//像添加.js文件一样，动态添加一个.php文件</span><br />
loadjscssfile<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;javascript.php&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">//动态一个.css文件</span><br />
loadjscssfile<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;mystyle.css&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>为了防止多次载入同一个js/css文件， 添加以下判断（这只是粗略检测）</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #006600; font-style: italic;">//临时载入的文件名</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> filesadded<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #003366; font-weight: bold;">function</span> checkloadjscssfile<span style="color: #009900;">&#40;</span>filename<span style="color: #339933;">,</span> filetype<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp;<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>filesadded.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;[&quot;</span><span style="color: #339933;">+</span>filename<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==-</span>1<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; loadjscssfile<span style="color: #009900;">&#40;</span>filename<span style="color: #339933;">,</span> filetype<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #006600; font-style: italic;">//把 [filename] 存入 filesadded</span><br />
&nbsp; filesadded<span style="color: #339933;">+=</span><span style="color: #3366CC;">&quot;[&quot;</span><span style="color: #339933;">+</span>filename<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;]&quot;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp;<span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;file already added!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #006600; font-style: italic;">//第一次载入</span><br />
checkloadjscssfile<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;myscript.js&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">//重复载入同一个文件， 失败</span><br />
checkloadjscssfile<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;myscript.js&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h4>动态删除 JavaScript/Csss 文件</h4>
<p>注意：ie6/7 下动态删除样式时有bug. 2种解决方案：1.样式表里不要有import的样式表 2.把link的type属性设置为空值， 然后再修改 href 的地， 或者直接设置href为空， 最后再把type值设置成”text/css” 强制让ie解释新的样式表。</p>
<ul>
<li>取得相应的 DOM 元素</li>
<li>根据 文件名&#038;文件类型 定位元素</li>
<li>用 DOM  removeChild 删除一个 “script” 或者 ”link” 元素</li>
</ul>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">function</span> removejscssfile<span style="color: #009900;">&#40;</span>filename<span style="color: #339933;">,</span> filetype<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp;<span style="color: #006600; font-style: italic;">//判断文件类型</span><br />
&nbsp;<span style="color: #003366; font-weight: bold;">var</span> targetelement<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span> <span style="color: #3366CC;">&quot;script&quot;</span> <span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span> <span style="color: #3366CC;">&quot;link&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #006600; font-style: italic;">//判断文件名</span><br />
&nbsp;<span style="color: #003366; font-weight: bold;">var</span> targetattr<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span> <span style="color: #3366CC;">&quot;src&quot;</span> <span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span> <span style="color: #3366CC;">&quot;href&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #003366; font-weight: bold;">var</span> allsuspects<span style="color: #339933;">=</span>document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span>targetelement<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #006600; font-style: italic;">//遍历元素， 并删除匹配的元素</span><br />
&nbsp;<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span>allsuspects.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&gt;=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>allsuspects<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;&amp;</span> allsuspects<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span>targetattr<span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span><span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> allsuspects<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span>targetattr<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>filename<span style="color: #009900;">&#41;</span><span style="color: #339933;">!=-</span>1<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;allsuspects<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>allsuspects<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
removejscssfile<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;somescript.js&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
removejscssfile<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;somestyle.css&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h4>动态更新 JavaScript/Csss 文件</h4>
<ul>
<li>使用 createElement 创建 要更新的 JavaScript/Css 元素</li>
<li>查找要被替换的元素</li>
<li>用 replaceChild 替换元素</li>
</ul>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">function</span> createjscssfile<span style="color: #009900;">&#40;</span>filename<span style="color: #339933;">,</span> filetype<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp;<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//if filename is a external JavaScript file</span><br />
&nbsp; <span style="color: #003366; font-weight: bold;">var</span> fileref<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><br />
&nbsp; fileref.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;type&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; fileref.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;src&quot;</span><span style="color: #339933;">,</span> filename<span style="color: #009900;">&#41;</span><br />
&nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp;<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//if filename is an external CSS file</span><br />
&nbsp; <span style="color: #003366; font-weight: bold;">var</span> fileref<span style="color: #339933;">=</span>document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;link&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; fileref.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;rel&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;stylesheet&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; fileref.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;type&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;text/css&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; fileref.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #339933;">,</span> filename<span style="color: #009900;">&#41;</span><br />
&nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp;<span style="color: #000066; font-weight: bold;">return</span> fileref<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">function</span> replacejscssfile<span style="color: #009900;">&#40;</span>oldfilename<span style="color: #339933;">,</span> newfilename<span style="color: #339933;">,</span> filetype<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp;<span style="color: #003366; font-weight: bold;">var</span> targetelement<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span> <span style="color: #3366CC;">&quot;script&quot;</span> <span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span> <span style="color: #3366CC;">&quot;link&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #003366; font-weight: bold;">var</span> targetattr<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span> <span style="color: #3366CC;">&quot;src&quot;</span> <span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span>filetype<span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span> <span style="color: #3366CC;">&quot;href&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;none&quot;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #003366; font-weight: bold;">var</span> allsuspects<span style="color: #339933;">=</span>document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span>targetelement<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span>allsuspects.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&gt;=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>allsuspects<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;&amp;</span> allsuspects<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span>targetattr<span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span><span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> allsuspects<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span>targetattr<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>oldfilename<span style="color: #009900;">&#41;</span><span style="color: #339933;">!=-</span>1<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> newelement<span style="color: #339933;">=</span>createjscssfile<span style="color: #009900;">&#40;</span>newfilename<span style="color: #339933;">,</span> filetype<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;allsuspects<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">replaceChild</span><span style="color: #009900;">&#40;</span>newelement<span style="color: #339933;">,</span> allsuspects<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp;<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #006600; font-style: italic;">//用 &quot;newscript.js&quot; 替换 &quot;oldscript.js&quot;</span><br />
replacejscssfile<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;oldscript.js&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;newscript.js&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;js&quot;</span><span style="color: #009900;">&#41;</span>；<br />
<span style="color: #006600; font-style: italic;">//用 &quot;newscript.css&quot; 替换 &quot;oldscript.css&quot;</span><br />
replacejscssfile<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;oldstyle.css&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;newstyle&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;css&quot;</span><span style="color: #009900;">&#41;</span>；</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.islighting.com/archives/141/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Espresso 升级拉！</title>
		<link>http://www.islighting.com/archives/106</link>
		<comments>http://www.islighting.com/archives/106#comments</comments>
		<pubDate>Tue, 15 Dec 2009 15:46:32 +0000</pubDate>
		<dc:creator>Bentz</dc:creator>
				<category><![CDATA[activities]]></category>

		<guid isPermaLink="false">http://www.islighting.com/?p=106</guid>
		<description><![CDATA[Espresso，mac下强大的web开发IDE，最近升级到1.1，增加了不少新功能。
试过不少编辑器，最终还是选择了espresso来写页面，因为他最像神器textmate。类似textmate一般干净的界面和主题，不断增加中的sugar(扩展)，完美支持中文，更能导入textmate的bundle为我所用！这些优点和轻量的感觉，使得写页面这种枯燥的事情也变得鲜活乐趣起来。

这次增加的功能不少是重要更新，类似&#8221;Find in Project&#8221;，&#8221;Image Preview&#8221;，&#8221;Open with&#8221;，都使得工作流更加集成。
在一个界面端完成所有要紧事，这恐怕是你我这样的懒人最期望的事情。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://macrabbit.com/espresso/" target="_blank">Espresso</a>，mac下强大的web开发IDE，最近升级到1.1，增加了不少新功能。</p>
<p>试过不少编辑器，最终还是选择了espresso来写页面，因为他最像神器textmate。类似textmate一般干净的界面和主题，不断增加中的sugar(扩展)，完美支持中文，更能导入textmate的bundle为我所用！这些优点和轻量的感觉，使得写页面这种枯燥的事情也变得鲜活乐趣起来。</p>
<p><a href="http://macrabbit.com/espresso/images/screenshots-1.1/MainFind.jpg" target="_blank"><img class="alignnone" title="MainFind" src="http://macrabbit.com/espresso/images/screenshots-1.1/MainFind-thumb.jpg" alt="" width="136" height="104" /></a><a href="http://macrabbit.com/espresso/images/screenshots-1.1/MainProjects.jpg" target="_blank"><img class="alignnone" title="MainProjects" src="http://macrabbit.com/espresso/images/screenshots-1.1/MainProjects-thumb.jpg" alt="" width="136" height="104" /></a><a href="http://macrabbit.com/espresso/images/screenshots-1.1/MainEditPreview.jpg" target="_blank"><img class="alignnone" title="MainEditPreview" src="http://macrabbit.com/espresso/images/screenshots-1.1/MainEditPreview-thumb.jpg" alt="" width="136" height="104" /></a><a href="http://macrabbit.com/espresso/images/screenshots-1.1/MainPublishSync.jpg" target="_blank"><img class="alignnone" title="MainPublishSync" src="http://macrabbit.com/espresso/images/screenshots-1.1/MainPublishSync-thumb.jpg" alt="" width="136" height="104" /></a></p>
<p>这次增加的功能不少是重要更新，类似&#8221;Find in Project&#8221;，&#8221;Image Preview&#8221;，&#8221;Open with&#8221;，都使得工作流更加集成。</p>
<p>在一个界面端完成所有要紧事，这恐怕是你我这样的懒人最期望的事情。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.islighting.com/archives/106/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zen Coding，透过css生成html</title>
		<link>http://www.islighting.com/archives/112</link>
		<comments>http://www.islighting.com/archives/112#comments</comments>
		<pubDate>Tue, 15 Dec 2009 09:28:29 +0000</pubDate>
		<dc:creator>Bentz</dc:creator>
				<category><![CDATA[devs]]></category>

		<guid isPermaLink="false">http://www.islighting.com/?p=112</guid>
		<description><![CDATA[是不是觉得每天都敲同样的html代码有点麻木？ok，那就让css代我们生成优雅的代码和排版吧。让我们专心做其他更重要的事。
这就是Zen Coding所能做的。Zen Coding是一套快速编写html/css的工具，语法简单至极，实现的效果却有点惊人。利用css的书写规则来创建html，想像一下这有多便利吧，尤其是列表、小模块，这简直太棒了！
演示视频

简单的例子
1div#content&#62;h1+p
上面这一行的输出结果
1234&#60;div id=&#34;content&#34;&#62;
&#160; &#160; &#60;h1&#62;&#60;/h1&#62;
&#160; &#160; &#60;p&#62;&#60;/p&#62;
&#60;/div&#62;
更多语法
1234567891011121314* E
Element name (div, p);
* E#id
Element with identifier (div#content, p#intro, span#error);
* E.class
Element with classes (div.header, p.error.critial). You can combine classes and IDs, too: div#content.column.width;
* E&#38;gt;N
Child element (div&#38;gt;p, div#footer&#38;gt;p&#38;gt;span);
* E+N
Sibling element (h1+p, div#header+div#content+div#footer);
* E*N
Element multiplication (ul#nav&#38;gt;li*5&#38;gt;a);
* E$*N
Item numbering (ul#nav&#38;gt;li.item-$*5);
上手很简单，多看几个例子就ok，或者在demo尝试一下，online demo。
Zen Coding支持的IDE众多，包括textmate和espresso，可以作为插件安装到我们最熟悉的IDE上。Ok, let&#8217;s speed up!
]]></description>
			<content:encoded><![CDATA[<p>是不是觉得每天都敲同样的html代码有点麻木？ok，那就让css代我们生成优雅的代码和排版吧。让我们专心做其他更重要的事。</p>
<p>这就是<a href="http://code.google.com/p/zen-coding/" target="_blank">Zen Coding</a>所能做的。Zen Coding是一套快速编写html/css的工具，语法简单至极，实现的效果却有点惊人。利用css的书写规则来创建html，想像一下这有多便利吧，尤其是列表、小模块，这简直太棒了！</p>
<p>演示视频<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /><param name="src" value="http://player.youku.com/player.php/sid/XMTM4NDQwNzgw/v.swf" /><embed type="application/x-shockwave-flash" width="480" height="400" src="http://player.youku.com/player.php/sid/XMTM4NDQwNzgw/v.swf" quality="high"></embed></object></p>
<p>简单的例子</p>
<div class="codecolorer-container css blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">div<span style="color: #cc00cc;">#content</span><span style="color: #00AA00;">&gt;</span>h1<span style="color: #00AA00;">+</span>p</div></td></tr></tbody></table></div>
<p>上面这一行的输出结果</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;div id=&quot;content&quot;&gt;<br />
&nbsp; &nbsp; &lt;h1&gt;&lt;/h1&gt;<br />
&nbsp; &nbsp; &lt;p&gt;&lt;/p&gt;<br />
&lt;/div&gt;</div></td></tr></tbody></table></div>
<p>更多语法</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">* E<br />
Element name (div, p);<br />
* E#id<br />
Element with identifier (div#content, p#intro, span#error);<br />
* E.class<br />
Element with classes (div.header, p.error.critial). You can combine classes and IDs, too: div#content.column.width;<br />
* E&amp;gt;N<br />
Child element (div&amp;gt;p, div#footer&amp;gt;p&amp;gt;span);<br />
* E+N<br />
Sibling element (h1+p, div#header+div#content+div#footer);<br />
* E*N<br />
Element multiplication (ul#nav&amp;gt;li*5&amp;gt;a);<br />
* E$*N<br />
Item numbering (ul#nav&amp;gt;li.item-$*5);</div></td></tr></tbody></table></div>
<p>上手很简单，多看几个例子就ok，或者在demo尝试一下，<a href="http://zen-coding.ru/demo/">online demo</a>。<br />
Zen Coding支持的IDE众多，包括textmate和espresso，可以作为插件安装到我们最熟悉的IDE上。Ok, let&#8217;s speed up!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.islighting.com/archives/112/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data URIs for CSS Images tests</title>
		<link>http://www.islighting.com/archives/98</link>
		<comments>http://www.islighting.com/archives/98#comments</comments>
		<pubDate>Tue, 15 Dec 2009 06:52:58 +0000</pubDate>
		<dc:creator>Bentz</dc:creator>
				<category><![CDATA[devs]]></category>

		<guid isPermaLink="false">http://www.islighting.com/?p=98</guid>
		<description><![CDATA[用Data URIs来嵌入image的好处是能减少连接数，更少的连接数意味着更快的访问速度，和更低的服务器负载。
Rob Flaherty作了一个 Data URIs for css images的测试，将一个页面做成三个版本，分别对比他们的加载情况：

页面a:默认页面，1 css 1 js 31 images, 33 requests
页面b:css images作data URIs嵌入到css中，3 requests
页面c:css images作data URIs嵌入到另一个css中，放到页尾， 6 requests

结论：如预期般的，加载时间c&#60;b&#60;a，但是效果并不明显， 具体情况见这里
]]></description>
			<content:encoded><![CDATA[<p>用<a href="http://en.wikipedia.org/wiki/Data_URI_scheme" target="_blank">Data URIs</a>来嵌入image的好处是能减少连接数，更少的连接数意味着更快的访问速度，和更低的服务器负载。<br />
Rob Flaherty作了一个 Data URIs for css images的测试，将一个页面做成三个版本，分别对比他们的加载情况：</p>
<ul>
<li>页面a:默认页面，1 css 1 js 31 images, 33 requests</li>
<li>页面b:css images作data URIs嵌入到css中，3 requests</li>
<li>页面c:css images作data URIs嵌入到另一个css中，放到页尾， 6 requests</li>
</ul>
<p>结论：如预期般的，加载时间c&lt;b&lt;a，但是效果并不明显， <strong><a href="http://www.ravelrumba.com/blog/data-uris-for-css-images-more-tests-more-questions/" target="_blank">具体情况见这里</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.islighting.com/archives/98/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>about lab</title>
		<link>http://www.islighting.com/archives/95</link>
		<comments>http://www.islighting.com/archives/95#comments</comments>
		<pubDate>Sat, 12 Dec 2009 14:10:51 +0000</pubDate>
		<dc:creator>Bentz</dc:creator>
				<category><![CDATA[devs]]></category>

		<guid isPermaLink="false">http://www.islighting.com/?p=95</guid>
		<description><![CDATA[把平常捣鼓的一些小玩意放在了lab中，经常更新。
经验很大程度上就是代码量的堆砌，轮子造出来了稍微修剪下就能应用，在细节上没有必要纠缠太多，快速实现，频繁迭代，不要让时间拖累了自己。
]]></description>
			<content:encoded><![CDATA[<p>把平常捣鼓的一些小玩意放在了<a href="http://www.islighting.com/lab">lab</a>中，经常更新。<br />
经验很大程度上就是代码量的堆砌，轮子造出来了稍微修剪下就能应用，在细节上没有必要纠缠太多，快速实现，频繁迭代，不要让时间拖累了自己。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.islighting.com/archives/95/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>js tips</title>
		<link>http://www.islighting.com/archives/69</link>
		<comments>http://www.islighting.com/archives/69#comments</comments>
		<pubDate>Mon, 07 Dec 2009 05:58:40 +0000</pubDate>
		<dc:creator>Bentz</dc:creator>
				<category><![CDATA[devs]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://www.islighting.com/?p=69</guid>
		<description><![CDATA[超长换行的字符串
在换行的地方加\
1234567var table = '&#60;div class=&#34;table-form&#34;&#62;\
&#60;table&#62;\
&#60;tr&#62;\
&#60;td &#62;&#60;input type=&#34;button&#34; value=&#34;关闭&#34;&#62;&#60;/td&#62;\
&#60;/tr&#62;\
&#60;/table&#62;\
&#60;/div&#62;';
]]></description>
			<content:encoded><![CDATA[<p><strong>超长换行的字符串</strong><br />
在换行的地方加\</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> table <span style="color: #339933;">=</span> <span style="color: #3366CC;">'&lt;div class=&quot;table-form&quot;&gt;<span style="color: #000099; font-weight: bold;">\</span><br />
&lt;table&gt;<span style="color: #000099; font-weight: bold;">\</span><br />
&lt;tr&gt;<span style="color: #000099; font-weight: bold;">\</span><br />
&lt;td &gt;&lt;input type=&quot;button&quot; value=&quot;关闭&quot;&gt;&lt;/td&gt;<span style="color: #000099; font-weight: bold;">\</span><br />
&lt;/tr&gt;<span style="color: #000099; font-weight: bold;">\</span><br />
&lt;/table&gt;<span style="color: #000099; font-weight: bold;">\</span><br />
&lt;/div&gt;'</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.islighting.com/archives/69/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mootools bundle for textmate</title>
		<link>http://www.islighting.com/archives/63</link>
		<comments>http://www.islighting.com/archives/63#comments</comments>
		<pubDate>Tue, 03 Nov 2009 03:50:23 +0000</pubDate>
		<dc:creator>Bentz</dc:creator>
				<category><![CDATA[devs]]></category>
		<category><![CDATA[bundle]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://www.islighting.com/?p=63</guid>
		<description><![CDATA[工欲善其事，必先利其器。textmate不愧为最强大的编辑器，各式的bundle不仅好玩，新奇，更重要的是使用，用好bundle的感觉就像武功高手打出一整套组合拳般淋漓畅快，华丽但又拳拳到肉。
mootools的bundle是在git上搜到的，作者Thomas Aylott貌似就是mootools开发者之一。。。他的git中还有一个非常好用的js bundle，相对textmate自带的bundle来说多了挺多实用的功能。
安装:
12cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/subtleGradient/MooTools.tmBundle.git
然后show bundle editor，成功安装～
使用时注意将语言切换到MooTools Javascript

]]></description>
			<content:encoded><![CDATA[<p>工欲善其事，必先利其器。textmate不愧为最强大的编辑器，各式的bundle不仅好玩，新奇，更重要的是使用，用好bundle的感觉就像武功高手打出一整套组合拳般淋漓畅快，华丽但又拳拳到肉。</p>
<p>mootools的<a href="http://github.com/subtleGradient/MooTools.tmBundle" target="_blank">bundle</a>是在git上搜到的，作者<a href="http://subtlegradient.com/" target="_blank">Thomas Aylott</a>貌似就是mootools开发者之一。。。他的git中还有一个非常好用的<a href="http://github.com/subtleGradient/javascript.tmbundle" target="_blank">js bundle</a>，相对textmate自带的bundle来说多了挺多实用的功能。</p>
<p>安装:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cd ~/Library/Application\ Support/TextMate/Bundles<br />
git clone git://github.com/subtleGradient/MooTools.tmBundle.git</div></td></tr></tbody></table></div>
<p>然后show bundle editor，成功安装～<br />
使用时注意将语言切换到MooTools Javascript</p>
<p><img class="alignnone size-full wp-image-65" title="屏幕快照 2009-11-03 上午11.44.26" src="http://www.islighting.com/wp-content/uploads/2009/11/屏幕快照-2009-11-03-上午11.44.26.png" alt="屏幕快照 2009-11-03 上午11.44.26" width="450" height="337" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.islighting.com/archives/63/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Wave</title>
		<link>http://www.islighting.com/archives/58</link>
		<comments>http://www.islighting.com/archives/58#comments</comments>
		<pubDate>Sat, 24 Oct 2009 10:56:28 +0000</pubDate>
		<dc:creator>Bentz</dc:creator>
				<category><![CDATA[activities]]></category>

		<guid isPermaLink="false">http://www.islighting.com/?p=58</guid>
		<description><![CDATA[要不是收到申请通过的信件，我都快忘记这茬了。。如果你还不了解google wave请看介绍
google这个受邀才能体验的机制做的狠抓人心，记得gmail出来时也是如此，最开始一个帐号能炒到上千美刀。。不过现在泛滥的可以不值钱鸟~
还有数个邀请，想要的朋友留言，我尽力发放   
]]></description>
			<content:encoded><![CDATA[<p>要不是收到申请通过的信件，我都快忘记这茬了。。如果你还不了解google wave<a href="http://wave.google.com/help/wave/about.html" target="_blank">请看介绍</a></p>
<p>google这个受邀才能体验的机制做的狠抓人心，记得gmail出来时也是如此，最开始一个帐号能炒到上千美刀。。不过现在泛滥的可以不值钱鸟~</p>
<p><del datetime="2009-12-12T05:59:03+00:00">还有数个邀请，想要的朋友留言，我尽力发放 </del> <img src='http://www.islighting.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.islighting.com/archives/58/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>foobar杂记</title>
		<link>http://www.islighting.com/archives/47</link>
		<comments>http://www.islighting.com/archives/47#comments</comments>
		<pubDate>Sun, 18 Oct 2009 06:36:06 +0000</pubDate>
		<dc:creator>Bentz</dc:creator>
				<category><![CDATA[activities]]></category>
		<category><![CDATA[album art]]></category>
		<category><![CDATA[foobar]]></category>

		<guid isPermaLink="false">http://www.islighting.com/?p=47</guid>
		<description><![CDATA[终于将客厅里的机器也安上了win7，比尔盖茨说过的家庭数字娱乐中心，正在慢慢实现。
重新装了foobar，界面还是太阳春了些，但对于这种自定性高的软件，我总是抱以十二分的好感，不管初始的界面或是功能多么简陋，一番diy以后，总有超出预期的惊喜。我安装的插件，列表如下：

foo_audioscrobbler
Last.fm推送
foo_ui_columns
columns ui配win7默认的主题，其实就很不错的了～
foo_out_asio
asio低延迟的输出，对音质很有帮助，既然我的m-audio 410声卡支持asio，那就不要浪费
foo_run
调用外部程序，
foo_w7shell
任务栏上显示专辑封面预览和播放控制


我的音乐都是以专辑文件夹形式归档的，免不了会有一些VA合辑的情况出现，想让他们在playlist中还是正常显示的话，可以修改playlist grouping script，改为
1&#34;$if2(%album artist%,%artist%) - %album% &#160; &#160; %date%&#34;
，然后将合辑下所有单曲信息中的album artist设为一致，比如VA。
专辑的封面也是个麻烦事，不过借用AlbumArtDownloader XUI和foo_run，可以很方便的完成。
下载AlbumArtDownloader ，安装，我设置常用的album art抓取站点是amazon，last.fm，discogs，junorecords，对于我常听的音乐类型来说，这几个就够用了，实在不行还有google image么～
在foobar设置面板中增加一项Get AlbumArt的项(名称随意)，设置Path为
1&#34;D:\Program Files\foobar2000\AlbumArtDownloader\AlbumArt.exe&#34; /artist &#34;%artist%&#34; &#34;%album%&#34; /album &#34;%album%&#34; /path &#34;$substr(%_path%,0,$strrchr(%_path%,'\'))folder.jpg&#34;
&#8220;D:\Program Files\foobar2000\AlbumArtDownloader\AlbumArt.exe&#8221;是我的目录，你需要把它改成你的。使用的话就是在playlist要抓封面的专辑或者单曲上右键 Run service -&#62; Get AlbumArt，调出AlbumArtDownloader界面，就能抓到封面并保存到专辑目录下了
]]></description>
			<content:encoded><![CDATA[<p>终于将客厅里的机器也安上了win7，比尔盖茨说过的家庭数字娱乐中心，正在慢慢实现。</p>
<p>重新装了foobar，界面还是太阳春了些，但对于这种自定性高的软件，我总是抱以十二分的好感，不管初始的界面或是功能多么简陋，一番diy以后，总有超出预期的惊喜。我安装的插件，列表如下：</p>
<ul>
<li><a href="http://www.mp3tag.de/en/fb2k.html" target="_blank">foo_audioscrobbler</a><br />
Last.fm推送</li>
<li><a href="http://http://yuo.be/columns.php" target="_blank">foo_ui_columns</a><br />
columns ui配win7默认的主题，其实就很不错的了～</li>
<li><a href="http://www.foobar2000.org/components/view/foo_out_asio" target="_blank">foo_out_asio</a><br />
asio低延迟的输出，对音质很有帮助，既然我的m-audio 410声卡支持asio，那就不要浪费</li>
<li><a href="http://www.mp3tag.de/en/fb2k.html" target="_blank">foo_run</a><br />
调用外部程序，</li>
<li><a href="http://wintense.com/238" target="_blank">foo_w7shell</a><br />
任务栏上显示专辑封面预览和播放控制</li>
</ul>
<p><a href="http://www.islighting.com/wp-content/uploads/2009/10/2009-10-18-14-59-17.png" target="_blank"><img class="alignnone size-full wp-image-52" title="2009-10-18 14-59-17" src="http://www.islighting.com/wp-content/uploads/2009/10/2009-10-18-14-59-17.png" alt="2009-10-18 14-59-17" width="426" height="262" /></a></p>
<p>我的音乐都是以专辑文件夹形式归档的，免不了会有一些VA合辑的情况出现，想让他们在playlist中还是正常显示的话，可以修改playlist grouping script，改为</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&quot;$if2(%album artist%,%artist%) - %album% &nbsp; &nbsp; %date%&quot;</div></td></tr></tbody></table></div>
<p>，然后将合辑下所有单曲信息中的album artist设为一致，比如VA。</p>
<p>专辑的封面也是个麻烦事，不过借用<a href="http://www.hydrogenaudio.org/forums/index.php?showtopic=51896" target="_blank">AlbumArtDownloader XUI</a>和foo_run，可以很方便的完成。<br />
下载AlbumArtDownloader ，安装，我设置常用的album art抓取站点是amazon，last.fm，discogs，junorecords，对于我常听的音乐类型来说，这几个就够用了，实在不行还有google image么～</p>
<p>在foobar设置面板中增加一项Get AlbumArt的项(名称随意)，设置Path为</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&quot;D:\Program Files\foobar2000\AlbumArtDownloader\AlbumArt.exe&quot; /artist &quot;%artist%&quot; &quot;%album%&quot; /album &quot;%album%&quot; /path &quot;$substr(%_path%,0,$strrchr(%_path%,'\'))folder.jpg&quot;</div></td></tr></tbody></table></div>
<p>&#8220;D:\Program Files\foobar2000\AlbumArtDownloader\AlbumArt.exe&#8221;是我的目录，你需要把它改成你的。使用的话就是在playlist要抓封面的专辑或者单曲上右键 Run service -&gt; Get AlbumArt，调出AlbumArtDownloader界面，就能抓到封面并保存到专辑目录下了</p>
]]></content:encoded>
			<wfw:commentRss>http://www.islighting.com/archives/47/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mac下清除dns缓存</title>
		<link>http://www.islighting.com/archives/42</link>
		<comments>http://www.islighting.com/archives/42#comments</comments>
		<pubDate>Thu, 15 Oct 2009 06:06:46 +0000</pubDate>
		<dc:creator>Bentz</dc:creator>
				<category><![CDATA[activities]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://www.islighting.com/?p=42</guid>
		<description><![CDATA[内网的dns服务器有时候会不稳定，导致svn无法连接到服务器，这时候可以清除一下dns缓存，正所谓来也冲冲，去也冲冲：
1dscacheutil -flushcache
]]></description>
			<content:encoded><![CDATA[<p>内网的dns服务器有时候会不稳定，导致svn无法连接到服务器，这时候可以清除一下dns缓存，正所谓来也冲冲，去也冲冲：</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">dscacheutil <span style="color: #660033;">-flushcache</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.islighting.com/archives/42/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
