<?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>程序如此灵动！ &#187; prototype</title>
	<atom:link href="http://newsn.net/tag/prototype/feed" rel="self" type="application/rss+xml" />
	<link>http://newsn.net</link>
	<description>苏南的网络日记本本  O(∩_∩)O  哈哈~</description>
	<lastBuildDate>Mon, 13 Jul 2009 02:59:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>强制修改wordpress的正文链接为新开窗口打开</title>
		<link>http://newsn.net/20090629/725.html</link>
		<comments>http://newsn.net/20090629/725.html#comments</comments>
		<pubDate>Mon, 29 Jun 2009 00:14:44 +0000</pubDate>
		<dc:creator>苏南</dc:creator>
				<category><![CDATA[IT.IT]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://newsn.net/20090629/725.html</guid>
		<description><![CDATA[WordPress的正文做链接的时候，默认是本页打开的，用livewriter写博客的时候也是默认本页打开。当然据说这样更符合国际化标准，但是好像对中国人的习惯新开页面得习惯有点水土不服。而且外带我很懒的去给所有的链接去增加target=’_blank’属性。今天说的是，批量修改这些页面链接，强制新开页面。
 
     一、写在前面     本文主要使用了一个函数，getElementsByClassName，这个是prototy.js中的一个标准函数，但是单独运行版却是多种多样，而且兼容性很差，本来想扩展object.prototype.getElementsByClassName，但是发现时好时坏，兼容性很差。后来就google到了这么一个函数，貌似很不错的说。     http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/     http://code.google.com/p/getelementsbyclassname/          二、不多说，上代码       getElementsByClassName:
var getElementsByClassName = function (className, tag, elm){
	if (document.getElementsByClassName) {
		getElementsByClassName = function (className, tag, elm) {
			elm = elm [...]]]></description>
		<wfw:commentRss>http://newsn.net/20090629/725.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>cakephp的debugkit在ie下的再次修正</title>
		<link>http://newsn.net/20090623/616.html</link>
		<comments>http://newsn.net/20090623/616.html#comments</comments>
		<pubDate>Tue, 23 Jun 2009 03:39:15 +0000</pubDate>
		<dc:creator>苏南</dc:creator>
				<category><![CDATA[IT.IT]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[debugkit]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://newsn.net/20090623/616.html</guid>
		<description><![CDATA[Cakephp的debugkit在ie下面已经修正一次，可以正常显示toolbar，今天用了一下，发现还是有点问题，不能点击开具体页面中的小箭头显示详细内容，就再次修正增加了个event的target属性，具体如下：
 
一、写在前面      在msdn上面看到了这篇文章，应该是对ie下面的prototype进行修正的比较权威的文章。网上的文章都是在讲如何让ff支持ie的属性的，这里反其道而行，讲ie如何支持ff的属性。     http://msdn.microsoft.com/en-us/library/dd229916(VS.85).aspx
二、本次更新主要修改的问题     &#160; 这里的小箭头不能点开。    
三、增加后的代码     plugins\debug_kit\vendors\js\js_debug_toolbar.js
if (document.all){
	Event.prototype.preventDefault = function () {
	  this.returnValue = false;
	};
	Object.defineProperty(Event.prototype, 'target', {
	  get: function() {
	    return this.srcElement;
	  }
	});
}
这里面已经包含了上次对debugkit的更新修正。使用方法一样，放到这个js文件的开头就行了。
  这段JS的功用是： 
当前浏览器是IE(document.all)的时候,使得event这个类先增加一个方法叫做preventDefault，然后增加一个属性值叫做target。因为这2个东东都是ff特有的，ie不认识，而这个debugkit又是针对ff所写的，所以有此hook。
]]></description>
		<wfw:commentRss>http://newsn.net/20090623/616.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>javascript的trim、replaceall、inarray</title>
		<link>http://newsn.net/20090615/576.html</link>
		<comments>http://newsn.net/20090615/576.html#comments</comments>
		<pubDate>Mon, 15 Jun 2009 06:54:23 +0000</pubDate>
		<dc:creator>苏南</dc:creator>
				<category><![CDATA[IT.IT]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://newsn.net/20090615/576.html</guid>
		<description><![CDATA[都是用正则表达式重写的prototype，很好用的说。
 
String.prototype.trim = function() {
	return this.replace(/(^\s*)&#124;(\s*$)/g, &#34;&#34;);
}
String.prototype.replaceAll = function(search, replace){
	var regex = new RegExp(search, &#34;g&#34;);
	return this.replace(regex, replace);
}
Array.prototype.inArray = function (value){
  for (var i=0; i &#60; this.length; i++){
      if (this[i] === value){
          return true;
      }
  [...]]]></description>
		<wfw:commentRss>http://newsn.net/20090615/576.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在IE下面使用Cakephp的debug kit插件</title>
		<link>http://newsn.net/20090605/537.html</link>
		<comments>http://newsn.net/20090605/537.html#comments</comments>
		<pubDate>Fri, 05 Jun 2009 10:02:50 +0000</pubDate>
		<dc:creator>苏南</dc:creator>
				<category><![CDATA[IT.IT]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[debugkit]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://newsn.net/20090605/537.html</guid>
		<description><![CDATA[Cakephp下面有个debugkit插件，是用来显示相关调试信息的。而且据说得到了Cakephp的作者之一的mark story的大力推荐，但是这个东东在ie下面却是不能使用的。本文说明如何在ie下面使用这个东东。

 

一、使用debugkit     官方网站是：http://thechaw.com/debug_kit/versions     写本文时，这个插件的最新版本是1.1。它的安装和使用很简单，     官方的readme是：
Installation
------------
 * Copy the files in this directory into app/plugins/debug_kit
 * Include the toolbar component in your app_controller.php:
	var $components = array('DebugKit.Toolbar');
 * Set debug mode to at least 1.
下载的脚本放置到app目录下的plugins目录就行了，然后在AppController里面用components来引入就行了。具体见图：

然后就会在你的app界面上出现如下toolbar。

点击对应的东东就可以显示相关的信息了。
关于debug的级别是在config/core.php 中用Configure::write(&#8217;debug&#8217;, 2);来控制的，注意修改就行啦。
但是这个toolbar有个致命的问题，就是在ie下面不能正常使用。
二、针对ie的修改
经过查看报错信息，发现原来是ie下不能识别event.preventDefault();的缘故。为了兼容IE，特地修改了ie下的event的prototype，让他支持event.preventDefault()方法。如下：
Event.prototype.preventDefault = function () {
  this.returnValue = [...]]]></description>
		<wfw:commentRss>http://newsn.net/20090605/537.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
