Add OCLC# to Amazon

Uses OCLC's xISBN lookup service to add the OCLC number (and a link to WorldCat) to Amazon.com book details

当前为 2015-05-15 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Add OCLC# to Amazon
  3. // @description Uses OCLC's xISBN lookup service to add the OCLC number (and a link to WorldCat) to Amazon.com book details
  4. // @namespace http://mbkle.in/userscripts
  5. // @include http://www.amazon.com/*
  6. // @version 1
  7. // @grant none
  8. // ==/UserScript==
  9. jQuery(document).ready(function () {
  10. var isbn_li = jQuery('#productDetailsTable .content li b:contains(ISBN)').first().parent()
  11. if (isbn_li.length > 0) {
  12. var isbn = isbn_li.text().match(/[0-9]+$/) [0];
  13. jQuery.ajax({
  14. type: 'GET',
  15. url: 'http://xisbn.worldcat.org/webservices/xid/isbn/' + isbn + '?method=getMetadata&format=json&fl=oclcnum',
  16. dataType: 'jsonp'
  17. }).done(function (data) {
  18. var oclc = data.list[0].oclcnum[data.list[0].oclcnum.length - 1]
  19. isbn_li.before('<li><b>OCLC #:</b> <a href="http://worldcat.org/oclc/' + oclc + '" target="_blank">' + oclc + '</a></li>');
  20. });
  21. }
  22. });