<?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>FND's Blag &#187; JavaScript</title>
	<atom:link href="http://fnd.lewcid.org/blog/archive/tag/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://fnd.lewcid.org/blog</link>
	<description>Just Another Personal Wobsite</description>
	<lastBuildDate>Thu, 11 Mar 2010 15:19:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Introducing chrjs, a JavaScript Library for TiddlyWeb Clients</title>
		<link>http://fnd.lewcid.org/blog/archive/151</link>
		<comments>http://fnd.lewcid.org/blog/archive/151#comments</comments>
		<pubDate>Thu, 11 Mar 2010 15:13:48 +0000</pubDate>
		<dc:creator>FND</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[libraries]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[TiddlyWeb]]></category>

		<guid isPermaLink="false">http://fnd.lewcid.org/blog/?p=151</guid>
		<description><![CDATA[In order to simplify the development of TiddlyWeb-based applications (like TiddlyRecon), I created a generic library for making HTTP requests to a TiddlyWeb server. This has recently undergone a complete rewrite to provide an API that is more in line with the TiddlyWeb spirit &#8212; tiddler-centric and compositional &#8212; and should now be ready for [...]]]></description>
			<content:encoded><![CDATA[<p>In order to simplify the development of <a href="http://tiddlyweb.com">TiddlyWeb</a>-based applications (like <a href="http://github.com/fnd/tiddlyrecon">TiddlyRecon</a>), I created a <a href="http://github.com/tiddlyweb/chrjs">generic library for making HTTP requests to a TiddlyWeb server</a>.<span id="more-151"></span><br />
This has recently undergone a complete rewrite to provide an API that is more in line with the TiddlyWeb spirit &mdash; tiddler-centric and compositional &mdash; and should now be ready for general use.</p>
<p>In the spirit of letting the code speak for itself (and to save me the trouble of <a href="http://anathem.wikia.com/wiki/Bulshytt">composing prose</a>), I created an interactive <a href="http://tiddlyweb.peermore.com/chrjs/demo.html">demo page</a> which should illustrate the basic aspects.</p>
<p>Any feedback would be much appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://fnd.lewcid.org/blog/archive/151/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery API Documentation in TiddlyWiki</title>
		<link>http://fnd.lewcid.org/blog/archive/143</link>
		<comments>http://fnd.lewcid.org/blog/archive/143#comments</comments>
		<pubDate>Sun, 14 Feb 2010 09:05:43 +0000</pubDate>
		<dc:creator>FND</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[TiddlyWiki]]></category>

		<guid isPermaLink="false">http://fnd.lewcid.org/blog/?p=143</guid>
		<description><![CDATA[The jQuery folks are nice enough to provide a raw XML dump of their API documentation (http://api.jquery.com). I wrote a quick macro to parse that data and store it as tiddlers: http://svn.tiddlywiki.org/Trunk/contributors/FND/plugins/jQueryDocsImportMacro.js Demo: http://fnd.lewcid.org/tmp/jQueryAPI.html http://groups.google.com/group/tiddlywikidev/browse_thread/thread/4974fa9717f669ab]]></description>
			<content:encoded><![CDATA[<blockquote><p>
The jQuery folks are nice enough to provide a raw XML dump of their API documentation (<a href="http://api.jquery.com">http://api.jquery.com</a>).<br />
I wrote a quick macro to parse that data and store it as tiddlers:<br />
<span id="more-143"></span><a href="http://svn.tiddlywiki.org/Trunk/contributors/FND/plugins/jQueryDocsImportMacro.js">http://svn.tiddlywiki.org/Trunk/contributors/FND/plugins/jQueryDocsImportMacro.js</a><br />
Demo:<br />
<a href="http://fnd.lewcid.org/tmp/jQueryAPI.html">http://fnd.lewcid.org/tmp/jQueryAPI.html</a>
</p></blockquote>
<p><a href="http://groups.google.com/group/tiddlywikidev/browse_thread/thread/4974fa9717f669ab">http://groups.google.com/group/tiddlywikidev/browse_thread/thread/4974fa9717f669ab</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fnd.lewcid.org/blog/archive/143/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Idioms For Element Generation</title>
		<link>http://fnd.lewcid.org/blog/archive/109</link>
		<comments>http://fnd.lewcid.org/blog/archive/109#comments</comments>
		<pubDate>Sat, 15 Aug 2009 12:31:41 +0000</pubDate>
		<dc:creator>FND</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://fnd.lewcid.org/blog/?p=109</guid>
		<description><![CDATA[While working on some jQuery-based applications for TiddlyWeb (post upcoming), I noticed there was no obvious concise way to chain the creation of multiple nested elements. Over the course of several discussions with Mike, we&#8217;ve come up with some simple idioms which we hope will make our code a little prettier: var entries = ["foo", [...]]]></description>
			<content:encoded><![CDATA[<p>While working on some <a href="http://jquery.com">jQuery</a>-based applications for <a href="http://tiddlyweb.com">TiddlyWeb</a> (post upcoming), I noticed there was no obvious concise way to chain the creation of multiple nested elements.</p>
<p>Over the course of several discussions with <a href="http://softwareas.com">Mike</a>, we&#8217;ve come up with some simple idioms which we hope will make our code a little prettier:<br />
<span id="more-109"></span></p>
<pre>
var entries = ["foo", "bar", "baz"];

$("&lt;ul /&gt;").
	append($.map(entries, function(item, i) {
		return $("&lt;li /&gt;").text(item)[0];
	})).
	appendTo(container);
</pre>
<pre style="margin-top: 10px">
$.fn.create = function(html) {
	return this.append(html).children(":last");
};

$("&lt;div /&gt;").
	create("&lt;h2 /&gt;").addClass(className).text(heading).end().
	create("&lt;p /&gt;").text(body).end().
	appendTo(container);
</pre>
<p>I&#8217;ve created a simple <a href="http://fnd.lewcid.org/misc/jQuery_idioms.html">demo page</a> (<a href="http://github.com/FND/jquery">source</a>) to better illustrate and explain this new approach, contrasting it with my previous code.</p>
<p>While I&#8217;m sure this sort of thing has been done before, it doesn&#8217;t seem to be common knowledge &mdash; at least nobody in the <a href="irc://irc.freenode.net/jQuery">jQuery IRC channel</a> had any ideas when I first asked.</p>
<p>Any comments (including <a href="http://www.urbandictionary.com/define.php?term=ydiw" title="you're doing it completely wrong">YDICW</a>, if necessary) would be appreciated.</p>
]]></content:encoded>
			<wfw:commentRss>http://fnd.lewcid.org/blog/archive/109/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>JavaScript Framework Detector</title>
		<link>http://fnd.lewcid.org/blog/archive/26</link>
		<comments>http://fnd.lewcid.org/blog/archive/26#comments</comments>
		<pubDate>Fri, 21 Nov 2008 12:49:05 +0000</pubDate>
		<dc:creator>FND</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bookmarklets]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://fnd.lewcid.org/blog/?p=26</guid>
		<description><![CDATA[Heavily inspired by Oskar Krawczyk&#8217;s WTFramework and Paul Downey&#8217;s subsequent enhancements, I&#8217;ve re-engineered this bookmarklet to be more extensible and better support multiple frameworks. In order to avoid confusion with Oskar&#8217;s original[1], I&#8217;ve uninspiringly named it JavaScript Framework Detector[2] (drag this link to your browser&#8217;s bookmarks toolbar or right-click and save it as a bookmark) [...]]]></description>
			<content:encoded><![CDATA[<p>Heavily inspired by Oskar Krawczyk&#8217;s <a href="http://blog.olicio.us/2008/11/08/wtframework-bookmarklet/">WTFramework</a> and Paul Downey&#8217;s <a href="http://blog.whatfettle.com/2008/11/19/wtframework/">subsequent enhancements</a>, I&#8217;ve re-engineered this bookmarklet to be more extensible and better support multiple frameworks.<br />
<span id="more-26"></span><br />
In order to avoid confusion with Oskar&#8217;s original<sup>[1]</sup>, I&#8217;ve uninspiringly named it</p>
<div style="font-size: 1.1em; text-align: center;">
<strong><a href='javascript:(function(){var%20c=document.getElementById("__wtframework");if(c){document.body.removeChild(c);return;}c=document.createElement("div");c.id="__wtframework";c.style.position="fixed";c.style.top="15px";c.style.right="20px";c.style.zIndex="9000";c.style.styleFloat="right";/*%20IE%20*/c.style.cssFloat="right";c.style.border="2px%20solid%20#FFF";c.style.padding="7px%2010px";c.style.MozBorderRadius="5px";c.style.WebkitBorderRadius="5px";c.style.fontFamily="\"Lucida%20Grande\",%20Helvetica,%20Tahoma";c.style.fontSize="0.9em";c.style.color="#FFF";c.style.backgroundColor="#000";c.style.opacity="0.7";c.style.filter="alpha(opacity%20=%2070)";/*%20IE%20*/c.style.MozBoxShadow="0px%200px%2020px%20#000";c.style.WebkitBoxShadow="0px%200px%2020px%20#000";c.style.cursor="pointer";c.href="#";document.body.appendChild(c);c.onclick=function(){this.parentNode.removeChild(this);};var%20frameworks=[];var%20check=function(indicator,name,version){try{if(window[indicator]){frameworks.push({name:name,version:eval(version)});}}catch(ex){}};check("MooTools","MooTools","MooTools.version");check("YAHOO","YUI","YAHOO.util.Dom.VERSION");check("Prototype","Prototype","Prototype.Version");check("Scriptaculous","Script.aculo.us","Scriptaculous.Version");check("jQuery","jQuery","jQuery.fn.jquery");check("dojo","Dojo%20Toolkit","dojo.version");check("MochiKit","MochiKit","MochiKit.MochiKit.VERSION");check("base2","Base2","base2.version");try{if(version&#038;&#038;version.title=="TiddlyWiki"){if(window.formatVersion){var%20v=formatVersion();}else{v=version.major+"."+version.minor+"."+version.revision+(version.beta?"%20(beta%20"+version.beta+")":"");}frameworks.push({name:"TiddlyWiki",version:v});}}catch(ex){}if(frameworks.length){for(var%20i=0;i<frameworks.length;i++){var%20el=document.createElement("div");el.appendChild(document.createTextNode(frameworks[i].name+"%20"+frameworks[i].version));c.appendChild(el);}}else{c.appendChild(document.createTextNode("no%20frameworks%20detected"));}})();'>JavaScript Framework Detector</a></strong><sup>[2]</sup><br />
<small>(drag this link to your browser&#8217;s bookmarks toolbar or right-click and save it as a bookmark)</small>
</div>
<p>The uncompressed source is available <a href="http://github.com/FND/bookmarklets/">on GitHub</a> (also for my previous <a href="http://fnd.lewcid.org/blog/archive/16">TinyURL bookmarklet</a>).</p>
<ol class="footnotes"><li id="footnote_0_26" class="footnote">I&#8217;d be happy for him to merge these changes back into WTFramework, thus rendering this fork obsolete</li><li id="footnote_1_26" class="footnote">created using <a href="http://subsimple.com/bookmarklets/jsbuilder.htm">Bookmarklet Builder</a></li></ol>]]></content:encoded>
			<wfw:commentRss>http://fnd.lewcid.org/blog/archive/26/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TinyURL Bookmarklet</title>
		<link>http://fnd.lewcid.org/blog/archive/16</link>
		<comments>http://fnd.lewcid.org/blog/archive/16#comments</comments>
		<pubDate>Mon, 18 Feb 2008 12:01:10 +0000</pubDate>
		<dc:creator>FND</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bookmarklets]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://fnd.lewcid.org/blog/archive/16</guid>
		<description><![CDATA[Since I frequently use TinyURLs, I&#8217;ve come up with a bookmarklet to simplify the process of providing both the TinyURL and the original URL[1]: TinyURL[2] (drag this link to your browser&#8217;s bookmarks toolbar or right-click and save it as a bookmark) This bookmarklet works in two steps: On the first click, the TinyURL is created. [...]]]></description>
			<content:encoded><![CDATA[<p>Since I frequently use <a href="http://tinyurl.com">TinyURLs</a>, I&#8217;ve come up with a <a href="http://lewcid.org/tiddlywiki-bookmarklets/">bookmarklet</a> to simplify the process of providing both the TinyURL and the original URL<sup>[1]</sup>:<br />
<span id="more-16"></span></p>
<div style="font-size: 1.1em; text-align: center;">
<strong><a href="javascript:(function(){function extractTinyURL(){var txt=document.body.innerHTML;var RE=/(http:\/\/tinyurl.com\/\w+)/;var original=document.getElementsByName('url')[0].value;var tiny=txt.match(RE)[1];return tiny+' ('+original+')';}function displayTinyURL(){var txt=extractTinyURL();var c=document.createElement('div');c.style.position='absolute';c.style.top='25%';c.style.left='25%';c.style.width='50%';c.style.width='border: 2px solid #AAA';c.style.padding='50px';c.style.backgroundColor='#EEE';var e=document.createElement('input');e.setAttribute('type','text');e.setAttribute('value',txt);e.style.width='100%';c.appendChild(e);document.body.appendChild(c);e.select();}if(document.location.toString().indexOf('tinyurl.com')==-1)document.location.href='http://tinyurl.com/create.php?url='+location.href;else displayTinyURL();})()">TinyURL</a></strong><sup>[2]</sup><br />
<small>(drag this link to your browser&#8217;s bookmarks toolbar or right-click and save it as a bookmark)</small>
</div>
<p>This bookmarklet works in two steps: On the first click, the TinyURL is created. The second click then extracts both URLs from the page and presents them in a newly-created input field, ready to copy and paste.<br />
The original plan was to circumvent the first step by using a hidden <code>IFRAME</code> element. However, due to <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">XSS</a> restrictions, that seems not to be possible.<br />
<!--more--><br />
<strong>Limitations</strong></p>
<p>TinyURL currently strips in-page anchors from the original URL (e.g. <code>http://domain.tld/index.html#section</code> becomes <code>http://domain.tld/index.html</code>).<br />
I&#8217;m afraid there is nothing I can do about this.</p>
<p>Also, some error handling is currently missing, which might lead to JavaScript errors in case TinyURL change their HTML structure.</p>
<p><strong>Source Code</strong><br />
(latest version available <a href="http://github.com/FND/bookmarklets/">on GitHub</a>)</p>
<pre>
function extractTinyURL() {
    var txt = document.body.innerHTML;
	var RE = /(http:\/\/tinyurl.com\/\w+)/;
	var original = document.getElementsByName("url")[0].value;
	var tiny = txt.match(RE)[1];
	return tiny + " (" + original + ")";
}

function displayTinyURL() {
	var txt = extractTinyURL();
	var c = document.createElement("div");
	c.style.position = "absolute";
	c.style.top = "25%";
	c.style.left = "25%";
	c.style.width = "50%";
	c.style.width = "border: 2px solid #AAA";
	c.style.padding = "50px";
	c.style.backgroundColor = "#EEE";
	var e = document.createElement("input");
	e.setAttribute("type", "text");
	e.setAttribute("value", txt);
	e.style.width = "100%";
	c.appendChild(e);
	document.body.appendChild(c);
	e.select();
}

if(document.location.toString().indexOf("tinyurl.com") == -1)
	document.location.href = "http://tinyurl.com/create.php?url=" + location.href;
else
	displayTinyURL();
</pre>
<p>Feel free to suggest improvements!</p>
<p><strong>2008-11-21:</strong> added link to GitHub repository</p>
<ol class="footnotes"><li id="footnote_0_16" class="footnote">see <a href="http://groups.google.com/group/TiddlyWiki/browse_thread/thread/329677d4a845de63/">here</a> for my reasoning on this</li><li id="footnote_1_16" class="footnote">created using <a href="http://subsimple.com/bookmarklets/jsbuilder.htm">Bookmarklet Builder</a></li></ol>]]></content:encoded>
			<wfw:commentRss>http://fnd.lewcid.org/blog/archive/16/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
