<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://commons.oreilly.com/wiki/skins/common/feed.css?97"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://commons.oreilly.com/wiki/index.php?title=Greasemonkey_Hacks/Site_Integration&amp;action=history&amp;feed=atom</id>
		<title>Greasemonkey Hacks/Site Integration - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://commons.oreilly.com/wiki/index.php?title=Greasemonkey_Hacks/Site_Integration&amp;action=history&amp;feed=atom"/>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Greasemonkey_Hacks/Site_Integration&amp;action=history"/>
		<updated>2013-05-19T18:49:58Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.11.0</generator>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Greasemonkey_Hacks/Site_Integration&amp;diff=9640&amp;oldid=prev</id>
		<title>Docbook2Wiki: Initial conversion from Docbook</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Greasemonkey_Hacks/Site_Integration&amp;diff=9640&amp;oldid=prev"/>
				<updated>2008-03-11T23:10:08Z</updated>
		
		<summary type="html">&lt;p&gt;Initial conversion from Docbook&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 23:10, 11 March 2008&lt;/td&gt;
			&lt;/tr&gt;
		&lt;/table&gt;</summary>
		<author><name>Docbook2Wiki</name></author>	</entry>

	<entry>
		<id>http://commons.oreilly.com/wiki/index.php?title=Greasemonkey_Hacks/Site_Integration&amp;diff=7963&amp;oldid=prev</id>
		<title>Docbook2Wiki: Initial conversion from Docbook</title>
		<link rel="alternate" type="text/html" href="http://commons.oreilly.com/wiki/index.php?title=Greasemonkey_Hacks/Site_Integration&amp;diff=7963&amp;oldid=prev"/>
				<updated>2008-03-11T20:29:52Z</updated>
		
		<summary type="html">&lt;p&gt;Initial conversion from Docbook&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Greasemonkey Hacks/TOC}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hacks 90–94: Introduction ==&lt;br /&gt;
