<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/">
<channel>
<title><![CDATA[Macji Pro]]></title>
<link>http://www.macji.com/feed/</link>
<language>zh-cn</language>
<description><![CDATA[记录一些应该记录的东东]]></description>
<pubDate>Sun, 14 Mar 2010 16:00:59 -0500</pubDate>
<item>
<title><![CDATA[第四届D2开始正式报名，有你，更精彩]]></title>
<link>http://www.macji.com/2009/12/08/d2forum/</link>
<pubDate>Tue, 08 Dec 2009 01:59:45 +0000</pubDate>
<category><![CDATA[HTML/CSS/JS/PHP]]></category>
<description><![CDATA[伴随着第四届D2前端技术论坛专题（专题地址：http://www.d2forum.org/d2/4/）的完成，正式开始了本届D2的报名，报名地址：http://www.d2forum.org/d2/4...]]></description>
<guid>http://www.macji.com/2009/12/08/d2forum/</guid>
<slash:comments>5</slash:comments>
<comments>http://www.macji.com/2009/12/08/d2forum/#comments</comments>
<content:encoded><![CDATA[<p><a title="第四届前端技术论坛专题" href="http://www.d2forum.org/d2/4/" target="_blank"><img class="size-full wp-image-238" title="第四届D2前端技术论坛专题" src="http://www.d2forum.org/wp-content/uploads/2009/12/d2-4.png" alt="第四届D2前端技术论坛专题" width="500" height="362" /></a></p><p>伴随着第四届D2前端技术论坛专题（专题地址：<a title="第四届前端技术论坛专题" href="http://www.d2forum.org/d2/4/" target="_blank">http://www.d2forum.org/d2/4/</a>）的完成，正式开始了本届D2的报名，报名地址：<a title="第四届D2前端技术论坛报名" href="http://www.d2forum.org/d2/4/sign_up.html" target="_blank">http://www.d2forum.org/d2/4/sign_up.html</a></p><p><strong>报名截止：</strong><span style="color: #ff0000;">2009年12月14日 0点0分0秒</span></p><p><strong>特别提醒：</strong><span style="color: #ff0000;">D2报名系统基于google 文档，如果发现无法报名，可能被墙（GFW），请尝试翻墙使用报名页面提供的源链接进行报名。</span></p><p><strong>如何获知您是否被邀请？</strong></p><ol><li>所有报名者都会收到邮件告之是否被邀请（嗯。此邮件可能躺在你的垃圾邮件夹里，敬请留意）；</li><li>如果您获得邀请函，请务必记得携带邀请函打印件，作为您进入会场的唯一凭证，否则将不能进入会场，敬请合作。</li></ol><p>--------------------<br />原文 <a href="http://www.d2forum.org/2009/12/05/topic-pages-of-the-fourth-d2-forum/">http://www.d2forum.org/2009/12/05/topic-pages-of-the-fourth-d2-forum/</a></p>]]></content:encoded>
<author><![CDATA[Macji]]></author>
<dc:creator><![CDATA[Macji]]></dc:creator>
<wfw:commentRss>http://www.macji.com/feed/2009/12/08/d2forum/</wfw:commentRss>
</item>
<item>
<title><![CDATA[还是宝淘, 还是倒过来淘宝, 还是Beta]]></title>
<link>http://www.macji.com/2009/10/11/baotao-org/</link>
<pubDate>Sun, 11 Oct 2009 01:22:39 +0000</pubDate>
<category><![CDATA[HTML/CSS/JS/PHP]]></category>
<description><![CDATA[ok, 宝淘 Beta是什么呢, 一个基于淘宝开放平台(TOP)开发的淘宝商品热卖推荐网站. 通过标签(tag) 形式来展现商品. 开发时间较短(国庆那几天写的, 10.6号发布的), 比较简单的说,...]]></description>
<guid>http://www.macji.com/2009/10/11/baotao-org/</guid>
<slash:comments>2</slash:comments>
<comments>http://www.macji.com/2009/10/11/baotao-org/#comments</comments>
<content:encoded><![CDATA[<p>ok, <a href="http://www.baotao.org" title="宝淘网, 倒过来淘宝" />宝淘 Beta</a>是什么呢, 一个基于淘宝开放平台(TOP)开发的淘宝商品热卖推荐网站. 通过标签(tag) 形式来展现商品. 开发时间较短(国庆那几天写的, 10.6号发布的), 比较简单的说, 很多交互还没有优化. 废话了, 进去一看就知道了. </p><p>谈谈实现吧, 首先, <a href="http://www.baotao.org" title="宝淘网, 倒过来淘宝" />宝淘</a>是一个纯javascript开发的一个站, 没有任何后端技术, 就一纯净的html. 怎么实现TOP查询跟展现呢. 首先是TOP的签名, 我看看为代码就知道怎么实现了. md5这些, 用<a href="http://phpjs.org/">php.js</a> 就可以搞定了. 再用<a href="http://developer.yahoo.com/yql/">YQL</a>去查询. 这样就完全没有难点了. 剩下的就是交互的实现了.</p><p>说说界面吧, 很多人一看, 就问我界面哪抄的, 说实话, 界面确是抄的, 我没有能力设计这么帅的, 抄的是一个第三方twitter的web客户端<a href="http://hootsuite.com/" target="_blank">http://hootsuite.com/</a>, 只是抄设计, 所有的实现都是自己按自己的思路写的, 我有洁癖, 一直以为改别人的东西还不如自己重新写来的快. 不过有些地方还是参考了, 比如class的命名. 当然日后我会找人设计一套皮肤.</p><p>还有更新计划, 目前只是简单的实现按标签检索的方式, 分页等, 那接下去会实现: </p><p><ol><li><del>本地存储, 用来保存用户浏览过的标签(其实我的interface.js里, 已经存在接口了.);</del></li><li>搜索功能 (搜索的交互都做完的了, 但宝淘存在意义是让那些没有购物目的人找到购物目的. 后来就去掉了)</li><li>优化交互(很多交互都很生硬, 不流畅.)</li><li>整合Twitter, 边看宝贝, 边发Tweet</li></ol></p><p>最后, 还有贡献者, 本来把项目寄放在GAE, 无奈, 某东东发飙, 访问的很不稳定. 幸亏有 <a href="http://blog.fouland.com/">小脚儿</a> 贡献的空间, 这里还是谢谢他的贡献... <br />如果您有什么意见, 请联系xiaomacji[at]gmail.com, 或者 直接 发twitter给@ibaotao. 如果您愿意贡献独立的设计, 创新的交互形式, 优雅的代码, 也请联系xiaomacji[at]gmail.com.</p><p>-------------分割线</p><br /><p>目前淘宝UED广招web前端开发工程师, 欢迎发简历. 有简历, 有机会.</p><p>update:</p><br /><p>2009-10-13 20:30</p><ul><li>支持IE6(由于女友公司用的是IE6, 被她说了好几次, 支持了IE6)</li><li>本地存储, 保存浏览过的tab, 默认定位到最后一次浏览的tab</li><li>分页自动滚动. 数据加载好, 自动滚动</li></ul>]]></content:encoded>
<author><![CDATA[Macji]]></author>
<dc:creator><![CDATA[Macji]]></dc:creator>
<wfw:commentRss>http://www.macji.com/feed/2009/10/11/baotao-org/</wfw:commentRss>
</item>
<item>
<title><![CDATA[快速创建基于淘宝开放API(TOP)的Firefox扩展]]></title>
<link>http://www.macji.com/2009/06/01/taobao-open-platform-based-on-the-development-of-firefox-extension/</link>
<pubDate>Mon, 01 Jun 2009 02:16:30 +0000</pubDate>
<category><![CDATA[HTML/CSS/JS/PHP]]></category>
<description><![CDATA[淘宝开放平台项目（TOP： taobao open platform）是淘宝（中国）软件公司面向3rd app开发者，提供API接口和相关开发环境的平台。

嗯, 这里介绍如何通过基于firefo...]]></description>
<guid>http://www.macji.com/2009/06/01/taobao-open-platform-based-on-the-development-of-firefox-extension/</guid>
<slash:comments>1</slash:comments>
<comments>http://www.macji.com/2009/06/01/taobao-open-platform-based-on-the-development-of-firefox-extension/#comments</comments>
<content:encoded><![CDATA[<blockquote><a href="http://www.taobao.com/theme/tao_source/" target="_blank">淘宝开放平台项目</a>（TOP： taobao open platform）是淘宝（中国）软件公司面向3rd app开发者，提供API接口和相关开发环境的平台。</blockquote><p>嗯, 这里介绍如何通过基于firefox的javascript去获取淘宝API提供的数据, 其实很简单. 获取数据需要签名和相关API方法, 具体请看<a href="http://isp.alisoft.com/apidoc/api/apiIndex.html" target="_blank">API文档</a>.</p><blockquote>签名方式为 md5(appsecret + key + value .... key + value)然后转大写字母,其中key,value对是除签名和图片外的所有请求参数按key做的升序排列, value无需编码。</blockquote><p>通过服务器端比如php, ruby, python等很容易实现签名方式, 但基于浏览器的javascript貌似望而却步, 但是mozilla提供了javascript的本地扩展, 让你用javascript也能实现更复杂的功能, 比如基于firefox的多线程下载工具. 下面给出简单的签名方式.</p><pre><code>
//去alisoft申请个app，会给他一个ID和CERT_CODE, 签名的时候需要
API_URL = 'http://sip.alisoft.com/sip/rest/',
APP_NAME = 'baotao', 
APP_ID = '22183',
CERT_CODE = 'cebc9bf0031411de8baffe67f4df8a7b';</pre><p></code></p><ul><li>首先是md5的实现, 其实javascript也实现md5, 网上有现成的算法, 没仔细研究, 拿来直接用, 发现md5中文后, 有问题, 估计是编码问题, 后来找到mozilla开发者中心的一段javascript实现md5的代码, 对其进行简单封装, 用<code>convertFromUnicode</code>对字符进行转码,再md5.<br /><br /><pre><code>
/**
 * md5
 * @return String
 */
var md5 = function(str){
	   var getHexStringFromBinary = function(str){
	  	    var hexchars = '0123456789abcdef';
	   	   var hexrep = new Array(str.length * 2);
	   	   var i;
	   	   for (i = 0; i < str.length; ++i)
	  	    {
			    hexrep[i * 2] = hexchars.charAt((str.charCodeAt(i) >> 4) & 15);
			    hexrep[i * 2 + 1] = hexchars.charAt(str.charCodeAt(i) & 15);
	  	    }
	   	   return hexrep.join('');
	   }
	  var hashMd5Hex = function(str){
	   	   var hash_engine = Components.classes["@mozilla.org/security/hash;1"].createInstance().QueryInterface(Components.interfaces.nsICryptoHash);
	   	   hash_engine.init(hash_engine.MD5);
	   	   var charcodes = new Array();
	   	   for (var i = 0; i < str.length; i++)
	   	   {
	   		 charcodes.push(str.charCodeAt(i));
	   	   }
	   	   hash_engine.update(charcodes, str.length);
	   	   return getHexStringFromBinary(hash_engine.finish(false));
	   }
	   return hashMd5Hex(convertFromUnicode('UTF-8', str));
}</code></pre></li><li>升序排序，其实就是把key拿出来排序，再放回去，php.js (via)<br /><pre><code>
/**
 * ksort
 * @return Array
 */
var ksort = function (array){
	var tmp_arr = {}, keys = [], key_num = 0, key = '', i = 0;

	for (key in array) {
		keys[key_num++] = key;
	}
	keys = keys.sort();
	for (i = 0; i < key_num; i++) {
		key = keys[i];
		tmp_arr[key] = array[key];
	}
	
	return tmp_arr;
};</code></pre></li><li>urlencode，做转码用，也是来自php.js<br /><pre><code>
/**
 * urlencode
 * @return String
 */
var urlencode = function(s){
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var encoded = "";
	for (var i = 0; i < s.length; i++ ) {
		var ch = s.charAt(i);
		if (ch == " ") {
			encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
			encoded += ch;
		} else {
			var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
				alert( "Unicode Character '" 
						+ ch 
						+ "' cannot be encoded using standard URL encoding.\n" +
						  "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for
	return encoded;
};
</pre></code></li><li>此方法返回url就是签名后的url，在chrome级别里可直接用XMLHttpRequest请求<br /><pre><code>
/**
 * getParameterStr
 * @return String
 */
var getParameterStr = function(arr){
	var s = '', c = 'cebc9bf0031411de8baffe67f4df8a7b';
	arr = ksort(arr);
	
	for(var i in arr){
		if('' != arr[i]){
			if(i == 'sip_timestamp'){
				s += i + '=' + urlencode(arr[i]) + '&';
			}else{
				s += i + '=' + encodeURIComponent(arr[i]) + '&';
				
			}
			c += i + arr[i];
		}
	}

	s += 'sip_sign=' +  md5(c).toUpperCase();
	return s;
}
</pre></code></li><li>最后去初始化相关参数，fields字段请参考api说明<br /><pre><code>
return {
	init: function(q, pageNo){
		var arr = parameters;
		arr['sip_timestamp'] = GetDate.init();	
		arr['sip_apiname'] = 'taobao.items.get';
		arr['cid'] = '';
		arr['q'] = q || 'mac';
		
		arr['fields'] = "iid,title,nick,type,cid,pic_path,delist_time,price,post_fee";
		arr['page_no'] = pageNo || 1;
		arr['page_size'] = 50;

		return API_URL + '?' + getParameterStr(arr);				
	}
}
</pre></code></li></ul><p>TOP签名还是挺麻烦的，源代码请下载宝淘扩展查看吧。<a href="https://addons.mozilla.org/zh-CN/firefox/addon/11309">https://addons.mozilla.org/zh-CN/firefox/addon/11309</a></p>]]></content:encoded>
<author><![CDATA[Macji]]></author>
<dc:creator><![CDATA[Macji]]></dc:creator>
<wfw:commentRss>http://www.macji.com/feed/2009/06/01/taobao-open-platform-based-on-the-development-of-firefox-extension/</wfw:commentRss>
</item>
<item>
<title><![CDATA[宝淘, 倒过来淘宝]]></title>
<link>http://www.macji.com/2009/04/07/baotao/</link>
<pubDate>Tue, 07 Apr 2009 11:08:45 +0000</pubDate>
<category><![CDATA[HTML/CSS/JS/PHP]]></category>
<description><![CDATA[首先要说明的是,  宝淘是一个Firefox扩展, 一个基于淘宝开放API的简易搜索器, 此扩展完全用javascript去获取数据, 没有用代理, 也就是说淘宝API挂掉, 此扩展才会失效.

...]]></description>
<guid>http://www.macji.com/2009/04/07/baotao/</guid>
<slash:comments>13</slash:comments>
<comments>http://www.macji.com/2009/04/07/baotao/#comments</comments>
<content:encoded><![CDATA[<p>首先要说明的是,  <a href="https://addons.mozilla.org/zh-CN/firefox/addon/11309">宝淘</a>是一个Firefox扩展, 一个基于淘宝开放API的简易搜索器, 此扩展完全用javascript去获取数据, 没有用代理, 也就是说淘宝API挂掉, 此扩展才会失效.</p><p>界面是抄Mac下的Quicksilver, 那几个字是自己画的, 自己觉得都很漂亮, 哇哈哈.., 不过windows下文字太大了, 有点失真</p><p>看预览图吧, 很漂亮滴...</p><blockquote><img src="https://addons.mozilla.org/en-US/firefox/images/p/31156/1239105788" alt="" /></blockquote><blockquote><img src="https://addons.mozilla.org/en-US/firefox/images/p/31157/1239105315" alt="" /></blockquote><blockquote><img src="https://addons.mozilla.org/en-US/firefox/images/p/31158/1239105356" alt="" /></blockquote><p>怎么用? 首先下载<a href="https://addons.mozilla.org/zh-CN/firefox/addon/11309">https://addons.mozilla.org/zh-CN/firefox/addon/11309</a>, 安装后, 右下角会出来一个"淘"的icon, 按ALT+Q呼出, 按TAB或者option+S(Mac), ALT+I(Windows)键入关键字搜索, 然后按方向键左右切换商品, 按方向键"DOWN", 进入商品详情页.</p><p>大家反映快捷键不好用, 恩, 用的人多, 这个小玩具下个版本就有自定义快捷键了. 赶快下载试用吧.</p>]]></content:encoded>
<author><![CDATA[Macji]]></author>
<dc:creator><![CDATA[Macji]]></dc:creator>
<wfw:commentRss>http://www.macji.com/feed/2009/04/07/baotao/</wfw:commentRss>
</item>
<item>
<title><![CDATA[又丢弃WP了, 开始Typecho]]></title>
<link>http://www.macji.com/2009/04/07/enter-typecho/</link>
<pubDate>Tue, 07 Apr 2009 07:11:21 +0000</pubDate>
<category><![CDATA[HTML/CSS/JS/PHP]]></category>
<category><![CDATA[我的生活]]></category>
<description><![CDATA[由于服务器主机到期, 换到另一主机了, 至于现在的主机在哪, 是誰的, 我一无所知. 对我来说, 能用就行....

换主机, 也把WP换成Typecho, 我貌似什么都没做, 空帷 全帮我搞定了...]]></description>
<guid>http://www.macji.com/2009/04/07/enter-typecho/</guid>
<slash:comments>23</slash:comments>
<comments>http://www.macji.com/2009/04/07/enter-typecho/#comments</comments>
<content:encoded><![CDATA[<p>由于服务器主机到期, 换到另一主机了, 至于现在的主机在哪, 是誰的, 我一无所知. 对我来说, 能用就行....</p><p>换主机, 也把WP换成Typecho, 我貌似什么都没做, <a href="http://www.quchao.com">空帷</a> 全帮我搞定了. 上周就换了, 一直没时间也懒得弄blog了, 这周休假在家, 想起blog了, 就给它重新写了个皮肤, 设计是抄的(抄自<a href="http://www.fofronline.com/">fofronline</a>), 自己稍微改了一下, 代码自己重构了, mac下看起来是比较的漂亮, windows下字体不是很舒服, 也懒得去弄了. 另外不是很了解Typeho, 一些原来blog上的功能都没加, 等了解了再加上去. 另外我厚脸皮的, 把这个皮肤命名为: <a href="http://www.macji.com">Enter</a></p><p>如果你有f'irebug之类的工具, 可以看到, 结构中, 没有几个div了, 基本上都换成html5了. 不支持IE浏览器. 去掉css, 看起来也是比较的"完美"了.</p><p>因为这不是WP的皮肤, 也没多少人用Typeho, 所以就不提供下载了, 如果你喜欢, 直接看源码和<a href="http://labs.macji.com/assets/style.css">http://labs.macji.com/assets/style.css</a>, 对了, 我已经完全屏蔽IE内核的浏览器了, 也就是说这个皮肤是完全不支持IE内核的浏览器的,  既然你能看到这个页面, 说明你没有用IE. 也不多说了.</p><p>恩, 新的系统, 新的皮肤, 新的开始, 每次换blog系统, 我都会这么说, 最近更新blog也很慢, 主要还是太忙了, 忙的累了, 也懒的去更新了. 接下来要克服这个毛病, 还是得坚持更新, 坚持分享.</p>]]></content:encoded>
<author><![CDATA[Macji]]></author>
<dc:creator><![CDATA[Macji]]></dc:creator>
<wfw:commentRss>http://www.macji.com/feed/2009/04/07/enter-typecho/</wfw:commentRss>
</item>
<item>
<title><![CDATA[如何正确处理ajax 302跳转问题]]></title>
<link>http://www.macji.com/2009/02/15/how-to-correctly-deal-with-ajax-302/</link>
<pubDate>Sat, 14 Feb 2009 18:04:00 +0000</pubDate>
<category><![CDATA[HTML/CSS/JS/PHP]]></category>
<description><![CDATA[如果我们的web应用有大量的异步请求，而这些异步请求是在web服务器认证的情况下，那当我们请求发生在服务器认证失效下，服务器自动302到登录页面，那我们异步获取的是登录页面的数据。我们看YUI代码，当...]]></description>
<guid>http://www.macji.com/2009/02/15/how-to-correctly-deal-with-ajax-302/</guid>
<slash:comments>1</slash:comments>
<comments>http://www.macji.com/2009/02/15/how-to-correctly-deal-with-ajax-302/#comments</comments>
<content:encoded><![CDATA[<p>如果我们的web应用有大量的异步请求，而这些异步请求是在web服务器认证的情况下，那当我们请求发生在服务器认证失效下，服务器自动302到登录页面，那我们异步获取的是登录页面的数据。我们看YUI代码，当ajax请求发生301 302属于失败事件。</p><pre><code>
...
if(httpStatus &gt;= 200 &amp;&amp; httpStatus &lt; 300 || httpStatus === 1223){
//
}
...
</code></pre><p>但事实上，并没有发生失败事件，<strong>浏览器会再发一次ajax请求到302的地址</strong>，如果还是发生302，一直请求，直到完成请求或者请求跨域失败为止。对于js来说，301 302这种跳转是透明的，无法处理。<br /><a href="http://labs.macji.com/302/index.html" target="_blank">测试地址</a>（请用firebug， 打开控制台，查看数据，一目了然）</p><p>那到底如何当ajax正确处理302呢，这是浏览器级别的问题，也就是说<strong>没有浏览器能正确处理302</strong>。对于我们前端来说，正确的验证ajax回来的数据，并给出提示，那也不友好（比如服务器端希望我们去登录页面）。更友好的处理是当服务器端发生302，那ajax就当"错误"处理，也做302跳转。</p><pre><code>
//success的时候 不是你想要的数据后，做如下验证
if(-1 != data.indexOf('x')){//x为302后页面特定的字符
	var LOGIN_DOMAIN = 'xxx';//302地址
	window.location = LOGIN_DOMAIN;
	return true;
}

//当302跳转后，ajax发生跨域，可以在failure处理，但 ie返回的是o.status 是 0
failure: function(o){
	if(302 == o.status){
		//
	}
}
</code></pre>]]></content:encoded>
<author><![CDATA[Macji]]></author>
<dc:creator><![CDATA[Macji]]></dc:creator>
<wfw:commentRss>http://www.macji.com/feed/2009/02/15/how-to-correctly-deal-with-ajax-302/</wfw:commentRss>
</item>
<item>
<title><![CDATA[牛气冲天]]></title>
<link>http://www.macji.com/2009/01/26/my-2008/</link>
<pubDate>Sun, 25 Jan 2009 17:08:42 +0000</pubDate>
<category><![CDATA[我的生活]]></category>
<description><![CDATA[已经1点了，牛年到了，鼠年我做了什么，新的一年，我又该回顾点什么呢？

嗯，08年4月，结束了我人生的第一份工作，被前老板称之为美工，我不懂设计，不懂美学。我更喜欢的是敲敲代码，研究点我不明白的东...]]></description>
<guid>http://www.macji.com/2009/01/26/my-2008/</guid>
<slash:comments>11</slash:comments>
<comments>http://www.macji.com/2009/01/26/my-2008/#comments</comments>
<content:encoded><![CDATA[<p>已经1点了，牛年到了，鼠年我做了什么，新的一年，我又该回顾点什么呢？</p><p>嗯，08年4月，结束了我人生的第一份工作，被前老板称之为美工，我不懂设计，不懂美学。我更喜欢的是敲敲代码，研究点我不明白的东西。正如我08年初所说的，我如愿的进入了UED部门，感谢小马哥带我进入淘宝UED，成为一位web前端开发者，这比美工要好听多了，为了对得起这title，我正努力的学习着。</p><p>2008年，工作很忙，但正是忙才能让我有所进步。</p><p>2008年，感谢<a title="xiaoma" href="http://ued.taobao.com" target="_blank">小马</a>，安排有意思的工作给我，当我反馈工作给你时，你总是说这不行，那不行，正是你说的不，才让我想的更多，思考的更多，进步的更多。完美主义的你，让我学到很多很多。但总觉得有点抱歉，每次去你家吃饭，白吃白喝，打麻将还赢你们钱，我在这里表示抱歉啦。</p><p>2008年，感谢<a title="正淳" href="http://www.htmlcssjs.com/blog/" target="_blank">正淳</a>，你的热心，接触过你的人，都知道你是多么的热心，拜托你的事，准没问题。听到你的声音，就知道你有多么的爱淘宝，爱工作。从最底层看问题，让我也了解到问题的另一面。你说我能教你的，就是那点经验。这话不是一般人能听得到的，感动ing。</p><p>2008年，最要感谢我的师傅 <a href="http://www.planabc.net/" target="_blank">圆心</a>，让我重新认识技能上的东东，你的学习方法，你的学习态度，你看问题的方式，做的你徒弟，我学到的太多了，唯一没学到的就是你的体重=.=，我没有在骂人哦，说实在话，谢谢你在这一年中带着我，你不烦耐心的跟我讲解着这个问题那个问题，09年，我会加油的。</p><p>2008年，要感谢的人太多了，感谢UED前端组，也感谢我自己。</p><p>2009年，该做点什么呢，提高效率。工作为什么很忙，效率是一方面，当然经验是效率的瓶颈。要好好记录工作最花时间的地方，总结原因。希望09年少加班，按时回家，然后做一些自己喜欢做的事。希望借着牛年，让我自己变得牛气冲天。</p><p>2009年，87年的我，多多少少也有点年纪了，看着UED进来比我年轻的人，感叹年轻真好，后生可畏。当然我也没有资格说这些话，我还是挺年轻的。嗯，比<a href="http://www.gracecode.com/" target="_blank">猥琐男</a>，比<a href="http://lifesinger.org/blog/" target="_blank">学术男</a>，比<a href="http://www.quchao.com/" target="_blank">腔调男</a>要年轻多。好好努力，好好去对得起这个年纪，对的起我的title。</p><p>娟娟，你真的太好了，我是一个不会说话的人，很多肉麻的话，我都没说出来。在新年之际，我要在这里好好谢谢你。时间过得真快，一年这么快就过去了，这一年中你从东边跟着我到西边，这些苦，这些累，你从来不说；这一年我们在欢声笑语中，让给我们更懂得了生活是平淡的，但我们让平淡的生活，变得非常的缤纷多彩；在这一年，我加班没时间陪你，你总是很体贴我，我加班回来，你总是会给我烧蛋炒饭，紫菜汤，我累了，你会给我按摩。我有这么好的一个老婆，我骄傲啊。在09年，我要做到逛街不喊累，吃辣不喊辣，吃醋不喊酸。其实还有很多话要说，这些全都是只属于我们俩的。</p><p>2009年，结果，结果，结果，让我们的结果牛气冲天。</p>]]></content:encoded>
<author><![CDATA[Macji]]></author>
<dc:creator><![CDATA[Macji]]></dc:creator>
<wfw:commentRss>http://www.macji.com/feed/2009/01/26/my-2008/</wfw:commentRss>
</item>
<item>
<title><![CDATA[javascript this 关键字小提示]]></title>
<link>http://www.macji.com/2009/01/18/javascript-this-keyword-tips/</link>
<pubDate>Sat, 17 Jan 2009 18:00:45 +0000</pubDate>
<category><![CDATA[HTML/CSS/JS/PHP]]></category>
<description><![CDATA[this指向当前作用域的对象，如果找不到，往上一层找，直到window。

this 关键字很好用，很灵活，正因为很灵活，所以一不小心你就会掉进陷阱，所以你要注意以下几点：

	元素对象的th...]]></description>
<guid>http://www.macji.com/2009/01/18/javascript-this-keyword-tips/</guid>
<slash:comments>5</slash:comments>
<comments>http://www.macji.com/2009/01/18/javascript-this-keyword-tips/#comments</comments>
<content:encoded><![CDATA[<p><strong>this指向当前作用域的对象，如果找不到，往上一层找，直到window</strong>。</p><p>this 关键字很好用，很灵活，正因为很灵活，所以一不小心你就会掉进陷阱，所以你要注意以下几点：</p><ol><li>元素对象的this，始终指向该元素，如事件绑定。</li><li>全局的this或者window的相关方法的this始终指向window对象，如setTimeout(function(){alert(this);}, 10)。</li><li>自己创建的对象（{}, new function等）里的this指向自己对象，如var obj = {xxx: function(){alert(this);}}</li><li>匿名函数的this，始终指向window对象，如(function(){alert(this);})();</li><li>想不到还有什么了，望达人补充。</li></ol><p>遇到在某function里不能正常使用this时，可以用call或者在其正常的作用域里var _this = this;然后用_this，最鹾的就是直接用对象名来调用。</p><p>另给自己定义的对象都应该创建一个属于该对象的 toString方法。</p>]]></content:encoded>
<author><![CDATA[Macji]]></author>
<dc:creator><![CDATA[Macji]]></dc:creator>
<wfw:commentRss>http://www.macji.com/feed/2009/01/18/javascript-this-keyword-tips/</wfw:commentRss>
</item>
<item>
<title><![CDATA[YUI Rich Text Editor在IE下的一个问题]]></title>
<link>http://www.macji.com/2009/01/15/yui-rich-text-editor-for-ie/</link>
<pubDate>Thu, 15 Jan 2009 11:44:02 +0000</pubDate>
<category><![CDATA[HTML/CSS/JS/PHP]]></category>
<description><![CDATA[最近项目中用到YUI Rich Text Editor，有个比较严重的问题是在IE下的设置 document.domain后，将导致YUI Rich Text Editor不能工作，这也是YUI Ri...]]></description>
<guid>http://www.macji.com/2009/01/15/yui-rich-text-editor-for-ie/</guid>
<slash:comments>4</slash:comments>
<comments>http://www.macji.com/2009/01/15/yui-rich-text-editor-for-ie/#comments</comments>
<content:encoded><![CDATA[<p>最近项目中用到YUI Rich Text Editor，有个比较严重的问题是在IE下的设置 document.domain后，将导致YUI Rich Text Editor不能工作，这也是YUI Rich Text Editor的一个bug，那如何解决呢，不设置document.domain或者等待Rich Text Editor更新吧。</p><p>请用IE查看：</p><p><a title="editor" href="http://labs.macji.com/yui-rich-text-editor-for-ie.html" target="_blank">http://labs.macji.com/yui-rich-text-editor-for-ie.html</a></p><p>它的作者是这样回答这个滴。。：</p><p><a href="http://sourceforge.net/tracker/?func=detail&amp;atid=836476&amp;aid=2052000&amp;group_id=165715" target="_self">http://sourceforge.net/tracker/?func=detail&amp;atid=836476&amp;aid=2052000&amp;group_id=165715</a></p><p>确实，在中国的环境下，很少有人会用这个编辑器。。。</p>]]></content:encoded>
<author><![CDATA[Macji]]></author>
<dc:creator><![CDATA[Macji]]></dc:creator>
<wfw:commentRss>http://www.macji.com/feed/2009/01/15/yui-rich-text-editor-for-ie/</wfw:commentRss>
</item>
<item>
<title><![CDATA[Progressive Enhancement 的 Tab]]></title>
<link>http://www.macji.com/2008/11/03/progressive-enhancement-of-the-tab-1/</link>
<pubDate>Mon, 03 Nov 2008 12:03:28 +0000</pubDate>
<category><![CDATA[HTML/CSS/JS/PHP]]></category>
<description><![CDATA[大家一直在讲Progressive Enhancement，如果你不看英文，那么请看玉伯翻译的理解渐进增强（Progressive Enhancement）。也标题一下，做一个tab切换实例，来进一步...]]></description>
<guid>http://www.macji.com/2008/11/03/progressive-enhancement-of-the-tab-1/</guid>
<slash:comments>7</slash:comments>
<comments>http://www.macji.com/2008/11/03/progressive-enhancement-of-the-tab-1/#comments</comments>
<content:encoded><![CDATA[<p>大家一直在讲<a href="http://www.alistapart.com/articles/understandingprogressiveenhancement">Progressive Enhancement</a>，如果你不看英文，那么请看玉伯翻译的<a href="http://lifesinger.org/blog/?p=298">理解渐进增强（Progressive Enhancement）</a>。也标题一下，做一个tab切换实例，来进一步说明Progressive Enhancement(渐进增强)。</p><p>需求：做一个tab，要求当用户禁止javascript后，tab还能照样使用。</p><blockquote><img src="http://labs.macji.com/img/tab.png" alt="" /></blockquote><p>貌似不能实现，可仔细想想是可以实现的，连<a href="http://www.macji.com/2008/10/01/pure-css-of-the-unobtrusive-carousel/">这个</a>都能实现，何况一个tab呢。。。</p><ol><li>首先我们写html结构<br /><br /><pre>
<code>
&lt;div id="tab" class="mj">
	&lt;ul class="mj-nav">
		&lt;li class="first">&lt;a href="#">&lt;span>类目1&lt;/span>&lt;/a>&lt;/li>
		&lt;li>&lt;a href="#">&lt;span>类目2&lt;/span>&lt;/a>&lt;/li>
		&lt;li>&lt;a href="#">&lt;span>类目3&lt;/span>&lt;/a>&lt;/li>
	&lt;/ul>
	&lt;div class="panel">
		这是类目1
	&lt;/div>
	&lt;div class="panel">
		这是类目2
	&lt;/div>
	&lt;div class="panel">
		这是类目3
	&lt;/div>
&lt;/div>
</code>
</pre><br /><br /><a href="http://labs.macji.com/tab/test-1.html">测试地址一</a></li><li>写上css<br /><br /><pre>
<code>
.mj{
	width:500px;
	padding:10px 0;
	border:solid 1px #bfbfbf;
}
.mj-nav, .mj-nav *{
	background:url(cat_selector.png) no-repeat 100px 100px;
}

/* tab 导航条 */
.mj .mj-nav{
	height:25px;
	padding:0 10px;
	line-height:25px;
	background-position:0 0;
}
.mj-nav li{
	float:left;
}
.mj-nav a{
	float:left;
	padding-left:20px;
}
.mj-nav span{
	display:block;
	padding-right:20px;
}
.mj-nav a{
	background-position:-500px 0;
}
.mj-nav .first a{
	background-position:100px 100px;
}
.mj-nav .selected{
	position:relative;
	margin:0 -1px 0 0;
}
.mj-nav .selected a{
	background-position:0 -25px;
}
.mj-nav .selected span{
	background-position:100% -25px;
}
</code>
</pre><br /><br /><a href="http://labs.macji.com/tab/test-2.html">测试地址二</a></li><li>引入js，这里直接用Tbar，<br /><br /><pre>
<code>
&lt;script src="http://assets.taobaocdn.com/js/tbra/tbra-widgets.js?t=20081028.js" type="text/javascript">&lt;/script>
&lt;script type="text/javascript">
TB.widget.SimpleTab.decorate('tab', {eventType:'click', currentClass:'selected'});
&lt;/script>
</code>
</pre><br /><br /><a href="http://labs.macji.com/tab/test-3.html">测试地址三</a></li><li>ok，到这里我们的tab就算完成了。只要浏览器支持javascript，那么就可以使用我们的tab，但是，如果用户禁止了javascript，那后果该是怎样的呢？惨不忍睹。<a href="http://labs.macji.com/tab/test-4.html">测试地址四</a></li><li>我们都知道锚点(url#xxx)，定位到页面的位置。如果我们的锚点都在一个容器里面(div)，并且这个容器只有100像素高(height:100px;overflow:hidden)，然后我们锚点到它的字容器(字容器都是height:100px)，那该是怎么样的呢？答案是可行的，可惜只有Opera不支持这种机制。<br /><pre>
<code>
//在原来的css基础上加上
.panels{
	height:50px;
	overflow:hidden;
}
.panel{
	height:50px;
}

&lt;div id="tab" class="mj">
	&lt;ul class="mj-nav">	
		&lt;li class="first">&lt;a href="#panel1">&lt;span>类目1&lt;/span>&lt;/a>&lt;/li>
		&lt;li>&lt;a href="#panel2">&lt;span>类目2&lt;/span>&lt;/a>&lt;/li>
		&lt;li>&lt;a href="#panel3">&lt;span>类目3&lt;/span>&lt;/a>&lt;/li>
	&lt;/ul>
	&lt;div class="panels">
		&lt;div id="panel1" class="panel">这是类目1&lt;/div>
		&lt;div id="panel2" class="panel">这是类目2&lt;/div>
		&lt;div id="panel3" class="panel">这是类目3&lt;/div>
	&lt;/div>
&lt;/div>

</code>
</pre><br /><br />我们只要再做一点点，就能让用户在没有javascript的情况下，也能使用tab，可乐而不为呢？<a href="http://labs.macji.com/tab/test-5.html">测试地址五</a></li><li>但是，当页面很长时，点击切换后，我们tab导航看不到了，<a href="http://labs.macji.com/tab/test-6.html">测试地址六</a></li><li>其实，我们只要在css上，调整一下就可以了。<br /><pre>
<code>
.mj{
	position:relative;
	width:500px;
	padding:10px 0;
	border:solid 1px #bfbfbf;
}
.mj-nav, .mj-nav *{
	background:url(cat_selector.png) no-repeat 100px 100px;
}
/* tab 导航条 */
.mj .mj-nav{
	position:absolute;
	left:0;
	top:10px;
	width:480px;
	height:25px;
	padding:0 10px;
	line-height:25px;
	background-position:0 0;
}</code>
</pre><br /><br /><a href="http://labs.macji.com/tab/test-7.html">测试地址七</a></li><li>这时，javascript可以出场了。我们给其加上脚本。<a href="http://labs.macji.com/tab/test-8.html">测试地址八</a></li><li>可恨的firefox 3，在有锚点，又有脚本，错位了。<a href="http://labs.macji.com/tab/test-9.html?#panel2">测试地址九</a></li><li>写上obj.scrollTop = 0;就可以了。<br /><br /><pre>
<code>
var TabSelector = (function(){
	var el = $D.get('tab');
	if ( !el ) return false;
	return {
		init: function(){
			$E.on(el.getElementsByTagName('ul')[0], 'click', function(){
				$E.stopEvent(ev);
			});
			TB.widget.SimpleTab.decorate('tab', {
				eventType:'click',
				tabPanelClass:'panel',
				currentClass:'selected'
			});
			$D.getLastChild(el).scrollTop = 0;
		}
	}
})();
$E.onDOMReady(TabSelector.init);
</code>
</pre><br /><br />比较完美的tab，<a href="http://labs.macji.com/tab/test-10.html">测试地址十</a>，如果再渐进增强，比如键盘事件，盲人触摸等，更极端的，当css失效时，但我没疯。</li></ol><p>其实到第三步，一个tab就做好了，也不需要考虑这么多了，但考虑下去，不是很难，疯一次也是不错的。</p>]]></content:encoded>
<author><![CDATA[Macji]]></author>
<dc:creator><![CDATA[Macji]]></dc:creator>
<wfw:commentRss>http://www.macji.com/feed/2008/11/03/progressive-enhancement-of-the-tab-1/</wfw:commentRss>
</item>
</channel>
</rss>