<?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>A colourful bubble? &#187; JavaScript</title>
	<atom:link href="http://www.paopao.name/category/programme/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.paopao.name</link>
	<description>生活 读书 新知</description>
	<lastBuildDate>Wed, 20 May 2009 02:22:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>在饭否上“盖楼”</title>
		<link>http://www.paopao.name/programme/javascript/fanfou-thread-status-user-js.html</link>
		<comments>http://www.paopao.name/programme/javascript/fanfou-thread-status-user-js.html#comments</comments>
		<pubDate>Thu, 14 May 2009 07:55:20 +0000</pubDate>
		<dc:creator>paopao</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[饭否]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Greasemonkey]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[UserScript]]></category>

		<guid isPermaLink="false">http://www.paopao.name/?p=201</guid>
		<description><![CDATA[不要被我这个标题给骗啦，其实这还是一个饭否上的 User JS &#8212; fanfou Thread Status。这次的功能其实和上一次的预览饭否的回复消息的 User JS功能类似，只是更进了一步：不只是预览被回复的消... ]]></description>
			<content:encoded><![CDATA[<p>不要被我这个标题给骗啦，其实这还是一个饭否上的 User JS &#8212; fanfou Thread Status。这次的功能其实和上一次的<a href="http://www.paopao.name/programme/javascript/whether-the-response-of-rice-to-preview-messages-user-js.html">预览饭否的回复消息的 User JS</a>功能类似，只是更进了一步：不只是预览被回复的消息，还能同时回溯预览之前的所有消息，这样看起来的效果就像是“盖楼”咯 <img src='http://www.paopao.name/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>P.S. 最近在测试这个脚本的时候还真的见过不少“高楼”的，超过一页的也不少&#8230;</p>
<p>既然功能类似，为什么要独立成一个新的脚本呢。主要原因是新的这个脚本修改了源消息链接的默认点击事件，可能会有人不喜欢，所以独立开来，那些没有“看楼”需求的同学可以选择原来的那个简单的脚本。</p>
<p><strong>使用方法：</strong></p>
<p>1、移动至源消息链接上时自动预览之前的所有相关消息；<br />
2、移出源消息链接后则隐藏预览的消息；<br />
3、点击源消息链接后则预览的消息不会自动隐藏，需要点击预览的消息或者预览其他的消息来使当前的预览消息隐藏；增加这个操作主要是由于某些“楼”比较高，需要滚动页面才能看全；<br />
4、双击源消息链接后转到源消息页面。</p>
<p><strong>使用效果：</strong></p>
<p><a href="http://www.paopao.name/wp-content/uploads/2009/05/fanfou-thread-status1.png"><img src="http://www.paopao.name/wp-content/uploads/2009/05/fanfou-thread-status1.png" alt="fanfou-thread-status" title="fanfou-thread-status" width="564" height="272" class="aligncenter size-full wp-image-202" /></a></p>
<p><strong>下载安装：</strong></p>
<p><a href="http://www.paopao.name/wp-content/uploads/2009/05/fanfouThreadStatus.js" target="_blank">fanfou Thread Status</a> for Opera</p>
<p><a href="http://userscripts.org/scripts/show/48896" target="_blank">fanfou Thread Status</a> for Firefox (Greasemonkey) </p>
<p><strong>*注意：</strong>此脚本不和我之前的<a href="http://www.paopao.name/programme/javascript/whether-the-response-of-rice-to-preview-messages-user-js.html">预览饭否的回复消息脚本</a>同时安装使用，请在两者中选择一个安装使用。</p>
<p>有问题和建议的话欢迎留言，也可以在<a href="http://fanfou.com/paopao" target="_blank">饭否上找我</a>。</p>
<img src="http://www.paopao.name/?ak_action=api_record_view&id=201&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paopao.name/programme/javascript/fanfou-thread-status-user-js.html/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>预览饭否消息图片的 User JS</title>
		<link>http://www.paopao.name/programme/javascript/preview-fanfou-photos-user-js.html</link>
		<comments>http://www.paopao.name/programme/javascript/preview-fanfou-photos-user-js.html#comments</comments>
		<pubDate>Wed, 13 May 2009 17:30:03 +0000</pubDate>
		<dc:creator>paopao</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[饭否]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Greasemonkey]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[thickbox]]></category>
		<category><![CDATA[UserScript]]></category>

		<guid isPermaLink="false">http://www.paopao.name/?p=194</guid>
		<description><![CDATA[饭否拍拍是饭否上个月推出的手机客户端，可以很方便的拍照上传。推出后广受好评，顿时涌现出许多“通过饭否拍拍”发出的消息。
虽然我的破手机没法安装(T_T)，但是我的饭否好友还是有... ]]></description>
			<content:encoded><![CDATA[<p><a href="http://fanfou.com/paipai" target="_balnk">饭否拍拍</a>是饭否上个月推出的手机客户端，可以很方便的拍照上传。推出后广受好评，顿时涌现出许多“通过饭否拍拍”发出的消息。</p>
<p>虽然我的破手机没法安装(T_T)，但是我的饭否好友还是有很多发照片的。不过饭否消息发的是缩略图，手机拍的照片本来就质量不高，一缩略就更看不清了，没办法只能一个一个点开看。为了结束这种痛苦的状态，就写了下面这个 User JS，主要功能是以 Thick Box的方式在当前页面预览消息中图片的大图。</p>
<p><strong>使用效果如下：</strong><br />
点击消息中的图片缩略图，就可以在当前页面预览大图，点击大图或者周围的灰色背景则返回页面</p>
<p><a href="http://www.paopao.name/wp-content/uploads/2009/05/fanfou-thick-pic.jpg"><img src="http://www.paopao.name/wp-content/uploads/2009/05/fanfou-thick-pic.jpg" alt="fanfou-thick-pic" title="fanfou-thick-pic" width="500" height="273" class="aligncenter size-full wp-image-195" /></a></p>
<p><strong>下载安装：</strong></p>
<p><a href="http://www.paopao.name/wp-content/uploads/2009/05/fanfouThickPic.js" target="_blank">fanfou Thick Pic</a> for Opera</p>
<p><a href="http://userscripts.org/scripts/show/48898" target="_blank">fanfou Thick Pic</a> for Firefox (Greasemonkey) </p>
<p>有问题和建议的话欢迎留言，也可以在饭否上找我。</p>
<img src="http://www.paopao.name/?ak_action=api_record_view&id=194&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paopao.name/programme/javascript/preview-fanfou-photos-user-js.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>预览饭否的回复消息的 User JS</title>
		<link>http://www.paopao.name/programme/javascript/whether-the-response-of-rice-to-preview-messages-user-js.html</link>
		<comments>http://www.paopao.name/programme/javascript/whether-the-response-of-rice-to-preview-messages-user-js.html#comments</comments>
		<pubDate>Mon, 11 May 2009 10:25:28 +0000</pubDate>
		<dc:creator>paopao</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[饭否]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Greasemonkey]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[UserScript]]></category>

		<guid isPermaLink="false">http://www.paopao.name/?p=186</guid>
		<description><![CDATA[最近饭否添加了一个新的功能，就是在显示 @ 回复别人的消息时，会同时显示被回复消息的链接，也就是是类似会话的功能。但是，如果需要看到源消息的话需要转到源消息的页面来查看，有... ]]></description>
			<content:encoded><![CDATA[<p>最近饭否添加了一个新的功能，就是在显示 @ 回复别人的消息时，会同时显示被回复消息的链接，也就是是类似会话的功能。但是，如果需要看到源消息的话需要转到源消息的页面来查看，有点不方便。</p>
<p>我写的这个 User JS 的功能就是给饭否页面加上预览源消息的功能，这个功能的灵感来自于 dofy 给 Twitter 写的 <a href="http://userscripts.org/scripts/show/43246" target="_blank">TwittSeven</a> 脚本。</p>
<p><strong>使用效果如下：</strong><br />
把鼠标移至源消息的链接上就会显示源消息<br />
<a href="http://www.paopao.name/wp-content/uploads/2009/05/fanfou-reply-status.png"><img src="http://www.paopao.name/wp-content/uploads/2009/05/fanfou-reply-status.png" alt="fanfou Reply Status" title="fanfou Reply Status" width="622" height="164" class="aligncenter size-full wp-image-191" /></a></p>
<p><strong>下载安装：</strong></p>
<p><a href="http://www.paopao.name/wp-content/uploads/2009/05/fanfoureplystatus.js" target="_blank">fanfou Reply Status</a> for Opera</p>
<p>同样，我也修改了一个给Firefox 用 Greasemonkey 的版本</p>
<p><a href="http://userscripts.org/scripts/show/48776" target="_blank">fanfou Reply Status</a> for Firefox</p>
<p><strong>更新记录：</strong></p>
<ul>
<li>2009/05/11  v0.1 初始版本</li>
<li>2009/05/12  v0.2 更新预览消息框的 CSS ，解决长消息的时间戳显示不整齐的问题</li>
</ul>
<p>有问题和建议的话欢迎留言，也可以在<a href="http://fanfou.com/paopao" target="_blank">饭否上找我</a>。</p>
<img src="http://www.paopao.name/?ak_action=api_record_view&id=186&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paopao.name/programme/javascript/whether-the-response-of-rice-to-preview-messages-user-js.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>给饭否添加一个 RF 按钮</title>
		<link>http://www.paopao.name/programme/javascript/add-rf-button-for-fanfou.html</link>
		<comments>http://www.paopao.name/programme/javascript/add-rf-button-for-fanfou.html#comments</comments>
		<pubDate>Mon, 11 May 2009 00:30:24 +0000</pubDate>
		<dc:creator>paopao</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[饭否]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Greasemonkey]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[UserScript]]></category>

		<guid isPermaLink="false">http://www.paopao.name/?p=178</guid>
		<description><![CDATA[玩 Twitter 的同学应该都知道 RT 吧，是 retweet 或 retweeting 之意，也就是引用或者重复别人的信息。我不怎么用 Twitter，但是一直在用饭否，饭否上也有人经常进行 RT ，我觉得这个词用在饭否上好... ]]></description>
			<content:encoded><![CDATA[<p>玩 Twitter 的同学应该都知道 RT 吧，是 retweet 或 retweeting 之意，也就是引用或者重复别人的信息。我不怎么用 Twitter，但是一直在用饭否，饭否上也有人经常进行 RT ，我觉得这个词用在饭否上好像不太对，应该用 RF 嘛，代表 refanfou， 哈哈</p>
<p>但是如果每次 RF 时手动复制粘贴还要加用户名挺麻烦的，所以就写了这样一个 Opera 的 userJS 脚本。这个脚本没什么其他的作用，就是给 home 页面的每条消息增加一个 RF 的按钮，点击后就可以自动 RF 该条消息了。按钮的样式上偷了个懒，采用的是饭否已经撤销掉的“分享”按钮的样式，不过这样看起来风格也比较一致。</p>
<p><strong>使用方法：</strong></p>
<p>1、在自己的 home 页，点击消息右侧的“分享”按钮，则会将当前消息加上 &#8220;RF @XX&#8221; 粘贴至发表消息框，并将页面定位至发表框，如果不需要修改则直接点击“发送”按钮转发消息；<br />
2、在其他页面，点击消息右侧的“分享”按钮，则会转到自己的 home 页，同时已经将要转发的内容填至发表框，只需点击“发送”按钮即可转发消息。</p>
<p><strong>使用效果如下：</strong></p>
<p><a href="http://www.paopao.name/wp-content/uploads/2009/05/fanfourf.png"><img src="http://www.paopao.name/wp-content/uploads/2009/05/fanfourf.png" alt="fanfouRF" title="fanfouRF" width="532" height="131" class="aligncenter size-full wp-image-188" /></a></p>
<p><strong>下载安装：</strong></p>
<p><a href="http://www.paopao.name/wp-content/uploads/2009/05/fanfourf.js" target="_blank">fanfourf.js</a> for Opera</p>
<p>其实 Opera 的 userJS 和 Firefox 的 Greasemonkey 脚本部分兼容，所以我就顺便改了一个 Greasemonkey 的版本，可以用在 Firefox 上。</p>
<p><a href="http://userscripts.org/scripts/show/48773" target="_blank">fanfourf.user.js</a> for Firefox</p>
<p><strong>更新记录：</strong></p>
<ul>
<li>2009/05/11 v0.1 初始版本</li>
<li>2009/05/14 v0.2 将转发消息的范围扩大至所有页面；不在自己的消息上显示 RF 按钮；默认不自动发送消息，可以在发送前修改消息；修正对自动截断的链接的读取；修正对用户名链接的处理；</li>
</ul>
<p>有问题和建议的话欢迎留言，也可以在<a href="http://fanfou.com/paopao" target="_blank">饭否上找我</a>。</p>
<img src="http://www.paopao.name/?ak_action=api_record_view&id=178&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paopao.name/programme/javascript/add-rf-button-for-fanfou.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>WordPress 搜索框添加文字提示</title>
		<link>http://www.paopao.name/programme/javascript/wordpress-searchbox-text-prompt.html</link>
		<comments>http://www.paopao.name/programme/javascript/wordpress-searchbox-text-prompt.html#comments</comments>
		<pubDate>Sun, 10 May 2009 11:29:51 +0000</pubDate>
		<dc:creator>paopao</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WebDevelop]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[IE8]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[searchbox]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.paopao.name/?p=165</guid>
		<description><![CDATA[搜索框里显示文字提示是目前常见的一种技术了，但是实现的方法有很多种，mg12 介绍一个使用 jQuery 添加文字提示的方法。
这个方法相比于原来直接添加 &#8220;input&#8221; 元素的值为提示文字的... ]]></description>
			<content:encoded><![CDATA[<p>搜索框里显示文字提示是目前常见的一种技术了，但是实现的方法有很多种，<a href="http://www.neoease.com/" target="_blank">mg12</a> 介绍一个<a href="http://www.neoease.com/wordpress-searchbox-tip/" target="_blank">使用 jQuery 添加文字提示</a>的方法。</p>
<p>这个方法相比于原来直接添加 &#8220;input&#8221; 元素的值为提示文字的办法，提升了可用性和可访问性，不过也存在两个缺点。一个是 mg12 自己也提到的不方便国际化的问题；另一个则是，如果用户要搜索的关键词和默认的文字提示相同时，则无法进行搜索。当然，你也可以认为第二个问题是我钻牛角尖，也许根本没有人会用默认的文字提示作为搜索关键词。其实我也认为不会出现这种情况，我只是想提出另一种思路来实现搜索框的文字提示，这个办法应该可以解决上面提到的两个问题。</p>
<p>下面是我修改我这个主题的搜索框提示的方法：</p>
<p>首先我需要对搜索框部分的主题文件做一点小小的修改</p>
<pre class="brush: php;">
&lt;form method=&quot;get&quot; id=&quot;searchform&quot; action=&quot;&lt;?php bloginfo('url'); ?&gt;/&quot;&gt;
&lt;div&gt;&lt;input type=&quot;text&quot; value=&quot;&lt;?php the_search_query(); ?&gt;&quot; name=&quot;s&quot; id=&quot;s&quot; title=&quot;&lt;?php _e('Type text to search here...'); ?&gt;&quot; /&gt;
&lt;input type=&quot;submit&quot; id=&quot;searchsubmit&quot; value=&quot;Search&quot; /&gt;
&lt;/div&gt;
&lt;/form&gt;
</pre>
<p>以上是我这个主题文件的 searchform.php 文件的内容，我做的修改只是给 &#8220;input&#8221; 元素添加了一个属性</p>
<blockquote><p> title=&#8221;&lt;?php _e(&#8217;Type text to search here&#8230;&#8217;); ?&gt;&#8221; </p></blockquote>
<p>这样就解决了提示文字的国际化问题，如果在语言文件里有定义就可以直接使用了。</p>
<p>然后就是 jQuery 的部分</p>
<pre class="brush: jscript;">
jQuery(document).ready(function(){
    // DOM 加载完毕时添加搜索提示
    // 修改搜索框的背景色为透明，以便显示其下方的文字
    $(&quot;input#s&quot;).css({backgroundColor:&quot;transparent&quot;});

    $(&quot;input#s&quot;)
        // 将搜索框的上层元素改为相对定位
        .parent().css({position:&quot;relative&quot;})
        // 添加一个绝对定位的 span 至搜索框的下方来显示文字提示
        .append('&lt;span id=&quot;searchtip&quot; style=&quot;position:absolute; top:2px; left:10px; color:#999; display:none; z-index:-1;&quot;&gt;' + $(&quot;input#s&quot;).attr(&quot;title&quot;) + '&lt;/span&gt;');

    // 如果搜索框内容为空则显示提示
    if($(&quot;input#s&quot;).val() == &quot;&quot;) {
        $(&quot;#searchtip&quot;).show();
    }

    // 当鼠标聚焦在搜索框
    $(&quot;input#s&quot;).focus(function(){
        // 如果搜索框内容为空则隐藏提示
        if($(this).val() == &quot;&quot;) {
            $(&quot;#searchtip&quot;).hide();
        }
    }).blur(function(){
        // 如果搜索框内容为空则显示提示
        if($(this).val() == &quot;&quot;) {
            $(&quot;#searchtip&quot;).show();
        }
    });

    // 当搜索表单提交时
    $(&quot;#searchform&quot;).submit(function(){
        // 如果搜索框内容为空则不提交
        if($(&quot;input#s&quot;).val() == &quot;&quot;) {
            return false;
        }
        return true;
    });

    // 解决 IE 8 透明背景色的问题
    $(&quot;#searchtip&quot;).click(function(){$(&quot;input#s&quot;).trigger(&quot;focus&quot;);});
});
</pre>
<p>这个方法的原理也很简单，就是在搜索框的后面加入一个绝对定位的 &#8220;span&#8221; 元素来显示文字提示，文字提示的内容则是通过获取搜索框的 title 值来添加。</p>
<p>以上就完成了搜索框文字提示的添加，下面是我在这个过程中遇到的一个问题。</p>
<p>注意到上面的最后一行代码了吗，是为了解决在 IE 8 下的一个问题的，本来可以不需要这行代码的，就是为了万恶的 IE &#8230;</p>
<p>问题是这样的，当一个绝对定位的元素位于一个 &#8220;input&#8221; 元素的下方时，在 IE 8 下你依旧可以用鼠标访问到这个元素，导致点击搜索框时无法获得焦点，在其他<a href="http://www.paopao.name/browsers">我测试的浏览器</a>中都没有这个问题。所以在 IE 8 下，需要为提示文字的 &#8220;span&#8221; 元素额外的绑定一个监听事件。而且有点奇怪的是，把 &#8220;input&#8221; 元素换成 &#8220;div&#8221; 元素后，IE 8 下的表现又和其他浏览器一致了。</p>
<p>关于这个问题我做了一个简单的<a href="http://paosha.net/demo/single/searchboxtip.html" target="_blank">演示 Demo</a> 页面，有兴趣的可以去看看，我手头没有 IE 7 和 IE 6 ，不知道这两个浏览器是不是存在同样的问题，另外如果你有解决这个问题的办法，也请多多指教。</p>
<img src="http://www.paopao.name/?ak_action=api_record_view&id=165&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paopao.name/programme/javascript/wordpress-searchbox-text-prompt.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>基于 jQuery 的旗帜效果纵向多级导航菜单</title>
		<link>http://www.paopao.name/programme/javascript/flag-style-multi-level-vertical-navigation-menu.html</link>
		<comments>http://www.paopao.name/programme/javascript/flag-style-multi-level-vertical-navigation-menu.html#comments</comments>
		<pubDate>Sun, 10 May 2009 04:55:28 +0000</pubDate>
		<dc:creator>paopao</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WebDevelop]]></category>
		<category><![CDATA[easing]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[multi-level]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.paopao.name/?p=141</guid>
		<description><![CDATA[最近看了一些<a href="http://www.google.com/search?hl=en&#038;q=jQuery+navigation&#038;btnG=Google+Search&#038;aq=f&#038;oq=" target="_blank">基于 jQuery 的好玩的导航菜单</a>，然后就想到了这样一个效果的菜单，其实我也... ]]></description>
			<content:encoded><![CDATA[<p>最近看了一些<a href="http://www.google.com/search?hl=en&#038;q=jQuery+navigation&#038;btnG=Google+Search&#038;aq=f&#038;oq=" target="_blank">基于 jQuery 的好玩的导航菜单</a>，然后就想到了这样一个效果的菜单，其实我也不知道该叫它什么效果，就叫旗帜效果 (flag style) 吧。</p>
<p>先来看看最终效果是什么样的： <a href="http://paosha.net/demo/flagnav/" target="_blank">演示(Demo)</a></p>
<p>一个导航菜单，最重要的是可访问性，其他的效果都是为了锦上添花的，所以首先我们要做一个纯 CSS 的纵向导航菜单，这样即使用户关闭了 JavaScript 也能无障碍的访问。</p>
<p><strong>第一步：</strong> 一个语义化的 HTML 结构</p>
<pre class="brush: xml;">
&lt;h2&gt;Flag Navigation&lt;/h2&gt;
&lt;ul id=&quot;nav&quot; class=&quot;nav&quot;&gt;
    &lt;li&gt;&lt;a href=&quot;#&quot;&gt;1 HTML&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;#&quot;&gt;2 CSS&lt;/a&gt;
        &lt;ul&gt;
            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;2.1 CSS 2&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;2.2 CSS 3&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;#&quot;&gt;3 JavaScript&lt;/a&gt;
        &lt;ul&gt;
            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;3.1 jQuery&lt;/a&gt;
                &lt;ul&gt;
                    &lt;li&gt;&lt;a href=&quot;#&quot;&gt;3.1.1 Download&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href=&quot;#&quot;&gt;3.1.2 Tutorial&lt;/a&gt;&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;3.2 Mootools&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href=&quot;#&quot;&gt;3.3 Prototype&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>一般来说，我们都使用一个嵌套的无序列表来表示一个多级导航菜单。</p>
<p><strong>第二步： </strong>给这段 HTML 加上一些样式</p>
<pre class="brush: css;">
body {font: 15px &quot;Arial&quot;}
h2 {font: 18px &quot;Arial&quot;; font-weight: bold; }
.nav, .nav ul{
    width:140px; /* 定义每级菜单的宽度 */
    margin:0;
    padding:0;
    list-style-type:none;
    list-style-position:outside;
    position:relative; /* 采用相对定位，为子菜单的绝对定位提供基准元素 */
    line-height:30px;  /* 定义每条菜单的行高 */
}
.nav a:link, .nav a:visited{ /* 定义链接的基本样式 */
    display:block;
    width:130px; /* 这里的宽度和下面的 padding 加起来是 140px */
    padding:0px 5px;
    color:#fff;
    text-decoration:none;
    background:url(bg.png) no-repeat -261px 0px; /* 背景图片定位，采用 CSS Sprites 技术 */
}
.nav a:hover,a:active{ /* 定义链接的悬停和点击时的样式 */
    background-position:-79px 0px;  /* 修改背景图片定位 */
    color:#333;
}
.nav li{  /* 每条菜单的定位方式为相对定位 */
    position:relative;
}
.nav ul {  /* 子菜单的样式 */
    position:absolute; /* 采用绝对定位 */
    top:0px; /* 子菜单和上一级菜单上部平齐 */
    left:140px; /* 子菜单显示在上一级菜单右侧 */
    display:none; /* 子菜单不显示 */
}
.nav li:hover&gt;ul{
    display:block; /* 当 list 悬停时，显示它的下一级子菜单 */
}
</pre>
<p>在 &#8220;ul&#8221; 的样式中使用 line-height 是为了让菜单文字能纵向居中，同时这个值在我们后面的 jQuery flagNav 插件中有使用到。<br />
这样我们就得到了一个纯 CSS 的纵向多级导航菜单，具体效果可以看看 <a href="http://paosha.net/demo/flagnav/" target="_blank">Demo</a> 页面的第一个菜单。<br />
<strong>*</strong>这个菜单的效果在 IE6 及其之前的浏览器中是表现不出来的，因为 IE6 不支持 &#8220;a&#8221; 元素之外的其他元素的 hover 伪类，这个可以通过一些复杂的 CSS Hack 来进行兼容，不过我这里就不管它了，感兴趣的同学可以自行 Google 之。</p>
<p><strong>第三步：</strong> 用 jQuery 来添加我们的旗帜动画效果</p>
<pre class="brush: xml;">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;../js/jquery.easing.1.3.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.flagNav.min.js&quot;&gt;&lt;/script&gt;
</pre>
<p>我们将 jQuery 库和 jQuery Easing 插件载入，并载入自己的 <a href="http://paosha.net/demo/flagnav/jquery.flagNav.js" target="_balnk">jQuery flagNav 插件</a>。</p>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot;&gt;
    $(document).ready(function(){
        $(&quot;#nav1&quot;).flagNav({bgposout:&quot;-261px 0px&quot;, bgposover:&quot;-79px 0px&quot;});
        $(&quot;#nav2&quot;).flagNav({bgposout:&quot;-261px 0px&quot;, bgposover:&quot;-79px 0px&quot;, rollback:true});
    });
&lt;/script&gt;
</pre>
<p>再在页面载入后对我们的菜单进行初始化，其中 flagNav 函数的参数中 bgposout 和 bgposover 的值分别和前面 CSS 中 &#8220;a:link&#8221; 和 &#8220;a:hover&#8221; 的 background-position 值相对应，rollback 参数则表示在菜单消失时是否使用动画效果，默认值是不使用。</p>
<p>这样我们就完成了一个带旗帜动画效果的纵向多级导航菜单，是不是挺简单的？</p>
<p>这个菜单在所有<a href="http://www.paopao.name/browsers">我使用的浏览器</a>上都测试通过了，如果你有任何问题或建议，欢迎给我留言。</p>
<img src="http://www.paopao.name/?ak_action=api_record_view&id=141&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paopao.name/programme/javascript/flag-style-multi-level-vertical-navigation-menu.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Circle Tag Cloud Plugin for jQuery</title>
		<link>http://www.paopao.name/programme/javascript/circle-tag-cloud-plugin-for-jquery.html</link>
		<comments>http://www.paopao.name/programme/javascript/circle-tag-cloud-plugin-for-jquery.html#comments</comments>
		<pubDate>Mon, 04 May 2009 03:59:47 +0000</pubDate>
		<dc:creator>paopao</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[easing]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tag]]></category>

		<guid isPermaLink="false">http://www.paopao.name/internet/circle-tag-cloud-plugin-for-jquery.html</guid>
		<description><![CDATA[昨天看到某个 blog 上一个 3D Tag Cloud 插件，效果很炫，是用 Flash 写的。很想把它移植到 JavaScript 来，不过尝试失败，最后得到的效果不甚理想，不过还是记录下来吧，也算是一个学习的过程。
*... ]]></description>
			<content:encoded><![CDATA[<p>昨天看到某个 blog 上一个 <a href="http://www.google.com/search?hl=en&#038;q=3d+tag+cloud&#038;btnG=Google+Search&#038;aq=f&#038;oq=" target="_blank">3D Tag Cloud</a> 插件，效果很炫，是用 Flash 写的。很想把它移植到 JavaScript 来，不过尝试失败，最后得到的效果不甚理想，不过还是记录下来吧，也算是一个学习的过程。</p>
<p>*<a href="http://paosha.net/demo/circletagcloud/" target="_blank">演示(Demo)</a><br />
*<a href="http://paosha.net/demo/circletagcloud/jquery.circletag.js" target="_blank">下载(Download)</a></p>
<p>这个效果是基于 <a href="http://jquery.com/" target="_blank">jQuery</a> 编写的，也用到了 <a href="http://gsgd.co.uk/" target="_blank">GSGD</a> 的 <a href="http://gsgd.co.uk/sandbox/jquery/easing/" target="_blank">Easing Plugin</a> (如果选择使用 jQuery 自带的 &#8220;linear&#8221; 或者 &#8220;swing&#8221; 效果的话则不需要包含此插件)。</p>
<p>首先需要一个适当的 html 结构：</p>
<pre class="brush: xml;">&lt;h2&gt;Circle Tag Cloud&lt;/h2&gt;
&lt;div id=&quot;tag_cloud&quot;&gt;
    &lt;a id=&quot;tag1&quot; href=&quot;#1&quot; style=&quot;font-size: 20pt; color:blueviolet&quot;&gt;UED&lt;/a&gt;
    &lt;a id=&quot;tag2&quot; href=&quot;#2&quot; style=&quot;font-size: 10pt; color:maroon&quot;&gt;JavaScript&lt;/a&gt;
    &lt;a id=&quot;tag3&quot; href=&quot;#3&quot; style=&quot;font-size: 15pt; color:dodgerblue&quot;&gt;Jquery&lt;/a&gt;
    &lt;a id=&quot;tag4&quot; href=&quot;#4&quot; style=&quot;font-size: 8pt; color:violet&quot;&gt;paopao&lt;/a&gt;
    &lt;a id=&quot;tag5&quot; href=&quot;#5&quot; style=&quot;font-size: 12pt; color:lightseagreen&quot;&gt;demo&lt;/a&gt;
&lt;/div&gt;</pre>
<p>然后给这段 html 加上一些必须的样式：</p>
<pre class="brush: css;">h2 {font: 13pt/15pt &quot;Arial&quot;; font-weight: bold; }
#tag_cloud{position:relative;width:300px;height:300px;background-color:#eee;overflow:hidden;}
#tag_cloud a{position:absolute;text-decoration:none;white-space:nowrap;}
#tag_cloud a:hover{border:1px solid #000}</pre>
<p>当然还要载入一些必需的 js 文件：</p>
<pre class="brush: jscript;">&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.easing.1.3.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.circletag.min.js&quot;&gt;&lt;/script&gt;</pre>
<p>最后，在页面里加入如下的初始化 js 代码就 ok 了：</p>
<pre class="brush: jscript;">&lt;script type=&quot;text/javascript&quot;&gt;
    $(document).ready(function(){
        $(&quot;#tag_cloud&quot;).circleTag({ speed: 300 });
    });
&lt;/script&gt;</pre>
<p>下载地址<a href="http://paosha.net/demo/circletagcloud/jquery.circletag.js" target="_blank">在此</a></p>
<p>需求：<br />
* jQuery 1.3 or higher<br />
* jQuery Easing Plugin 1.3</p>
<img src="http://www.paopao.name/?ak_action=api_record_view&id=115&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paopao.name/programme/javascript/circle-tag-cloud-plugin-for-jquery.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>你的第一条饭否/ Twitter 消息</title>
		<link>http://www.paopao.name/programme/javascript/your-first-fanfou-twitter-message.html</link>
		<comments>http://www.paopao.name/programme/javascript/your-first-fanfou-twitter-message.html#comments</comments>
		<pubDate>Mon, 27 Apr 2009 02:59:58 +0000</pubDate>
		<dc:creator>paopao</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WebDevelop]]></category>
		<category><![CDATA[饭否]]></category>
		<category><![CDATA[GAE]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[JSONP]]></category>
		<category><![CDATA[tinyurl]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.paopao.name/fanfou/your-first-fanfou-twitter-message.html</guid>
		<description><![CDATA[前天在饭否上看到有些人在玩一个 Twitter 应用，这个应用可以查出你加入 Twitter 的时间。觉得蛮好玩的，因为我用 Twitter 很少（主要是觉得网页版速度不够快，又不想再开一个客户端），所以... ]]></description>
			<content:encoded><![CDATA[<p>前天在饭否上看到有些人在玩一个<a href="http://whendidyoujointwitter.appspot.com/" target="_blank"> Twitter 应用</a>，这个应用可以查出你加入 Twitter 的时间。觉得蛮好玩的，因为我用 Twitter 很少（主要是觉得网页版速度不够快，又不想再开一个客户端），所以想看看能不能移植到饭否来。虽然<a href="http://code.google.com/p/fanfou-api/wiki/ApiDocumentation" target="_blank">饭否的 API</a> 和 Twitter 的基本相同，但是在用户信息这部分稍有不同，饭否并没有提供用户的创建时间这个字段。</p>
<p>没办法，只好曲线救国了&#8230; 我用了搜索用户消息的办法来查找用户的第一条消息，虽然这和用户的创建时间不一定一样，不过这也算是另一种应用吧 ^_^</p>
<p>第一次使用 <a href="http://code.google.com/appengine/" target="_blank">Google App Engine</a> 来部署应用，不过没用到 Python (因为不会 =,= )，只是直接使用了静态文件：</p>
<p><a href="http://yourfirstfanfoumessage.appspot.com/" target="_blank">你在饭否的第一条消息？</a><br />
<ins datetime="2009-04-28T01:46:47+00:00">不幸的发现饭否的 API 也有同样的限制，虽然没有在文档里写明，但是经过测试，只能得到最多 3,200 条用户消息&#8230;</ins><br />
<ins datetime="2009-04-30T04:04:02+00:00"><strong>Update 了一个新的版本，现在应该可以查询所有人的第一条消息了，即使你是消息数超过 3,200 的饭否狂人 <img src='http://www.paopao.name/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></ins></p>
<p><a href="http://yourfirsttwitter.appspot.com/" target="_blank">Your First Twitter?</a><br />
<ins datetime="2009-04-27T03:50:20+00:00">Twitter 这个版本有点问题，由于 API 的限制，只能得到最多 3,200 条用户消息，所以消息数超过 3,200 的目前还无法查到第一条消息&#8230;</ins></p>
<blockquote><p>Rest API Limit<br />
Clients may request up to 3,200 statuses via the page and count parameters for timeline REST API methods. </p></blockquote>
<p><a href="http://yourfirsttwitter.appspot.com/search.htm" target="_blank">Your First Twitter? (Search Version)</a><br />
<ins datetime="2009-04-27T13:55:03+00:00">Twitter 消息数超过 3,200 的 Twitter 狂人们可以尝试这个版本，通过 google 搜索来查找的，不一定能成功</ins></p>
<p>另外第一次用到了 <a href="http://www.google.com/search?q=JSONP" target="_blank">JSONP</a> 技术，和 <a href="http://jquery.com/" target="_blank">Jquery</a> 结合起来使用的话，很好很方便。</p>
<p>感谢 James Padolsey 的 <a href="http://james.padolsey.com/javascript/create-a-tinyurl-with-jsonp/" target="_blank">TinyURL JSONP API</a> ，可以很方便的得到缩短网址。</p>
<img src="http://www.paopao.name/?ak_action=api_record_view&id=114&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.paopao.name/programme/javascript/your-first-fanfou-twitter-message.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
