<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: bookmarklet code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 27 Jul 2008 02:52:17 GMT</pubDate>
    <description>DZone Snippets: bookmarklet code</description>
    <item>
      <title>Tweetburner Bookmarklet</title>
      <link>http://snippets.dzone.com/posts/show/5276</link>
      <description>// javscript bookmarklet for tweetburner&lt;br /&gt;&lt;code&gt;&lt;br /&gt;javascript:void(location.href='http://tweetburner.com/links/create?url='+location.href)&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 23 Mar 2008 23:16:47 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5276</guid>
      <author>gvenk (Gerard van Enk)</author>
    </item>
    <item>
      <title>delicious read later bookmarklet</title>
      <link>http://snippets.dzone.com/posts/show/5195</link>
      <description>&lt;code&gt;&lt;br /&gt;javascript:delicious=window.open('https://api.del.icio.us/v1/posts/add?description='+encodeURIComponent(document.title)+'&amp;tags=2read'+'&amp;url='+window.location.href,'delicious','toolbar=no,width=50,height=50');setTimeout('delicious.close()',1500);&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 03 Mar 2008 01:51:24 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5195</guid>
      <author>caffo ()</author>
    </item>
    <item>
      <title>DOM Mouse-Over Element Selection and Isolation</title>
      <link>http://snippets.dzone.com/posts/show/4513</link>
      <description>DOM ISO.v.0.3.0.7.bookmarklet.js&lt;br /&gt;bookmarklet for selecting and isolating an element on a page.&lt;br /&gt;&lt;br /&gt;two sections:&lt;br /&gt;section 1:  Mouseover DOM, setup and handle mouse events and show information about element in informational div.  Click to select, Any key to cancel.&lt;br /&gt;section 2:  Element Isolation with help of XPath.  prompt user for XPath expression  e.g., //DIV[@id='post-body'].  then use XPath to select all elements not(ancestor or descendant or self), then delete those elements.  also ignore self-or-descendants of head and title.&lt;br /&gt;&lt;br /&gt;tools:&lt;br /&gt;Ruderman's javascript development environment:  https://www.squarefree.com/bookmarklets/webdevel.html#jsenv&lt;br /&gt;Mielczarek's js to bookmarklet generator:  http://ted.mielczarek.org/code/mozilla/bookmarklet.html&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;(function() {&lt;br /&gt;	//GLOBALS&lt;br /&gt;		//globals for classMausWork&lt;br /&gt;		var gSelectedElement;	//currently only one selection&lt;br /&gt;		var gHoverElement;		//whatever element the mouse is over&lt;br /&gt;		var gHovering=false;	//mouse is over something&lt;br /&gt;		var gObjArrMW=[];	//global array of classMausWork objects.  for removing event listeners when done selecting.&lt;br /&gt;		&lt;br /&gt;		//extended	&lt;br /&gt;		var infoDiv;		//currently just container for InfoDivHover, might add more here&lt;br /&gt;		var infoDivHover;	//container for hoverText text node.&lt;br /&gt;		var hoverText;		//show information about current element that the mouse is over&lt;br /&gt;		//const EXPERIMENTAL_NEW_CODE=true;	//debugging. new features.&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	//START&lt;br /&gt;	SetupDOMSelection();	&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;		&lt;br /&gt;	//(Section 1) Element Selection&lt;br /&gt;	function SetupDOMSelection()&lt;br /&gt;	{&lt;br /&gt;&lt;br /&gt;		{&lt;br /&gt;			//setup event listeners&lt;br /&gt;			//var pathx="//div | //span | //table | //td | //tr | //ul | //ol | //li | //p";&lt;br /&gt;			var pathx="//div | //span | //table | //th | //td | //tr | //ul | //ol | //li | //p | //iframe";&lt;br /&gt;			var selection=$XPathSelect(pathx);&lt;br /&gt;			for(var element, i=0;element=selection(i);i++)&lt;br /&gt;			{			&lt;br /&gt;				if(element.tagName.match(/^(div|span|table|td|tr|ul|ol|li|p)$/i))	//redundant check.&lt;br /&gt;				{&lt;br /&gt;					var m = new classMausWork(element);&lt;br /&gt;					gObjArrMW.push(m);&lt;br /&gt;					attachMouseEventListeners(m);&lt;br /&gt;				}&lt;br /&gt;			}&lt;br /&gt;			document.body.addEventListener('mousedown',MiscEvent,false);&lt;br /&gt;			document.body.addEventListener('mouseover',MiscEvent,false);&lt;br /&gt;			document.body.addEventListener('mouseout',MiscEvent,false);&lt;br /&gt;			document.addEventListener('keypress',MiscEvent,false);&lt;br /&gt;		}&lt;br /&gt;		{&lt;br /&gt;			//setup informational div to show which element the mouse is over.&lt;br /&gt;			infoDiv=document.createElement('div');&lt;br /&gt;			var s=infoDiv.style;&lt;br /&gt;			s.position='fixed';&lt;br /&gt;			s.top='0';&lt;br /&gt;			s.right='0';&lt;br /&gt;			&lt;br /&gt;			s.display='block';&lt;br /&gt;			s.width='auto';&lt;br /&gt;			s.padding='0px';&lt;br /&gt;&lt;br /&gt;			document.body.appendChild(infoDiv);&lt;br /&gt;			infoDivHover=document.createElement('div');&lt;br /&gt;&lt;br /&gt;			s=infoDivHover.style;&lt;br /&gt;			s.fontWeight='bold';			&lt;br /&gt;			s.padding='3px';&lt;br /&gt;			s.Opacity='0.8';&lt;br /&gt;			s.borderWidth='thin';&lt;br /&gt;			s.borderStyle='solid';&lt;br /&gt;			s.borderColor='white';&lt;br /&gt;			s.backgroundColor='black';&lt;br /&gt;			s.color='white';&lt;br /&gt;			&lt;br /&gt;			infoDiv.appendChild(infoDivHover);			&lt;br /&gt;			hoverText=document.createTextNode('selecting');&lt;br /&gt;			infoDivHover.appendChild(hoverText);&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	function CleanupDOMSelection()&lt;br /&gt;	{&lt;br /&gt;		for(var m; m=gObjArrMW.pop(); )&lt;br /&gt;		{&lt;br /&gt;			detachMouseEventListeners(m);&lt;br /&gt;		}&lt;br /&gt;		ElementRemove(infoDiv);&lt;br /&gt;		document.body.removeEventListener('mousedown',MiscEvent,false);&lt;br /&gt;		document.body.removeEventListener('mouseover',MiscEvent,false);&lt;br /&gt;		document.body.removeEventListener('mouseout',MiscEvent,false);		&lt;br /&gt;		document.removeEventListener('keypress',MiscEvent,false);&lt;br /&gt;	}	&lt;br /&gt;&lt;br /&gt;	function attachMouseEventListeners(c)&lt;br /&gt;	{&lt;br /&gt;		//c is object of class classMausWork&lt;br /&gt;		c.element.addEventListener("mouseover",c.mouse_over,false);				&lt;br /&gt;		c.element.addEventListener("mouseout",c.mouse_out,false);	&lt;br /&gt;		c.element.addEventListener("mousedown",c.mouse_click,false);		&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	function detachMouseEventListeners(c)&lt;br /&gt;	{&lt;br /&gt;		//c is object of class classMausWork&lt;br /&gt;		c.resetElementStyle();&lt;br /&gt;		c.element.removeEventListener("mouseover",c.mouse_over,false);				&lt;br /&gt;		c.element.removeEventListener("mouseout",c.mouse_out,false);	&lt;br /&gt;		c.element.removeEventListener("mousedown",c.mouse_click,false);		&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	//mouse event  handling class for element, el.&lt;br /&gt;	function classMausWork(element)&lt;br /&gt;	{	&lt;br /&gt;		//store information about the element this object is assigned to handle. element,  original style, etc.	&lt;br /&gt;		this.element=element;&lt;br /&gt;		&lt;br /&gt;		var elementStyle=element.getAttribute('style');&lt;br /&gt;		var target;&lt;br /&gt;		&lt;br /&gt;		this.mouse_over=function(ev)&lt;br /&gt;		{	&lt;br /&gt;			if(gHovering)return;&lt;br /&gt;			var e=element;			&lt;br /&gt;			var s=e.style;&lt;br /&gt;			s.backgroundColor='yellow';&lt;br /&gt;			s.borderWidth='thin';&lt;br /&gt;			s.borderColor='lime';&lt;br /&gt;			s.borderStyle='solid';					&lt;br /&gt;			InfoMSG(ElementInfo(e),'yellow','blue','yellow');&lt;br /&gt;			gHoverElement=e;&lt;br /&gt;			gHovering=true;&lt;br /&gt;			target=ev.target;&lt;br /&gt;			ev.stopPropagation();		&lt;br /&gt;		};&lt;br /&gt;		&lt;br /&gt;		this.mouse_out=function(ev)&lt;br /&gt;		{&lt;br /&gt;			if(!gHovering)return;&lt;br /&gt;			if(gHoverElement!=element ||ev.target!=target)return;&lt;br /&gt;			var e=element;&lt;br /&gt;			e.setAttribute('style',elementStyle);&lt;br /&gt;			InfoMSG('-','white','black','white');	&lt;br /&gt;			gHoverElement=null;&lt;br /&gt;			gHovering=false;&lt;br /&gt;			target=null;&lt;br /&gt;			//ev.stopPropagation();&lt;br /&gt;		};&lt;br /&gt;		&lt;br /&gt;		this.mouse_click=function(ev)&lt;br /&gt;		{&lt;br /&gt;			if(!gHovering)return;&lt;br /&gt;			if(gHoverElement!=element ||ev.target!=target)return;&lt;br /&gt;			var e=element;&lt;br /&gt;			e.setAttribute('style',elementStyle);&lt;br /&gt;			ev.stopPropagation();			&lt;br /&gt;			CleanupDOMSelection();			&lt;br /&gt;			gHoverElement=null;&lt;br /&gt;			gHovering=false;&lt;br /&gt;			target=null;&lt;br /&gt;			&lt;br /&gt;			if(ev.button==0)&lt;br /&gt;			{&lt;br /&gt;				gSelectedElement=e;&lt;br /&gt;				ElementSelected(e);	//finished selecting, cleanup then move to next part (section 2), element isolation.&lt;br /&gt;			}&lt;br /&gt;		};&lt;br /&gt;		&lt;br /&gt;		this.resetElementStyle=function()&lt;br /&gt;		{&lt;br /&gt;			element.setAttribute('style',elementStyle);&lt;br /&gt;		};		&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	function MiscEvent(ev)		//keypress, and mouseover/mouseout/mousedown event on body.  cancel selecting.&lt;br /&gt;	{&lt;br /&gt;		if(ev.type=='mouseout' &amp;&amp; !gHovering)&lt;br /&gt;		{&lt;br /&gt;			InfoMSG('-','white','black','white');&lt;br /&gt;		}&lt;br /&gt;		else if(ev.type=='mouseover' &amp;&amp; !gHovering)&lt;br /&gt;		{&lt;br /&gt;			InfoMSG('cancel','yellow','red','yellow');&lt;br /&gt;		}&lt;br /&gt;		else //keypress on document or mousedown on body, cancel ops.&lt;br /&gt;		{&lt;br /&gt;			CleanupDOMSelection();&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	function InfoMSG(text,color,bgcolor,border)&lt;br /&gt;	{&lt;br /&gt;		&lt;br /&gt;		var s=infoDivHover.style;&lt;br /&gt;		if(color)s.color=color;&lt;br /&gt;		if(bgcolor)s.backgroundColor=bgcolor;&lt;br /&gt;		if(border)s.borderColor=border;&lt;br /&gt;		if(text)hoverText.data=text;&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	//(Section 2) Element Isolation&lt;br /&gt;	function ElementSelected(element)	//finished selecting element.  setup string to prompt user.&lt;br /&gt;	{&lt;br /&gt;		PromptUserXpath(ElementInfo(element));&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	&lt;br /&gt;	function PromptUserXpath(defaultpath)		//prompt user, isolate element.&lt;br /&gt;	{&lt;br /&gt;		var userpath = prompt("XPath of elements to isolate : ", defaultpath);&lt;br /&gt;		if(userpath &amp;&amp; userpath.length&gt;0)&lt;br /&gt;		{&lt;br /&gt;			var addPredicate = "[count(./ancestor-or-self::head)=0][count(./ancestor-or-self::title)=0]";	//exclude head &amp; title elements from selection so they aren't removed&lt;br /&gt;			var addPath = "//script | //form | //object | //embed";	//include these elements in selection for removal&lt;br /&gt;			var pathx=TransformXPath_NoAncestorDescendentSelf(userpath, addPredicate, addPath);		//the xpath selection of all elements to be removed/deleted.&lt;br /&gt;			&lt;br /&gt;			try&lt;br /&gt;			{&lt;br /&gt;				var element;&lt;br /&gt;				var elements=$XPathSelect(pathx);	&lt;br /&gt;				for(var i=0;element=elements(i);i++)&lt;br /&gt;				{			&lt;br /&gt;&lt;br /&gt;					if(!element.nodeName.match(/^(head|title)$/i))	//redundant check.&lt;br /&gt;					{&lt;br /&gt;						ElementRemove(element);&lt;br /&gt;					}&lt;br /&gt;				}&lt;br /&gt;			}&lt;br /&gt;			&lt;br /&gt;			catch(err)&lt;br /&gt;			{&lt;br /&gt;				alert("wtf: "+err);&lt;br /&gt;			}&lt;br /&gt;			&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;		&lt;br /&gt;	&lt;br /&gt;	//support&lt;br /&gt;	function $XPathSelect(p, context) &lt;br /&gt;	{&lt;br /&gt;	  if (!context) context = document;&lt;br /&gt;	  var i, arr = [], xpr = document.evaluate(p, context, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);&lt;br /&gt;	  return function(x) { return xpr.snapshotItem(x); };	//closure.  wooot!  returns function-type array of elements (usually elements, or something else depending on the xpath expression).&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	function ElementRemove(e)&lt;br /&gt;	{&lt;br /&gt;		if(e)e.parentNode.removeChild(e);&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	function ElementInfo(element)&lt;br /&gt;	{&lt;br /&gt;		var txt='';&lt;br /&gt;		if(element)&lt;br /&gt;		{&lt;br /&gt;			txt=element.tagName.toLowerCase();		//txt=element.tagName;&lt;br /&gt;			txt=attrib(txt,element,'id');&lt;br /&gt;			txt=attrib(txt,element,'class');	&lt;br /&gt;			txt='//'+txt;&lt;br /&gt;		}&lt;br /&gt;		return txt;&lt;br /&gt;		&lt;br /&gt;		function attrib(t,e,a)&lt;br /&gt;		{			&lt;br /&gt;			if(e.hasAttribute(a))&lt;br /&gt;			{&lt;br /&gt;				t+="[@"+a+"='"+e.getAttribute(a)+"']";&lt;br /&gt;			}&lt;br /&gt;			return t;&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	&lt;br /&gt;	//function to 'invert' the XPath by selecting all elements that are not ancestor and not descendent and not self.&lt;br /&gt;	function TransformXPath_NoAncestorDescendentSelf(u, includePredicates, includePaths)&lt;br /&gt;	{	&lt;br /&gt;		&lt;br /&gt;		//sample input (u):					//div[@class='sortbox']&lt;br /&gt;		//sample output						//*[  not(./descendant-or-self::*=//div[@class='sortbox'])][  not(./ancestor-or-self::*=//div[@class='sortbox'])]&lt;br /&gt;		//sample output with additional conditions:		//*[  not(./descendant-or-self::*=//div[@class='sortbox'])][  not(./ancestor-or-self::*=//div[@class='sortbox'])][count(./ancestor-or-self::head)=0][count(./ancestor-or-self::title)=0]&lt;br /&gt;		&lt;br /&gt;			//obsolete method.  much faster but can only be used for limited types of (simple) xpath expressions -- unlike the current version, which should be able to convert any xpath.&lt;br /&gt;			//input:			table[@id='topbar']&lt;br /&gt;			//output:			//*[not(./descendant-or-self::table[@id='topbar']) and not(./ancestor-or-self::table[@id='topbar'])]&lt;br /&gt;			//output (alternative):	//*[count(./descendant-or-self::table[@id='topbar'])=0 and count(./ancestor-or-self::table[@id='topbar'])=0]&lt;br /&gt;		&lt;br /&gt;		&lt;br /&gt;		var o1=	'./descendant-or-self::*='+gr(u);&lt;br /&gt;		o1=	'not' + gr(o1);&lt;br /&gt;		o1=	nt(o1);	&lt;br /&gt;		var o2= './ancestor-or-self::*='+gr(u);&lt;br /&gt;		o2=	'not' + gr(o2);&lt;br /&gt;		o2=	nt(o2);&lt;br /&gt;&lt;br /&gt;		var o=	'//*'+o1+o2;&lt;br /&gt;		if(includePredicates &amp;&amp; includePredicates.length&gt;0)	o += includePredicates;&lt;br /&gt;		if(includePaths &amp;&amp; includePaths.length&gt;0) o += ' | ' + includePaths;&lt;br /&gt;		return o;&lt;br /&gt;		&lt;br /&gt;		&lt;br /&gt;		function nt(term){return wrap(term,'[]');}	//node test; predicate - enclose with bracket.&lt;br /&gt;		function gr(term){return wrap(term,'()');}	//group - parenthesize.&lt;br /&gt;		function wrap(term, enclosure){return enclosure.charAt(0)+term+enclosure.charAt(1);}&lt;br /&gt;	}	&lt;br /&gt;	&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	&lt;br /&gt;})();&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 09 Sep 2007 01:25:47 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4513</guid>
      <author>jczerg68 (Jon C)</author>
    </item>
    <item>
      <title>Babelfish translate</title>
      <link>http://snippets.dzone.com/posts/show/4265</link>
      <description>Ok, so maybe some of you might think that Babelfish's the best translator out there. I don't know about that , but I do know where my towel is ;)&lt;br /&gt;So, boys and girls, here's the bookmarklet that allows to translate your current web-page using the babelfish translation engine.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;javascript:location.href='http://babelfish.altavista.com/babelfish/tr?trurl='+encodeURIComponent(location.href)+'&amp;lp=%s&amp;btnTrUrl=Translate'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To make it useful, save it as a bookmark in FF (or as a new search engine in Opera) and give it a keyword/shortcut by editing the bookmark's properties in FF (or the search properties in Opera). Let's call him, say 'bf', that should do it.&lt;br /&gt;&lt;br /&gt;Here are some examples:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;bf en_fr&lt;br /&gt;bf fr_en&lt;br /&gt;bf en_ja&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;br /&gt;G.R.</description>
      <pubDate>Thu, 05 Jul 2007 20:48:59 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4265</guid>
      <author>griflet (guillaume riflet)</author>
    </item>
    <item>
      <title>Google translate bookmarklet</title>
      <link>http://snippets.dzone.com/posts/show/4264</link>
      <description>Here's perhaps the most powerful bookmarklet I've ever created ...&lt;br /&gt;This one translates the current web page from your current browser session into another language!&lt;br /&gt;&lt;br /&gt;Syntax from the address bar in your FF or Opera browser:&lt;br /&gt;&lt;code&gt;&lt;br /&gt; tr &lt;FROM&gt;|&lt;TO&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;&lt;code&gt;&lt;br /&gt; tr en|de&lt;br /&gt; tr en|fr&lt;br /&gt; tr en|pt&lt;br /&gt; tr de|en&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Here's the bookmarklet code&lt;br /&gt;&lt;code&gt;&lt;br /&gt;javascript:location.href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&amp;langpair=%s&amp;hl=EN&amp;ie=UTF-8&amp;oe=UTF-8&amp;prev=%2Flanguage_tools'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;FF instructions:&lt;br /&gt;Copy/paste the code in a new bookmark. Then, in the new bookmark properties, edit the keyword/shortcut field and insert 'tr'. That's it!&lt;br /&gt;&lt;br /&gt;Opera instructions:&lt;br /&gt;Copy the bookmarklet code. Then, in tools--&gt;preferences--&gt;search--&gt;add--&gt;details, paste the code in the address field, fill in a name for in the name field, and write 'tr' in the keyword field. Then save all. That's it!</description>
      <pubDate>Thu, 05 Jul 2007 17:25:51 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4264</guid>
      <author>griflet (guillaume riflet)</author>
    </item>
    <item>
      <title>Anidar comentarios en Meneame.net 1&#170; referencia(BookMarklet)</title>
      <link>http://snippets.dzone.com/posts/show/2521</link>
      <description>Anida los comentarios usando el n&#250;mero de comentario (#XX) que los usuarios de Meneame utilizan para referirse a otros comentarios, pero &#250;nicamente tiene en cuenta la 1&#170; referencia.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;javascript:(function() {var cl = document.getElementById("comments-list");var l = null;for(var i in cl.childNodes){l = cl.childNodes.item(i);if(l &amp;&amp; (l.tagName) &amp;&amp; (l.tagName.toUpperCase() == "LI")){var d = l.firstChild;var nc = parseInt(d.id.slice(8));var r = d.firstChild.nextSibling.nextSibling.innerHTML.match(/#[0-9]+/g);var nr = 0;var anidado = false;for(var j in r){nr = parseInt(r[j].slice(1));if((anidado = (nr &gt; 0) &amp;&amp; (nc &gt; nr))){var lr = document.getElementById("comment-" + nr).parentNode;if(lr.lastChild.name != "anidados"){var a = document.createElement("ul");a.name = "anidados";a.style.borderLeft = "1px dotted #aaaaaa";lr.appendChild(a);}lr.lastChild.appendChild(l.cloneNode(true));try{cl.removeChild(l);} catch(e){}break;}}}}})();&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 02 Sep 2006 20:56:09 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2521</guid>
      <author>jnsntndr (jnsntndr)</author>
    </item>
    <item>
      <title>Enlaces entre comentarios en Meneame.net (bookmarlet)</title>
      <link>http://snippets.dzone.com/posts/show/2518</link>
      <description>Funciona como el script de anidar pero enlazando a los comentarios&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;javascript:(function() {var cl = document.getElementById("comments-list");var l = null;for(var i in cl.childNodes){l = cl.childNodes.item(i);if(l &amp;&amp; (l.tagName) &amp;&amp; (l.tagName.toUpperCase() == "LI")){var d = l.firstChild;var nc = parseInt(d.id.slice(8));var nr = 0;var o = d.firstChild.nextSibling.nextSibling;var t = o.innerHTML;var r = t.match(/#[0-9]+/g);for(var j in r){nr = parseInt(r[j].slice(1)); if((nr &gt;0) &amp;&amp; (nc &gt; nr))o.innerHTML = t.replace(r[j],"&lt;a href='" + document.URL.replace(/#comment.*$/g,"") + "#comment-" + nr + "'&gt;" + r[j] +"&lt;/a&gt;")}}}})(); void 0;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 02 Sep 2006 18:55:08 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2518</guid>
      <author>jnsntndr (jnsntndr)</author>
    </item>
    <item>
      <title>Anidar comentarios en Meneame.net (Bookmarklet)</title>
      <link>http://snippets.dzone.com/posts/show/2516</link>
      <description>Anida los comentarios usando el n&#250;mero de comentario (#XX) que los usuarios de Meneame utilizan para referirse a otros comentarios&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;javascript:(function() {var cl = document.getElementById("comments-list");var l = null;for(var i in cl.childNodes){l = cl.childNodes.item(i);if(l &amp;&amp; (l.tagName) &amp;&amp; (l.tagName.toUpperCase() == "LI")){var d = l.firstChild;var nc = parseInt(d.id.slice(8));var r = d.firstChild.nextSibling.nextSibling.innerHTML.match(/#[0-9]+/g);var nr = 0;var anidado = false;for(var j in r){nr = parseInt(r[j].slice(1));if((anidado = (nr &gt; 0) &amp;&amp; (nc &gt; nr))){var lr = document.getElementById("comment-" + nr).parentNode;if(lr.lastChild.name != "anidados"){var a = document.createElement("ul");a.name = "anidados";a.style.borderLeft = "1px dotted #aaaaaa";lr.appendChild(a);}lr.lastChild.appendChild(l.cloneNode(true));try{cl.removeChild(l);} catch(e){}}}}}})(); void 0;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 02 Sep 2006 15:57:02 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2516</guid>
      <author>jnsntndr (jnsntndr)</author>
    </item>
    <item>
      <title>logging bookmarklets for debugging javascript</title>
      <link>http://snippets.dzone.com/posts/show/2443</link>
      <description>Dragg the following two links to your browser's toolbar (tested with Firefox 1.5 and IE 6) :&lt;br /&gt;&lt;a href="javascript:(function(){log49 = [];})()"&gt;49.cl&lt;/a&gt;&lt;br /&gt;&lt;a href="javascript:(function(){alert(log49.join('\n-=-=-=-=-=\n'));})()"&gt;49.sh&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When you are writing some javascript embedded in a webpage and you want to debug your code, this gives you way to log things without alerting them. &lt;br /&gt;&lt;br /&gt;Example :&lt;br /&gt;&lt;code&gt;&lt;br /&gt;// part of embedded javascript code&lt;br /&gt;log49 = [];//log49 is global variable.&lt;br /&gt;var num = 1;&lt;br /&gt;log49.push('num = '+num); // log the state of num&lt;br /&gt;num = num+1;&lt;br /&gt;log49.push('second num ='+num); // again.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then the two bookmarklets let you reset or view the log in runtime.&lt;br /&gt;49.cl lets you reset the log by clearing the list stored in the global variable log49.&lt;br /&gt;49.sh shows you the log by joining and alerting the value of log49.&lt;br /&gt;</description>
      <pubDate>Sat, 19 Aug 2006 01:37:57 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2443</guid>
      <author>em3zh3 (Doc Aha)</author>
    </item>
    <item>
      <title>Open Text Links // Bookmarklet</title>
      <link>http://snippets.dzone.com/posts/show/2441</link>
      <description>Open Text Links :  this bookmarklet collects strings of the form http://... or https://... in the user-selected text and then open them all in new windows. tested with Firefox 1.5 and IE 6.&lt;br /&gt;&lt;br /&gt;The code&lt;br /&gt;&lt;code&gt;&lt;br /&gt;javascript:(function(){var w=window,d=document,rg=/\bhtt(p|ps)\:\/\/\S+\b/ig,gS='getSelection';var links=(''+(w[gS]? w[gS]():(d[gS]?d[gS]():d.selection.createRange().text))).match(rg);if(confirm(links.join('\n')))for(var i=0,len=links.length;i&lt;len;i++) w.open(links[i]);alert('done');})()&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Code with comments&lt;br /&gt;&lt;code&gt;&lt;br /&gt;javascript:(function(){&lt;br /&gt;  var w=window,d=document,rg=/\bhtt(p|ps)\:\/\/\S+\b/ig,gS='getSelection';&lt;br /&gt;&lt;br /&gt;  // set links = the list of strings of the form http:/... or https:/... in the selected area&lt;br /&gt;  var links=(''+(w[gS]? w[gS]():(d[gS]?d[gS]():d.selection.createRange().text))).match(rg);&lt;br /&gt;&lt;br /&gt;  // if user confirms the list then open them all in new windows and then alert 'done'.&lt;br /&gt;  if(confirm(links.join('\n')))&lt;br /&gt;     for(var i=0,len=links.length;i&lt;len;i++)&lt;br /&gt;        w.open(links[i]);alert('done');&lt;br /&gt;})()&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 19 Aug 2006 00:58:00 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2441</guid>
      <author>em3zh3 (Doc Aha)</author>
    </item>
  </channel>
</rss>
