<?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>Conroyp.com</title>
	<atom:link href="http://www.conroyp.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.conroyp.com</link>
	<description>Technically speaking</description>
	<lastBuildDate>Tue, 22 Jun 2010 17:10:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Analytics eccentricities</title>
		<link>http://www.conroyp.com/2010/06/22/analytics-eccentricities/</link>
		<comments>http://www.conroyp.com/2010/06/22/analytics-eccentricities/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 17:10:54 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[bugfix]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://www.conroyp.com/?p=209</guid>
		<description><![CDATA[Back around the start of March, I noticed that pretty much every time I logged in to Google Analytics I was running in to problems with the summary views. The dashboard would typically load up my list of sites, then freeze without actually fetching any data. Refreshing the page would usually sort this out, before [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Back around the start of March, I noticed that pretty much every time I logged in to Google Analytics I was running in to problems with the summary views.</p>
<p>The dashboard would typically load up my list of sites, then freeze without actually fetching any data. Refreshing the page would usually sort this out, before the same thing happened again when I click in to a site's individual profile.</p>
<div id="attachment_242" class="wp-caption aligncenter" style="width: 535px"><a href="http://www.conroyp.com/wp-content/uploads/2010/06/dashboard.png"><img src="http://www.conroyp.com/wp-content/uploads/2010/06/dashboard.png" alt="" title="Dashboard Hanging" width="525" height="196" class="size-full wp-image-242" /></a><p class="wp-caption-text">Still loading..</p></div><br />
<span id="more-209"></span></p>
<p>
Occasionally, rather than the page just hanging, there would also be an error message to the effect of "This page has encountered an error which may prevent it from working correctly" which would appear in red at the top of the page. Again, refreshing the page would cause both of these to go away and normal service to resume.</p>
<p><div id="attachment_230" class="wp-caption aligncenter" style="width: 535px"><a href="http://www.conroyp.com/wp-content/uploads/2010/05/Analytics-Bug.png"><img src="http://www.conroyp.com/wp-content/uploads/2010/05/Analytics-Bug.png" alt="Analytics quirk" title="Analytics quirk" width="525" height="64" class="size-full wp-image-230" /></a><p class="wp-caption-text">We have a(n intermittent) problem</p></div>
<p>
<br />
As a refresh would sort these issues out after a brief wait, they were minor annoyances, but never annoying enough to justify time and energy spent hunting the web for a cure - more an itchy finger than a bad foot cramp.
</p>
<p>But eventually, that itch has to be scratched, so I looked in to it a little bit more. I eventually came across the following tid-bit on the <a href="http://www.google.com/support/forum/p/Google+Analytics/thread?tid=07ce7e97a706fee8&#038;hl=en">analytics support forum</a>:</p>
<blockquote><p>mobpage: try to set your date an time of computer ..it will work after that </p></blockquote>
<p>My local clock was running a bit fast, so I set it back by 10 minutes or so, and the errors magically disappeared! </p>
<h4>So what's happening here?</h4>
<p>Good question. As with all issues relating to google javascript, it's quite difficult to find out exactly what's at the root of this. The javascript is compressed and minified, so reverse-engineering it would require substantially more time than would be worth it!<br />
My suspicion is that at some point in the javascript analytics attempts to evaluate the difference between the local clock and the remote server one. This difference can be handy to have when working with date-sensitive info stored remotely, such as the raw analytics data. </p>
<p>My suspicion is that somewhere along the line a bug snuck in, whereby this code allows for there to be 0 difference, or for the server to be ahead of the local machine, but forget the check for the local machine to be ahead of the server.<br />
As such, when the local time is too far ahead, the code gets confused by the difference, hangs, and blocks the subsequent code from loading. </p>
<h4>Why does it work fine when you refresh the page?</h4>
<p>I'm guessing that this issue doesn't affect a page reload due to the combination of browser caching and black magic that appears when a js-heavy page is refreshed, namely that the initial checks are mostly cached and thus not capable of blocking the subsequent page load code which was previously prevented from running. As such, the rest of the page can be rendered without issue.</p>
<p>Again, most of the above is pure speculation on my part without any real assessment of the underlying code. However, the important point here is that I no longer get page freezes/red error bars in analytics, and the response time is noticeably faster, all from one clock change!</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.conroyp.com/2010/06/22/analytics-eccentricities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Grab Bag of Bookmarklets</title>
		<link>http://www.conroyp.com/2010/04/18/a-grab-bag-of-bookmarklets/</link>
		<comments>http://www.conroyp.com/2010/04/18/a-grab-bag-of-bookmarklets/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 15:46:21 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[whois]]></category>

		<guid isPermaLink="false">http://www.conroyp.com/?p=179</guid>
		<description><![CDATA[A (semi-) frequently updated list of simple bookmarklets I've found somewhat useful. Some of the more complex ones for use on twitter.com (Custom filtering of the timeline and Hovercard removal) are discussed in more detail elsewhere on the site. The below are a collection of short and sweet bookmarklets that do a simple but effective [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>A (semi-) frequently updated list of simple bookmarklets I've found somewhat useful. Some of the more complex ones for use on twitter.com (<a href="http://www.conroyp.com/2010/03/11/declutter/">Custom filtering of the timeline</a> and <a href="http://www.conroyp.com/2010/03/20/decluttering-twitter-part-deux/">Hovercard removal</a>) are discussed in more detail elsewhere on the site. The below are a collection of short and sweet bookmarklets that do a simple but effective job.</p>
<p><span id="more-179"></span><br />
<b>Quick Links</b></p>
<ul>
<li><a href='#whois'>WHOIS Lookup</a></li>
<li><a href='#dual_site'>Dual Site Toggle</a></li>
<li><a href='#dfeojm'>Down for everyone, or just me?</a></li>
</ul>
<p></p>
<h3 id='whois'>WHOIS Lookup</h3>
<p><a href="http://en.wikipedia.org/wiki/WHOIS">WHOIS</a> is a protocol for finding out the contact details of the owner of a domain. Traditionally this information is accessed via the command line, however a number of websites now exist as wrappers for this information. </p>
<p>Sites such as <a href="http://who.is/">Who.is</a> allow accessing of domain ownership and contact info via a web browser. What's particularly nice about the who.is site is that you can query any site by placing the domain name you wish to query at the end of the who.is url, i.e. http://who.is/daft.ie will give WHOIS info for Daft.ie.</p>
<p>This simple <a href="javascript:window.location = 'http://who.is/whois/'+window.location.host;">WHOIS bookmarklet</a> automates this process. Clicking this bookmarklet will query the WHOIS info for the site you're currently on, via the who.is site. Copy the code below in to a new bookmarklet, or drag the WHOIS bookmarklet link above to your browser's bookmarks bar.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">window.<span style="color: #660066;">location</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'http://who.is/whois/'</span><span style="color: #339933;">+</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">host</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p></p>
<h3 id='dual_site'>Dual Site Toggle</h3>
<p>This bookmarklet when you want compare the same page on two different sites which both use the same url structure, e.g. a local development environment (localhost) and the same page on the live server (example.com).<br />
For this example, we'll compare property result pages on <a href="http://www.daft.ie">Daft.ie</a> with the same ones on the mobile version of the site, <a href="http://m.daft.ie">m.daft.ie</a>.</p>
<p>First, we decide on the two sites between which we want to toggle.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> siteA <span style="color: #339933;">=</span> <span style="color: #3366CC;">'www.daft.ie'</span><span style="color: #339933;">;</span><br />
<span style="color: #003366; font-weight: bold;">var</span> siteB <span style="color: #339933;">=</span> <span style="color: #3366CC;">'m.daft.ie'</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>
Next we need to grab the filename of the current page, as well as any query string arguments. This value will stay the same between both sites.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #006600; font-style: italic;">// Store the filename and query string, where applicable</span><br />
<span style="color: #003366; font-weight: bold;">var</span> sstr <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span><br />
<span style="color: #006600; font-style: italic;">// Query string exists?</span><br />
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">search</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; sstr <span style="color: #339933;">=</span> window.<span style="color: #660066;">location</span>.<span style="color: #660066;">pathname</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'?'</span><span style="color: #339933;">+</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">search</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000066; font-weight: bold;">else</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; sstr <span style="color: #339933;">=</span> window.<span style="color: #660066;">location</span>.<span style="color: #660066;">pathname</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>
Finally, we need to figure out which host we're on, and then switch to the other one!</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">host</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>siteA<span style="color: #009900;">&#41;</span><span style="color: #339933;">==-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; window.<span style="color: #660066;">location</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'http://'</span><span style="color: #339933;">+</span>siteA<span style="color: #339933;">+</span>sstr<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000066; font-weight: bold;">else</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; window.<span style="color: #660066;">location</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'http://'</span><span style="color: #339933;">+</span>siteB<span style="color: #339933;">+</span>sstr<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>As it's a bookmarklet, we need to compress it all down to one line.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">javascript<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">var</span> siteA <span style="color: #339933;">=</span> <span style="color: #3366CC;">'www.daft.ie'</span><span style="color: #339933;">;</span>var siteB <span style="color: #339933;">=</span> <span style="color: #3366CC;">'m.daft.ie'</span><span style="color: #339933;">;</span>var sstr <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>if<span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">search</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>sstr <span style="color: #339933;">=</span> window.<span style="color: #660066;">location</span>.<span style="color: #660066;">pathname</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'?'</span><span style="color: #339933;">+</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">search</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>sstr <span style="color: #339933;">=</span> window.<span style="color: #660066;">location</span>.<span style="color: #660066;">pathname</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>if<span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">host</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>siteA<span style="color: #009900;">&#41;</span><span style="color: #339933;">==-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>window.<span style="color: #660066;">location</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'http://'</span><span style="color: #339933;">+</span>siteA<span style="color: #339933;">+</span>sstr<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>window.<span style="color: #660066;">location</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'http://'</span><span style="color: #339933;">+</span>siteB<span style="color: #339933;">+</span>sstr<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>To use this toggle, you can either copy the above code to a new bookmarklet, or drag this <a href="javascript:var siteA = 'www.daft.ie';var siteB = 'm.daft.ie';var sstr = '';if(window.location.search.substring(1).length>1){sstr = window.location.pathname+'?'+window.location.search.substring(1);}else{sstr = window.location.pathname;};if(window.location.host.indexOf(siteA)==-1){window.location='http://'+siteA+sstr;}else{window.location = 'http://'+siteB+sstr;};">Site toggle</a> link to your bookmarks bar.<br />
<br />To see it in action, we can pick <a href="http://www.daft.ie/searchsale.daft?id=428175">a random house on Daft.ie</a> (in this case, the house used by TV3's The Apprentice), then click the bookmarklet to toggle between the mobile and web versions of the same page.</p>
<p>Updating this for any other pair of sites is as simple as editing the siteA and siteB variables in the bookmarklet.</p>
<p></p>
<h3 id='dfeojm'>Down for everyone, or just me?</h3>
<p><a href="http://www.downforeveryoneorjustme.com">Downforeveryoneorjustme.com</a> is a site that comes in handy when trying to check whether a site being inaccessible is a problem with the site itself, or your local network. It will basically ping the server from a location different to your own, and see if it's still available from there.</p>
<p>We're basically doing the same thing here as we did for the WHOIS bookmarklet above, so:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">window.<span style="color: #660066;">location</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'http://www.downforeveryoneorjustme.com/'</span><span style="color: #339933;">+</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">host</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>
Dragging this <a href="javascript:window.location = 'http://www.downforeveryoneorjustme.com/'+window.location.host;">DFEOJM bookmarklet</a> to your browser's bookmarks bar will let you check the next time you get a "server inaccessible" error message whether the problem is on your network or with the site itself.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.conroyp.com/2010/04/18/a-grab-bag-of-bookmarklets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bookmarklets &#8211; a quick explanation!</title>
		<link>http://www.conroyp.com/2010/04/04/bookmarklets-a-quick-explanation/</link>
		<comments>http://www.conroyp.com/2010/04/04/bookmarklets-a-quick-explanation/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 00:37:28 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.conroyp.com/?p=154</guid>
		<description><![CDATA[I've been tinkering quite a bit lately with improving the twitter web interface with the use of bookmarklets. I've put together a series of bookmarklets which allow you to do everything from apply custom filters to your twitter timeline, to removing the "Hovercards" which Twitter have recently added. Most of the feedback I've received both [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I've been tinkering quite a bit lately with improving the <a href="http://www.twitter.com">twitter</a> web interface with the use of bookmarklets. I've put together a series of bookmarklets which allow you to do everything from <a href="http://www.conroyp.com/2010/03/11/declutter/">apply custom filters to your twitter timeline</a>, to <a href="http://www.conroyp.com/2010/03/20/decluttering-twitter-part-deux/">removing the "Hovercards"</a> which Twitter have recently added.</p>
<p>Most of the feedback I've received both in the comments here and on twitter has been very positive, but I've also heard from a few folk who have had difficulty actually saving the bookmarklets and getting them to work.</p>
<p>Admittedly, the posts on the bookmarklets did assume a certain level of technical know-how, so this post is intended as a quick intro for those who want to use the bookmarklets, but aren't quite sure where to start.</p>
<p><span id="more-154"></span></p>
<h3>So what is a bookmarklet?</h3>
<p>A <a href="http://en.wikipedia.org/wiki/Bookmarklet">bookmarklet</a> is:</p>
<blockquote><p>a small computer application, stored as the URL of a bookmark in a web  browser or as a hyperlink on a web page. [...] They are  designed to add one-click functionality to a browser or web  page. When clicked, a bookmarklet performs some function, one of a wide  variety such as a search query or data extraction.</p></blockquote>
<p>So bookmarklets basically allow us as a user to add some basic functionality to a web site from our browser, without needing to have access to that site's server. Once the bookmarklet is clicked, whatever javascript it contains will execute on the current page.</p>
<p>In this case, we have bookmarklets specifically crafted for twitter's web site (filtering our timeline, removing hovercards, etc) so when we go to twitter.com and click the bookmarklet, our custom code shall be run by our browser as if it were part of twitter's own code.</p>
<p>So, how do we save and then run these bookmarklets? Well, there are several different options..</p>
<p>&nbsp;</p>
<h3>Option 1 - Drag and drop!</h3>
<p>Probably the quickest way of saving a bookmarklet is to drag it from it's location on the page and drop it on your bookmark bar.<br />
First, we need to make sure the bookmarks bar is accessible. The bookmark bar is typically found immediately under the address bar in your browser (highlighted in red on the image below).</p>
<p>If you're running Firefox or Internet Explorer, then it should be showing by default. On Chrome, you may have to press "Ctrl+B", or go to "Settings" (spanner icon) then click "Always show bookmark bar".</p>
<div id="attachment_157" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.conroyp.com/wp-content/uploads/2010/04/BookmarkBar.png"><img class="size-medium wp-image-157" title="BookmarkBar" src="http://www.conroyp.com/wp-content/uploads/2010/04/BookmarkBar-300x63.png" alt="Bookmark Bar (Firefox)" width="300" height="63" /></a><p class="wp-caption-text">Bookmark Bar (Firefox)</p></div>
<p>Once your bookmark bar is visible, you can click on a bookmarklet link, drag it to this bar, then have it ready to run!</p>
<p>So, given this <a href="javascript:twttr.HOVERCARD.disable();$('ul.sidebar-menu%20a').bind('click',%20function(e)%20{twttr.HOVERCARD.disable();});void(0);">Disable Hovercard</a> link, all you need to do is:</p>
<ul>
<li>press your mouse down on the link above (do not let go of the mouse button!)</li>
<li>drag your mouse to an empty spot on your bookmark bar</li>
<li>let go of the mouse button</li>
</ul>
<p>You should know see a "Disable Hovercard" bookmarklet on your bookmark bar. Go to twitter.com, click this bookmarklet and you should not see any more hovercards!</p>
<div id="attachment_159" class="wp-caption aligncenter" style="width: 464px"><a href="http://www.conroyp.com/wp-content/uploads/2010/04/BookmarkletSuccess.png"><img class="size-full wp-image-159" title="BookmarkletSuccess" src="http://www.conroyp.com/wp-content/uploads/2010/04/BookmarkletSuccess.png" alt="Bookmarklet" width="454" height="96" /></a><p class="wp-caption-text">Success!</p></div>
<p>&nbsp;</p>
<h3>Option 2 - Let the browser do it</h3>
<p>Most browsers have menu options which will do the same thing as the dragging-and-dropping above.</p>
<p>&nbsp;</p>
<p><strong>Internet Explorer</strong></p>
<div id="attachment_161" class="wp-caption aligncenter" style="width: 310px"><strong> </strong><strong><a href="http://www.conroyp.com/wp-content/uploads/2010/04/IEFav.png"><img class="size-medium wp-image-161" title="IEFav" src="http://www.conroyp.com/wp-content/uploads/2010/04/IEFav-300x155.png" alt="Adding a bookmarklet - IE" width="300" height="155" /></a></strong><p class="wp-caption-text">Adding a Bookmarklet - IE</p></div>
<ul>
<li>Right-click on the "<a href="javascript:twttr.HOVERCARD.disable();$('ul.sidebar-menu%20a').bind('click',%20function(e)%20{twttr.HOVERCARD.disable();});void(0);">Disable Hovercard</a>" bookmarklet link</li>
<li>Select "Add a Favourite.."</li>
<li>You can re-title the bookmarklet using the "Name" field, if you want</li>
<li>Select "Favourites Bar" from the "Create in" menu</li>
<li>Press "Add"</li>
</ul>
<p>&nbsp;</p>
<p><strong>Firefox</strong></p>
<div id="attachment_164" class="wp-caption aligncenter" style="width: 310px"><strong> </strong><strong><a href="http://www.conroyp.com/wp-content/uploads/2010/04/FFFav.png"><img class="size-medium wp-image-164" title="FFFav" src="http://www.conroyp.com/wp-content/uploads/2010/04/FFFav-300x157.png" alt="Adding a bookmarklet - FF" width="300" height="157" /></a></strong><p class="wp-caption-text">Adding a Bookmarklet - Firefox</p></div>
<ul>
<li>Right-click on the "<a href="javascript:twttr.HOVERCARD.disable();$('ul.sidebar-menu%20a').bind('click',%20function(e)%20{twttr.HOVERCARD.disable();});void(0);">Disable  Hovercard</a>" bookmarklet link</li>
<li>Select "Bookmark This Link"</li>
<li>If you want, you can rename the bookmarklet using the "Name" field</li>
<li>Select "Bookmarks Toolbar" from the "Folder" drop-down</li>
<li>Click "Save"</li>
</ul>
<p><strong>Chrome</strong><br />
Currently, Chrome doesn't have an easy right-click option for saving bookmarklets, so if you're on Chrome, you'll have to follow Option 1 above!</p>
<p>&nbsp;</p>
<h3>That's all folks!</h3>
<p>And that's all there is to it! You should now have a "Disable Hovercard" bookmarklet on your bookmark bar. To see it in action:</p>
<ul>
<li>go to twitter.com and log in</li>
<li>mouse over a username in a tweet to see the hovercard appear</li>
<li>click the bookmarklet</li>
<li>mouse over the same username, and - hey presto - the hovercard should now be gone</li>
</ul>
<p>And that's all there is to it! The same process can be applied for any other bookmarklet, including the <a href="http://www.conroyp.com/2010/03/11/declutter/">timeline filtering bookmarklet</a> (remove those foursquare check-ins, xbox achievements and other such auto-tweets!)</p>
<p>So hopefully this post should help make things a little clearer for those who were having trouble with the bookmarklets previously - if not, let me know in the comments below!</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.conroyp.com/2010/04/04/bookmarklets-a-quick-explanation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DeCluttering Twitter, Part Deux</title>
		<link>http://www.conroyp.com/2010/03/20/decluttering-twitter-part-deux/</link>
		<comments>http://www.conroyp.com/2010/03/20/decluttering-twitter-part-deux/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 19:46:42 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[hovercard]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.conroyp.com/?p=123</guid>
		<description><![CDATA[If you're just here to learn how to kill the Twitter Hovercards, then drag the Hovercard Removal bookmarklet to your browser's bookmarks bar, go twitter.com, click it and you're done! Read on if you're in any way curious about the technical errata behind this.. Most of my twitter usage comes via applications that makes use [...]


Related posts:<ol><li><a href='http://www.conroyp.com/2010/03/11/declutter/' rel='bookmark' title='Permanent Link: DeClutter'>DeClutter</a> <small>Updated 28/03/2010 - changed how the bookmarklet re-applies itself to...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><b>If you're just here to learn how to kill the Twitter Hovercards, then drag the <a href="javascript:twttr.HOVERCARD.disable();$('ul.sidebar-menu a').bind('click', function(e) {twttr.HOVERCARD.disable();});$('#home_link, #logo').attr('data', '{\'dispatch_action\':\'home\'}');$('#home_link, #logo').addClass('in-page-link');$('.in-page-link').isInPageLink();$('#results_update').text('Hovercards removed succesfully').show();void(0);">Hovercard Removal</a> bookmarklet to your browser's bookmarks bar, go twitter.com, click it and you're done!<br />
Read on if you're in any way curious about the technical errata behind this..</b></p>
<p>Most of my <a href="http://twitter.com/conroyp">twitter</a> usage comes via applications that makes use of the API, such as Tweetie on the iPhone or the Echofon plugin for Firefox. However, I still spend a considerable amount of my time a-tweetin' via the web interface.</p>
<p>For the most part, twitter's web interface is reasonably clean, but there are still a few niggly bits that I'd rather do without. Luckily, one of the beauties of the web interface is that it allows the usage of bookmarklets, so if there's something you don't like, a quick line of javascript in the browser's address bar will sort it out!</p>
<p>I've <a href="http://www.conroyp.com/2010/03/11/declutter/">written previously</a> about using bookmarklets to hide tweets from your timeline that contain blacklisted words (sport-related, xbox achievements, etc). The next step is now to use bookmarklets to tweak the web interface itself. A nice side-effect of Twitter's use of jQuery for the web interface is that all of the jQuery selectors and functions are available to us, should we need them. </p>
<p>We'll start by hiding the Hovercard!<br />
<span id="more-123"></span></p>
<p>&nbsp;</p>
<h3>Hiding the Hovercard</h3>
<p>Twitter recently launched <a href="http://blog.twitter.com/2010/02/flying-around-with-hovercards.html">"Hovercards"</a> on the web interface. According to the blog announcement, hovercards are:</p>
<blockquote><p>cards which appear when you hover over a username or avatar. The cards display additional information about the person and allow you to interact with them while staying within the context of your page.</p></blockquote>
<div id="attachment_130" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.conroyp.com/wp-content/uploads/2010/03/boosh-screenshot2.jpg"><img class="size-medium wp-image-130" title="Twitter Hovercards" src="http://www.conroyp.com/wp-content/uploads/2010/03/boosh-screenshot2-300x108.jpg" alt="" width="300" height="108" /></a><p class="wp-caption-text">Hovercards (via Twitter blog)</p></div>
<p>All good and well, and potentially useful. However, whenever I move my  mouse up, down or across my timeline, these hovercards are springing up  and obscuring other tweets in the timeline. Personally, I've been  finding this feature far more annoying than useful, so would like to  turn it off.</p>
<p>Fortunately, twitter have a very handy javascript function call available to do just that:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">twttr.<span style="color: #660066;">HOVERCARD</span>.<span style="color: #660066;">disable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>So, sticking</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">javascript<span style="color: #339933;">:</span>twttr.<span style="color: #660066;">HOVERCARD</span>.<span style="color: #660066;">disable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>void<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>in to the browser's address bar will stop these hovercards from appearing again on the main timeline. So far, so good.</p>
<p>However, once any of the links on the right side of the interface are clicked ("@ replies", "Retweets", etc), then suddenly the hovercards are back in force. Now we need to ensure that the hovercards are disabled whenever these links are clicked. We can do this by attaching the disable() call to the click event for any of these links on the sidebar.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul.sidebar-menu a'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; twttr.<span style="color: #660066;">HOVERCARD</span>.<span style="color: #660066;">disable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>One unfortunate limitation of bookmarklets is that their effect only lasts while you stay on the same page - if you hit F5 or reload the page in any way, they need to be re-applied. For most of the links on the twitter web interface, this isn't an issue as they reload dynamically without refreshing the whole page (@ Replies, Direct Messages, etc). </p>
<p>However, somewhat erratically, the "Home" link and twitter logo at the top of the page both link to twitter.com in the traditional fashion. Clicking either of these out of habit to reload the page will mean that the effect of the bookmarklet is lost, and it must be re-applied. </p>
<p>This is a bit of a pain, so instead we will use the bookmarklet to make both of these links behave the same way as the "Home" link on the right hand sidebar.</p>
<p>Looking at the source of the twitter homepage, there are two things on each of the sidebar links which cause them to load content in situ, rather than requiring the browser to load a whole new page:</p>
<ul>
<li>A dispatch_action attached to a data attribute</li>
<li>The class in-page-link</li>
</ul>
<p>So we adjust our bookmarklet to add the same dispatch_action to the data attribute of the main logo link (id #logo) and the "Home" link at the top of the page (id #home_link). We want them to behave the same way as the "Home" link in the sidebar, so we assign the same data action.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#home_link, #logo'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'data'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'{<span style="color: #000099; font-weight: bold;">\'</span>dispatch_action<span style="color: #000099; font-weight: bold;">\'</span>:<span style="color: #000099; font-weight: bold;">\'</span>home<span style="color: #000099; font-weight: bold;">\'</span>}'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Next we need to add the appropriate class, in-page-link. However, adding this class alone won't do anything. On initial page load, jQuery applies a handler to each link of this type which causes the opening of links without the need for a full page refresh. We need to re-call this function so that it is applied to our newly-classed links.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#home_link, #logo'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'in-page-link'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.in-page-link&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">isInPageLink</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Finally, we want some visual confirmation that this has all worked as planned! We can re-use twitter's notification bar to display a success message.</p>
<div id="attachment_131" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.conroyp.com/wp-content/uploads/2010/05/hovercards_applied.png"><img class="size-medium wp-image-130" title="Twitter Hovercards removed" src="http://www.conroyp.com/wp-content/uploads/2010/05/hovercards_applied.png" alt="Hovercards removed successfully!"" width="500" /></a><p class="wp-caption-text">Hovercards removed successfully!</p></div>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#results_update'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Hovercards removed succesfully'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Combining all of this in to a single bookmarklet gives us <a href="javascript:twttr.HOVERCARD.disable();$('ul.sidebar-menu a').bind('click', function(e) {twttr.HOVERCARD.disable();});$('#home_link, #logo').attr('data', '{\'dispatch_action\':\'home\'}');$('#home_link, #logo').addClass('in-page-link');$('.in-page-link').isInPageLink();$('#results_update').text('Hovercards removed succesfully').show();void(0);">Hovercard removal</a>. Drag this to your browser's toolbar then click it when logged in to twitter.com, and hovercards shall be no more.</p>
<p>Other quick-and-dirty bookmarklets:</p>
<p><b>Removing the "Trending Topics" list</b><br />
The "Trending Topics" list is stored in a div named 'trends'. Removing this using jQuery is as simple as:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">javascript<span style="color: #339933;">:</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#trends'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>void<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>which gives a <a href="javascript:$('#trends').remove();void(0);">Remove Trending List</a> bookmarklet.</p>
<p><b>Removing the Twitter ad</b><br />
It's a small thing, but some people aren't too fond of the small twitter text ad in the top right of the web interface.<br />
This ad has the associated class "promotion", so fortunately, removing it is as simple as</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">javascript<span style="color: #339933;">:</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.promotion'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>void<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>which gives the <a href="javascript:$('.promotion').remove();void(0);">Remove Twitter Ad</a> bookmarklet.</p>
<p>&nbsp;</p>
<h3>Quick-access Bookmarklets</h3>
<p>Drag these bookmarklets to your browser's bookmarks bar for quick access when logged in to twitter's web interface.</p>
<ul>
<li><a href="javascript:twttr.HOVERCARD.disable();$('ul.sidebar-menu a').bind('click', function(e) {twttr.HOVERCARD.disable();});$('#home_link, #logo').attr('data', '{\'dispatch_action\':\'home\'}');$('#home_link, #logo').addClass('in-page-link');$('.in-page-link').isInPageLink();$('#results_update').text('Hovercards removed succesfully').show();void(0);">Hovercard Removal</a></li>
<li><a href="javascript:$('#trends').remove();void(0);">Remove Trending List</a></li>
<li><a href="javascript:$('.promotion').remove();void(0);">Remove Twitter Ad</a></li>
<li><a href="javascript:$('.promotion').remove();$('#trends').remove();twttr.HOVERCARD.disable();$('ul.sidebar-menu a').bind('click', function(e) {twttr.HOVERCARD.disable();});$('#home_link, #logo').attr('data', '{\'dispatch_action\':\'home\'}');$('#home_link, #logo').addClass('in-page-link');$('.in-page-link').isInPageLink();$('#results_update').text('Hovercards removed succesfully').show();void(0);">Hovercard, Ad &#038; Trends removal</a> (all 3 of the above combined)</li>
</ul>
<p>&nbsp;</p>
<p><b>Unsure about how exactly to save a bookmarklet?</b><br />
For those of you who may be a little unsure about how exactly you would save or run a bookmarklet, I've put together a <a href="http://www.conroyp.com/2010/04/04/bookmarklets-a-quick-explanation/">quick introduction to bookmarklets</a>, which will hopefully make things a little clearer!</p>


<p>Related posts:<ol><li><a href='http://www.conroyp.com/2010/03/11/declutter/' rel='bookmark' title='Permanent Link: DeClutter'>DeClutter</a> <small>Updated 28/03/2010 - changed how the bookmarklet re-applies itself to...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.conroyp.com/2010/03/20/decluttering-twitter-part-deux/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>DeClutter</title>
		<link>http://www.conroyp.com/2010/03/11/declutter/</link>
		<comments>http://www.conroyp.com/2010/03/11/declutter/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 21:23:51 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[bookmarklet]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.conroyp.com/?p=46</guid>
		<description><![CDATA[Updated 28/03/2010 - changed how the bookmarklet re-applies itself to now work in realtime, rather than at clumsy, staggered intervals. Twitter can be a very useful tool, particularly once you've built up a decent-sized network of people with interests common to your own. The twitter timeline is often compared to being in a pub filled [...]


Related posts:<ol><li><a href='http://www.conroyp.com/2010/03/20/decluttering-twitter-part-deux/' rel='bookmark' title='Permanent Link: DeCluttering Twitter, Part Deux'>DeCluttering Twitter, Part Deux</a> <small>If you're just here to learn how to kill the...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><b><i>Updated 28/03/2010 - changed how the bookmarklet re-applies itself to now work in realtime, rather than at clumsy, staggered intervals.</i></b></p>
<p>Twitter can be a very useful tool, particularly once you've built up a decent-sized network of people with interests common to your own. The twitter timeline is often compared to being in a pub filled exclusively with your friends, and being able to hear all of the conversations going on at once.</p>
<p>However, just as you have that friend who occasionally likes to go in to excrutiating detail about his collection of porcelain squirrels, there are times when your interests diverge and you'd rather not hear the full details of next weekend's Porcelainathon. And so it is with Twitter.</p>
<p>Once you've started following more than a handful of people, you'll occasionally find your timeline filling up with tweets about things that you're really not that interested in. You'd rather not take the nuclear option and unfollow those involved, as they generally have interesting/useful tweets. But equally you'd rather not have to scroll through 3 pages of automated tweets about foursquare checkins, app downloads and the like.</p>
<p>&nbsp;</p>
<h3>Enter DeClutter</h3>
<p>DeClutter is a javascript bookmarklet which will remove from your timeline any tweets which match a "blacklist" of keywords you've defined. </p>
<p>Below you can enter a series of terms which you want to banish from your timeline (one term per line). After entering them, you can either copy and paste the resulting javascript in to a bookmarklet in your browser, or drag the DeClutter link at the bottom of the page to your browser's bookmarks bar.<br />
<span id="more-46"></span><br />
Once it has been saved, log on to twitter.com and click your new bookmarklet. Straight away you should see tweets disappearing from the timeline. This filter will re-apply itself automatically in the background every time you click "more", "@ replies", etc, so you don't need to re-click the bookmarklet whenever your timeline is refreshed.<br />
This can lead to some odd behaviour, such as only 3-4 tweets appearing instead of 20 when you click "more", or not additional tweets appearing when you click the blue "new tweets" bar. This means that tweets which have been loaded matched your filters, and have been removed without ever being displayed to you.</p>
<p>&nbsp;</p>
<h3>Customise DeClutter</h3>
<p>Enter words or phrases you wish to banish from your timeline below. Alternatively, you can try one of the below general category links to get you started!<br />
<a href="#txtFilter" onclick="jQuery('#txtFilters').val('mufc\nlfc\nrooney\nchelsea\ndrogba\ngoal\nkeane\ntorres\ngerrard\nronaldo').trigger('keyup');">Sport</a> | <a href="#txtFilter" onclick="jQuery('#txtFilters').val('fianna\nfine gael\nsinn fein\nbudget\ntribunal\ndail\ndáil\nlenihan\ncowen\nharney\ngilmore\ninda').trigger('keyup');">Irish Politics</a> | <a href="#txtFilter" onclick="jQuery('#txtFilters').val('ps3\nxbox\npsp\nnintendo\nwii').trigger('keyup');">Computer games</a> | <a href="#txtFilter" onclick="jQuery('#txtFilters').val('foursquare\nxboxtweet\nmacheist\nmr. tweet\nroflquiz').trigger('keyup');">Auto-tweets</a></p>
<p><script type="text/javascript">
var filters = Array();
jQuery(document).ready(function(){
    // Catch default values..
    filters = jQuery('#txtFilters').val().trim().split("\n");
    updateBookmarklet();
    var jInput = jQuery( "#txtin" );
    jQuery( "#txtFilters" ).keyup(
        function(){
            filters = jQuery(this).val().trim().split("\n");
            updateBookmarklet();
        }
    );
});
var bkmrkFirst = "javascript:$('body').bind('ajaxSuccess',declutter);void(declutter());function declutter(){";
var bkmrkLast = "$.each($('.hentry'), function(){var c = $(this).html(); var p = $(this); $.each(rk, function(i, v){ if(c.toLowerCase().indexOf(v) > 0){p.remove();}});});";
function updateBookmarklet()
{
    var conds = Array();
    var fcon = Array();
    var str = '';
    jQuery.each(filters, function(){
        fcon.push(this.toLowerCase().replace(/[']/, "\\\'"));
    });
    var htmlin = bkmrkFirst+"var rk=['"+fcon.join("', '")+"'];"+bkmrkLast+'}';
    jQuery('#bkmrk').html(htmlin);
    jQuery('#quickLink').attr('href', htmlin);    
}
</script></p>
<p>Enter keywords below:<br />
<textarea id="txtFilters" class="inputFilters" cols="30" rows="4">Election</textarea></p>
<p>&nbsp;</p>
<h3>Your bookmarklet</h3>
<p>The text below will automatically update as you enter keywords above. When you're done adding, copy the below text in to a new bookmarklet.</p>
<div id="bkmrk" style='width:400px;font-size:12px;font-face:Courier;line-height:16px;padding:2px;border:1px dotted grey;'>&nbsp;</div>
<p>Alternatively, drag this <a id="quickLink">DeClutter bookmarklet</a> to your browser's bookmark bar.</p>
<p>&nbsp;</p>
<h3>What now?</h3>
<p>After dragging the bookmarklet to your browser's bookmark bar, log in to twitter.com, click it and that's all there is to it!</p>
<p>If you've got any suggestions for refinements to this bookmarklet, let me know in the comments below. Equally, feel free to share your own list of keyword filters for inclusion on the category list above!</p>
<p>&nbsp;</p>
<h3>The Tech Bit</h3>
<p>The twitter web interface presents the timeline as a styled list. Each list element has a number of classes, chief amongst them "hentry".<br />
The declutter function inside the bookmarklet loops through all elements with the class "hentry" on the currently-visible page, then checks whether any of the blacklisted keywords are present in the html of that element.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">function</span> declutter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Remove tweets containing these terms!</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> rk<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'election'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Twitter timeline entries have class &quot;hentry&quot; - loop through them, </span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// removing those that match blacklisted term</span><br />
&nbsp; &nbsp; $.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.hentry'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> c <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> p <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Iterate through the keywords, removing the parent element </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// where a match is found</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span>rk<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> v<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Lower-case the text so case issues don't trip us up</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>c.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>v.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p><b>Updated 28/03/2010 - we're now using the ajaxSuccess event, rather than the crude, browser-crashery and slightly hacky setTimeout call!</b></p>
<p>Of course, this bookmarklet wouldn't be all that useufl if you had to re-apply it every time you click "@ replies", "more", "new tweets", etc. In order to have the filters be re-applied automatically, we can bind it to the <a href="http://api.jquery.com/ajaxSuccess/">ajaxSuccess</a> event. This event is conveniently fired by jQuery </p>
<blockquote><p>whenever an Ajax request completes successfully... Any and all handlers that have been registered with the .ajaxSuccess()  method are executed at this time.
</p></blockquote>
<p>As all of the various twitter timelines are loaded via ajax requests, binding the declutter function to this event ensures that it will be re-run after each successful loading of the timeline, meaning that we don't have to worry about manually re-applying the bookmarklet.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'body'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ajaxSuccess'</span><span style="color: #339933;">,</span>declutter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>We then wrap the call to declutter() up in a void() call to prevent the browser from opening a new page, and that's all there is to it!</p>
<p>&nbsp;</p>
<h3>FAQ</h3>
<p>- <i>Will I still see the hidden tweets if I use Tweetie/Echofon/Twitter API?</i><br />
Yes, this bookmarklet only affects the web interface to twitter.</p>
<p>- <i>Will this bookmarklet automatically run every time I visit twitter.com?</i><br />
If you have closed your browser or the tab in which you first ran the bookmarklet, then you will need to start it again.</p>
<p>- <i>On which browsers have you tested this?</i><br />
It's been tested in the latest versions of Firefox, IE &#038; Chrome. If you're using an earlier version of any of these, it *should* work, but YMMV. If it fails horribly in earlier browsers, let me know via the comments below and I'll see about updating it.</p>
<p>- <i>You say 'bookmarklet' a lot. What is that?</i><br />
A bookmarklet is a small application, stored as the URL of a bookmark in a web browser or as a hyperlink on a web page, or so sayeth <a href="http://en.wikipedia.org/wiki/Bookmarklet">the wiki</a>.</p>
<p>- <i>I'm not particularly technical - can you explain how exactly I 'save' a bookmarklet?</i><br />
I've put together a <a href="http://www.conroyp.com/2010/04/04/bookmarklets-a-quick-explanation/">quick introduction to bookmarklets</a> which will hopefully make things a bit clearer!</p>
<p>- <i>Hmm. I think there's a better way of doing this</i><br />
This has been hacked together very quickly using a few basic jQuery functions, I'm sure there's plenty of room for improvement! If you've got suggestions for improvement, let me know via the comments below.</p>
<p>- <i>How very Web2.0 - why didn't you call it DeCluttr?</i><br />
I did originally, then discovered that the name had already <a href="http://www.decluttr.com">been taken</a>. After that I tried to come up with a catchy new name, but <a href="http://blog.stackoverflow.com/2009/03/it-stack-overflow-update-naming-is-hard/">naming things is hard</a>.</p>
<p>- <i>You should have some pictures on this post. I like pictures.</i><br />
That's not really a question. Still, if you must, <a href="http://gallery.mtbr.com/data/mtbr/500/orson_welles.gif">have an image</a>.</p>


<p>Related posts:<ol><li><a href='http://www.conroyp.com/2010/03/20/decluttering-twitter-part-deux/' rel='bookmark' title='Permanent Link: DeCluttering Twitter, Part Deux'>DeCluttering Twitter, Part Deux</a> <small>If you're just here to learn how to kill the...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.conroyp.com/2010/03/11/declutter/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