&lt;br /&gt;
One of the most powerful features of Greasemonkey scripts is the ability to integrate different sites in ways that neither site expected. This can be as simple as adding a form on one site that submits data to another site, or as complex as pulling data from disparate sites and combining them dynamically.&lt;br /&gt;
&lt;br /&gt;
Most of the hacks in this chapter rely on a Greasemonkey API function called &amp;lt;tt&amp;gt;GM_xmlhttpRequest&amp;lt;/tt&amp;gt;, which allows user scripts to get and post data to any site, anywhere, at any time. As you may recall from &amp;quot;Avoid Common Pitfalls&amp;quot; [[Greasemonkey Hacks/Getting Started#Avoid Common Pitfalls|'''[Hack #12]''']], this function was the center of a number of security holes in previous versions of Greasemonkey. Those vulnerabilities have long since been resolved, but you should always be aware of the power that Greasemonkey provides. It's a wonderful thing, but like every sufficiently advanced technology, it can be used for evil as well as good.&lt;br /&gt;
&lt;br /&gt;
All the scripts in this chapter are safe to use, which is to say that they only do what they claim to do. Where there are unavoidable privacy concerns, I call them out specifically in the text.&lt;br /&gt;
&lt;br /&gt;
== Translate Any Web Page ==&lt;br /&gt;
&lt;br /&gt;
'''Add a form at the top of every web page to translate it into your language'''.&lt;br /&gt;
&lt;br /&gt;
Google Language Tools offers automated online translation of any web page. It's simple to use; just visit ''http://translate.google.com'', enter the URL of the page, and select the source and target languages.&lt;br /&gt;
&lt;br /&gt;
As is the case with so many web services, it would be even simpler to use if it were integrated with the web pages you visit. This hack adds a form at the top of every web page to hook it into Google's translation service.&lt;br /&gt;
&lt;br /&gt;
=== The Code ===&lt;br /&gt;
&lt;br /&gt;
This user script runs on all pages. It contains a hardcoded matrix of all the translations that Google Language Tools can perform automatically. English dominates the lists, as both a source and a target language. The script attempts to autodiscover the page's language by looking for a &amp;lt;tt&amp;gt;lang&amp;lt;/tt&amp;gt; attribute on the &amp;lt;tt&amp;gt;&amp;lt;html&amp;gt;&amp;lt;/tt&amp;gt; element. In XHTML, authors can also specify the language in the &amp;lt;tt&amp;gt;xml:lang&amp;lt;/tt&amp;gt; attribute, but that functionality is left as an exercise for the reader. In theory, authors can also specify the language in the &amp;lt;tt&amp;gt;Content-Language&amp;lt;/tt&amp;gt; HTTP header, but HTTP headers are not accessible to user scripts, so we can't check for that either.&lt;br /&gt;
&lt;br /&gt;
On the bright side, the script does remember your previous choices for source and target languages, using the &amp;lt;tt&amp;gt;GM_setValue&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;GM_getValue&amp;lt;/tt&amp;gt; functions to store your preferences in the local Firefox preferences registry.&lt;br /&gt;
&lt;br /&gt;
Save the following user script as ''translatepage.user.js:''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
		// ==UserScript==&lt;br /&gt;
		// @name		  Translate Page&lt;br /&gt;
		// @namespace	  http://diveintomark.org/projects/greasemonkey/&lt;br /&gt;
		// @description   translate pages with Google Language Tools&lt;br /&gt;
		// @include		  http://*&lt;br /&gt;
		// @include		  https://*&lt;br /&gt;
		// @exclude		  http://www.google.com/language_tools*&lt;br /&gt;
		// @exclude		  http://translate.google.com/*&lt;br /&gt;
		// ==/UserScript==&lt;br /&gt;
	&lt;br /&gt;
		if (location.pathname == '/translate_c') return;&lt;br /&gt;
		&lt;br /&gt;
		var arArTranslate = {};&lt;br /&gt;
		arArTranslate['en'] = ['de', 'es', 'fr', 'it', 'pt', 'ja', 'ko', 'zh-CN'];&lt;br /&gt;
		arArTranslate['de'] = ['en', 'fr'];&lt;br /&gt;
		arArTranslate['es'] = ['en'];&lt;br /&gt;
		arArTranslate['fr'] = ['en', 'de'];&lt;br /&gt;
		arArTranslate['it'] = ['en'];&lt;br /&gt;
		arArTranslate['pt'] = ['en'];&lt;br /&gt;
		arArTranslate['ja'] = ['en'];&lt;br /&gt;
		arArTranslate['ko'] = ['en'];&lt;br /&gt;
		arArTranslate['zh-CN'] = ['en'];&lt;br /&gt;
		&lt;br /&gt;
		var arTranslateName = { &lt;br /&gt;
			'en': 'English', &lt;br /&gt;
			'es': 'Spanish', &lt;br /&gt;
			'de': 'German', &lt;br /&gt;
			'fr': 'French', &lt;br /&gt;
			'it': 'Italian', &lt;br /&gt;
			'pt': 'Portuguese', &lt;br /&gt;
			'ja': 'Japanese', &lt;br /&gt;
			'ko': 'Korean', &lt;br /&gt;
			'zh-CN': 'Chinese (Simplified)'};&lt;br /&gt;
&lt;br /&gt;
		var langSource; &lt;br /&gt;
		var attrLang = document.evaluate(&amp;quot;//html/@lang&amp;quot;, document, null, &lt;br /&gt;
			XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; &lt;br /&gt;
		if (attrLang) {&lt;br /&gt;
			langSource = attrLang.value; }&lt;br /&gt;
		if (!(langSource in arArTranslate)) {&lt;br /&gt;
			langSource = GM_getValue('lang.source') || 'en'; &lt;br /&gt;
		}&lt;br /&gt;
		var langTarget = GM_getValue('lang.target') || arArTranslate[langSource][0];&lt;br /&gt;
		for (var i = arArTranslate[langSource].length; i &amp;gt;= 0; i--) {&lt;br /&gt;
			if (arArTranslate[langSource][i] == langTarget) break; &lt;br /&gt;
		}&lt;br /&gt;
		if (i &amp;lt; 0) {&lt;br /&gt;
			langTarget = arArTranslate[langSource][0]; &lt;br /&gt;
		}&lt;br /&gt;
		var elmTranslateDiv = document.createElement('div');&lt;br /&gt;
		elmTranslateDiv.style.borderBottom = '1px solid silver';&lt;br /&gt;
		elmTranslateDiv.style.textAlign = 'right';&lt;br /&gt;
		var htmlSelect = '&amp;lt;select name=&amp;quot;langpair&amp;quot; id=&amp;quot;langpair&amp;quot;&amp;gt;';&lt;br /&gt;
		for (var langOneSource in arArTranslate) {&lt;br /&gt;
			for (var i = 0; i &amp;lt; arArTranslate[langOneSource].length; i++) {&lt;br /&gt;
				langOneTarget = arArTranslate[langOneSource][i];&lt;br /&gt;
				htmlSelect += '&amp;lt;option value=&amp;quot;' + langOneSource + '|' +&lt;br /&gt;
				langOneTarget + '&amp;quot;' +&lt;br /&gt;
				(((langOneSource == langSource) &amp;amp;&amp;amp; (langOneTarget ==&lt;br /&gt;
		langTarget)) ?&lt;br /&gt;
				 ' selected' : '') + '&amp;gt;' + arTranslateName[langOneSource] + &lt;br /&gt;
				 ' to ' + arTranslateName[langOneTarget] + '&amp;lt;/option&amp;gt;';&lt;br /&gt;
			} &lt;br /&gt;
		}&lt;br /&gt;
		htmlSelect += '&amp;lt;/select&amp;gt; ';&lt;br /&gt;
		elmTranslateDiv.innerHTML =&lt;br /&gt;
			 '&amp;lt;form id=&amp;quot;translatepage&amp;quot; &amp;lt;/nowiki&amp;gt;Googleweb page translation using Google Language Tools&amp;lt;nowiki&amp;gt;method=&amp;quot;GET&amp;quot; ' +&lt;br /&gt;
			 'action=&amp;quot;http://translate.google.com/translate&amp;quot; ' +&lt;br /&gt;
			 'style=&amp;quot;font-size: small; font-family: sans-serif;&amp;quot;&amp;gt;' +&lt;br /&gt;
			 'Translate this &amp;lt;/nowiki&amp;gt;integrationpage top form for language translationpage from ' +&lt;br /&gt;
 			 htmlSelect +&lt;br /&gt;
 			 '&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;u&amp;quot; value=&amp;quot;' + location + '&amp;quot;&amp;gt;' +&lt;br /&gt;
 			 '&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;hl&amp;quot; value=&amp;quot;en&amp;quot;&amp;gt;' +&lt;br /&gt;
 			 '&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;c2coff&amp;quot; value=&amp;quot;1&amp;quot;&amp;gt;' +&lt;br /&gt;
 			 '&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;ie&amp;quot; value=&amp;quot;UTF-8&amp;quot;&amp;gt;' +&lt;br /&gt;
 			 '&amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;oe&amp;quot; value=&amp;quot;UTF-8&amp;quot;&amp;gt;' +&lt;br /&gt;
 			 '&amp;lt;input type=&amp;quot;submit&amp;quot; value=&amp;quot;Translate&amp;quot;&amp;gt;' +&lt;br /&gt;
 			 '&amp;lt;/form&amp;gt;';&lt;br /&gt;
 		document.body.insertBefore(elmTranslateDiv, document.body.firstChild); &lt;br /&gt;
 		var elmTranslateForm = document.getElementById('translatepage');&lt;br /&gt;
 		if (!elmTranslateForm) return;&lt;br /&gt;
 		elmTranslateForm.addEventListener('submit', function(event) {&lt;br /&gt;
 			 var elmSelect = document.getElementById('langpair');&lt;br /&gt;
 			 if (!elmSelect) return true;&lt;br /&gt;
 			 var ssValue = elmSelect.value;&lt;br /&gt;
 	 var langSource = ssValue.substring(0, ssValue.indexOf('|'));&lt;br /&gt;
 			 var langTarget = ssValue.substring(ssValue.indexOf('|') + 1);&lt;br /&gt;
 			 GM_setValue('lang.source', langSource);&lt;br /&gt;
 			 GM_setValue('lang.target', langTarget);&lt;br /&gt;
 			 return true;&lt;br /&gt;
 		}, true);&lt;br /&gt;
&lt;br /&gt;
=== Running the Hack ===&lt;br /&gt;
&lt;br /&gt;
After installing the user script (Tools → Install This User Script), go to ''http://greasemonkey.mozdev.org''. At the top of the page, you will see drop-down box labeled &amp;quot;Translate this page from.&amp;quot; This hack tries to autopopulate the source language by looking at the page's metadata. However, many pages do not properly specify their language, so you might need to tweak the value manually.&lt;br /&gt;
&lt;br /&gt;
After selecting the appropriate values, click Translate to see Google's translation, as shown in [[Greasemonkey Hacks/Site Integration#greasemonkeyhks-CHP-11-FIG-1|Figure 11-1]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;greasemonkeyhks-CHP-11-FIG-1&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 11-1. Greasemonkey home page in Spanish'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Greasemonkey Hacks_I_11_tt378.png|Greasemonkey home page in Spanish]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the translation is done entirely by a computer, it is far from perfect. In some cases, it is wildly and humorously inaccurate. (There are entire sites devoted to cataloging humorous computer translations of famous texts. Some people have entirely too much free time.) But Google's autotranslation will usually be accurate enough to give you a general overview of what the author was trying to express.&lt;br /&gt;
&lt;br /&gt;
== Warn Before Buying an Album ==&lt;br /&gt;
&lt;br /&gt;
'''Find out whether an album is produced by a record label that supports the RIAA'''.&lt;br /&gt;
&lt;br /&gt;
There are people in the world who dislike the Recording Industry Association of America (RIAA) because of their simultaneous disregard for both artists' rights (cheating artists with lopsided contracts) and customers' rights (suing fans and treating them like thieves). I am not one of those people, but I still like this hack, because it demonstrates Greasemonkey's role in enabling what I call ''passive activism''.&lt;br /&gt;
&lt;br /&gt;
My theory is that there is a small group of activists who will go out of their way to boycott the RIAA. But there is a much larger group of people who would like to boycott, but they don't actually get around to doing the necessary research when they're about to buy something. This hack helps that larger group, by adding an icon next to an album title on Amazon.com that shows whether this album is produced by a record label that supports the RIAA. It doesn't prevent you from buying the album; it just reminds you that you once cared enough to install a script that would remind you to think about this issue before buying.&lt;br /&gt;
&lt;br /&gt;
=== The Code ===&lt;br /&gt;
&lt;br /&gt;
This user script runs on all Amazon.com pages. It parses the URL to get the ASIN—a globally unique identifier that identifies the album you're browsing—and then uses the &amp;lt;tt&amp;gt;GM_xmlhttpRequest&amp;lt;/tt&amp;gt; function to check the Magnetbox (''http://www.magnetbox.com'') database to determine whether this album is produced by a company that supports the RIAA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;warning&amp;quot;&amp;gt;&lt;br /&gt;
'''Warning'''&lt;br /&gt;
&lt;br /&gt;
This script sends information about your Amazon.com browsing habits to Magnetbox. You should run this script only if you are comfortable exposing this information.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the following user script as ''riaa-radar.user.js:''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
		// ==UserScript==&lt;br /&gt;
		// @name		RIAA Radar&lt;br /&gt;
		// @namespace	http://www.magnetbox.com/riaa/&lt;br /&gt;
		// @description Warn before buying albums produced by RIAA-supported labels&lt;br /&gt;
		// @include		http://*.amazon.tld/*&lt;br /&gt;
		// ==/UserScript==&lt;br /&gt;
		&lt;br /&gt;
		// based on code by Ben Tesch&lt;br /&gt;
		// included here with his gracious permission&lt;br /&gt;
		var radar = 'http://www.magnetbox.com/riaa/check.asp?asin=';&lt;br /&gt;
		var asin = &amp;quot;&amp;quot;;&lt;br /&gt;
		var index = location.href.indexOf('/-/');&lt;br /&gt;
		if (index != -1) {&lt;br /&gt;
			asin = location.href.substring(index + 3, index + 13);&lt;br /&gt;
		} else { &lt;br /&gt;
			index = location.href.indexOf('ASIN'); &lt;br /&gt;
			if (index != -1) {&lt;br /&gt;
				asin = location.href.substring(index + 5, index + 15);&lt;br /&gt;
			} &lt;br /&gt;
		} &lt;br /&gt;
		if (!asin) { return; }&lt;br /&gt;
		GM_xmlhttpRequest({method:'GET', url: radar + asin,&lt;br /&gt;
			onload:function(results) {&lt;br /&gt;
			var status = &amp;quot;unknown&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
			if (results.responseText.match('button_warn.gif')) {&lt;br /&gt;
				status = &amp;quot;Warning!&amp;quot;;&lt;br /&gt;
			} else {&lt;br /&gt;
				if (results.responseText.match('No album was found.')) {&lt;br /&gt;
				status = &amp;quot;Unknown&amp;quot;;&lt;br /&gt;
				} else {&lt;br /&gt;
				status = &amp;quot;Safe!&amp;quot;;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			var origTitle = document.evaluate(&amp;quot;//b[@class='sans']&amp;quot;,&lt;br /&gt;
				document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,&lt;br /&gt;
				null).singleNodeValue;&lt;br /&gt;
			if (!origTitle) { return; }&lt;br /&gt;
			var div = origTitle.parentNode;&lt;br /&gt;
			var titlechld = origTitle.firstChild;&lt;br /&gt;
			var title = titlechld.nodeValue;&lt;br /&gt;
			var newTitle = document.createElement('b');&lt;br /&gt;
			newTitle.setAttribute('class', 'sans');&lt;br /&gt;
			var titleText = document.createTextNode(title);&lt;br /&gt;
			newTitle.appendChild(titleText);&lt;br /&gt;
			var sp = document.createTextNode(' ');&lt;br /&gt;
			var link = document.createElement('a');&lt;br /&gt;
			link.setAttribute('title', &amp;quot;RIAA Radar&amp;quot;);&lt;br /&gt;
			link.setAttribute('href', radar + asin);&lt;br /&gt;
			&lt;br /&gt;
			var pic = document.createElement('img');&lt;br /&gt;
			pic.setAttribute('title', &amp;quot;RIAA Radar: &amp;quot; + status);&lt;br /&gt;
			if (status == 'Warning!') {&lt;br /&gt;
				pic.src = &amp;quot;http://www.magnetbox.com/riaa/images/button_warn2.gif&amp;quot;;&lt;br /&gt;
			} else if (status == 'Safe!') {&lt;br /&gt;
				pic.src = &amp;quot;http://www.magnetbox.com/riaa/images/button_safe2.gif&amp;quot;;&lt;br /&gt;
			} else {&lt;br /&gt;
				pic.src = &amp;quot;http://www.magnetbox.com/riaa/images/button_caution2.&lt;br /&gt;
		gif&amp;quot;;&lt;br /&gt;
			}&lt;br /&gt;
				pic.style.border = &amp;quot;0px&amp;quot;;&lt;br /&gt;
				link.appendChild(pic);&lt;br /&gt;
				&lt;br /&gt;
				div.insertBefore(newTitle, origTitle);&lt;br /&gt;
				div.insertBefore(sp, origTitle);&lt;br /&gt;
				div.insertBefore(link, origTitle);&lt;br /&gt;
				div.removeChild(origTitle);&lt;br /&gt;
			}});&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running the Hack ===&lt;br /&gt;
&lt;br /&gt;
After installing the user script (Tools → Install This User Script), go to ''http://www.amazon.com'' and search for &amp;lt;tt&amp;gt;dave matthews stand up&amp;lt;/tt&amp;gt;. Click through to the album page. At the top of the page, next to the album title, you will see a warning icon, as shown in [[Greasemonkey Hacks/Site Integration#greasemonkeyhks-CHP-11-FIG-2|Figure 11-2]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;greasemonkeyhks-CHP-11-FIG-2&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 11-2. &amp;quot;Warning&amp;quot; icon next to album title'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Greasemonkey Hacks_I_11_tt380.png|&amp;quot;Warning&amp;quot; icon next to album title]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The warning icon indicates that this album was produced by a record label that supports the RIAA. The script does not prevent you from buying the album, it simply informs you of its status.&lt;br /&gt;
&lt;br /&gt;
Now, search Amazon.com for another album—for example, &amp;lt;tt&amp;gt;astral projection another world&amp;lt;/tt&amp;gt;. Click through to the album page and you will see a &amp;quot;safe&amp;quot; icon next to the album title, as shown in [[Greasemonkey Hacks/Site Integration#greasemonkeyhks-CHP-11-FIG-3|Figure 11-3]].&lt;br /&gt;
&lt;br /&gt;
This album is produced by an independent record label out of Israel that is not a member of the RIAA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;greasemonkeyhks-CHP-11-FIG-3&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 11-3. &amp;quot;Safe&amp;quot; icon next to album title'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Greasemonkey Hacks_I_11_tt381.png|&amp;quot;Safe&amp;quot; icon next to album title]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Find Out Who's Reading What You're Reading ==&lt;br /&gt;
&lt;br /&gt;
'''Use Feedster to find weblogs that link to the current page'''.&lt;br /&gt;
&lt;br /&gt;
Feedster (''http://www.feedster.com'') is an RSS search engine that tracks tens of thousands of weblogs and news sites in almost real time. Not only is it a great way to find out what people are talking about, but it can also be used to discover what pages people are linking to.&lt;br /&gt;
&lt;br /&gt;
But why limit yourself to searching manually to find out who's linking to a particular page? This hack adds a window that floats above web pages and shows you who is linking to the page and what they're saying about it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;warning&amp;quot;&amp;gt;&lt;br /&gt;
'''Warning'''&lt;br /&gt;
&lt;br /&gt;
Because this script gets information from a central source (Feedster), the operators of Feedster will be able to track the pages you visit. By default, this hack will ''not'' retrieve any information from Feedster until you click the triangle icon to expand the OmniFeedster floating window. You remain in control of when the script &amp;quot;phones home&amp;quot; to Feedster.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The Code ===&lt;br /&gt;
&lt;br /&gt;
This user script runs on all ''http://'' pages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tip&amp;quot;&amp;gt;&lt;br /&gt;
'''Tip'''&lt;br /&gt;
&lt;br /&gt;
For privacy reasons, it will not run on ''https://'' pages unless you explicitly change the default configuration.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code is divided into three parts:&lt;br /&gt;
&lt;br /&gt;
# The &amp;lt;tt&amp;gt;getFeedsterLinks&amp;lt;/tt&amp;gt; function is the main entry point for retrieving information from Feedster. Feedster provides link information as an RSS feed. All you need to do is construct the appropriate URL and then parse the XML results. The &amp;lt;tt&amp;gt;getFeedsterLinks&amp;lt;/tt&amp;gt; function retrieves the Feedster RSS feed with &amp;lt;tt&amp;gt;GM_xmlhttpRequest&amp;lt;/tt&amp;gt;, parses it with Firefox's native &amp;lt;tt&amp;gt;DOMParser&amp;lt;/tt&amp;gt; object, iterates through it to create an HTML representation, and then calls &amp;lt;tt&amp;gt;_refresh&amp;lt;/tt&amp;gt; to update the OmniFeedster floating window.&lt;br /&gt;
# Several functions manage the OmniFeedster floating window. The &amp;lt;tt&amp;gt;mousedown&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;mouseup&amp;lt;/tt&amp;gt; listeners call &amp;lt;tt&amp;gt;getDraggableFromEvent&amp;lt;/tt&amp;gt; to allow you to move the floating window, and &amp;lt;tt&amp;gt;savePosition&amp;lt;/tt&amp;gt; stores the position locally so it reappears in the same place when you follow a link or refresh the page.&lt;br /&gt;
# The &amp;lt;tt&amp;gt;createFloater&amp;lt;/tt&amp;gt; function creates the floating window itself, adds it to the page, and positions it based on the saved coordinates.&lt;br /&gt;
&lt;br /&gt;
Save the following user script as ''omnifeedster.user.js'':&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
		// ==UserScript==&lt;br /&gt;
		// @name		  OmniFeedster&lt;br /&gt;
		// @namespace	  http://diveintomark.org/projects/greasemonkey/&lt;br /&gt;
		// @description	  display who's linking to this page via Feedster&lt;br /&gt;
		// @include		  http://*&lt;br /&gt;
		// ==/UserScript==&lt;br /&gt;
	&lt;br /&gt;
		var _expanded = false;&lt;br /&gt;
	&lt;br /&gt;
		function getFeedsterLinks(sID) {&lt;br /&gt;
			var urlFeedster = 'http://feedster.com/links.php?' +&lt;br /&gt;
				'type=rss&amp;amp;limit=5&amp;amp;url=' + escape(getCurrentUrl());&lt;br /&gt;
			GM_xmlhttpRequest({&lt;br /&gt;
				method: 'GET',&lt;br /&gt;
				url: urlFeedster,&lt;br /&gt;
				onload: function(oResponseDetails) {&lt;br /&gt;
				if (oResponseDetails.status != 200) {&lt;br /&gt;
				_refresh(sID, '');&lt;br /&gt;
				return;&lt;br /&gt;
				}&lt;br /&gt;
				var oParser = new DOMParser();&lt;br /&gt;
				var oDom = oParser.parseFromString(&lt;br /&gt;
				oResponseDetails.responseText, 'application/xml');&lt;br /&gt;
				if (oDom.firstChild.nodeName == 'parsererror') {&lt;br /&gt;
				_refresh(sID, '');&lt;br /&gt;
				return;&lt;br /&gt;
				}&lt;br /&gt;
				var html, arItems, oItem, urlLink, sTitle, sDescription;&lt;br /&gt;
				html = '&amp;lt;ul style=&amp;quot;list-style: none; margin: 0; padding: 0&amp;quot;&amp;gt;';&lt;br /&gt;
				arItems = oDom.getElementsByTagName('item');&lt;br /&gt;
				for (var i = 0; i &amp;lt; arItems.length; i++) {&lt;br /&gt;
				oItem = arItems[i];&lt;br /&gt;
				urlLink = oItem.getElementsByTagName('link')[0].textContent;&lt;br /&gt;
				sTitle = oItem.getElementsByTagName('title')[0].textContent;&lt;br /&gt;
				sDescription = unescape(oItem.getElementsByTagName(&lt;br /&gt;
				'description')[0].textContent.replace(/&amp;lt;\S[^&amp;gt;]*&amp;gt;/g,&lt;br /&gt;
				''));&lt;br /&gt;
				html += '&amp;lt;li&amp;gt;&amp;lt;a style=&amp;quot;display: block; padding-bottom:2px; ' +&lt;br /&gt;
				'border-bottom: 1px solid #888; text-decoration: none; ' + &lt;br /&gt;
				'background-color: transparent; color: navy; font: 10px ' +	&lt;br /&gt;
				'&amp;quot;Gill Sans&amp;quot;, Verdana, sans-serif; font-weight: normal; ' +&lt;br /&gt;
				'font-variant: none;&amp;quot; href=&amp;quot;' + urlLink + '&amp;quot; title=&amp;quot;' + &lt;br /&gt;
				sDescription + '&amp;quot;&amp;gt;' + sTitle + '&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;';&lt;br /&gt;
				}&lt;br /&gt;
				html += '&amp;lt;/ul&amp;gt;';&lt;br /&gt;
				_refresh(sID, html);&lt;br /&gt;
				}}); &lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				function _refresh(sID, htmlContent) {&lt;br /&gt;
				var elmFloater = document.getElementById(sID);&lt;br /&gt;
				if (!elmFloater) { return; } &lt;br /&gt;
				var elmContent = document.getElementById(sID + '_content');&lt;br /&gt;
				if (!elmContent) { return; }&lt;br /&gt;
				elmContent.innerHTML = htmlContent +&lt;br /&gt;
				'[&amp;lt;a style=&amp;quot;text-decoration: none; background-color: ' + &lt;br /&gt;
				'transparent; color: navy; font: 10px &amp;quot;Gill Sans&amp;quot;, Verdana, ' + &lt;br /&gt;
				'sans-serif; font-weight: normal; font-variant: none;&amp;quot; ' +&lt;br /&gt;
				'title=&amp;quot;Find this page on Feedster!&amp;quot; ' + &lt;br /&gt;
				'href=&amp;quot;http://feedster.com/links.php?url=' +&lt;br /&gt;
				escape(getCurrentUrl()) + '&amp;quot;&amp;gt;more&amp;lt;/a&amp;gt;]';&lt;br /&gt;
				var style = getComputedStyle(elmContent, '');&lt;br /&gt;
				var iHeight = parseInt(style.height) + 15;&lt;br /&gt;
				elmFloater.height = iHeight;&lt;br /&gt;
				GM_setValue(getPrefixFromID(sID) + '.height', iHeight);&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				function getCurrentUrl() { &lt;br /&gt;
				var urlThis = location.href;&lt;br /&gt;
				var iHashPos = urlThis.indexOf('#'); &lt;br /&gt;
				if (iHashPos != -1) {&lt;br /&gt;
				urlThis = urlThis.substring(0, iHashPos);&lt;br /&gt;
				} &lt;br /&gt;
				return urlThis; &lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				function getDraggableFromEvent(event) {&lt;br /&gt;
				var elmDrag = event.target;&lt;br /&gt;
				if (!elmDrag) { return null; } &lt;br /&gt;
				while (elmDrag.nodeName != 'BODY' &amp;amp;&amp;amp;&lt;br /&gt;
				elmDrag.className != 'drag' &amp;amp;&amp;amp;&lt;br /&gt;
				elmDrag.className != 'nodrag') {&lt;br /&gt;
				elmDrag = elmDrag.parentNode;&lt;br /&gt;
				}&lt;br /&gt;
				if (elmDrag.className != 'drag') { return null; }&lt;br /&gt;
				return elmDrag;&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				document.addEventListener('mousedown', function(event) {&lt;br /&gt;
				var elmDrag = getDraggableFromEvent(event); &lt;br /&gt;
				if (!elmDrag) { return true; } &lt;br /&gt;
				var style = getComputedStyle(elmDrag, ''); &lt;br /&gt;
				var iStartElmTop = parseInt(style.top); &lt;br /&gt;
				var iStartElmLeft = parseInt(style.left); &lt;br /&gt;
				var iStartCursorX = event.clientX; &lt;br /&gt;
				var iStartCursorY = event.clientY; &lt;br /&gt;
				elmDrag._mousemove = function(event) {&lt;br /&gt;
				elmDrag.style.top = (event.clientY + iStartElmTop -&lt;br /&gt;
				iStartCursorY) + 'px';&lt;br /&gt;
				elmDrag.style.left = (event.clientX + iStartElmLeft	-&lt;br /&gt;
				iStartCursorX) + 'px';&lt;br /&gt;
				return false;&lt;br /&gt;
				};&lt;br /&gt;
				document.addEventListener('mousemove', elmDrag._mousemove, true);&lt;br /&gt;
				return false;&lt;br /&gt;
				}, true);&lt;br /&gt;
&lt;br /&gt;
				document.addEventListener('mouseup', function(event) {&lt;br /&gt;
				var elmDrag = getDraggableFromEvent(event);&lt;br /&gt;
				if (!elmDrag) { return true; } &lt;br /&gt;
				savePosition(elmDrag);&lt;br /&gt;
				document.removeEventListener('mousemove', elmDrag._mousemove, true);&lt;br /&gt;
				}, true);&lt;br /&gt;
		&lt;br /&gt;
				function getPrefixFromID(sID) {&lt;br /&gt;
				return 'floater.' + sID;&lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				function savePosition(elmDrag) { &lt;br /&gt;
				var sID = elmDrag.id; &lt;br /&gt;
				var style = getComputedStyle(elmDrag, '');&lt;br /&gt;
				GM_setValue(getPrefixFromID(sID) + '.left', parseInt(style.left));&lt;br /&gt;
				GM_setValue(getPrefixFromID(sID) + '.top', parseInt(style.top)); &lt;br /&gt;
				}&lt;br /&gt;
&lt;br /&gt;
				function createFloater(sTitle, sID) {&lt;br /&gt;
				var elmFloater = document.createElement('div');&lt;br /&gt;
				elmFloater.id = sID; &lt;br /&gt;
				elmFloater.className = 'drag'; &lt;br /&gt;
				var iLeft = GM_getValue(getPrefixFromID(sID) + '.left', 10);&lt;br /&gt;
				var iTop = GM_getValue(getPrefixFromID(sID) + '.top', 10);&lt;br /&gt;
				var iWidth = GM_getValue(getPrefixFromID(sID) + '.width', 150);&lt;br /&gt;
				_&amp;lt;/nowiki&amp;gt;integrationweblog and news site tracking&amp;lt;nowiki&amp;gt;expanded = GM_getValue(getPrefixFromID(sID) +&lt;br /&gt;
				'.expanded', false);&lt;br /&gt;
				var iHeight = _expanded ? GM_getValue(&lt;br /&gt;
				getPrefixFromID(sID) + '.height', 100) : 13;&lt;br /&gt;
				elmFloater.setAttribute('style', 'position: absolute; left: ' +&lt;br /&gt;
				iLeft + 'px; top: ' + iTop + 'px; width: ' + iWidth + &lt;br /&gt;
				'px; height: ' + iHeight + 'px; font: 9px Verdana, sans-serif; ' + &lt;br /&gt;
				'background-color: #faebd7; color: #333; opacity: 0.9; ' + &lt;br /&gt;
				'z-index: 99; border: 1px solid black');&lt;br /&gt;
&lt;br /&gt;
				var elmHeader = document.createElement('h1');&lt;br /&gt;
				elmHeader.id = sID + '_header';&lt;br /&gt;
				elmHeader.setAttribute('style', 'position: relative; margin: 0; ' +&lt;br /&gt;
				'padding: 0; left: 0; top: 0; width: 100%; height: 13px; ' + &lt;br /&gt;
				'background-color: navy; color: #eee; text-align: center; ' + &lt;br /&gt;
				'opacity: 1.0; cursor: move; font: 9px Verdana, sans-serif;');&lt;br /&gt;
				if (sTitle) {&lt;br /&gt;
				elmHeader.appendChild(document.createTextNode(sTitle));&lt;br /&gt;
				}&lt;br /&gt;
				elmFloater.appendChild(elmHeader);&lt;br /&gt;
&lt;br /&gt;
				var elmContent = document.createElement('div');&lt;br /&gt;
				elmContent.id = sID + '_content';&lt;br /&gt;
				elmContent.className = 'nodrag';&lt;br /&gt;
				elmContent.setAttribute('style', 'position: absolute; top: 14px; ' +&lt;br /&gt;
				'left: 0; width: 100%; overflow: hidden; background-color: ' + &lt;br /&gt;
				'#faebd7; color: #333; border: 0; margin: 0; padding: 0; ' + &lt;br /&gt;
				'font: 10px &amp;quot;Gill Sans&amp;quot;, Verdana, sans-serif');&lt;br /&gt;
				elmContent.style.display = _expanded ? 'block' : 'none';&lt;br /&gt;
				elmContent.value = GM_getValue(getPrefixFromID(sID) + '.text', ''); &lt;br /&gt;
				elmFloater.appendChild(elmContent);&lt;br /&gt;
&lt;br /&gt;
				var elmExpand = document.createElement('a');&lt;br /&gt;
				elmExpand.id = sID + '_expand';&lt;br /&gt;
				elmExpand.className = 'nodrag';&lt;br /&gt;
				elmExpand.innerHTML = _expanded ? '&amp;amp;amp;#9660;' : '&amp;amp;amp;#9654;';&lt;br /&gt;
				elmExpand.setAttribute('style', 'display: block; position: ' +&lt;br /&gt;
				'absolute; top: 1px; left: 1px; width: 8px; height: 8px; ' + &lt;br /&gt;
				'font: 10px Verdana, sans-serif; border: 0; margin-top: ' + &lt;br /&gt;
				(_expanded ? '0px' : '-2px') + '; padding: 0; ' + &lt;br /&gt;
				'background-color: transparent; color: white; ' +&lt;br /&gt;
				'text-decoration: none');&lt;br /&gt;
				&amp;lt;/nowiki&amp;gt;integrationweblog and news site trackingelmExpand.title = 'Show/hide details';&lt;br /&gt;
 				elmExpand.href = '#';&lt;br /&gt;
 				elmExpand.addEventListener('click', function(event) {&lt;br /&gt;
 				_expanded = !_expanded; &lt;br /&gt;
 				GM_setValue(getPrefixFromID(sID) + '.expanded',&lt;br /&gt;
 				_expanded);&lt;br /&gt;
 				elmFloater.style.height = (_expanded ?&lt;br /&gt;
 				GM_getValue(getPrefixFromID(sID) + '.height', 100) : 13) + 'px';&lt;br /&gt;
 				elmExpand.innerHTML = _expanded ? '&amp;amp;amp;#9660;' : '&amp;amp;amp;#9654;';&lt;br /&gt;
 				elmExpand.style.marginTop = _expanded ? '0px' : '-2px';&lt;br /&gt;
 				elmContent.style.display = _expanded ? 'block' : 'none';&lt;br /&gt;
 				if (_expanded) {&lt;br /&gt;
 				getFeedsterLinks(sID);&lt;br /&gt;
 				}&lt;br /&gt;
 				event.preventDefault();&lt;br /&gt;
 				}, true);&lt;br /&gt;
 				elmHeader.appendChild(elmExpand);&lt;br /&gt;
 		&lt;br /&gt;
 				window.addEventListener('load', function() {&lt;br /&gt;
 				document.body.appendChild(elmFloater);&lt;br /&gt;
 				if (_expanded) {&lt;br /&gt;
 				getFeedsterLinks(sID);&lt;br /&gt;
 				}	&lt;br /&gt;
 				}, true);&lt;br /&gt;
 				}&lt;br /&gt;
 &lt;br /&gt;
 				createFloater('OmniFeedster', 'omnifeedster');&lt;br /&gt;
&lt;br /&gt;
=== Running the Hack ===&lt;br /&gt;
&lt;br /&gt;
After installing the user script (Tools → Install This User Script), go to ''http://del.icio.us''. At the top of the browser window, you will see a small navy bar titled OmniFeedster, as shown in [[Greasemonkey Hacks/Site Integration#greasemonkeyhks-CHP-11-FIG-4|Figure 11-4]].&lt;br /&gt;
&lt;br /&gt;
Click the triangle icon in the OmniFeedster bar to expand the window and fetch a list of pages that link to and comment on the current page. If you hover your cursor over a link, it will display a short excerpt of the remote page, as shown in [[Greasemonkey Hacks/Site Integration#greasemonkeyhks-CHP-11-FIG-5|Figure 11-5]].&lt;br /&gt;
&lt;br /&gt;
The script takes the excerpt from the &amp;lt;tt&amp;gt;description&amp;lt;/tt&amp;gt; element in the Feedster search feed. Since some sites include HTML in their descriptions, the script strips all HTML formatting. This occasionally leads to nonsensical text if the original site's HTML does not linearize well, but it is generally readable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;greasemonkeyhks-CHP-11-FIG-4&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 11-4. OmniFeedster floating window'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Greasemonkey Hacks_I_11_tt383.png|OmniFeedster floating window]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;greasemonkeyhks-CHP-11-FIG-5&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 11-5. OmniFeedster links for http://del.icio.us'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Greasemonkey Hacks_I_11_tt384.png|OmniFeedster links for http://del.icio.us]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Add Wikipedia Links to Any Web Page ==&lt;br /&gt;
&lt;br /&gt;
'''Turn the Web into the ultimate cross-referenced library'''.&lt;br /&gt;
&lt;br /&gt;
Stefan Magdalinski of Whitelabel.org (''http://www.whitelabel.org'') created a bit of a stir with his WikiProxy, which added links to the BBC's news articles that pointed to pages in the online encyclopedia Wikipedia (''http://www.wikipedia.org''). The proxy worked by reading in a BBC page, extracting candidates for linking using specially tailored regular expressions, and then comparing these candidates to a list of phrases from the Wikipedia database.&lt;br /&gt;
&lt;br /&gt;
This raises the possibility of extending this functionality beyond the BBC site. It's not feasible to proxy the entire Web (unless you're Google), but it sounds like a perfect task for a Greasemonkey script. One big problem: you need to check the term candidates against the Wikipedia database, which weighs in at a hefty 18 megabytes for the article titles alone.&lt;br /&gt;
&lt;br /&gt;
Stefan, author of the original WikiProxy, has kindly agreed to make the Wikipedia term lookup accessible as a web service. This hack uses his web service to look up possible Wikipedia entries and adds links to the current page based on the keyword lookup.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;warning&amp;quot;&amp;gt;&lt;br /&gt;
'''Warning'''&lt;br /&gt;
&lt;br /&gt;
This script contacts a central server on every page load, which presents a privacy risk.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The Code ===&lt;br /&gt;
&lt;br /&gt;
This user script runs on all pages. It is quite complex, but it breaks down into five steps:&lt;br /&gt;
&lt;br /&gt;
;Define useful variables&lt;br /&gt;
: The first section defines several variables, including various versions of the Wikipedia icons to label the new links, regular expressions to identify possible terms, and the URLs for the keyword lookup service and for Wikipedia itself.&lt;br /&gt;
;Define convenience functions&lt;br /&gt;
: The &amp;lt;tt&amp;gt;addWikiLinkStyle&amp;lt;/tt&amp;gt; function adds new global style information to the page so that the Wikipedia links change appearance when the mouse moves over them. The &amp;lt;tt&amp;gt;getTerms&amp;lt;/tt&amp;gt; function retrieves all the possible terms from the page that match a given regular expression.&lt;br /&gt;
;Call the keyword lookup service&lt;br /&gt;
: The main part of the script uses three separate regular expressions to extract candidates for linking. (The third expression is for acronyms.) It then calls the web service using GM_xmlhttpRequest. The keyword lookup service works with &amp;lt;tt&amp;gt;GET&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;POST&amp;lt;/tt&amp;gt;; we use the &amp;lt;tt&amp;gt;POST&amp;lt;/tt&amp;gt; method because the list of candidate terms might be too long to fit in the URL of a &amp;lt;tt&amp;gt;GET&amp;lt;/tt&amp;gt; request.&lt;br /&gt;
;Add hyperlinks to the text&lt;br /&gt;
: The web service request is performed asynchronously, so nothing happens until the server returns some results. The &amp;lt;tt&amp;gt;GM_xmlhttpRequest&amp;lt;/tt&amp;gt; calls our &amp;lt;tt&amp;gt;onload&amp;lt;/tt&amp;gt; callback function, which parses the XML returned from the keyword lookup service to get the terms that match the Wikipedia database. We use the matching terms to construct a regular expression, and then we iterate over all the text nodes in the HTML page and wrap each matched term with a link to the corresponding Wikipedia page.&lt;br /&gt;
;Provide undo capability&lt;br /&gt;
: Finally, we add a menu item to the Firefox menu bar, using &amp;lt;tt&amp;gt;GM_ registerMenuCommand&amp;lt;/tt&amp;gt;, which removes the Wikipedia links we just added.&lt;br /&gt;
&lt;br /&gt;
To minimize the load on Stefan's keyword lookup service, we use an associative array, &amp;lt;tt&amp;gt;usedTerms&amp;lt;/tt&amp;gt;, to keep track of which term candidates have been found on the page. This saves time and bandwidth by ensuring that each potential keyword is checked only once.&lt;br /&gt;
&lt;br /&gt;
Save the following user script as ''wikipedia-proxy.user.js:''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
	// ==UserScript==&lt;br /&gt;
	// @name				  Wikiproxy: Greasemonkey Edition&lt;br /&gt;
	// @namespace			  http://www.allpeers.com/blog/greasemonkey&lt;br /&gt;
	// @description			  Adds &amp;lt;/nowiki&amp;gt;web pagesWikipedia links&amp;lt;nowiki&amp;gt;Wikipedia links to key terms in webpages&lt;br /&gt;
	// @include				  http://*&lt;br /&gt;
	// @exclude				  http://wikiproxy.whitelabel.org/*&lt;br /&gt;
	// @exclude				  http://www.theyworkforyou.com/*&lt;br /&gt;
	// @exclude				  http://*.wikipedia.tld/*&lt;br /&gt;
	// ==/UserScript==&lt;br /&gt;
	&lt;br /&gt;
	// based on code by Matthew Gertner, Valentin Laube, and others &lt;br /&gt;
	// and included here with their gracious permission&lt;br /&gt;
    &lt;br /&gt;
	var iconcolor = 0; // 0 blue, 1 green, 2 red&lt;br /&gt;
	var icons = [ &lt;br /&gt;
		&amp;quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKAgMAAADwXCcu&amp;quot;+&lt;br /&gt;
		&amp;quot;AAAADFBMVEUWJgGkyP%2F%2F%2F%2F8AZv87Gt1vAAAAAXRSTlMAQObYZgAAAC1JRE&amp;quot;+ &lt;br /&gt;
		&amp;quot;FUCNdjYP7%2FgYF51QYG%2Fv8bGHhXb2BgXg2hzco%2FMNw8z8BgzsDAwMPAAAAtcQ&amp;quot;+&lt;br /&gt;
		&amp;quot;zEPgrvTwAAAABJRU5ErkJggg%3D%3D&amp;quot;,&lt;br /&gt;
		&amp;quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKAgMAAADwXCcu&amp;quot;+&lt;br /&gt;
		&amp;quot;AAAADFBMVEUbHgGW0nL%2F%2F%2F9SqxuFak3hAAAAAXRSTlMAQObYZgAAAC1JREFU&amp;quot;+&lt;br /&gt;
		&amp;quot;CNdjYP7%2FgYF51QYG%2Fv8bGHhXb2BgXg2hzco%2FMNw8z8BgzsDAwMPAAAAtcQzE&amp;quot;+&lt;br /&gt;
		&amp;quot;PgrvTwAAAABJRU5ErkJggg%3D%3D&amp;quot;,&lt;br /&gt;
		&amp;quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKAgMAAADwXCcu&amp;quot;+&lt;br /&gt;
		&amp;quot;AAAADFBMVEUbHgH%2Fq47%2F%2F%2F%2F%2FVBnJ4fJlAAAAAXRSTlMAQObYZgAAAC&amp;quot;+&lt;br /&gt;
		&amp;quot;1JREFUCNdjYP7%2FgYF51QYG%2Fv8bGHhXb2BgXg2hzco%2FMNw8z8BgzsDAwMPAAA&amp;quot;+&lt;br /&gt;
		&amp;quot;AtcQzEPgrvTwAAAABJRU5ErkJggg%3D%3D&amp;quot;&lt;br /&gt;
	];&lt;br /&gt;
	var icons2 = [&lt;br /&gt;
		&amp;quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs%2&amp;quot;+&lt;br /&gt;
		&amp;quot;B9AAAAeElEQVQY02NkQAIB0%2F7%2FZ8ABWNAF1mdiKgqczsDASMi09ZkQhSgmFjoz&amp;quot;+&lt;br /&gt;
		&amp;quot;MNipoZoEA0wwxoYsRsb%2BvQw4AROy1YXOuBUyIyuyU2NgOHSLgaFgFQODFD8Dw4n7&amp;quot;+&lt;br /&gt;
		&amp;quot;DAwrzyCZdPDm%2F%2F%2F%2F%2F0NomKcCpiHYKOGHrAgvIKQIAECSPtEmaizfAAAA&amp;quot;+&lt;br /&gt;
		&amp;quot;AElFTkSuQmCC&amp;quot;,&lt;br /&gt;
		&amp;quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs%2&amp;quot;+&lt;br /&gt;
		&amp;quot;B9AAAAi0lEQVQY02NkQAIdR5P%2FM%2BAALOgC5VZzMBR1HkthYCRkWrnVHIbOYymo&amp;quot;+&lt;br /&gt;
		&amp;quot;JupLWzN4yCeimAQDTDBGhfVcxotPj%2BJyIkJhx9Hk%2F%2FrS1jgVMiIr8pBPZNjx&amp;quot;+&lt;br /&gt;
		&amp;quot;cD7DxadHGfSlrRlQbOg4mvx%2F%2B4N5%2F%2F%2F%2F%2F%2F9%2F%2B4N5%2F2Ge&amp;quot;+&lt;br /&gt;
		&amp;quot;6jia%2FB%2FDgzDF%2BMKRqMBmYGBgAAApFkF%2BHyXzbAAAAABJRU5ErkJggg%3D%&amp;quot;+&lt;br /&gt;
		&amp;quot;3D&amp;quot;,&lt;br /&gt;
		&amp;quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs%2&amp;quot;+&lt;br /&gt;
		&amp;quot;B9AAAAf0lEQVQY042QyxGCQBBE36BRQQ4UKSw5QA4sOeDVo5gDxOCdQNqDfN1asS8z&amp;quot;+&lt;br /&gt;
		&amp;quot;NfWqa7qNneSdiOgaXKoupNoSO3WrOmjLL8esgDQ%2FOC1KlsXqmzE8Yi9uoLwTWREF&amp;quot;+&lt;br /&gt;
		&amp;quot;LwcozWF8wr0BM5heMPabk4Zekj5zDiXvFARc4R89%2FlU2wBsinj50jQNjuAAAAABJ&amp;quot;+&lt;br /&gt;
		&amp;quot;RU5ErkJggg%3D%3D&amp;quot;&lt;br /&gt;
	];&lt;br /&gt;
	var bgprefix = &amp;quot;url(&amp;quot;&lt;br /&gt;
	var bgsuffix = &amp;quot;) center right no-repeat&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	var requestUrl = &amp;quot;http://wikiproxy.whitelabel.org/xml.php&amp;quot;;&lt;br /&gt;
	var &amp;lt;/nowiki&amp;gt;integrationWikipedia links&amp;lt;nowiki&amp;gt;wikipediaUrlPrefix = &amp;quot;http://en.wikipedia.org/wiki/&amp;quot;;&lt;br /&gt;
	var excludeAncestors = [&amp;quot;a&amp;quot;, &amp;quot;script&amp;quot;, &amp;quot;style&amp;quot;, &amp;quot;input&amp;quot;,&lt;br /&gt;
		&amp;quot;textarea&amp;quot;, &amp;quot;select&amp;quot;, &amp;quot;option&amp;quot;];&lt;br /&gt;
&lt;br /&gt;
	var excludeXPath = &amp;quot;ancestor::*[&amp;quot;;&lt;br /&gt;
	for (var tagNum=0; tagNum&amp;lt;excludeAncestors.length; tagNum++)&lt;br /&gt;
		excludeXPath += (tagNum == 0 ? &amp;quot;&amp;quot; : &amp;quot; or &amp;quot;) + &amp;quot;self::&amp;quot; +&lt;br /&gt;
			excludeAncestors[tagNum];&lt;br /&gt;
	excludeXPath += &amp;quot;]&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	// Regular expression definitions from News Wikiproxy&lt;br /&gt;
	var capsword = &amp;quot;A|[A-Z][a-zA-Z'0-9]{1,}&amp;quot;;&lt;br /&gt;
	var fillerwords = &amp;quot;a|of|and|in|on|under|the&amp;quot;;&lt;br /&gt;
	var middlewordre = &amp;quot;(&amp;quot; + capsword + &amp;quot;|&amp;quot; + fillerwords + &amp;quot;|[A-Z]\.)[ \\t]*&amp;quot;;&lt;br /&gt;
	var endwordre = &amp;quot;(&amp;quot; + capsword + &amp;quot;)[ \\t]*&amp;quot;;&lt;br /&gt;
	var acronymre = &amp;quot;\\b([A-Z][A-Z0-9]{2,})\\b&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	// Match either &amp;quot;Two Endwords&amp;quot; or &amp;quot;Endword and Some Middle Words&amp;quot;&lt;br /&gt;
	var greedyproperre = &amp;quot;\\b(&amp;quot; + endwordre + &amp;quot;(&amp;quot; + middlewordre + &amp;quot;)*&amp;quot; +&lt;br /&gt;
		endwordre + &amp;quot;)\\b&amp;quot;;&lt;br /&gt;
	// Match without filler words (so if you have a phrase like&lt;br /&gt;
	// &amp;quot;Amnesty International and Human Rights Watch&amp;quot; you also get both parts &lt;br /&gt;
	// separately &amp;quot;Amnesty International&amp;quot; and &amp;quot;Human Rights Watch&amp;quot;)&lt;br /&gt;
	var frugalproperre = &amp;quot;\\b((&amp;quot; + endwordre + &amp;quot;){2,})\\b&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	var usedTerms = new Object();&lt;br /&gt;
	function &amp;lt;/nowiki&amp;gt;integrationWikipedia linksaddWikiLinkStyle() {&lt;br /&gt;
 		var wikiLinkStyle = document.createElement('style');&lt;br /&gt;
 		wikiLinkStyle.id = &amp;quot;wikilinkstyle&amp;quot;;&lt;br /&gt;
 		wikiLinkStyle.type = &amp;quot;text/css&amp;quot;;&lt;br /&gt;
 		wikiLinkStyle.innerHTML = '.wikilink, .wikilink_over {\n'&lt;br /&gt;
 			+ 'color: inherit;\n'&lt;br /&gt;
 			+ 'Wikipediaadding links to web pagespadding-right: 13px;\n'&lt;br /&gt;
 			+ '}\n'&lt;br /&gt;
 			+ '.wikilink {\n'&lt;br /&gt;
 			+ 'background: transparent ' + bgprefix&lt;br /&gt;
 			+ icons[iconcolor] + bgsuffix + ';\n'&lt;br /&gt;
 			+ '}\n'&lt;br /&gt;
 			+ '.wikilink_over {\n'&lt;br /&gt;
 			+ 'background: transparent ' + bgprefix&lt;br /&gt;
 			+ icons2[iconcolor] + bgsuffix + ';\n'&lt;br /&gt;
 			+ '}';&lt;br /&gt;
 		document.getElementsByTagName('head')[0].appendChild(wikiLinkStyle); &lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	function getTerms(str, regexpstr, terms) {&lt;br /&gt;
 		var candidates = str.match(new RegExp(regexpstr, &amp;quot;mg&amp;quot;)); &lt;br /&gt;
 		for (var i=0; i&amp;lt;candidates.length; i++) {&lt;br /&gt;
 			var term = candidates[i];&lt;br /&gt;
 			while (term.charAt(term.length-1) == &amp;quot; &amp;quot;)&lt;br /&gt;
 				term = term.substring(0, term.length-1);&lt;br /&gt;
 			if (usedTerms[term] == null) {&lt;br /&gt;
 				if (terms.length &amp;gt; 0) {&lt;br /&gt;
 				terms += &amp;quot; &amp;quot;;&lt;br /&gt;
 				}&lt;br /&gt;
 				terms += term.replace(/ /g, &amp;quot;_&amp;quot;);&lt;br /&gt;
 				usedTerms[term] = term;&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 		return terms;&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	if (document.documentElement.tagName == &amp;quot;HTML&amp;quot;) {&lt;br /&gt;
 		var treeWalker = document.createTreeWalker(&lt;br /&gt;
 			document.documentElement, NodeFilter.SHOW_TEXT, null, false);&lt;br /&gt;
 		var text = &amp;quot;&amp;quot;;&lt;br /&gt;
 		var textNode;&lt;br /&gt;
 		while (textNode = treeWalker.nextNode()) {&lt;br /&gt;
 			if (!document.evaluate(&amp;quot;ancestor::script&amp;quot;, textNode, null,&lt;br /&gt;
 				XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue) {&lt;br /&gt;
 				text += textNode.nodeValue + &amp;quot;\n&amp;quot;;&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		var terms = getTerms(text, greedyproperre, &amp;quot;&amp;quot;);&lt;br /&gt;
 		terms = getTerms(text, frugalproperre, terms);&lt;br /&gt;
 		terms = getTerms(text, acronymre, terms);&lt;br /&gt;
 		GM_xmlhttpRequest({&lt;br /&gt;
 			method: 'POST',&lt;br /&gt;
 			url: requestUrl,&lt;br /&gt;
 			headers: {&lt;br /&gt;
 				'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',&lt;br /&gt;
 				'Content-type': 'application/x-www-form-urlencoded'&lt;br /&gt;
 			},&lt;br /&gt;
 			data: 'text=' + escape(terms),&lt;br /&gt;
 			onload: function(responseDetails) {&lt;br /&gt;
 				var parser = new DOMParser();&lt;br /&gt;
 				var responseXML = parser.parseFromString(&lt;br /&gt;
 				responseDetails.responseText, &amp;quot;text/xml&amp;quot;);&lt;br /&gt;
 				var termSnapshot = document.evaluate(&amp;quot;/wikiproxy/term/text()&amp;quot;,&lt;br /&gt;
 				responseXML, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,&lt;br /&gt;
 				null);&lt;br /&gt;
 				var normalizedTerms = new Object();&lt;br /&gt;
 				var termRegExp = &amp;quot;&amp;quot;;&lt;br /&gt;
 				for (var i=0; i&amp;lt;termSnapshot.snapshotLength; i++)&lt;br /&gt;
 				{&lt;br /&gt;
 				var termNodeValue = termSnapshot.snapshotItem(i).&lt;br /&gt;
 				nodeValue.replace(/_/g, &amp;quot; &amp;quot;);&lt;br /&gt;
 				normalizedTerms[termNodeValue.toLowerCase()] =&lt;br /&gt;
 				termNodeValue;&lt;br /&gt;
 				if (termRegExp.length &amp;gt; 0) {&lt;br /&gt;
 				termRegExp += &amp;quot;|&amp;quot;;&lt;br /&gt;
 				}&lt;br /&gt;
 				termRegExp += termNodeValue;&lt;br /&gt;
 				}&lt;br /&gt;
 				termRegExp = new RegExp(&amp;quot;\\b(&amp;quot; + termRegExp + &amp;quot;)\\b&amp;quot;, &amp;quot;mg&amp;quot;);&lt;br /&gt;
 				treeWalker = document.createTreeWalker(&lt;br /&gt;
 				document.documentElement, NodeFilter.SHOW_TEXT, null,&lt;br /&gt;
 				false);&lt;br /&gt;
 				while (textNode = treeWalker.nextNode())&lt;br /&gt;
 				{&lt;br /&gt;
 				if (responseXML.evaluate(excludeXPath, textNode, null,&lt;br /&gt;
 				XPathResult.FIRST_ORDERED_NODE_TYPE,&lt;br /&gt;
 				null).singleNodeValue) { continue; }&lt;br /&gt;
 &lt;br /&gt;
 				var matches = textNode.nodeValue.match(termRegExp);&lt;br /&gt;
 				if (!matches) { continue; }&lt;br /&gt;
 				&lt;br /&gt;
 				// add wiki link style &lt;br /&gt;
 				if (!document.getElementById ('wikilinkstyle')) {&lt;br /&gt;
 integrationWikipedia links&lt;br /&gt;
 				           Wikipediaadding links to web pagesaddWikiLinkStyle(); &lt;br /&gt;
 				}&lt;br /&gt;
 &lt;br /&gt;
 				for (i=0; i&amp;lt;matches.length; i++)&lt;br /&gt;
 				{&lt;br /&gt;
 				var term = matches[i];&lt;br /&gt;
 				if(!term)continue; &lt;br /&gt;
 				var displayTerm = term.replace(/_/g, &amp;quot; &amp;quot;);&lt;br /&gt;
 				term = normalizedTerms[term.toLowerCase()];&lt;br /&gt;
 				var termIndex = textNode.nodeValue.indexOf(displayTerm);&lt;br /&gt;
 				var preTermNode = document.createTextNode(&lt;br /&gt;
 				textNode.nodeValue.substring(0, termIndex));&lt;br /&gt;
 				textNode.nodeValue = textNode.nodeValue.substring(&lt;br /&gt;
 				termIndex+displayTerm.length); &lt;br /&gt;
 				var anchor = document.createElement(&amp;quot;a&amp;quot;);&lt;br /&gt;
 				anchor.className = &amp;quot;wikilink&amp;quot;;&lt;br /&gt;
 				anchor.addEventListener('mousemove', function () {&lt;br /&gt;
 				this.className = 'wikilink_over';&lt;br /&gt;
 				}, true);&lt;br /&gt;
 				anchor.addEventListener('mouseout', function () {&lt;br /&gt;
 				this.className = 'wikilink';&lt;br /&gt;
 				}, true);&lt;br /&gt;
 				anchor.href = integrationWikipedia linkswikipediaUrlPrefix + term;&lt;br /&gt;
 				var termNode = document.createTextNode(displayTerm);&lt;br /&gt;
 				anchor.insertBefore(termNode, anchor.firstChild);&lt;br /&gt;
 				textNode.parentNode.insertBefore(preTermNode, textNode);&lt;br /&gt;
 				textNode.parentNode.insertBefore(anchor, textNode);&lt;br /&gt;
 				}&lt;br /&gt;
 				}&lt;br /&gt;
 			}&lt;br /&gt;
 		});&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	function undoWikify() {&lt;br /&gt;
 		var Wikipediaadding links to web pageswlinks = document.evaluate('//a[@class=&amp;quot;wikilink&amp;quot;]',&lt;br /&gt;
 			document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);&lt;br /&gt;
 		for (var i = 0; i &amp;lt; wlinks.snapshotLength; i++) {&lt;br /&gt;
 			var wlink = wlinks.snapshotItem(i);&lt;br /&gt;
 			var text = document.createTextNode(wlink.textContent);&lt;br /&gt;
 			wlink.parentNode.replaceChild(text, wlink);&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 	GM_registerMenuCommand('Undo Wikify', undoWikify);&lt;br /&gt;
&lt;br /&gt;
=== Running the Hack ===&lt;br /&gt;
&lt;br /&gt;
After installing the script (Tools → Install This User Script), load ''http://www.cia.gov/cia/publications/factbook/geos/uk.html''. The script converts all words on the page that have Wikipedia entries into links, decorated with a Wikipedia icon, as shown in [[Greasemonkey Hacks/Site Integration#greasemonkeyhks-CHP-11-FIG-6|Figure 11-6]].&lt;br /&gt;
&lt;br /&gt;
We take care not to change text that was already linked in the original page.&lt;br /&gt;
&lt;br /&gt;
—''Matthew Gertner''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;greasemonkeyhks-CHP-11-FIG-6&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 11-6. Wikified CIA Factbook'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Greasemonkey Hacks_I_11_tt386.png|Wikified CIA Factbook]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Compare Book Prices ==&lt;br /&gt;
&lt;br /&gt;
'''Add competitors' prices to online book retailers'''.&lt;br /&gt;
&lt;br /&gt;
When the Web was new, pundits and trade magazines hyped the possibility of ''agents'' that followed you around online and fetched the lowest prices, or recommended similar sites, or made your coffee, or something. The hype died down quickly, but many of the best ideas have eventually resurfaced in one form or another. It turns out that most people don't actually care about some bureaucrat's idea of &amp;quot;similar sites,&amp;quot; but everybody cares about finding the lowest prices.&lt;br /&gt;
&lt;br /&gt;
This hack adds a floating window to online bookstores, such as Amazon. com, that shows you the price for the same book on other sites. Really.&lt;br /&gt;
&lt;br /&gt;
=== The Code ===&lt;br /&gt;
&lt;br /&gt;
This user script runs on several online book stores:&lt;br /&gt;
&lt;br /&gt;
* Amazon.com&lt;br /&gt;
* BarnesAndNoble.com&lt;br /&gt;
* Powells.com&lt;br /&gt;
* Half.com&lt;br /&gt;
* Buy.com&lt;br /&gt;
&lt;br /&gt;
The script parses the ISBN—a globally unique identifier for the book you're viewing—and uses it to fetch pricing information from other sites. Sites like Amazon.com provide an official web services API for getting this information; for other sites, the script relies on tried-and-true techniques of screen scraping.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tip&amp;quot;&amp;gt;&lt;br /&gt;
'''Tip'''&lt;br /&gt;
&lt;br /&gt;
By default, this script adds associate IDs to the links it constructs, which gives the script's author a small referral fee. If you dislike this, or you have your own associate ID, you can change the first few lines of code to define your own IDs or remove them altogether.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the following user script as ''bookburro.user.js:''&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
	// ==UserScript==&lt;br /&gt;
	// @name		Book Burro - Remixing the bookstore&lt;br /&gt;
	// @namespace	http://overstimulate.com/userscripts/&lt;br /&gt;
	// @description Find the cheapest books&lt;br /&gt;
	// @include		http://amazon.com/*&lt;br /&gt;
	// @include		http://www.amazon.com/*&lt;br /&gt;
	// @include		http://www.powells.com/*&lt;br /&gt;
	// @include		http://half.ebay.com/*&lt;br /&gt;
	// @include		http://buy.com/*&lt;br /&gt;
	// @include		http://www.buy.com/*&lt;br /&gt;
	// @include		http://search.barnesandnoble.com/*&lt;br /&gt;
	// @include		http://barnesandnoble.com/*&lt;br /&gt;
	// @include		http://www.barnesandnoble.com/*&lt;br /&gt;
	// @exclude&lt;br /&gt;
	// ==/UserScript==&lt;br /&gt;
	&lt;br /&gt;
	// based on code by Jesse Andrews and Britt Selvitelle &lt;br /&gt;
	// and included here with their gracious permission&lt;br /&gt;
	&lt;br /&gt;
	// Change these as desired&lt;br /&gt;
	var amazon_associate_code = 'anotherjesse-20';&lt;br /&gt;
	var amazon_dev_key = '0XYJJ825QSB9Q7F2XN02';&lt;br /&gt;
	var bn_associate_code = '41456445';&lt;br /&gt;
	var half_associate_code = '1698206-1932276';&lt;br /&gt;
&lt;br /&gt;
	function checkISBN( isbn ) {&lt;br /&gt;
		try {       &lt;br /&gt;
			isbn=isbn.toLowerCase().replace(/-/g,'').replace(/ /g,'');&lt;br /&gt;
			if (isbn.length != 10) return false;&lt;br /&gt;
			var checksum = 0;&lt;br /&gt;
			for (var i=0; i&amp;lt;9; i++) {&lt;br /&gt;
				if (isbn[i] == 'x') {&lt;br /&gt;
				checksum += 10 * (i+1);&lt;br /&gt;
				} else {&lt;br /&gt;
				checksum += isbn[i] * (i+1);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
			checksum = checksum % 11;&lt;br /&gt;
			if (checksum == 10) checksum = 'x';&lt;br /&gt;
			if (isbn[9] == checksum)&lt;br /&gt;
				return isbn;&lt;br /&gt;
			else&lt;br /&gt;
				return false;&lt;br /&gt;
		} catch (e) { return false; } &lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	function dom_createLink(url, txt, title) { &lt;br /&gt;
		var a = document.createElement(&amp;quot;a&amp;quot;);&lt;br /&gt;
		a.setAttribute(&amp;quot;href&amp;quot;, url);&lt;br /&gt;
		a.setAttribute(&amp;quot;style&amp;quot;, &amp;quot;color: #00a; text-decoration: none; &amp;quot; +&lt;br /&gt;
			&amp;quot;font-weight: bold&amp;quot;);&lt;br /&gt;
		if (title) a.setAttribute(&amp;quot;title&amp;quot;, title);&lt;br /&gt;
		a.appendChild(document.createTextNode(txt));&lt;br /&gt;
		return a;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	function add_site(url, title, loc_id ) {&lt;br /&gt;
		var a = dom_createLink( url, title, title + ' Search');&lt;br /&gt;
		var b = document.createElement(&amp;quot;b&amp;quot;);&lt;br /&gt;
		b.innerHTML = 'fetching';&lt;br /&gt;
		b.setAttribute(&amp;quot;id&amp;quot;, loc_id);&lt;br /&gt;
&lt;br /&gt;
		var tr = document.createElement(&amp;quot;tr&amp;quot;);&lt;br /&gt;
		var td_left = document.createElement(&amp;quot;td&amp;quot;);&lt;br /&gt;
		var td_right = document.createElement(&amp;quot;td&amp;quot;);&lt;br /&gt;
		td_left.appendChild(a);&lt;br /&gt;
		td_right.appendChild(b);&lt;br /&gt;
		td_right.setAttribute(&amp;quot;align&amp;quot;, &amp;quot;right&amp;quot;);&lt;br /&gt;
		tr.appendChild(td_left);&lt;br /&gt;
		tr.appendChild(td_right);&lt;br /&gt;
		return tr;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	function str2xml(strXML) { &lt;br /&gt;
		//create a DOMParser&lt;br /&gt;
		var objDOMParser = new DOMParser();&lt;br /&gt;
		//create new document from string&lt;br /&gt;
		var objDoc = objDOMParser.parseFromString(strXML, &amp;quot;text/xml&amp;quot;);&lt;br /&gt;
		return objDoc;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	function int2money( cents ) { &lt;br /&gt;
		var money = &amp;quot;$&amp;quot;&lt;br /&gt;
			if (cents&amp;lt; 100) { &lt;br /&gt;
		money = money + '0.';&lt;br /&gt;
			} else { &lt;br /&gt;
				money = money + Math.floor(cents/100) + '.';&lt;br /&gt;
			}&lt;br /&gt;
		cents = cents % 100;&lt;br /&gt;
		if (cents &amp;lt; 10)&lt;br /&gt;
			money = money + '0';&lt;br /&gt;
		money = money + cents;&lt;br /&gt;
		return money;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	function run_queries(isbn) {&lt;br /&gt;
		var errmsg = 'Either there are no &amp;lt;/nowiki&amp;gt;book prices&amp;lt;nowiki&amp;gt;books available,\\' +&lt;br /&gt;
			'or there is a parsing error because of\\n' +&lt;br /&gt;
			'some change to their website.\\n\\n' +&lt;br /&gt;
			'Not everyone has a nice webservice like Amazon';&lt;br /&gt;
&lt;br /&gt;
		////// AJAX for BN.com /////&lt;br /&gt;
&lt;br /&gt;
		GM_xmlhttpRequest({method:&amp;quot;POST&amp;quot;,&lt;br /&gt;
			url:'http://search.barnesandnoble.com/booksearch/isbninquiry.asp?' +&lt;br /&gt;
				'isbn='+isbn,&lt;br /&gt;
			data:&amp;quot;&amp;quot;,&lt;br /&gt;
			onload:function(result) {&lt;br /&gt;
				try {&lt;br /&gt;
				document.getElementById('burro_bn').innerHTML = &lt;br /&gt;
				result.responseText.match(&lt;br /&gt;
				'priceRightBNPrice[^&amp;gt;]*&amp;gt;\([^&amp;lt;]*\)&amp;lt;/')[1];&lt;br /&gt;
				} catch (e) {&lt;br /&gt;
				document.getElementById('burro_bn').parentNode.innerHTML = &lt;br /&gt;
				'&amp;lt;a href=&amp;quot;javascript: alert(\''+errmsg+'\');&amp;quot;&amp;gt;none&amp;lt;/a&amp;gt;';&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		////// AJAX for Buy.com /////&lt;br /&gt;
&lt;br /&gt;
		GM_xmlhttpRequest({method:&amp;quot;POST&amp;quot;,&lt;br /&gt;
			url:'http://www.buy.com/retail/GlobalSearchAction.asp?qu='+&lt;br /&gt;
				isbn, data:&amp;quot;&amp;quot;,&lt;br /&gt;
			onload:function(result) {&lt;br /&gt;
				try { &lt;br /&gt;
				document.getElementById('burro_buy').innerHTML =&lt;br /&gt;
				result.responseText.match(&lt;br /&gt;
				'productPrice[^&amp;gt;]*&amp;gt;\([^&amp;lt;]*\)&amp;lt;/')[1];&lt;br /&gt;
				} catch (e) { &lt;br /&gt;
				document.getElementById('burro_buy').parentNode.innerHTML =&lt;br /&gt;
				'&amp;lt;a href=&amp;quot;javascript: alert(\''+errmsg+'\');&amp;quot;&amp;gt;none&amp;lt;/a&amp;gt;';&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
		////// AJAX for half.com /////&lt;br /&gt;
		GM_xmlhttpRequest({method:&amp;quot;POST&amp;quot;,&lt;br /&gt;
			url:'http://half.ebay.com/search/search.jsp?' +&lt;br /&gt;
				'product=&amp;lt;/nowiki&amp;gt;book prices&amp;lt;nowiki&amp;gt;books:isbn&amp;amp;query='+isbn, data:&amp;quot;&amp;quot;,&lt;br /&gt;
			onload:function(result) {&lt;br /&gt;
				try { &lt;br /&gt;
				document.getElementById('burro_half').innerHTML = &lt;br /&gt;
				result.responseText.match(&lt;br /&gt;
				'Best[^P]*Price[^\$]*\([^&amp;lt;]*\)&amp;lt;')[1];&lt;br /&gt;
				} catch (e) { &lt;br /&gt;
				document.getElementById('burro_half').parentNode.innerHTML = &lt;br /&gt;
				'&amp;lt;a href=&amp;quot;javascript: alert(\''+errmsg+'\');&amp;quot;&amp;gt;none&amp;lt;/a&amp;gt;';&lt;br /&gt;
				}&lt;br /&gt;
				}&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			////// AJAX for amazon.com /////&lt;br /&gt;
			GM_xmlhttpRequest({method:&amp;quot;POST&amp;quot;,&lt;br /&gt;
				 url:'http://xml.amazon.com/onca/xml3?t=' + amazon_associate_code + &lt;br /&gt;
				 '&amp;amp;dev-t=' + amazon_dev_key +&lt;br /&gt;
				 '&amp;amp;type=lite&amp;amp;f=xml&amp;amp;mode=books&amp;amp;AsinSearch='+isbn, data:&amp;quot;&amp;quot;,&lt;br /&gt;
				 onload:function(result) {&lt;br /&gt;
				 var x = str2xml( result.responseText );&lt;br /&gt;
				 var ourprices = x.getElementsByTagName('OurPrice'); &lt;br /&gt;
				 if (ourprices.length == 0) {&lt;br /&gt;
				document.getElementById('burro_amazon').parentNode.&lt;br /&gt;
			innerHTML = &lt;br /&gt;
				'&amp;lt;a href=&amp;quot;javascript: alert(\''+errmsg+'\');&amp;quot;&amp;gt;none&amp;lt;/a&amp;gt;&lt;br /&gt;
			';&lt;br /&gt;
				 } else {&lt;br /&gt;
&lt;br /&gt;
				document.getElementById('burro_amazon').innerHTML =&lt;br /&gt;
				&amp;lt;/nowiki&amp;gt;book prices&amp;lt;nowiki&amp;gt;ourprices[0].childNodes[0].nodeValue;&lt;br /&gt;
				 }&lt;br /&gt;
				 var usedprices = x.getElementsByTagName('UsedPrice');&lt;br /&gt;
				 if (usedprices.length == 0) {&lt;br /&gt;
				var elmMarket = document.getElementById('burro_ &lt;br /&gt;
		   amazonmarket');&lt;br /&gt;
				elmMarket.parentNode.innerHTML = &lt;br /&gt;
				'&amp;lt;a href=&amp;quot;javascript: alert(\''+errmsg+'\');&amp;quot;&amp;gt;none&amp;lt;/a&amp;gt;&lt;br /&gt;
		   ';&lt;br /&gt;
				} else {&lt;br /&gt;
				document.getElementById('burro_amazonmarket').innerHTML =&lt;br /&gt;
				usedprices[0].childNodes[0].nodeValue;&lt;br /&gt;
				}&lt;br /&gt;
				}&lt;br /&gt;
			}); &lt;br /&gt;
			var msg = 'We want to check with them regarding the traffic of querying&lt;br /&gt;
		'+ &lt;br /&gt;
				'for prices from their site on every click…';&lt;br /&gt;
			document.getElementById('burro_powell').parentNode.innerHTML =&lt;br /&gt;
				'&amp;lt;a href=&amp;quot;javascript: alert(\''+msg+'\');&amp;quot;&amp;gt;(info)&amp;lt;/a&amp;gt;';&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		function burro( location, isbn ) {&lt;br /&gt;
			var elmWrapper = document.createElement(&amp;quot;div&amp;quot;);&lt;br /&gt;
			elmWrapper.setAttribute(&amp;quot;title&amp;quot;,&amp;quot;Click triangle to expand/collapse&amp;quot;);&lt;br /&gt;
			elmWrapper.setAttribute(&amp;quot;style&amp;quot;,'position:fixed;z-index:99;top:15px;' +&lt;br /&gt;
				'left:15px;background-color:#ffc;border:1px solid orange;' +&lt;br /&gt;
				'padding:4px;text-align:left;opacity:.85;font:8pt sans-serif;' +&lt;br /&gt;
				'overflow:hidden;width:200px;height:15px;margin-bottom:15px;');&lt;br /&gt;
			var elmCaret = document.createElement(&amp;quot;img&amp;quot;);&lt;br /&gt;
			elmCaret.setAttribute(&amp;quot;style&amp;quot;, &amp;quot;top:-10px&amp;quot;);&lt;br /&gt;
			elmCaret.setAttribute(&amp;quot;src&amp;quot;, 'data:image/png;base64,iVBORw0KGgoAAA' +&lt;br /&gt;
				'ANSUhEUgAAAAsAAAALCAYAAACprHcmAAAABmJLR0QA/wD/AP+gvaeTAAAAC' + &lt;br /&gt;
				'XBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1QQYCR020Q08hgAAAB10RVh0' +&lt;br /&gt;
				'Q29tbWVudABDcmVhdGVkIHdpdGggVGhlIEdJTVDvZCVuAAAAiklEQVQY07X' +&lt;br /&gt;
				'PIQoCURSF4e8NAzYxGicNuAa1WlyCO3AlZnfiNgwahQFxikkcBIsGfaZpzg' +&lt;br /&gt;
				'ODJ/4c/nMvPyR8g7EsephgH6q6aXnWIelhjkUsi0EL88TqFUfMYlnscMoS5' + &lt;br /&gt;
				'wUccMYS4yxhfuGNPho88oQ5xxQjrHHpKkcMccMqVPU99eATG2zb4n/zAS4O' +&lt;br /&gt;
				'HrV1hIB/AAAAAElFTkSuQmCC');&lt;br /&gt;
			elmCaret.setAttribute(&amp;quot;id&amp;quot;, &amp;quot;hide_show_elmCaret&amp;quot;);&lt;br /&gt;
			elmWrapper.appendChild( elmCaret );&lt;br /&gt;
			var elmTitle = document.createElement(&amp;quot;img&amp;quot;);&lt;br /&gt;
			elmTitle.setAttribute(&amp;quot;style&amp;quot;, &amp;quot;padding-left:6px&amp;quot;);&lt;br /&gt;
			elmTitle.setAttribute(&amp;quot;src&amp;quot;, 'data:image/gif;base64,R0lGODlheAAO' +&lt;br /&gt;
				'AOYAAAAAAOmUUUOGfx1eVj8/M1ijnqBhLrmFVv//zNi6oCUIAO/vwJqEbGk' +&lt;br /&gt;
				'4EL+/mm9vWZmZmVpaWvfAl7ydiC8vJo+PcwAPCaJtSylNS////4tCC9/fs0' +&lt;br /&gt;
				'MeAa+vjefy9LR1QpnMzH9/Zny3s7WIazttbG5MMVyVj09PQJ+fgMvO11UwE' +&lt;br /&gt;
				'wMWGq10R5K6ugg2Nh8fGdiecOaxhdiKTAAACZlqPnWtqu/dxTxlYXNeS1o6' + &lt;br /&gt;
				'IU8rEZqytlp2d4p4bDZ/dn+Eh4pWL2JNOFKLhf/frtusjtGFS750N8ulfo1' + &lt;br /&gt;
				'qVM/Ppm2HhsSQa615UvSlYy5HS9rb1hAEDqdvPjgpJg8PDP/vx4S2s6toMz' +&lt;br /&gt;
				'RERKmlmrS8vkFfXwAhHnI7Ek06K+3x8D92c6/M0DNmZk5nb4xNGr+8s9uNT' +&lt;br /&gt;
				'8x9OysRAtSniJWOlq6GYwAICZGtsP+4dGVCLkaVj4GpqF9fTMuLW8q/ra1r' +&lt;br /&gt;
				'OV1UTXpKJmaZmb+SabGzstWXZEtMTmg9G4RZN4rFwVZeYSH5BAUUAAgALAA' +&lt;br /&gt;
				'AAAB4AA4AAAf/gAiCg4MzM4SIgyo5hGcKj1JTiZOUlZaXmJmagmtrPEprlR' +&lt;br /&gt;
				'N9TA0ICjpIaiMjSEhdm7Gys7SInXd3JiQ3oZN8Bx9jXGpoaEtLFzRumkkEK' +&lt;br /&gt;
				'LTNz4nRtbWGbHBVJttCJBaTDQYaYzASSzAHQCxEmw4AIbTu8Iny1bMzWTtw' +&lt;br /&gt;
				'cH4Fbz4DBHhLZGfMmCJy5NCwY0qWuwdxCHQYVIHAiYmCkkR8sABBvQ4hkgx' +&lt;br /&gt;
				'6GBFjCGknPYYkUCGEgwcnNix4QCCOyEsrVoBpUUOEvwIAw4T5RkjFmA8faP' +&lt;br /&gt;
				'DhU8sdgAcUADhA8ODpCQATN0yhEGKrx3coAMQh5BSqVAQACAhKiyAEgCnv/' +&lt;br /&gt;
				'94CAICAwpQQdjdcmiFmRQuf/nwICDMAA4ZeCLrouBClMR8VJUrMcjd2A4CY' +&lt;br /&gt;
				'lwVNeYEgDgCRFQCgcHdVLVmxCCyfQGuardvVaD8jCFsBQRLUllY40eICRA0' +&lt;br /&gt;
				'BwL8I7ZRhUA8VNAx8sIOGSoISy2LVYz2dAF3rguQ5xT3y3Vq1bFm3PSt+/N' +&lt;br /&gt;
				'TyliyIwbAFhB+BJIinKC5oAh8WBqzAoEKFA5ISONTxRwqZPITAApfdNhYCL' +&lt;br /&gt;
				'0hylV60uUNBVedl99SBmYXnGnnhhfaMapmsgYEY7bWwxRoZZJBCGlAMMgEQ' +&lt;br /&gt;
				'dMhghR5DxKAADWokYMMTWeyBiTtTdODZM3Z1EBo8HYjlgL9dC8izwBSmWRj' +&lt;br /&gt;
				'kkAhMMeWG54WnFQUOeFbhJWtoocWJHqj4gyGE6MBCGQHIUIQZetBwAB5qBE' +&lt;br /&gt;
				'GGF3n8KNYLFx541RQPDIICnxSIVE9Y0nwVB5+BzgbXCRSo5VaWUSYR1QuJh' +&lt;br /&gt;
				'niFBRlkAQEAiA1yBgtFtNGEEUbQYUAUeKDBABYZPBGBPbTWWs1cP4BKyRk0' +&lt;br /&gt;
				'6NFEAKdawUIUTBBhgxfI+mjrssxiMpclXdhBRxlmmJEUDTQckcAcXnjwRKP' +&lt;br /&gt;
				'NhltrIAA7');&lt;br /&gt;
			elmWrapper.appendChild( elmTitle );&lt;br /&gt;
			var elmCloseBox = document.createElement(&amp;quot;img&amp;quot;);&lt;br /&gt;
			elmCloseBox.setAttribute(&amp;quot;src&amp;quot;, 'data:image/png;base64,iVBORw0KG' +&lt;br /&gt;
				'goAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAABmJLR0QA/wD/AP+gvaeT' +&lt;br /&gt;
				'AAAACXBIWXMAAAuJAAALiQE3ycutAAAAB3RJTUUH1QQYCDcSg6d+SAAAAPB' +&lt;br /&gt;
				'JREFUKM+Fkr1qAkEURs9dnWBrJT5IHkEw4gtEsBQs/AlpkiKlJGnEJlqIjR' +&lt;br /&gt;
				'brPoAQYhPio1hGsPAHFoW5KSIxo7J7qvlgDty534j6Rolgt987OQnA7XuEs' +&lt;br /&gt;
				'TuegwIeMYiIkx2hVnsjCL7+su9/0mz2Lox0oNOpUiw+kc2mUVWGww8mkxYi' +&lt;br /&gt;
				'YK09F4xJMho9kMs9IiJMpy8Y83vFWkUTCVcAWCxWLJcrRIT1OiSTOczuCXi' +&lt;br /&gt;
				'eK2y3IeXyK4PBPZtNSKn0zGzWJpW6uvyGer1LpVIgn78GYD7/ptHo0e/fHb' +&lt;br /&gt;
				'emvtHIHv4zvonv4ayXuK9xyg8qt0tfe9qKPAAAAABJRU5ErkJggg==');&lt;br /&gt;
			elmCloseBox.setAttribute(&amp;quot;style&amp;quot;, 'position:absolute;left:190px;' +&lt;br /&gt;
				'top:3px;margin:2px;width:12px;height:12px;background-color:' +&lt;br /&gt;
				'#ffb;border:none;line-height:8px;text-align:center;');&lt;br /&gt;
			elmCloseBox.setAttribute(&amp;quot;title&amp;quot;,&amp;quot;Click To Remove&amp;quot;);&lt;br /&gt;
			elmCloseBox.addEventListener('click', function() {&lt;br /&gt;
				this.parentNode.style.display = &amp;quot;none&amp;quot;;&lt;br /&gt;
			}, true);&lt;br /&gt;
			elmWrapper.appendChild(elmCloseBox);&lt;br /&gt;
			var elmAbout = document.createElement(&amp;quot;a&amp;quot;);&lt;br /&gt;
			var elmAboutImg = document.createElement(&amp;quot;img&amp;quot;);&lt;br /&gt;
			elmAboutImg.setAttribute(&amp;quot;border&amp;quot;, &amp;quot;0&amp;quot;);&lt;br /&gt;
			elmAboutImg.setAttribute(&amp;quot;src&amp;quot;, 'data:image/png;base64,iVBORw0KG' +&lt;br /&gt;
				'goAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAABmJLR0QA/wD/AP+gvaeT' +&lt;br /&gt;
				'AAAACXBIWXMAAAuJAAALiQE3ycutAAAAB3RJTUUH1QQYCDkprC+64gAAAOd' +&lt;br /&gt;
				'JREFUKM+FkrFOAkEURc9ddrJZCgsqCwtCIiUFJa2df2CwNXRS8AmGisLEaG' +&lt;br /&gt;
				'Gs3VhTYDUtxZaED/AriGHjPhuEDC5wq3l5czL3vjeyzBlHtC6KoI4BuPk8Q' +&lt;br /&gt;
				'qx3549rov3+YPBIp3NHq3VLlnkkBf0AWK2+6fevWCze8H7CaPRKUfzgnKsG' +&lt;br /&gt;
				'0jSh272kLEuWyy/a7QvSNKnIsJEk6vWE2SxnPH5nOn3YWopjh9VqIbDBGA5' +&lt;br /&gt;
				'fyPNnGo2znZVIEEWhJTNDgmbzfHvZzA6H/pP3k3/TqQQkIYle7z6oT74wnz' +&lt;br /&gt;
				'8d3KNOfY19/QKFiTrWqbiPtAAAAABJRU5ErkJggg==');&lt;br /&gt;
			elmAbout.appendChild(elmAboutImg);&lt;br /&gt;
			elmAbout.setAttribute(&amp;quot;style&amp;quot;, 'position:absolute;left:175px;top' +&lt;br /&gt;
				':3px;margin:2px;width:12px;height:12px;background-color:#ff' +&lt;br /&gt;
				'b;border:none;line-height:12px;text-align:center;text-decor' +&lt;br /&gt;
				'ation:none;');&lt;br /&gt;
			elmAbout.setAttribute(&amp;quot;title&amp;quot;,&amp;quot;OverStimulate&amp;quot;);&lt;br /&gt;
			elmAbout.setAttribute(&amp;quot;href&amp;quot;, 'http://overstimulate.com/articles' +&lt;br /&gt;
				'/2005/04/24/greasemonkey-&amp;lt;/nowiki&amp;gt;book prices&amp;lt;nowiki&amp;gt;book-burro-find-cheap-books');&lt;br /&gt;
			elmWrapper.appendChild(elmAbout);&lt;br /&gt;
			var elmContent = document.createElement(&amp;quot;table&amp;quot;);&lt;br /&gt;
			elmContent.setAttribute(&amp;quot;style&amp;quot;, 'padding:0 5px;width:100%;font:' +&lt;br /&gt;
				'10pt sans-serif;');&lt;br /&gt;
			elmContent.appendChild( add_site('http://www.amazon.com/exec/obi' +&lt;br /&gt;
				'dos/ASIN/' + isbn + &amp;quot;/&amp;quot; + amazon_associate_code, &amp;quot;Amazon&amp;quot;,&lt;br /&gt;
				&amp;quot;burro_amazon&amp;quot; ));&lt;br /&gt;
			elmContent.appendChild( add_site(&amp;quot;http://www.amazon.com/exec/obi&amp;quot; +&lt;br /&gt;
				&amp;quot;dos/redirect?tag=&amp;quot;+amazon_associate_code+&lt;br /&gt;
				&amp;quot;&amp;amp;path=tg/stores/offering/list/-/&amp;quot;+isbn+&amp;quot;/all/&amp;quot;,&lt;br /&gt;
				&amp;quot;Amazon (used)&amp;quot;, &amp;quot;burro_amazonmarket&amp;quot; ));&lt;br /&gt;
			elmContent.appendChild( add_site( 'http://service.bfast.com/bfas' + &lt;br /&gt;
				't/click?bfmid=2181&amp;amp;sourceid=' + bn_associate_code +'&amp;amp;bfpid=' +&lt;br /&gt;
				isbn + '&amp;amp;bfmtype=book', &amp;quot;Barnes &amp;amp; Noble&amp;quot;, &amp;quot;burro_bn&amp;quot;));&lt;br /&gt;
			elmContent.appendChild( add_site(&amp;quot;http://www.buy.com/retail/Glob&amp;quot; +&lt;br /&gt;
				&amp;quot;alSearchAction.asp?qu=&amp;quot; + isbn, &amp;quot;Buy.com&amp;quot;, &amp;quot;burro_buy&amp;quot;));&lt;br /&gt;
			elmContent.appendChild( add_site( 'http://www.tkqlhce.com/click-' +&lt;br /&gt;
				half_associate_code+'?ISBN=' + isbn, 'Half.com', 'burro_half' ));&lt;br /&gt;
			elmContent.appendChild( add_site('http://www.powells.com/cgi-bin' +&lt;br /&gt;
				'/biblio?isbn=' + isbn, &amp;quot;Powell's Books&amp;quot;, &amp;quot;burro_powell&amp;quot;));&lt;br /&gt;
			elmWrapper.appendChild(elmContent); &lt;br /&gt;
			elmWrapper.addEventListener('click', function() {&lt;br /&gt;
				var elmCaret = document.getElementById('hide_show_elmCaret');&lt;br /&gt;
				if (this.style.height != &amp;quot;auto&amp;quot;) { &lt;br /&gt;
				if (this.style.height == &amp;quot;15px&amp;quot;) {&lt;br /&gt;
				run_queries( isbn ); &lt;br /&gt;
				}&lt;br /&gt;
				this.style.height = &amp;quot;auto&amp;quot;;&lt;br /&gt;
				elmCaret[&amp;quot;src&amp;quot;] = 'data:image/png;base64,iVBORw0KGgoAAAA' +&lt;br /&gt;
				'NSUhEUgAAAAsAAAALCAYAAACprHcmAAAABmJLR0QA/wD/AP+gva' +&lt;br /&gt;
				'eTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1QQYCRoeq' +&lt;br /&gt;
				'/kCuwAAAB10RVh0Q29tbWVudABDcmVhdGVkIHdpdGggVGhlIEdJ' +&lt;br /&gt;
				'TVDvZCVuAAAAmElEQVQY083QMUoDARSE4W92U2xhkxSpAgY0AXM' + &lt;br /&gt;
				'Q29zCM3iSXEXQTrCws44Im85CkO1jnq2KKQWnGxiY+Yd/oXw1tT' +&lt;br /&gt;
				'rr7D86CYdD5Xk3HA8vTi8la7xW1T5Jg8IEN6PvPXnEAkOa5l5Vi' + &lt;br /&gt;
				'wuc4yk/d9VyfoLrqnpIMmCGu2z79/wGUsv5FFcYY5Nt/wKjI+Bv' +&lt;br /&gt;
				'uEWnbfu///kTargo75QVC5oAAAAASUVORK5CYII=';&lt;br /&gt;
				} else {&lt;br /&gt;
				elmCaret[&amp;quot;src&amp;quot;] = 'data:image/png;base64,iVBORw0KGgoAAAA' +&lt;br /&gt;
				'NSUhEUgAAAAsAAAALCAYAAACprHcmAAAABmJLR0QA/wD/AP+gva' +&lt;br /&gt;
				'eTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1QQYCR020' +&lt;br /&gt;
				'Q08hgAAAB10RVh0Q29tbWVudABDcmVhdGVkIHdpdGggVGhlIEdJ' +&lt;br /&gt;
				'TVDvZCVuAAAAiklEQVQY07XPIQoCURSF4e8NAzYxGicNuAa1Wly' +&lt;br /&gt;
				'CO3AlZnfiNgwahQFxikkcBIsGfaZpzgODJ/4c/nMvPyR8g7Esep' +&lt;br /&gt;
				'hgH6q6aXnWIelhjkUsi0EL88TqFUfMYlnscMoS5wUccMYS4yxhf' +&lt;br /&gt;
				'uGNPho88oQ5xxQjrHHpKkcMccMqVPU99eATG2zb4n/zAS4OHrV1' +&lt;br /&gt;
				'hIB/AAAAAElFTkSuQmCC';&lt;br /&gt;
				this.style.height = &amp;quot;14px&amp;quot;;&lt;br /&gt;
				}&lt;br /&gt;
			}, true);&lt;br /&gt;
			document.getElementsByTagName(&amp;quot;body&amp;quot;)[0].appendChild(elmWrapper);&lt;br /&gt;
		}&lt;br /&gt;
			&lt;br /&gt;
		if (document.location.href.match('amazon.com') &amp;amp;&amp;amp;&lt;br /&gt;
			!document.location.href.match('rate-this')) {&lt;br /&gt;
			isbn = checkISBN(&lt;br /&gt;
				document.location.href.match(/\/([0-9X]{10})(\/|\?|$)/)[1]);&lt;br /&gt;
			if (isbn) burro( 'amazon', isbn ); &lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		if (document.location.href.match('barnesandnoble.com')) {&lt;br /&gt;
			isbn = checkISBN( document.location.href.match(&lt;br /&gt;
				/[iI][sS][Bb][Nn]=([0-9X]{10})(\&amp;amp;|\?|$)/)[1] );&lt;br /&gt;
			if (isbn) burro( 'bn', isbn );&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		if (document.location.href.match('buy.com')) {&lt;br /&gt;
			var isbn = checkISBN(&lt;br /&gt;
				document.title.match(/ISBN ([0-9X]{10})/)[1] );&lt;br /&gt;
			if (isbn) burro( 'buy', isbn );&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		if (document.location.href.match('powells.com')) {&lt;br /&gt;
			var arBold = document.getElementsByTagName('b');&lt;br /&gt;
			for (var i=0; i&amp;lt;arBold.length; i++) {&lt;br /&gt;
				if (arBold[i].innerHTML.match('ISBN:')) {&lt;br /&gt;
				isbn = checkISBN(arBold[i].nextSibling.nextSibling.text);&lt;br /&gt;
				if (isbn) burro( 'powells', isbn );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if (document.location.href.match('half.ebay.com')) {&lt;br /&gt;
			var arBold = document.getElementsByTagName('b');&lt;br /&gt;
			for	(var i=0; i&amp;lt;arBold.length; i++) {&lt;br /&gt;
				if (arBold[i].innerHTML.match('ISBN:')) { &lt;br /&gt;
				isbn = checkISBN(arBold[i].nextSibling.text);&lt;br /&gt;
				if (isbn) burro( 'half', isbn );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running the Hack ===&lt;br /&gt;
&lt;br /&gt;
After installing this script (Tools → Install This User Script), go to ''http://www.amazon.com'' and search for &amp;lt;tt&amp;gt;Harry Potter Half-Blood Prince&amp;lt;/tt&amp;gt;. Click through to the book page. In the top-left corner is a small floating window titled Book Burro. Click the triangle to expand the window, and Book Burro will fetch prices from other online retailers, as shown in [[Greasemonkey Hacks/Site Integration#greasemonkeyhks-CHP-11-FIG-7|Figure 11-7]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;greasemonkeyhks-CHP-11-FIG-7&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 11-7. Comparison shopping for Harry Potter'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Greasemonkey Hacks_I_11_tt388.png|Comparison shopping for Harry Potter]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each of the competitors is a link to buy that book on another site. Click Barnes &amp;amp; Noble to go to the book page at ''http://barnesandnoble.com'', as shown in [[Greasemonkey Hacks/Site Integration#greasemonkeyhks-CHP-11-FIG-8|Figure 11-8]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;greasemonkeyhks-CHP-11-FIG-8&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 11-8. Harry Potter on BarnesAndNoble.com'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Greasemonkey Hacks_I_11_tt389.png|Harry Potter on BarnesAndNoble.com]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script will not fetch prices from other sites unless you expand the Book Burro window. You will need to expand the pricing window manually each time you go to a book page to see competitors' prices.&lt;/div&gt;</summary>
		<author><name>Docbook2Wiki</name></author>	</entry>

	</feed>