<?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; bookmarklets</title>
	<atom:link href="http://fnd.lewcid.org/blog/archive/tag/bookmarklets/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>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>
