<?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>occasionally useful &#187; jquery</title>
	<atom:link href="http://blog.maxaller.name/category/javascript/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.maxaller.name</link>
	<description>ruby, ubuntu, etc</description>
	<lastBuildDate>Sun, 11 Jul 2010 07:01:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Debugging unobtrusive javascript in jQuery</title>
		<link>http://blog.maxaller.name/2009/09/debugging-unobtrusive-javascript-in-jquery/</link>
		<comments>http://blog.maxaller.name/2009/09/debugging-unobtrusive-javascript-in-jquery/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 03:49:34 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[unobtrusive]]></category>

		<guid isPermaLink="false">http://blog.maxaller.name/?p=194</guid>
		<description><![CDATA[So if you work for a large enterprise website like I do, where each page loads dozens or hundreds of kilobytes of javascript, it can be hard to figure out exactly what happens when you click that div and something magically happens, due to the wonders of unobtrusive javascript.
Or, to rephrase the question, "I know [...]]]></description>
			<content:encoded><![CDATA[<p>So if you work for a large enterprise website like I do, where each page loads dozens or hundreds of kilobytes of javascript, it can be hard to figure out exactly what happens when you click that div and something magically happens, due to the wonders of unobtrusive javascript.</p>
<p>Or, to rephrase the question, "I know how to add event handlers to an object -- how do I enumerate what's already been attached?"</p>
<p>And it's pretty easy, but unfortunately it doesn't use a public API.  Anyway, try this in Firebug:</p>
<p><code lang="javascript"><br />
  $("#the_button").data("events");<br />
</code></p>
<p>If there are any events on that element, they'll be displayed.  The only drawback is...you have to know exactly which element the events are attached to, or guess around a bit.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2009/09/debugging-unobtrusive-javascript-in-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Accessing GM_xmlhttprequest from event handlers bound by jQuery</title>
		<link>http://blog.maxaller.name/2009/01/accessing-gm_xmlhttprequest-from-event-handlers-bound-by-jquery/</link>
		<comments>http://blog.maxaller.name/2009/01/accessing-gm_xmlhttprequest-from-event-handlers-bound-by-jquery/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 05:42:05 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[musing]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://giftswappo.com/wordpress/?p=58</guid>
		<description><![CDATA[So I like jQuery.  And I like Greasemonkey.  I especially like the ability of Greasemonkey's ajax calls to go cross-domain.  But how do I get access to this functionality in my event handlers?  Calling GM_xmlhttprequest in a method that doesn't execute while the Greasemonkey sandbox is still alive doesn't work.  [...]]]></description>
			<content:encoded><![CDATA[<p>So I like jQuery.  And I like Greasemonkey.  I especially like the ability of Greasemonkey's ajax calls to go cross-domain.  But how do I get access to this functionality in my event handlers?  Calling GM_xmlhttprequest in a method that doesn't execute while the Greasemonkey sandbox is still alive doesn't work.  At first I didn't think it was possible, but I discovered a way...using setInterval.</p>
<p><span id="more-58"></span>So here's the problem.  You want something like this:</p>
<pre lang="Javascript">$(function(){
  $("a").click(function(){
    GM_xmlhttprequest({url: "http://www.google.com/", method: 'GET'});
  });
});</pre>
<p>or something, right?  But that doesn't work because by the time the $'s DOM ready event fired, Greasemonkey is <em>gone</em>.  So what do you do?  Well...keep Greasemonkey around, but in a limited capacity.  Okay okay, here's the code:</p>
<pre lang="Javascript">var ajaxQueue = [];
var processAjaxQueue = function(){
  if (ajaxQueue.length > 0) {
    for (ajax in ajaxQueue) {
      var obj = ajaxQueue[ajax];
      // http://diveintogreasemonkey.org/api/gm_xmlhttprequest.html
      GM_xmlhttpRequest(obj);
    }
    ajaxQueue = [];
  }
}
setInterval(function(){
  processAjaxQueue();
}, 100);

function gmAjax(obj){
  ajaxQueue.push(obj);
}</pre>
<p>So now you call gmAjax instead of GM_xmlhttprequest (with the same argument) and it'll get fired off within the next 100ms.  Neat huh?  And if you're worried about security (which you should be) -- I've tested this myself, and gmAjax isn't acccessible anywhere outside of the Greasemonkey sandbox.  Huzzah, mission accomplished.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2009/01/accessing-gm_xmlhttprequest-from-event-handlers-bound-by-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DEPRECATED: Announcing: jQuery optimization races</title>
		<link>http://blog.maxaller.name/2008/12/announcing-jquery-optimization-races/</link>
		<comments>http://blog.maxaller.name/2008/12/announcing-jquery-optimization-races/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 02:07:48 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[google]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[just for fun]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://giftswappo.com/wordpress/?p=49</guid>
		<description><![CDATA[Note...this site is down for now...
You don't have to understand it to see that it's at least a bit interesting, so check it out:
http://www.nutriscan.org/jquery_optimization/
It documents a bunch of different ways of doing similar things, and compares them in terms of performance.  How much are you really losing by using the jQuery convenience method?
]]></description>
			<content:encoded><![CDATA[<p>Note...this site is down for now...</p>
<p>You don't have to understand it to see that it's at least a bit interesting, so check it out:</p>
<p><a href="http://www.nutriscan.org/jquery_optimization/">http://www.nutriscan.org/jquery_optimization/</a></p>
<p>It documents a bunch of different ways of doing similar things, and compares them in terms of performance.  How much are you <em>really</em> losing by using the jQuery convenience method?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2008/12/announcing-jquery-optimization-races/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Visualization API + jQuery</title>
		<link>http://blog.maxaller.name/2008/12/google-visualization-api-jquery/</link>
		<comments>http://blog.maxaller.name/2008/12/google-visualization-api-jquery/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 21:46:52 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[google]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://giftswappo.com/wordpress/?p=48</guid>
		<description><![CDATA[TODO: bring animations to charts in the Google Visualization API via jQuery to illustrate performance described in previous post.
Relevant link.
]]></description>
			<content:encoded><![CDATA[<p>TODO: bring animations to charts in the Google Visualization API via jQuery to illustrate performance described in previous post.</p>
<p><a href="http://code.google.com/apis/visualization/documentation/gallery/columnchart.html" target="_blank">Relevant link</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2008/12/google-visualization-api-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery performance</title>
		<link>http://blog.maxaller.name/2008/12/jquery-performance/</link>
		<comments>http://blog.maxaller.name/2008/12/jquery-performance/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 20:45:46 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://giftswappo.com/wordpress/?p=47</guid>
		<description><![CDATA[TODO: write a series of test cases that illustrate ways to write high-performance jQuery.
]]></description>
			<content:encoded><![CDATA[<p>TODO: write a series of test cases that illustrate ways to write high-performance jQuery.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2008/12/jquery-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Projects in progress</title>
		<link>http://blog.maxaller.name/2008/12/projects-in-progress/</link>
		<comments>http://blog.maxaller.name/2008/12/projects-in-progress/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 01:12:54 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[merb]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://giftswappo.com/wordpress/?p=46</guid>
		<description><![CDATA[I have many projects in progress...
1) "Anybody can program" book, have half of the outline for the first draft done
2) Stylometry web app, have some of the backend services done that calculate stylometry stats
a) Dictionary looker upper, reasonably complete for Merriam-Webster only
3) Blog application, just a few thoughts on paper and a few lines of [...]]]></description>
			<content:encoded><![CDATA[<p>I have many projects in progress...</p>
<p>1) "Anybody can program" book, have half of the outline for the first draft done<br />
2) Stylometry web app, have some of the backend services done that calculate stylometry stats<br />
a) Dictionary looker upper, reasonably complete for Merriam-Webster only<br />
3) Blog application, just a few thoughts on paper and a few lines of code<br />
4) Notepad, a note-keeping application, could pass for done<br />
5) Merb Google RSS feed sample application, could pass for done<br />
6) jQuery_merb, a javascript library bridging the gap between jQuery/javascript and merb.  limited scope, but could pass for done<br />
7) merb_solitary_part, a merb slice for hitting parts outside of "regular" requests.  Needs some renaming/refactoring and some docs, but could pass for done<br />
8 ) Kollaba, a site for finding collaborators to work on...anything.  fair bit of progress on it, but probably dead.<br />
9) merb-rails upload benchmark application, basically creating the same simple application in both versions.  done enough to be used for benchmarks, at least (and yes, merb's faster).</p>
<p>Phew.  I need to finish some stuff!  But new ideas are so much more exciting...</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2008/12/projects-in-progress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jquery_merb continued</title>
		<link>http://blog.maxaller.name/2008/11/jquery_merb-continued/</link>
		<comments>http://blog.maxaller.name/2008/11/jquery_merb-continued/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 19:00:29 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[just for fun]]></category>
		<category><![CDATA[merb]]></category>

		<guid isPermaLink="false">http://giftswappo.com/wordpress/?p=41</guid>
		<description><![CDATA[So...I think, for now, I'm done with jquery_merb.

And for once, that's a good thing, because by "done for now" I mean..."done" pending more ideas.  It's thoroughly documented and tested, and I think I might just set it aside for now until I find other features it needs to interact with Merb better.  Which [...]]]></description>
			<content:encoded><![CDATA[<p>So...I think, for now, I'm done with jquery_merb.</p>
<p><span id="more-41"></span></p>
<p>And for once, that's a good thing, because by "done for now" I mean..."done" pending more ideas.  It's thoroughly documented and tested, and I think I might just set it aside for now until I find other features it needs to interact with Merb better.  Which may be never.</p>
<p>On the bright side, Minirequest/Solitary Part came out of it and is now living in its own repository.  It's like half done, but doesn't have tests or much documentation.  Also I'd like it to work with partials, which it currently doesn't handle <em>at all</em>.  After that though, it's on to my next project...</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2008/11/jquery_merb-continued/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>introducing&#8230;jquery_merb (sort of)</title>
		<link>http://blog.maxaller.name/2008/11/introducingjquery_merb-sort-of/</link>
		<comments>http://blog.maxaller.name/2008/11/introducingjquery_merb-sort-of/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 05:40:07 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[just for fun]]></category>
		<category><![CDATA[merb]]></category>

		<guid isPermaLink="false">http://giftswappo.com/wordpress/?p=40</guid>
		<description><![CDATA[I love jQuery.  I love Merb.  I thought, so why not work on both?  I tried this previously from the merb side with the now gone merb_multi_js plugin, which I had made a substantial amount of progress on before I killed it.  It was designed to mimic rails and generate handy [...]]]></description>
			<content:encoded><![CDATA[<p>I love jQuery.  I love Merb.  I thought, so why not work on both?  I tried this previously from the merb side with the now gone merb_multi_js plugin, which I had made a substantial amount of progress on before I killed it.  It was designed to mimic rails and generate handy JavaScript for you not using Prototype.js, but whatever web framework you wanted (I of course had jQuery, Prototype.js, and I think YUI).  Alas, I realized that because of some of its design principles, it would never be performance-friendly.</p>
<p>Enter jquery_merb, or jquery.merb.js.</p>
<p><span id="more-40"></span></p>
<p>This library takes on a different role; rather than generating javascript for you (ew) it's meant to be a collection of helpers that assist your coding in interacting with your Merb server.  For instance, if you want to use AJAX to perform CRUD operations on a resource, instead of hacking together an ajax call you can say this:</p>
<pre><span class="c">$.merb.resource.read({resources: 'notes', id: 5, dataType: 'json'})
</span></pre>
<p>Neat huh?  The interface isn't <em>quite </em>as clean as it could be, but alas, that's because of the inescapable fact that resources have singular and plural forms which can't be resolved programmatically in JavaScript.</p>
<p>The thing I've been working on for the past couple days actually <em>does </em>dip into the merb side, but only just.  I think it would be cool to be able to easily reload a <strong>part</strong> (using AJAX) that you use in your view, without a lot of extra work from you (no special controller methods or templates, or even writing an ajax call).  This would mean something as simple as $("#my_part").merb_reload(); and the part would reload with, say, the most recent blog posts.  See <a href="http://github.com/nanodeath/jquery_merb/wikis/ideas" target="_blank">here</a> for more details.</p>
<p>So that's what I'm working on these days...</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2008/11/introducingjquery_merb-sort-of/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>merb_multi_js</title>
		<link>http://blog.maxaller.name/2008/06/merb_multi_js/</link>
		<comments>http://blog.maxaller.name/2008/06/merb_multi_js/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 19:06:54 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[merb]]></category>

		<guid isPermaLink="false">http://giftswappo.com/wordpress/?p=19</guid>
		<description><![CDATA[I'm writing a plugin right now to add some built-in JS functionality to Merb.  It's coming along pretty well, but is still pretty raw and not specced, though it does have SOME documentation.  It's available at http://github.com/nanodeath/merb_multi_js/wikis/home.  If you have questions, you're encouraged to send me a message at Freenode#merb.
]]></description>
			<content:encoded><![CDATA[<p>I'm writing a plugin right now to add some built-in JS functionality to Merb.  It's coming along pretty well, but is still pretty raw and not specced, though it does have SOME documentation.  It's available at http://github.com/nanodeath/merb_multi_js/wikis/home.  If you have questions, you're encouraged to send me a message at Freenode#merb.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2008/06/merb_multi_js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery :(</title>
		<link>http://blog.maxaller.name/2008/03/jquery/</link>
		<comments>http://blog.maxaller.name/2008/03/jquery/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 04:50:23 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[jquery]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://giftswappo.com/wordpress/?p=12</guid>
		<description><![CDATA[I wish Rails wasn't so intimately tied with Prototype+scriptaculous.  It makes jQuery that much harder to use.  Even so, using page &#60;&#60; and jQuery is much easier than trying to use Prototype to achieve the same end.  Not to be a fanboy or anything, but is there any other library out there [...]]]></description>
			<content:encoded><![CDATA[<p>I wish Rails wasn't so intimately tied with Prototype+scriptaculous.  It makes jQuery that much harder to use.  Even so, using page &lt;&lt; and jQuery is much easier than trying to use Prototype to achieve the same end.  Not to be a fanboy or anything, but is there any other library out there that can remove a specific option from a dropdown select box in one short line of code?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2008/03/jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
