Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book General > Deals, Freebies, and Resources (No Self-Promotion)

Notices

Reply
 
Thread Tools Search this Thread
Old 07-16-2012, 07:09 PM   #1
kakapo
The Night Parrot
kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.
 
kakapo's Avatar
 
Posts: 22
Karma: 105390
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     http://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);
      }
    }
  }
}
kakapo is offline   Reply With Quote
Old 07-16-2012, 09:55 PM   #2
copyrite
Wizard
copyrite ought to be getting tired of karma fortunes by now.copyrite ought to be getting tired of karma fortunes by now.copyrite ought to be getting tired of karma fortunes by now.copyrite ought to be getting tired of karma fortunes by now.copyrite ought to be getting tired of karma fortunes by now.copyrite ought to be getting tired of karma fortunes by now.copyrite ought to be getting tired of karma fortunes by now.copyrite ought to be getting tired of karma fortunes by now.copyrite ought to be getting tired of karma fortunes by now.copyrite ought to be getting tired of karma fortunes by now.copyrite ought to be getting tired of karma fortunes by now.
 
copyrite's Avatar
 
Posts: 1,004
Karma: 1395081
Join Date: Sep 2010
Location: Maryland
Device: Samsung Galaxy S4, K3K, PW, N7.2, Fire HD 6"
Pretty cool! Thanks!
copyrite is offline   Reply With Quote
 
Advertisement
Old 07-17-2012, 06:42 AM   #3
sherman
Addict
sherman can bend spoons with a thought.sherman can bend spoons with a thought.sherman can bend spoons with a thought.sherman can bend spoons with a thought.sherman can bend spoons with a thought.sherman can bend spoons with a thought.sherman can bend spoons with a thought.sherman can bend spoons with a thought.sherman can bend spoons with a thought.sherman can bend spoons with a thought.sherman can bend spoons with a thought.
 
Posts: 279
Karma: 134960
Join Date: Sep 2008
Location: Auckland - NZ
Device: Sony PRS-505/SC, B&N Nook, Sony PRS-650/BC, Kobo Glo
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
sherman is offline   Reply With Quote
Old 07-17-2012, 11:21 AM   #4
Joseph R
Zealot
Joseph R ought to be getting tired of karma fortunes by now.Joseph R ought to be getting tired of karma fortunes by now.Joseph R ought to be getting tired of karma fortunes by now.Joseph R ought to be getting tired of karma fortunes by now.Joseph R ought to be getting tired of karma fortunes by now.Joseph R ought to be getting tired of karma fortunes by now.Joseph R ought to be getting tired of karma fortunes by now.Joseph R ought to be getting tired of karma fortunes by now.Joseph R ought to be getting tired of karma fortunes by now.Joseph R ought to be getting tired of karma fortunes by now.Joseph R ought to be getting tired of karma fortunes by now.
 
Joseph R's Avatar
 
Posts: 136
Karma: 2120000
Join Date: Aug 2011
Location: Edmonton, Alberta
Device: Kindle Paperwhite, Nexus 7, Kobo Glo
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!
Joseph R is offline   Reply With Quote
Old 07-17-2012, 08:11 PM   #5
kyteflyer
Wizard
kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.
 
kyteflyer's Avatar
 
Posts: 1,123
Karma: 1835838
Join Date: Jul 2009
Location: Newcastle, Australia
Device: iPhone, iPad Mini
Wonder why its not working here... script installed OK...
kyteflyer is offline   Reply With Quote
Old 07-17-2012, 08:30 PM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 38,521
Karma: 19637653
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 1, iPhone 5
Anyway want to come up with scripts for Sony, B&N, & Kobo please?
JSWolf is offline   Reply With Quote
Old 07-31-2012, 08:02 PM   #7
kyteflyer
Wizard
kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.
 
kyteflyer's Avatar
 
Posts: 1,123
Karma: 1835838
Join Date: Jul 2009
Location: Newcastle, Australia
Device: iPhone, iPad Mini
Script is working on the computer, just love it. Thanks
kyteflyer is offline   Reply With Quote
Old 03-02-2013, 05:36 PM   #8
kyteflyer
Wizard
kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.
 
kyteflyer's Avatar
 
Posts: 1,123
Karma: 1835838
Join Date: Jul 2009
Location: Newcastle, Australia
Device: iPhone, iPad Mini
Thumbs up FYI: Works in other browsers too

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.

kyteflyer is offline   Reply With Quote
Old 03-02-2013, 06:28 PM   #9
Shack70
Guru
Shack70 ought to be getting tired of karma fortunes by now.Shack70 ought to be getting tired of karma fortunes by now.Shack70 ought to be getting tired of karma fortunes by now.Shack70 ought to be getting tired of karma fortunes by now.Shack70 ought to be getting tired of karma fortunes by now.Shack70 ought to be getting tired of karma fortunes by now.Shack70 ought to be getting tired of karma fortunes by now.Shack70 ought to be getting tired of karma fortunes by now.Shack70 ought to be getting tired of karma fortunes by now.Shack70 ought to be getting tired of karma fortunes by now.Shack70 ought to be getting tired of karma fortunes by now.
 
Shack70's Avatar
 
Posts: 774
Karma: 1043626
Join Date: Dec 2010
Location: York, Pa
Device: Kindle 3, Kindle Fire, Ipod Touch 2G, iPod Touch 4G, iPad, Kobo
Working fine here (Firefox + Amazon US Store)! Thanks!
Shack70 is offline   Reply With Quote
Old 03-03-2013, 04:46 PM   #10
kakapo
The Night Parrot
kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.kakapo shapes the world with his or her thoughts.
 
