User talk:Lunchboxhero/monobook.js

Headline 1
i tried this every time with empty cache:

1) reload this code page it didnt work

2) save code in a seperate temp.js file(most likely won't work)

and open it

--Roaming 11:03, 13 December 2005 (UTC)


 * You need to copy the code that is on User:Lunchboxhero/monobook.js to your user monobook.js page. In your case, it would be User:Roaming/monobook.js.Lunchboxhero


 * THANKS WORKS GREAT out of the box this A9.com replacement for amazon.com code in the respective line worked also well for me, should work with the bookpage or seach enginepage of choice replacing 'www ... ' with page of choice (not really there is a minor disapt about the program)

document.links[i].href='http://www.a9.com/isbn%20'+RegExp.$1;

--

How do you create the page monobook.js at your user page? Do you upload a file? Where do you do this and why is it assumed that you should know how to do this?

PaulPk (talk) 18:18, 22 October 2009 (UTC)

Headline 2
Please sir, I cannot get it to work either. I use a mozilla browser. Can you please look at my page and advice me how it is wrong? User:Engwar/monobook.js A human 03:10, 31 December 2005 (UTC) A: sure i douls look at you page

--

Would the cache reloading instructions be any different for Opera? I just tried your script and still get the Book sources article. -thanks, Onceler 19:07, 14 February 2006 (UTC)

Firefox/Mozilla/Opera workaround.
I tried to set this up in Firefox and it wouldn't work. So I set it up in IE. Opened Firefox back up, and it works. Voila. Try the same fix for other browsers. If it doesnt work just hit it with a hammer.

Minor (random) suggestion
Not meaning to be patronising, but you don't necessarily need the variable  here: var ln = document.links[i].href.match(/isbn=(.*)/); if (ln) { document.links[i].href='http://www.amazon.com/exec/obidos/ASIN/'+RegExp.$1; } This would work too: if( document.links[i].href.match(/isbn=(.*)/) ) { document.links[i].href='http://www.amazon.com/exec/obidos/ASIN/'+RegExp.$1; } It's small, but I figure that this code is used lots so it might make a noticeable difference. *shrugs* It's up to you though, Mr. Lunchboxhero. :) -- drrngrvy tlk @ 19:26, 28 August 2006 (UTC)

Adapt to make $wgBookstoreListEn serve an Amazon.com affiliate bookstore
Dear LBH:

I'm trying to rework $wgBookstoreListEn in Language.php so that the ISBN Book Source link tells Amazon that the user is coming into the Amazon site from my site. I've modified the relevant line in

/* private */ $wgBookstoreListEn = array(       "AddALL" => "http://www.addall.com/New/Partner.cgi?query=$1&type=ISBN",        "PriceSCAN" => "http://www.pricescan.com/books/bookDetail.asp?isbn=$1",        "Barnes & Noble" => "http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=$1",        "Amazon.com" => "http://www.amazon.com/exec/obidos/ISBN=$1"

to: "Amazon.com" => "http://www.amazon.com/exec/obidos/ISBN=$1/ref=ase/theclausewitzhomA/"

but the link produced is still simply http://www.amazon.com/exec/obidos/ISBN=0385720386.

Any idea what the problem is?

Thanks,

Chris

Amazon: Looking for something?
Your code works, but the link produced http://www.amazon.com/exec/obidos/ASIN/8877500182 caused Amazon to say "We're sorry. The Web address you entered is not a functioning page on our site." There seems to be some problem, but I'm not sure how to fix it. -- Jreferee 20:10, 20 October 2006 (UTC)

Amazon doesn't have a book with that ISBN number.

Lunchboxhero

Tweak
I modified it so it would be easier for novices to customize. I hope you don't mind. If so, I can revert and create a new version in Wikipedia: or my own userspace. Superm401 - Talk 01:05, 9 January 2007 (UTC)

I like this idea, and would incorporate it, but the script no longer seems to work.

Lunchboxhero
 * I'm very sorry. I did test the code, but not the latest version.  I made the foolish mistake of assuming the last changes (disbabling the script on the Book sources pages) were trivial.  In fact, I forgot to quote a string, breaking the entire thing.  The below should work; I'd be grateful if you tested it and used it if you approve:

function externISBN { var magicURL = "http://www.amazon.com/gp/search/ref=sr_adv_b/?search-alias=stripbooks&field-isbn=MAGICNUMBER"; if(wgPageName != "Special:Booksources" && wgPageName != "Wikipedia:Book_sources"){ for (var i = 0; i < document.links.length; i++) {               if( document.links[i].href.match(/isbn=(.*)/) ) { document.links[i].href=magicURL.replace(/MAGICNUMBER/ig, RegExp.$1); }    }   } }
 * --Superm401 - Talk 07:11, 14 January 2007 (UTC)
 * The MAGICNUMBER regex can be replaced for efficiency. Thus, it would be:

function externISBN {

var magicURL = "http://www.amazon.com/gp/search/ref=sr_adv_b/?search-alias=stripbooks&field-isbn=MAGICNUMBER"; var magicRegex = /MAGICNUMBER/ig; if(wgPageName != "Special:Booksources" && wgPageName != "Wikipedia:Book_sources"){ for (var i = 0; i < document.links.length; i++) {               if( document.links[i].href.match(/isbn=(.*)/) ) { document.links[i].href=magicURL.replace(magicRegex, RegExp.$1); }    }   } }

addOnloadHook(externISBN);
 * And this version was tested. --Superm401 - Talk 07:16, 14 January 2007 (UTC)

Great! Thanks.

Lunchboxhero
 * You're welcome. Sorry about the problem before. Superm401 - Talk 05:31, 18 January 2007 (UTC)

13-digit ISBNs
'[Hi, I'm reporting a problem per a suggestion I received in response to a helpme on my user page; this is a copy. At least now I know now it's not just a problem with my own setup. As you will see, it's confusing but not urgent. Thank you, CliffC 22:57, 9 September 2007 (UTC)]'

13-digit ISBNs are not working for me. For example, none of the 13-digit ISBNs under the three cover images from ...for Dummies work for me. Each results in an Amazon.com 404 ("We're sorry. The Web address you entered is not a functioning page on our site ") error. If I substitute the equivalent 10-digit ISBN, the Amazon.com page comes up fine. Example below. Is this some personal setup problem, a Wikipedia one, or Amazon's? Any guesses would be appreciated. My monobook.js is HERE; I've tried a more vanilla version with no better results. FWIW, pasting the 13-digit ISBN straight into Amazon's search box works fine. --CliffC 19:53, 9 September 2007 (UTC)

thumb|150px|left 13-digit ISBN not working, ISBN 9780470043998

thumb|150px|right10-digit ISBN works fine, ISBN 0470043997


 * Hi, I've clicked on the ISBN there to go to Wikipedia's ISBN page, gone down to the "Find this book on Amazon.com" link, and clicked there, and it found the book, both for the ISBN13 as well as the ISBN10. So I'm not having the problem.  Are you still experiencing an issue? &mdash; Timotab Timothy (not Timdagnabbit!) 21:30, 9 September 2007 (UTC)
 * hang on, I just realised you mean using the code to avoid going to Special:Booksources. Let me check. &mdash; Timotab Timothy (not Timdagnabbit!) 21:36, 9 September 2007 (UTC)
 * OK, I can reproduce the problem, but not sure why. I suggest you report it to the author of the code.  His comments suggest the best place would be User_talk:Lunchboxhero/monobook.js  &mdash; Timotab Timothy (not Timdagnabbit!) 21:51, 9 September 2007 (UTC)

Well, you can use this as your magicURL: http://www.amazon.com/s?search-alias=stripbooks&field-isbn=MAGICNUMBER

Lunchboxhero 12:47, 21 September 2007 (UTC)
 * This also works with amazon in the UK, by replacing the amazon.com with amazon.co.uk DuncanHill (talk) 12:18, 28 April 2008 (UTC)


 * Thanks very much! I changed that one line in my monobook.js to read
 *  var magicURL = "http://www.amazon.com/s?search-alias=stripbooks&field-isbn=MAGICNUMBER"; 
 * and now it works fine for both types of ISBN. I tried appending the "/wikipedia08-20" string that's supposed to give Wikipedia some sort of Amazon referral credit – for ISBN13s Amazon doesn't understand the string (gives an error), but it still works for ISBN10s.  Well, I'm off to order the entire "For Dummies" catalog.  --CliffC 16:28, 21 September 2007 (UTC)
 * Very funny. I tried to generate an appropriate affiliate link with the field-isbn.  I think it is:
 * http://www.amazon.com/gp/search?ie=UTF8&field-isbn=MAGICNUMBER&tag=wikipedia08-20
 * I know that works (in that it takes you to the book), but I don't know whether Wikipedia will really get a credit. Superm401 - Talk 08:55, 28 April 2008 (UTC)
 * Some testing with Amazon's official link tester indicates that it will, but no guarantees. Superm401 - Talk 09:11, 28 April 2008 (UTC)


 * Good deal. I'll change the default URL. Lunchboxhero (talk) 15:49, 29 April 2008 (UTC)

amazon is spam
It is totally wrong to give a reference to amazon as the default, Wikipedia credit or no--that is spam of the most blatant sort for a commercial bookstore. The isbn page was designed to prevent this by getting people not to use amazon. A suitable neutral non-profit source should be used as the default, and the best is probably WorldCat. DGG (talk) 00:35, 25 December 2007 (UTC)
 * The ISBN is designed to let people find the book source of their choice.  It is certainly not designed to absolutely prevent use of Amazon.  The code here is for people that want a single book source.  That source can be anything you want; Lunchboxhero wanted Amazon, so that's how it was first created.  There's nothing stopping you from taking this code, and putting it in your own monobook with the URL changed to WorldCat.  It is deliberately easy to change. Superm401 - Talk 23:05, 26 December 2007 (UTC)

The conversation continues at Wikipedia talk:Spam. Lunchboxhero (talk)

"link" to Special:Book_sources is now Book sources
Hi, in the introductory comments, the "link" to Special:Book_sources seems to now be Book sources. --Jtir (talk) 22:29, 8 January 2008 (UTC)

I'm not sure what you are talking about. Lunchboxhero (talk) 12:33, 9 January 2008 (UTC)
 * Sorry for not being more specific. The second line in the comments at the head of User:Lunchboxhero/monobook.js refers to Special:Book_sources instead of Book sources.


 * Great tool, BTW.
 * Maybe it could be added to the "Gadgets".
 * --Jtir (talk) 14:36, 9 January 2008 (UTC)

Hi Jtir,

The Mediawiki software turns ISBN references into links to Special:Book_sources, (i.e. http://en.wikipedia.org/w/index.php?title=Special:Booksources&isbn=0394572432). Wikipedia:Book_sources is where the content of Special:Book_sources can be edited.

Thanks for your compliment. I would be very happy to have it added as a gadget, but I am not sure who you talk to about that.

Lunchboxhero (talk) 17:50, 10 January 2008 (UTC)
 * Hi, I was basically noting that Special:Book_sources is a red link. Is that expected?
 * WP:GADGETS seems to be where gadgets are discussed.
 * --Jtir (talk) 18:05, 10 January 2008 (UTC)

Oh! I got you. Thanks for the heads up. Lunchboxhero (talk) 01:05, 11 January 2008 (UTC)
 * Thanks. --Jtir (talk) 14:58, 11 January 2008 (UTC)

Script no longer working(?)
I've had your script successfully installed in my User/monobook.js page for some time, but today noticed it is no longer working correctly. Can you think of any reason it might not now be working? Thanks in advance! — Bellhalla (talk) 03:45, 7 March 2008 (UTC)
 * Oh, good: I'm not the only one. Lunchboxhero? --zenohockey (talk) 05:01, 10 March 2008 (UTC)
 * For the broken ISBN redirection script, suggested changing "isbn=" to "Special:Booksources" in the script, and then reloading. It worked for me, so I thought I'd pass it along. (Apparently the ISBN code was changed, which broke Lunchboxhero’s script.) — Bellhalla (talk) 03:23, 11 March 2008 (UTC)

Yes, the ISBN Code was changed, which broke the script. I've updated the code and it now works. You can either copy and paste the script or make this change on your monobook.js page.

Lunchboxhero (talk) 03:56, 11 March 2008 (UTC)


 * The script seems to have been broken again by someone changing Special:Booksources to Special:BookSources, but this can be fixed by making the same change to the script (twice). R.e.b. (talk) 02:12, 13 March 2008 (UTC)
 * Hello, I'm coming from another wiki where I want to fix up our "Special:Booksources" page. First, the link to Amazon must have changed, since it no longer works.  Second, does anyone remember how to edit "Special:Booksources" off the top of their head before I go digging around on the web?  Thanks! Huw Powell (talk) 20:30, 19 March 2008 (UTC)

Separate the script?
I was wondering if you could separate the ISBN script, so that it is by itself and importable, like Magnus' fixdisambig script (added at my/our monobooks using

(I don't know js very well, so this might not actually be optimal for some reason? But I'm assuming it's the simplest way for everyone to get updates at once - you update it at a central location, and we all instantly/automatically benefit...)

I was having other script problems today, hence poking around :) -- Quiddity (talk) 18:29, 25 March 2008 (UTC)


 * Good Idea. I have done this, and the script is working for now. Lunchboxhero (talk) 19:14, 29 March 2008 (UTC)


 * Marvellous! Thanks :) -- Quiddity (talk) 21:46, 29 March 2008 (UTC)

Not working
I noticed that this wasn't working, so I changed to the new script (I had an older version), but it still does not work - I just go to the book sources page. DuncanHill (talk) 09:00, 23 April 2008 (UTC)
 * Works for me currently. Did you try clearing your browser cache? -- Quiddity (talk) 19:38, 23 April 2008 (UTC)
 * Yes - I've fixed it now, apparently I had something in my monobook.js that should have been in monobook.css and that stopped it working. DuncanHill (talk) 08:30, 24 April 2008 (UTC)

Not working August 2008
Tried refreshing and clearing cache both in Firefox and Internet Explorer, no luck. I have a pretty clean User:MrDolomite/monobook.js, so I'm not sure what gives. Holler if it is just me. &mdash; MrDolomite &bull; Talk 18:25, 21 August 2008 (UTC)

Seems to be working fine for me. Lunchboxhero (talk) 06:38, 22 August 2008 (UTC)

Not working January 2009
Hi, I've just noticed it is not working for me. DuncanHill (talk) 01:35, 9 January 2009 (UTC)


 * OK, I've worked it out, this change stopped it working if one still had "magicURL" instead of "book_source_URL" in the var bit. DuncanHill (talk) 02:23, 9 January 2009 (UTC)

Member of Amazon Associates?
I wonder if you could comment on:
 * 1) Whether you are a member of Amazon Associates?
 * 2) Whether the part of the default URL &tag=wikipedia08-20 is your Amazon Associates tracking code?
 * 3) Whether it's ethical to include this code on Wikipedia?

