Advertisement
Guest User

OrbisAmazon TamperMonkey

a guest
Sep 26th, 2014
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name       AmazonToYaleLibrary
  3. // @namespace  http://alexreinking.com/
  4. // @version    0.1
  5. // @description  Find the ISBN numbers, and add an ORBIS search link by the book name.
  6. // @match      http://www.amazon.com/*
  7. // @copyright  2014, Alex Reinking
  8. // @require http://code.jquery.com/jquery-latest.js
  9. // ==/UserScript==
  10.  
  11. $(document).ready(function() {
  12.     var isbn10 = $("#productDetailsTable .content li:contains('ISBN-10:')").text();
  13.     var isbn13 = $("#productDetailsTable .content li:contains('ISBN-13:')").text();
  14.    
  15.     var isbn = isbn13;
  16.     if (isbn == "") {
  17.         isbn = isbn10;
  18.     }
  19.     isbn = isbn.split(':')[1].replace(/\D/g,'');
  20.    
  21.     var urlPre = "http://orbis.library.yale.edu/vwebv/search?searchArg1=";
  22.     var urlPost = "&argType1=all&searchCode1=GKEY&combine2=and&searchArg2=&argType2=all&searchCode2=GKEY&combine3=and&searchArg3=&argType3=all&searchCode3=GKEY&year=2013-2014&fromYear=&toYear=&location=all&place=all&type=all&medium=all&language=all&recCount=50&searchType=2&page.search.search.button=Search";
  23.    
  24.     var wholeURL = urlPre + isbn + urlPost;
  25.     $("#productTitle").append(" <a href='" + wholeURL + "'>(ORBIS Search)</a>");
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement