| 
			
			 | 
		#1 | 
| 
			
			
			
			 The Night Parrot 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 23 
				Karma: 138516 
				Join Date: Feb 2011 
				Location: Codfish Island, NZ 
				
				
				Device: Palm Vx, Kindle Keyboard (wifi) 
				
				
				 | 
	
	
	
		
		
			
			 
				
				GreaseMonkey script to check Kindle prices in this forum
			 
			
			
			I have written a script for GreaseMonkey (a FireFox addon) to check the prices of Kindle ebooks linked in MobileRead forum posts.  Once installed, any links to a Kindle ebook will have the price displayed after then.  Prices are coloured red for free and blue otherwise. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Currently the script only works in FireFox with GreaseMonkey installed. Even though Google Chrome can use some GreaseMonkey scripts, it can't use this one. I should be able to make it work as a proper Chrome extension, just ask and i will. The script is set up to check amazon.com links. It can check amazon.co.uk links, just change the appropriate line at the top. Adding of additional Amazon countries should be easy enough. It should even be possible to add other ebook stores, eg Kobo or B&N. To install the script, go to http://userscripts.org/scripts/show/138544 or copy out the code below. Code: 
	// ==UserScript==
// @name        MobileRead Kindle Price Check
// @namespace   kakapo.public
// @description Checks price of Kindle ebook links in MobileRead forum posts
// @include     https://www.mobileread.com/forums/showthread.php*
// @version     1
// ==/UserScript==
// change com in line below to co.uk for Amazon UK
var site_regex = /^(http|https):\/\/(www\.)?amazon\.(com)(\/.*)/;
var ebook_url_regexs = [
  /^\/dp\//,
  /^\/[^\/]+\/dp\//,
  /^\/gp\/product\//
];
var check_price = function(element, url) {
  var xhr = GM_xmlhttpRequest({
    method: 'GET',
    url: url,
    onload: function(response) {
      var data = response.responseText;
      var pos0 = data.indexOf('class="priceLarge"');
      var pos1 = data.indexOf('>', pos0);
      var pos2 = data.indexOf('<', pos1);
      var price = data.substring(pos1 + 1, pos2).trim();
      if (price == '') {
        price = 'N/A';
      }
      var color = price == 'Free' || price == '$0.00' || price == '£0.00' ? 'red' : 'blue';
      element.insertAdjacentHTML('afterend', ' <span style="color:'+color+'">('+price+')</span>');
    }
  });
}
var a = document.getElementsByTagName('a');
for (var i = 0; i < a.length; i++) {
  var url = a[i].href;
  var parts = site_regex.exec(url);
  if (parts) {
    for (var j = 0; j < ebook_url_regexs.length; j++)  {
      if (ebook_url_regexs[j].test(parts[parts.length-1])) {
        check_price(a[i], url);
      }
    }
  }
}
 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,841 
				Karma: 4985051 
				Join Date: Sep 2010 
				Location: Maryland 
				
				
				Device: Kindle 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Pretty cool! Thanks!
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 877 
				Karma: 2676800 
				Join Date: Sep 2008 
				Location: Taranaki - NZ 
				
				
				Device: Kobo Aura H2O, Kobo Forma 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			And still no one knows just WHAT is going on over at Amazon... 
		
	
		
		
		
		
		
		
		
		
		
		
	
	This thread on the Amazon discussion boards has quite a number of very confused international Amazon customers. Us folks from NZ seem to be especially affected. I haven't been able to obtain ANY of the advertised freebies from Amazon for at least a week now  
		 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 Zealot 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 136 
				Karma: 2137000 
				Join Date: Aug 2011 
				Location: Calgary, Alberta 
				
				
				Device: iPad, Kobo Glo HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thank you for the good work, kakapo!  
		
	
		
		
		
		
		
		
		
		
		
		
	
	![]() Tampermonkey is Chrome's equivalent to greasemonkey. All you need to do is go to ''add a new script', and Copy and Paste Kakapo's script and you are good to go!  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,845 
				Karma: 9547754 
				Join Date: Jul 2009 
				Location: Newcastle, Australia 
				
				
				Device: iPhone 12 Mini 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Wonder why its not working here... script installed OK...
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,782 
				Karma: 150249619 
				Join Date: Nov 2006 
				Location: Roslindale, Massachusetts 
				
				
				Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Anyway want to come up with scripts for Sony, B&N, & Kobo please?
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,845 
				Karma: 9547754 
				Join Date: Jul 2009 
				Location: Newcastle, Australia 
				
				
				Device: iPhone 12 Mini 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Script is working on the computer, just love it.  Thanks  
		
	
		
		
		
		
		
		
		
		
		
		
	
	 
		 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#8 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,845 
				Karma: 9547754 
				Join Date: Jul 2009 
				Location: Newcastle, Australia 
				
				
				Device: iPhone 12 Mini 
				
				
				 | 
	
	
	
		
		
			
			 
			
			I've given up on Firefox because it has turned into a giant slug... So mostly using Chrome, Opera and Safari. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Sadly, Greasekit for Safari does not any longer seem to be maintained, and the old script isn't compatible with newer versions of Safari... perhaps someone will do something about it. On Chrome, its Tampermonkey, and in Opera, its Violentmonkey. This script works beautifully in both of those.  
		 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#9 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 777 
				Karma: 1043626 
				Join Date: Dec 2010 
				Location: York, Pa 
				
				
				Device: Kindle Paperwhite 11th Generation 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Working fine here (Firefox + Amazon US Store)!  Thanks!
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#10 | |
| 
			
			
			
			 The Night Parrot 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 23 
				Karma: 138516 
				Join Date: Feb 2011 
				Location: Codfish Island, NZ 
				
				
				Device: Palm Vx, Kindle Keyboard (wifi) 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 While i'm here, any suggestions for new features for the Kindle Price Check script? Proper UK/DE/etc versions? Automatic .com to .co.uk link conversion? BN/Kobo/Sony support?  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#11 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,698 
				Karma: 4748723 
				Join Date: Dec 2007 
				
				
				
				Device: Kindle Paperwhite 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			This is terrific. Thank you. And yes, Tapermonkey + Script works just fine with Chrome. 
		
	
		
		
		
		
		
		
		
		
		
		
		
			Edit: I was surprised, but it also shows prices for linked Android Apps as well. Last edited by carld; 03-03-2013 at 05:15 PM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#12 | |
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,845 
				Karma: 9547754 
				Join Date: Jul 2009 
				Location: Newcastle, Australia 
				
				
				Device: iPhone 12 Mini 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 [edit] WORKING!! Yay! Hope it works for my other scripts for other sites too  
		Last edited by kyteflyer; 03-04-2013 at 05:49 PM.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#13 | 
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,933 
				Karma: 5477576 
				Join Date: Nov 2010 
				
				
				
				Device: Kindle Paperwhite, iPhone, Kobo LC 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thanks Kakapo.  Karma going to you.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#14 | 