Thanks Woz2 (talk) 20:12, 12 May 2009 (UTC)

I am not a member of Amazon Associates. Wikipedia was at one point, although I don't know if the account is still active. The id referenced in the tracking code was given to Jimbo Wales by Amazon back in 2004. I think including the tracking code in the default url is ethical, because I explain to potential users of this code what it is and how to disable it. Thank you for your concern.

Lunchboxhero (talk) 13:34, 13 May 2009 (UTC)

Thanks for the info. Maybe it would be good to add a comment in the code with that reference to explain what the tracking code for? Looks a bit fishy otherwise. Cheers.Woz2 (talk) 18:57, 13 May 2009 (UTC)

e.g. after... add... Woz2 (talk) 19:04, 13 May 2009 (UTC)

Vector skin
I'm not sure how this should best be laid out, but your code works fine with the new "beta" vector skin. Of course, installing it requires the user to edit their User:foo/vector.js. Should there be a public service announcement on this page about that? Rswarbrick (talk) 10:28, 23 April 2010 (UTC)

Copied to Wiktionary
I've taken the liberty of copying this script to Wiktionary - it's at wikt:User:Keith the Koala/common.js and wikt:User:Keith the Koala/externISBN.js. Hope you don't mind! Keith the Koala (talk) 10:30, 5 August 2016 (UTC)