﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-System.gc()</title><link>http://www.blogjava.net/unrealwalker/</link><description>Java,C,Ruby,futbol and games</description><language>zh-cn</language><lastBuildDate>Wed, 15 Apr 2026 06:02:09 GMT</lastBuildDate><pubDate>Wed, 15 Apr 2026 06:02:09 GMT</pubDate><ttl>60</ttl><item><title>Google 2010年1月4日logo解析</title><link>http://www.blogjava.net/unrealwalker/archive/2010/01/05/308296.html</link><dc:creator>unrealwalker</dc:creator><author>unrealwalker</author><pubDate>Tue, 05 Jan 2010 08:40:00 GMT</pubDate><guid>http://www.blogjava.net/unrealwalker/archive/2010/01/05/308296.html</guid><wfw:comment>http://www.blogjava.net/unrealwalker/comments/308296.html</wfw:comment><comments>http://www.blogjava.net/unrealwalker/archive/2010/01/05/308296.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/unrealwalker/comments/commentRss/308296.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/unrealwalker/services/trackbacks/308296.html</trackback:ping><description><![CDATA[
		<p>
				<img src="http://www.google.co.uk/logos/newton10-tree.jpg" />
		</p>
		<p>Google于2010年1月4日在主页推出了特别的logo来纪念牛顿的诞辰，此logo的特别之处是当你静候几秒钟后，logo中的一个苹果会掉下来，很好的呼应了logo的主题。<br />我通过对其页面代码的查看，发现其写的很精致，下面节选关键的代码看一看： <br /><br />HTML代码节选：</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #000000">
						<img src="http://www.blogjava.net/images/dot.gif" />
						<br />
				</span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">br </span>
				<span style="COLOR: #ff0000">clear</span>
				<span style="COLOR: #0000ff">=all </span>
				<span style="COLOR: #ff0000">id</span>
				<span style="COLOR: #0000ff">=lgpd</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000">从下面开始</span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">img </span>
				<span style="COLOR: #ff0000">src</span>
				<span style="COLOR: #0000ff">="/logos/newton10-apple.png"</span>
				<span style="COLOR: #ff0000"> style</span>
				<span style="COLOR: #0000ff">="visibility:hidden"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000">预加载掉下来的那颗苹果的图片</span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">a </span>
				<span style="COLOR: #ff0000">href</span>
				<span style="COLOR: #0000ff">="/search?q=isaac+newton&amp;ct=newton10-tree&amp;oi=ddle"</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000">苹果树logo图片</span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />  </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">img </span>
				<span style="COLOR: #ff0000">src</span>
				<span style="COLOR: #0000ff">=/logos/newton10-tree.jpg </span>
				<span style="COLOR: #ff0000">width</span>
				<span style="COLOR: #0000ff">=384 </span>
				<span style="COLOR: #ff0000">height</span>
				<span style="COLOR: #0000ff">=138 </span>
				<span style="COLOR: #ff0000">border</span>
				<span style="COLOR: #0000ff">=0 </span>
				<span style="COLOR: #ff0000">alt</span>
				<span style="COLOR: #0000ff">="Birthday of Sir Isaac Newton"</span>
				<span style="COLOR: #ff0000"> <br />    title</span>
				<span style="COLOR: #0000ff">="Birthday of Sir Isaac Newton"</span>
				<span style="COLOR: #ff0000"> id</span>
				<span style="COLOR: #0000ff">=logo  </span>
				<span style="COLOR: #ff0000">style</span>
				<span style="COLOR: #0000ff">="margin-top:-1.22em"</span>
				<span style="COLOR: #ff0000"> <br />    onload</span>
				<span style="COLOR: #0000ff">="<img src="http://www.blogjava.net/images/dot.gif" />"</span>
				<span style="COLOR: #ff0000"> </span>
				<span style="COLOR: #0000ff">/&gt;&lt;/</span>
				<span style="COLOR: #800000">a</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000">logo的onload声明并调用了苹果下落函数，见后</span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />  </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">img </span>
				<span style="COLOR: #ff0000">id</span>
				<span style="COLOR: #0000ff">="fall"</span>
				<span style="COLOR: #ff0000"> src</span>
				<span style="COLOR: #0000ff">="/logos/newton10-apple.png"</span>
				<span style="COLOR: #ff0000"> style</span>
				<span style="COLOR: #0000ff">="position:relative;right:248px;bottom:46px"</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000">掉下来的那颗苹果的图片</span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />  </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">noscript</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />    </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">style</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #800000; BACKGROUND-COLOR: #f5f5f5">
						<br />      #fall</span>
				<span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{</span>
				<span style="COLOR: #ff0000; BACKGROUND-COLOR: #f5f5f5">bottom</span>
				<span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">:</span>
				<span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">-210px!important</span>
				<span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">} </span>
				<span style="COLOR: #800000; BACKGROUND-COLOR: #f5f5f5">/**浏览器不支持脚本则把苹果直接摆在地上**/<br />    </span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">style</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">
						<br />  </span>
				<span style="COLOR: #0000ff">&lt;/</span>
				<span style="COLOR: #800000">noscript</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #008000">&lt;!--</span>
				<span style="COLOR: #008000">到这里结束</span>
				<span style="COLOR: #008000">--&gt;</span>
				<span style="COLOR: #000000">
						<br />  </span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">form<br /></span>
				<span style="COLOR: #ff0000">
						<img src="http://www.blogjava.net/images/dot.gif" />
				</span>
		</div>
		<br />在logo的onload时间中的Javascript:<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span> <span style="COLOR: #000000">setTimeout(</span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000">(){</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 下落函数，2秒后会被调用</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">var</span><span style="COLOR: #000000"> h</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 水平速度</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">var</span><span style="COLOR: #000000"> v</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 垂直速度</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">var</span><span style="COLOR: #000000"> f</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">document.getElementById('fall');<span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 那颗苹果的图片</span><br /></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">var</span><span style="COLOR: #000000"> i</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">setInterval(</span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000">(){<span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 单步下落函数，每25毫秒被调用一次</span><br /></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(f){<br /></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">var</span><span style="COLOR: #000000"> r</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">parseInt(f.style.right)</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">h;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 水平位移</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">var</span><span style="COLOR: #000000"> b</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">parseInt(f.style.bottom)</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">v;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 垂直位移</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">            f.style.right</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">r</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">'px';<br /></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">            f.style.bottom</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">b</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">'px';<br /></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(b</span><span style="COLOR: #000000">&gt;-</span><span style="COLOR: #000000">210</span><span style="COLOR: #000000">){</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 未下落到-210</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">12</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">                v</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">2</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 模拟加速度，v'=at+v，at=常量=2</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">13</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">            }</span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">{</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 已下落到-210</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">14</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">                h</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">(v</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">9</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">v</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">0.1</span><span style="COLOR: #000000">:</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 落地后横向反弹的速度为垂直速度的0.1倍（理想情况下此比率固定）</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">15</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">                v</span><span style="COLOR: #000000">*=</span><span style="COLOR: #000000">(v</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">9</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">?-</span><span style="COLOR: #000000">0.3</span><span style="COLOR: #000000">:</span><span style="COLOR: #000000">0</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 0.3为每次反弹后剩下的速度百分比（不知是否符合非弹性碰撞规律？）</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">16</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">            }<br /></span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">        }<br /></span><span style="COLOR: #008080">18</span> <span style="COLOR: #000000">    },</span><span style="COLOR: #000000">25</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">19</span> <span style="COLOR: #000000">    google.rein</span><span style="COLOR: #000000">&amp;&amp;</span><span style="COLOR: #000000">google.rein.push(</span><span style="COLOR: #0000ff">function</span><span style="COLOR: #000000">(){</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 资源回收队列，rein是一个数组</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">20</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">        clearInterval(i);<br /></span><span style="COLOR: #008080">21</span> <span style="COLOR: #000000">        h</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080">22</span> <span style="COLOR: #000000">        v</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">23</span> <span style="COLOR: #000000">    })<br /></span><span style="COLOR: #008080">24</span> <span style="COLOR: #000000">},</span><span style="COLOR: #000000">2000</span><span style="COLOR: #000000">)</span></div><br />可以看到代码很好的模拟了重力加速度，让苹果的掉落更真实。<br />此Javascript还试图通过数组来收集待回收的资源，应该是用于随后释放（但我还未找到监听此数组的函数）。<br /><br />一段游戏一样的代码，依然可以看出代码作者的用心和水平，读后可谓受益匪浅。<br /><img src="http://www.google.co.uk/logos/newton10-apple.png" /><img src="http://www.google.co.uk/logos/newton10-apple.png" /><img src="http://www.google.co.uk/logos/newton10-apple.png" /><img src="http://www.google.co.uk/logos/newton10-apple.png" /><img src="http://www.google.co.uk/logos/newton10-apple.png" /><img src="http://www.google.co.uk/logos/newton10-apple.png" /><img src="http://www.google.co.uk/logos/newton10-apple.png" /><img src ="http://www.blogjava.net/unrealwalker/aggbug/308296.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/unrealwalker/" target="_blank">unrealwalker</a> 2010-01-05 16:40 <a href="http://www.blogjava.net/unrealwalker/archive/2010/01/05/308296.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>GreaseMonkey相关及原创脚本</title><link>http://www.blogjava.net/unrealwalker/archive/2006/04/19/41780.html</link><dc:creator>unrealwalker</dc:creator><author>unrealwalker</author><pubDate>Tue, 18 Apr 2006 17:17:00 GMT</pubDate><guid>http://www.blogjava.net/unrealwalker/archive/2006/04/19/41780.html</guid><wfw:comment>http://www.blogjava.net/unrealwalker/comments/41780.html</wfw:comment><comments>http://www.blogjava.net/unrealwalker/archive/2006/04/19/41780.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/unrealwalker/comments/commentRss/41780.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/unrealwalker/services/trackbacks/41780.html</trackback:ping><description><![CDATA[GreaseMonkey(<a href='https://addons.mozilla.org/addon.php?id=748'>下载</a>)是Firefox的扩展，可以通过脚本对你正在浏览的页面进行修改，个人认为GreaseMonkey脚本可以分为两类，hack和fix，hack指通过修改页面为我们带来更多的便利或达到某些特别目的；而fix指对页面错误进行修正，国内用户可能更需要，但这显然是不提倡的用法，GreaseMonkey作为Firefox的扩展，实在没有义务为那些不符合标准的网页遮羞。
<br/>
<br/>
<h3>原创GreaseMonkey脚本列表</h3>
(fix)太平洋下载/看图/评论修复
<a href='http://unrealwalker.googlepages.com/pconlinefix.user.js'>下载</a>
<br/>
<span style='color:#f00'>注意只有在页面下载完成或出现表格后按停止才会生效</span>
<br/>
<br/>
(hack)百度MP3无弹出窗口直接下
<a href='http://unrealwalker.googlepages.com/baidump3fix.user.js'>下载</a>
<br/>
<br/>
(fix)动网论坛引用修复
<a href='http://unrealwalker.googlepages.com/dvbbsfix.user.js'>下载</a>
<br/>
<span style='color:#f00'>鼠标定位到引用的文字中，并一直按键盘的"向右"即可在后面添加自己的内容</span>
<br/>
<br/>
(hack)动网论坛屏蔽某用户发言
<a href='http://unrealwalker.googlepages.com/dvbbs_user_fliter.user.js'>下载</a>
<br/>
<br/>
水平有限，报告bug请发信给<a href='mailto:unrealwalker@gmail.com'>unrealwalker@gmail.com</a>，最好写上出错情况，出错页面，谢谢！
<br/>
<br/>
<h3>GreaseMonkey相关的一些链接：</h3>
<a href='http://greasemonkey.mozdev.org/'>Greasemonkey</a>
GreaseMonkey扩展主页（E文）
<br/>
<br/>
<a href='http://wiki.mozcn.org/index.php/Firefox:Dive_Into_Greasemonkey'>Firefox:Dive Into Greasemonkey</a>
一个GreaseMonkey教程
<br/><img src ="http://www.blogjava.net/unrealwalker/aggbug/41780.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/unrealwalker/" target="_blank">unrealwalker</a> 2006-04-19 01:17 <a href="http://www.blogjava.net/unrealwalker/archive/2006/04/19/41780.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>