<?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>NINNYPANTS &#187; JavaScript</title>
	<atom:link href="http://ninnypants.com/blog/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://ninnypants.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Thu, 02 Feb 2012 01:32:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Fixing Javascript Errors in WordPress SEO</title>
		<link>http://ninnypants.com/blog/2011/04/13/fixing-javascript-errors-in-wordpress-seo/</link>
		<comments>http://ninnypants.com/blog/2011/04/13/fixing-javascript-errors-in-wordpress-seo/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 22:16:37 +0000</pubDate>
		<dc:creator>ninnypants</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress SEO]]></category>

		<guid isPermaLink="false">http://ninnypants.com/?p=848</guid>
		<description><![CDATA[In the last two versions of Yoast&#8217;s WordPress SEO plugin there&#8217;s been errors in the JavaScript that cause parts of tinymce to not work. The issue is some of the variables are not strings like expected, so when they try to run string methods against them, causing JavaScript to throw a syntax error. The simple [...]]]></description>
			<content:encoded><![CDATA[<p>In the last two versions of Yoast&#8217;s <a href="http://yoast.com/wordpress/seo/">WordPress SEO plugin</a> there&#8217;s been errors in the JavaScript that cause parts of tinymce to not work. The issue is some of the variables are not strings like expected, so when they try to run string methods against them, causing JavaScript to throw a syntax error. The simple fix is to add type checking for lines 189 and 200 of wp-seo-metabox.js.&nbsp;</p><pre class="crayon-plain-tag"><code>if ( !desc || desc.length &amp;lt; 1 ) {
	desc = jQuery(&quot;#content&quot;).val();
	if(typeof desc == 'string'){
		desc = yst_strip_tags( desc );
	}
	var descsearch = new RegExp( focuskw, 'gim');
	if ( desc.search(descsearch) != -1 ) {
		desc = desc.substr( desc.search(descsearch), wpseo_meta_desc_length );
	} else {
		desc = desc.substr(0, wpseo_meta_desc_length );
	}
	jQuery(&quot;#snippet .desc span&quot;).css('color','#777777');
}

for (var i in keywords) {
	if(typeof keywords[i] == 'string'){
		var kw			= yst_strip_tags( keywords[i] );
		var urlfocuskw 	= kw.replace(' ','-').toLowerCase();
		focuskwregex 	= new RegExp( '('+kw+')', 'gim');
		urlfocuskwregex = new RegExp( '('+urlfocuskw+')', 'gim' );
		desc 			= desc.replace( focuskwregex, '&lt;strong&gt;'+&quot;$1&quot;+'&lt;/strong&gt;' );
		title 			= title.replace( focuskwregex, '&lt;strong&gt;'+&quot;$1&quot;+'&lt;/strong&gt;' );
		url 			= url.replace( urlfocuskwregex, '&lt;strong&gt;'+&quot;$1&quot;+'&lt;/strong&gt;' );
	}
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://ninnypants.com/blog/2011/04/13/fixing-javascript-errors-in-wordpress-seo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New Formatting for XMLHttpRequest</title>
		<link>http://ninnypants.com/blog/2009/03/30/new-formatting-for-xmlhttprequest/</link>
		<comments>http://ninnypants.com/blog/2009/03/30/new-formatting-for-xmlhttprequest/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 05:38:12 +0000</pubDate>
		<dc:creator>ninnypants</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[XMLHttpRequest]]></category>

		<guid isPermaLink="false">http://www.ninnypants.com/blog/?p=47</guid>
		<description><![CDATA[Recently I decided to try reducing the size of hacking the HTTP request for cross browser support in AJAX. This little snippet has been tested and is working.

// new xml http object
var xmlHttp = new XMLHttpRequest() ? new XMLHttpRequest() :
			( new ActiveXObject("Msxml2.XMLHTTP") ? new ActiveXObject("Msxml2.XMLHTTP") :
			( new ActiveXObject("Microsoft.XMLHTTP") ? new ActiveXObject("Microsoft.XMLHTTP") : null ) );]]></description>
			<content:encoded><![CDATA[<p>Recently I decided to try reducing the size of hacking the HTTP request for cross browser support in AJAX. This little snippet has been tested and is working.</p><pre class="crayon-plain-tag"><code>// new xml http object
var xmlHttp = new XMLHttpRequest() ? new XMLHttpRequest() :
		( new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;) ? new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;) :
		( new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;) ? new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;) : null ) );</code></pre><p>I find this new method easier to read and is much more elegant than the method bellow; which is the only method I&#8217;ve seen out there.</p><pre class="crayon-plain-tag"><code>try{
	// Firefox, Opera 8.0+, Safari
	xml=new XMLHttpRequest();
}catch(e){
	// Internet Explorer
	try{
		xml=new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;);
	}catch(e){
		try{
			xml=new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
		}catch(e){
			alert(&quot;Your browser does not support AJAX!&quot;);
			return false;
		}
	}
}</code></pre><p>I know that I am not the only who has tried to shorten this section of code. Let me know what you think or how you handle it yourself.</p>
]]></content:encoded>
			<wfw:commentRss>http://ninnypants.com/blog/2009/03/30/new-formatting-for-xmlhttprequest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