| 
			
			
			
			 Old Fart In Training 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 534 
				Karma: 2742476 
				Join Date: Jan 2011 
				Location: Gladewater, Texas 
				
				
				Device: K3+3g/KFHD 7"/Nexus 7/Nexus 7.2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thanks Kakapo, 
		
	
		
		
		
		
		
		
		
		
		
		
	
	This is almost as good as "crispy" bacon!  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#15 | 
| 
			
			
			
			 Connoisseur 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 97 
				Karma: 124056 
				Join Date: Nov 2010 
				Location: Canada 
				
				
				Device: Kobo Clara B&W, Kindle Paperwhite 10th Gen, Kindle 7th Gen 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thanks, it's working great with Greasemonkey, although I had to add  
		
	
		
		
		
		
		
		
		
		
		
		
	
	Code: 
	// @grant GM_xmlhttpRequest Thanks  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
            
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| WOW! The Kobo Forum is Almost Getting as Much Action as the Kindle Forum!!! | pokee | Kobo Reader | 16 | 11-13-2011 10:50 AM | 
| Hate high ebook prices? Check out this experiment | iq3 | News | 75 | 02-08-2011 07:02 AM | 
| A site to check on prices of ebooks | sadievan | Deals and Resources (No Self-Promotion or Affiliate Links) | 3 | 12-06-2010 04:55 PM | 
| Serious exploit in Greasemonkey 0.4 | Alexander Turcic | Lounge | 2 | 07-19-2005 05:59 AM |