kakapo's Avatar
 
Posts: 22
Karma: 105390
Join Date: Feb 2011
Location: Codfish Island, NZ
Device: Palm Vx, Kindle Keyboard (wifi)
Quote:
Originally Posted by kyteflyer View Post
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.
Try NinjaKit as a replacement for Greasekit. It works for me on Safari 5.1.7 (still on 10.6 here, so can't get Safari 6).

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?
kakapo is offline   Reply With Quote
Old 03-03-2013, 05:02 PM   #11
carld
Wizard
carld ought to be getting tired of karma fortunes by now.carld ought to be getting tired of karma fortunes by now.carld ought to be getting tired of karma fortunes by now.carld ought to be getting tired of karma fortunes by now.carld ought to be getting tired of karma fortunes by now.carld ought to be getting tired of karma fortunes by now.carld ought to be getting tired of karma fortunes by now.carld ought to be getting tired of karma fortunes by now.carld ought to be getting tired of karma fortunes by now.carld ought to be getting tired of karma fortunes by now.carld ought to be getting tired of karma fortunes by now.
 
Posts: 2,681
Karma: 3909099
Join Date: Dec 2007
Device: Kindle Fire HD, Kindle 3, Droid Razr Maxx HD
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.
carld is offline   Reply With Quote
Old 03-04-2013, 05:42 PM   #12
kyteflyer
Wizard
kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.kyteflyer ought to be getting tired of karma fortunes by now.
 
kyteflyer's Avatar
 
Posts: 1,123
Karma: 1835838
Join Date: Jul 2009
Location: Newcastle, Australia
Device: iPhone, iPad Mini
Quote:
Originally Posted by kakapo View Post
Try NinjaKit as a replacement for Greasekit. It works for me on Safari 5.1.7 (still on 10.6 here, so can't get Safari 6).
Thanks for that.. I'll give it a try (on 10.8.3 beta and latest safari so should be interesting... will report back)

[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.
kyteflyer is offline   Reply With Quote
Old 03-06-2013, 07:56 PM   #13
sadievan
Wizard
sadievan ought to be getting tired of karma fortunes by now.sadievan ought to be getting tired of karma fortunes by now.sadievan ought to be getting tired of karma fortunes by now.sadievan ought to be getting tired of karma fortunes by now.sadievan ought to be getting tired of karma fortunes by now.sadievan ought to be getting tired of karma fortunes by now.sadievan ought to be getting tired of karma fortunes by now.sadievan ought to be getting tired of karma fortunes by now.sadievan ought to be getting tired of karma fortunes by now.sadievan ought to be getting tired of karma fortunes by now.sadievan ought to be getting tired of karma fortunes by now.
 
sadievan's Avatar
 
Posts: 1,800
Karma: 3000000
Join Date: Nov 2010
Device: Kindle Paperwhite 2, iPhone, Kindle Fire HD 6
Thanks Kakapo. Karma going to you.
sadievan is offline   Reply With Quote
Old 03-06-2013, 08:27 PM   #14
DustyDisks
Want sum bacon?
DustyDisks ought to be getting tired of karma fortunes by now.DustyDisks ought to be getting tired of karma fortunes by now.DustyDisks ought to be getting tired of karma fortunes by now.DustyDisks ought to be getting tired of karma fortunes by now.DustyDisks ought to be getting tired of karma fortunes by now.DustyDisks ought to be getting tired of karma fortunes by now.DustyDisks ought to be getting tired of karma fortunes by now.DustyDisks ought to be getting tired of karma fortunes by now.DustyDisks ought to be getting tired of karma fortunes by now.DustyDisks ought to be getting tired of karma fortunes by now.DustyDisks ought to be getting tired of karma fortunes by now.
 
DustyDisks's Avatar
 
Posts: 488
Karma: 1596586
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!
DustyDisks is offline   Reply With Quote
Old 03-16-2013, 01:13 PM   #15
darthyoda6
Enthusiast
darthyoda6 can self-interpret dreams as they happen.darthyoda6 can self-interpret dreams as they happen.darthyoda6 can self-interpret dreams as they happen.darthyoda6 can self-interpret dreams as they happen.darthyoda6 can self-interpret dreams as they happen.darthyoda6 can self-interpret dreams as they happen.darthyoda6 can self-interpret dreams as they happen.darthyoda6 can self-interpret dreams as they happen.darthyoda6 can self-interpret dreams as they happen.darthyoda6 can self-interpret dreams as they happen.darthyoda6 can self-interpret dreams as they happen.
 
Posts: 37
Karma: 20874
Join Date: Nov 2010
Location: Canada
Device: Kobo Glo, Nexus 7 2012, Acer Iconia W510
Thanks, it's working great with Greasemonkey, although I had to add
Code:
// @grant       GM_xmlhttpRequest
at the top to get rid of the message that kept poping up about the script needing to grant permission. Is there a way to get the script to use the amazon.com links but check the price against amazon.ca? Or do I just need to change the (com) to (ca).

Thanks
darthyoda6 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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, Freebies, and Resources (No Self-Promotion) 3 12-06-2010 04:55 PM
Serious exploit in Greasemonkey 0.4 Alexander Turcic Lounge 2 07-19-2005 05:59 AM


All times are GMT -4. The time now is 09:11 PM.


MobileRead.com is a privately owned, operated and funded community.