AutoLink TIB/UB

Wandelt ISBNs in Links auf den Katalog der TIB bzw. weiterer ausgewählter Bibliotheken um und ermittelt, ob die Bücher in der Bibliothek vorhanden sind.

  1. // ==UserScript==
  2. // @name AutoLink TIB/UB
  3. // @namespace http://www.tempelb.de/
  4. // @author Bernhard Tempel
  5. // @description Wandelt ISBNs in Links auf den Katalog der TIB bzw. weiterer ausgewählter Bibliotheken um und ermittelt, ob die Bücher in der Bibliothek vorhanden sind.
  6. // @grant GM_getValue
  7. // @grant GM_setValue
  8. // @grant GM_deleteValue
  9. // @grant GM_registerMenuCommand
  10. // @grant GM_xmlhttpRequest
  11. // @grant GM_openInTab
  12. // @include *
  13. // @exclude http://opac.tib.eu*
  14. // @exclude https://opac.tib.eu*
  15. // @exclude http://stabikat*
  16. // @exclude http://osopc4.ub.uni-osnabrueck.de*
  17. // @exclude http://www.econis.eu*
  18. // @exclude http://opac.uni-giessen.de/*
  19. // @exclude http://opac.sub.uni-goettingen.de/*
  20. // @exclude http://opac.lbs-ilmenau.gbv.de/*
  21. // @exclude http://kataloge.thulb.uni-jena.de/DB=1/*
  22. // @exclude http://lhopc4.ub.uni-kiel.de:8080*
  23. // @exclude http://opac.ub.uni-marburg.de/*
  24. // @exclude http://opac.ub.uni-mainz.de/*
  25. // @exclude http://katalog.ub.uni-rostock.de*
  26. // @exclude http://katalogix.uni-muenster.de/*
  27. // @exclude https://katalogix.uni-muenster.de/*
  28. // @exclude http://opac.bibliothek.uni-augsburg.de/*
  29. // @exclude https://opac.bibliothek.uni-augsburg.de/*
  30.  
  31. // @version 0.28.20220801190400
  32.  
  33. // ==/UserScript==
  34.  
  35. /*
  36. Compiled by Bernhard Tempel (bernhard.tempel//at//freenet.de).
  37.  
  38. 2022-08-01 / 0.28beta
  39.  
  40. Revision history
  41.  
  42. 2022-08-01 / 0.28beta
  43. * TIB only: For titles not found in the TIB catalogue, a link to the Common Union Catalogue (GVK) is now inserted.
  44.  
  45. 2019-05-12 / 0.27beta
  46. * Adding new menu command "Bestandsanfrage manuell anstoßen" to process local files (gratefully provided by Philipp Zumstein)
  47.  
  48. 2017-11-22 / 0.26beta
  49. * Adding UB Augsburg (gratefully provided by Heike da Silva Cardoso)
  50.  
  51. 2016-08-29 / 0.25beta
  52. * New base OPAC URL for some libraries in Hannover
  53.  
  54.  
  55. 2016-07-14 / 0.24beta
  56. * Adding ULB Muenster
  57.  
  58. 2016-01-21 / 0.23beta
  59. * Adding UB Mainz
  60. * Replace "TIB/UB" with "TIB" (except for script name)
  61.  
  62. 2015-12-18 / 0.22beta
  63. * Adding JLU Gießen
  64. * Adding THM Gießen
  65.  
  66. 2015-07-13 / 0.21beta
  67. * Adding ThULB Jena
  68. * TIB/UB: exclude metadata for PDA
  69.  
  70. 2015-01-14 / 0.20beta
  71. * Adding UB Ilmenau
  72.  
  73. 2014-10-29 / 0.19beta
  74. * Bugfix
  75.  
  76. 2014-10-06 / 0.18beta
  77. * Adding UB Marburg
  78.  
  79. 2014-10-02 / 0.17beta
  80. * rised version counter for testing purposes
  81.  
  82. 2014-10-02 / 0.16beta
  83. * For TIB/UB library or reading room location is displayed in front of shelfmark
  84. * Removed update functionality as userscripts.org does not work again
  85. * Prepared new update functionality (within Greasemonkey) for new script location at gf.qytechs.cn
  86.  
  87.  
  88. 2014-07-07 / 0.15beta
  89. * Adding SUB Goettingen
  90.  
  91. 2013-11-27 / 0.14beta
  92. * Bugfix: Default libraryName now set to TIB/UB if undefined after installing AutoLink TIB/UB the first time
  93. * Explicit specification of recommended metadata block imperative @grant (Greasemonkey 1.0-)
  94.  
  95. 2012-08-01 / 0.13beta
  96. * Adding UB Kiel
  97.  
  98. 2011-11-23 / 0.12beta
  99. * Adding Econis / ZBW Kiel und Hamburg
  100. * Adding UB Rostock
  101.  
  102. 2011-07-03 / 0.11beta
  103. * Adding UB Osnabrueck
  104.  
  105. 2011-07-03 / 0.10beta
  106. * Extending to other libraries (selection via Greasemonkey menu); default is TIB/UB
  107. * Improving pattern matching for shelfmarks
  108.  
  109. 2011-06-18 /0.09beta
  110. * Cleaning up code to enable easier adaption for other library catalogues
  111. * Improving comments
  112.  
  113. 2011-06-18 / 0.08beta
  114. * Adding update check functionality (gratefully provided by http://userscripts.org/scripts/review/20145)
  115.  
  116. 2011-06-18 / 0.07beta
  117. * Cleaning up code for first public version
  118.  
  119. 2011-06-17 / 0.06beta
  120. * Instead of de-linking now adding element text element with ISBN which may be processed by autolink
  121. * Removing different handling for books on order (not necessary at least for OPC4 PICA catalogue)
  122.  
  123. 2011-02-20 / 0.05beta
  124. * Updating isbnjs (improved version only in svn repository)
  125.  
  126. 2010-09-22 / 0.04beta
  127. * Bugfixing de-linking. Removed exception for Amazon pages as not necessary any more.
  128.  
  129. 2010-09-21 / 0.03beta:
  130. * Adding exeption from de-linking for Amazon pages
  131.  
  132. 2010-09-20 / 0.02beta:
  133. * Adding de-linking: links presumably containing an ISBN now are de-linked and can be processed by Autolink without deadly recursion.
  134.  
  135. Inspired by and based on following scripts:
  136.  
  137. * Autolink by Jesse Ruderman (http://www.squarefree.com/2005/05/22/autolink/)
  138. * isbnjs - An ISBN JavaScript Library by hetappi.pm (code completely included)
  139. * Edward Vielmetti's Greasemonkey script for inserting library holdings information into Google Book Search (http://vielmetti.typepad.com/superpatron/2006/02/inserting_libra.html) and derived scripts
  140. * http://userscripts.org/scripts/review/20145
  141. */
  142.  
  143. // Anzahl der ISBNs auf einer Seite, die ohne Rückfrage am Katalog geprüft werden
  144. var maxisbns = 50;
  145.  
  146. // Zur Verarbeitung lokal gespeicherter Dateien
  147.  
  148. GM_registerMenuCommand( "Bestandsabfrage manuell anstossen", initNow);
  149. function initNow() {
  150. init(true);
  151. }
  152.  
  153. /* Auswahl der Bibliothek per Menü ermöglichen
  154. Default ist: TIB.
  155. */
  156.  
  157. if (GM_getValue("libraryName") == undefined){ GM_setValue("libraryName", "TIB"); }
  158. if (GM_getValue("libraryName") == "TIB"){ GM_setValue("libraryName", "TIB"); }
  159.  
  160. /* Zur Anpassung des Skripts für Kataloge weiterer Bibliothek, die PICA OPC4 verwenden,
  161. ist der folgende Block anzupassen (Menüregistrierung und Variablen) */
  162.  
  163. function registerTIBUB() {
  164. GM_setValue("libraryName", "TIB");
  165. alert(GM_getValue("libraryName") + " ausgewählt");
  166. }
  167. GM_registerMenuCommand( "TIB", registerTIBUB);
  168.  
  169. function registerFHH() {
  170. GM_setValue ("libraryName", "FHH");
  171. alert(GM_getValue("libraryName") + " ausgewählt");
  172. }
  173. GM_registerMenuCommand( "FHH", registerFHH);
  174.  
  175. function registerGWLB() {
  176. GM_setValue("libraryName", "GWLB");
  177. alert(GM_getValue("libraryName") + " ausgewählt");
  178. }
  179. GM_registerMenuCommand( "GWLB", registerGWLB);
  180.  
  181. function registerSBBPK() {
  182. GM_setValue("libraryName", "SBB-PK");
  183. alert(GM_getValue("libraryName") + " ausgewählt");
  184. }
  185. GM_registerMenuCommand( "SBB-PK", registerSBBPK);
  186.  
  187. function registerEconis() {
  188. GM_setValue("libraryName", "ZBW");
  189. alert(GM_getValue("libraryName") + " ausgewählt");
  190. }
  191. GM_registerMenuCommand( "ZBW/Econis", registerEconis);
  192.  
  193. function registerUB_Giessen() {
  194. GM_setValue("libraryName", "UB GI");
  195. alert(GM_getValue("libraryName") + " ausgewählt");
  196. }
  197. GM_registerMenuCommand( "UB Giessen", registerUB_Giessen);
  198.  
  199. function registerTHM_Giessen() {
  200. GM_setValue("libraryName", "THM GI");
  201. alert(GM_getValue("libraryName") + " ausgewählt");
  202. }
  203. GM_registerMenuCommand( "THM Giessen", registerTHM_Giessen);
  204.  
  205. function registerSUB_Goettingen() {
  206. GM_setValue("libraryName", "SUB Gö");
  207. alert(GM_getValue("libraryName") + " ausgewählt");
  208. }
  209. GM_registerMenuCommand( "SUB Göttingen", registerSUB_Goettingen);
  210.  
  211. function registerUB_Ilmenau() {
  212. GM_setValue("libraryName", "/ UB IL /");
  213. alert(GM_getValue("libraryName") + " ausgewählt");
  214. }
  215. GM_registerMenuCommand( "UB Ilmenau", registerUB_Ilmenau);
  216.  
  217. function registerThULB() {
  218. GM_setValue("libraryName", "ThULB");
  219. alert(GM_getValue("libraryName") + " ausgewählt");
  220. }
  221. GM_registerMenuCommand( "ThULB", registerThULB);
  222.  
  223. function registerUB_Kiel() {
  224. GM_setValue("libraryName", "UB Kiel");
  225. alert(GM_getValue("libraryName") + " ausgewählt");
  226. }
  227. GM_registerMenuCommand( "UB Kiel", registerUB_Kiel);
  228.  
  229. function registerUB_Mainz() {
  230. GM_setValue("libraryName", "UB-MZ");
  231. alert(GM_getValue("libraryName") + " ausgewählt");
  232. }
  233. GM_registerMenuCommand( "UB Mainz", registerUB_Mainz);
  234.  
  235. function registerUB_Marburg() {
  236. GM_setValue("libraryName", "UB MR");
  237. alert(GM_getValue("libraryName") + " ausgewählt");
  238. }
  239. GM_registerMenuCommand( "UB Marburg", registerUB_Marburg);
  240.  
  241. function registerULB_Muenster() {
  242. GM_setValue("libraryName", "ULB Muenster");
  243. alert(GM_getValue("libraryName") + " ausgewählt");
  244. }
  245. GM_registerMenuCommand( "ULB Münster", registerULB_Muenster);
  246.  
  247. function registerUBOs() {
  248. GM_setValue("libraryName", "UB Os");
  249. alert(GM_getValue("libraryName") + " ausgewählt");
  250. }
  251. GM_registerMenuCommand( "UB Os", registerUBOs);
  252.  
  253. function registerUB_Rostock() {
  254. GM_setValue("libraryName", "UB Rostock");
  255. alert(GM_getValue("libraryName") + " ausgewählt");
  256. }
  257. GM_registerMenuCommand( "UB Rostock", registerUB_Rostock);
  258.  
  259. function registerUBA() {
  260. GM_setValue("libraryName", "UBA");
  261. alert(GM_getValue("libraryName") + " ausgewählt");
  262. }
  263. GM_registerMenuCommand( "UBA", registerUBA);
  264.  
  265. switch(GM_getValue("libraryName"))
  266. {
  267. case 'TIB':
  268. // Für Abfrage im Picaplus-Format (Parsing der Signatur einfacher)
  269. var libraryUrlPatternA = "https://opac.tib.eu/DB=1/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&TRM=(not+lcd+eblpda)+and+num+";
  270. // Für Einfügen des Links auf den Katalog
  271. var libraryUrlPatternB = "https://opac.tib.eu/DB=1/LNG=DU/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+";
  272. // Für Verlinkung auf GVK (Anwendung bei nicht im Katalog der TIB gefundenen Titeln)
  273. var libraryUrlPatternC = "https://kxp.k10plus.de/DB=2.1/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+"
  274. // Name der Bibliothek (möglichst kurz, wird u.a. hinter ISBNs in die Webseiten geschrieben
  275. var libraryName = GM_getValue("libraryName");
  276. // String zum Erkennen einer Kurzliste als Ergebnis der Abfrage (in diesem Fall wird keine Signatur ausgelesen);
  277. var libraryAvailability = /\d+ von \d+/;
  278. // String zum Parsen der Signatur
  279. var libraryShelfmark = /<TD>209A\/\d\d<\/TD><TD>.*?\$a([^$<]*)/i;
  280. // String zum Parsen des Standorts
  281. var libraryLocation = /<TD>209A\/\d\d<\/TD><TD>.*?\$f([^$<]*)/i;
  282. // String zum Erkennen eines Nulltreffer-Ergebnisses
  283. var notFound = /Es wurde nichts gefunden/;
  284. break;
  285.  
  286. case 'FHH':
  287. libraryUrlPatternA = "https://opac.tib.eu/DB=4/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&TRM=num+";
  288. libraryUrlPatternB = "https://opac.tib.eu/DB=4/LNG=DU/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+";
  289. libraryName = GM_getValue("libraryName");
  290. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  291. libraryShelfmark = /<TD>209A\/01<\/TD><TD>.*?\$a([^$<]*)/i;
  292. libraryLocation = "";
  293. notFound = /Es wurde nichts gefunden/;
  294. break;
  295.  
  296. case 'GWLB':
  297. libraryUrlPatternA = "https://opac.tib.eu/DB=3/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&TRM=num+";
  298. libraryUrlPatternB = "https://opac.tib.eu/DB=3/LNG=DU/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+";
  299. libraryName = GM_getValue("libraryName");
  300. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  301. libraryShelfmark = /<TD>209A\/01<\/TD><TD>.*?\$a([^$<]*)/i;
  302. libraryLocation = "";
  303. notFound = /Es wurde nichts gefunden/;
  304. break;
  305.  
  306. case 'SBB-PK':
  307. libraryUrlPatternA = "http://stabikat.sbb.spk-berlin.de/DB=1/CMD?ACT=SRCHA&PRS=PP%7F&SRT=YOP&TRM=xnum+";
  308. libraryUrlPatternB = "http://stabikat.sbb.spk-berlin.de/DB=1/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=xnum+";
  309. libraryName = GM_getValue("libraryName");
  310. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  311. libraryShelfmark = /<TD>209A\/01<\/TD><TD>.*?\$a([^$<]*)/i;
  312. libraryLocation = "";
  313. notFound = /Es wurde nichts gefunden/;
  314. break;
  315.  
  316. case 'UB Os':
  317. libraryUrlPatternA = "http://osopc4.ub.uni-osnabrueck.de:8080/DB=1/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&SRT=YOP&TRM=num+";
  318. libraryUrlPatternB = "http://osopc4.ub.uni-osnabrueck.de:8080/DB=1/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+";
  319. libraryName = GM_getValue("libraryName");
  320. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  321. libraryShelfmark = /<TD>209A\/01<\/TD><TD>.*?\$a([^$<]*)/i;
  322. libraryLocation = "";
  323. notFound = /Es wurde nichts gefunden/;
  324. break;
  325.  
  326. case 'UB Rostock':
  327. libraryUrlPatternA = "http://katalog.ub.uni-rostock.de/DB=1/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&SRT=YOP&TRM=num+";
  328. libraryUrlPatternB = "http://katalog.ub.uni-rostock.de/DB=1/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+";
  329. libraryName = GM_getValue("libraryName");
  330. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  331. libraryShelfmark = /<TD>209A\/01<\/TD><TD>.*?\$a([^$<]*)/i;
  332. libraryLocation = "";
  333. notFound = /Es wurde nichts gefunden/;
  334. break;
  335.  
  336. case 'ZBW':
  337. libraryUrlPatternA = "http://www.econis.eu/DB=1/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&SRT=YOP&TRM=num+";
  338. libraryUrlPatternB = "http://www.econis.eu/DB=1/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+";
  339. libraryName = GM_getValue("libraryName");
  340. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  341. libraryShelfmark = /<TD>209A\/01<\/TD><TD>.*?\$a([^$<]*)/i;
  342. libraryLocation = "";
  343. notFound = /Es wurde nichts gefunden/;
  344. break;
  345.  
  346. case 'UB Kiel':
  347. libraryUrlPatternA = "http://lhopc4.ub.uni-kiel.de:8080/DB=1/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&SRT=YOP&TRM=num+";
  348. libraryUrlPatternB = "http://lhopc4.ub.uni-kiel.de:8080/DB=1/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+";
  349. libraryName = GM_getValue("libraryName");
  350. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  351. libraryShelfmark = /<TD>209A\/01<\/TD><TD>.*?\$a([^$<]*)/i;
  352. libraryLocation = "";
  353. notFound = /Es wurde nichts gefunden/;
  354. break;
  355.  
  356. case 'SUB Gö':
  357. libraryUrlPatternA = "http://opac.sub.uni-goettingen.de/DB=1/CMD?ACT=SRCHA&PRS=PP%7F&SRT=YOP&TRM=num+";
  358. libraryUrlPatternB = "http://opac.sub.uni-goettingen.de/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+";
  359. libraryName = GM_getValue("libraryName");
  360. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  361. libraryShelfmark = /<TD>209A\/01<\/TD><TD>.*?\$a([^$<]*)/i;
  362. libraryLocation = "";
  363. notFound = /Es wurde nichts gefunden/;
  364. break;
  365.  
  366. case 'UB-MZ':
  367. libraryUrlPatternA = "http://opac.ub.uni-mainz.de/DB=1/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&TRM=num:+";
  368. libraryUrlPatternB = "http://opac.ub.uni-mainz.de/DB=1/LNG=DU/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num:+";
  369. libraryName = GM_getValue("libraryName");
  370. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  371. libraryShelfmark = /<TD>209A\/\d\d<\/TD><TD>.*?\$a([^$<]*)/i;
  372. libraryLocation = /<TD>209A\/\d\d<\/TD><TD>.*?\$f([^$<]*)/i;
  373. notFound = /Es wurde nichts gefunden/;
  374. break;
  375.  
  376. case 'UB MR':
  377. libraryUrlPatternA = "http://opac.ub.uni-marburg.de/DB=1/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&TRM=num+";
  378. libraryUrlPatternB = "http://opac.ub.uni-marburg.de/DB=1/LNG=DU/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+";
  379. libraryName = GM_getValue("libraryName");
  380. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  381. libraryShelfmark = /<TD>209A\/\d\d<\/TD><TD>.*?\$a([^$<]*)/i;
  382. libraryLocation = /<TD>209A\/\d\d<\/TD><TD>.*?\$f([^$<]*)/i;
  383. notFound = /Es wurde nichts gefunden/;
  384. break;
  385.  
  386. case 'UB GI':
  387. libraryUrlPatternA = "http://opac.uni-giessen.de/DB=1/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&TRM=num:";
  388. libraryUrlPatternB = "http://opac.uni-giessen.de/DB=1/LNG=DU/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num:";
  389. libraryName = GM_getValue("libraryName");
  390. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  391. libraryShelfmark = /<TD>209A\/\d\d<\/TD><TD>.*?\$a([^$<]*)/i;
  392. libraryLocation = /<TD>209A\/\d\d<\/TD><TD>.*?\$f([^$<]*)/i;
  393. notFound = /Es wurde nichts gefunden/;
  394. break;
  395.  
  396. case 'THM GI':
  397. libraryUrlPatternA = "http://opac.uni-giessen.de/DB=40/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&TRM=num:";
  398. libraryUrlPatternB = "http://opac.uni-giessen.de/DB=40/LNG=DU/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num:";
  399. libraryName = GM_getValue("libraryName");
  400. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  401. libraryShelfmark = /<TD>209A\/\d\d<\/TD><TD>.*?\$a([^$<]*)/i;
  402. libraryLocation = /<TD>209A\/\d\d<\/TD><TD>.*?\$f([^$<]*)/i;
  403. notFound = /Es wurde nichts gefunden/;
  404. break;
  405.  
  406. case '/ UB IL /':
  407. libraryUrlPatternA = "http://opac.lbs-ilmenau.gbv.de/DB=1/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&SRT=YOP&TRM=num+";
  408. libraryUrlPatternB = "http://opac.lbs-ilmenau.gbv.de/DB=1/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+";
  409. libraryName = GM_getValue("libraryName");
  410. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  411. libraryShelfmark = /<TD>209A\/\d\d<\/TD><TD>.*?\$a([^$<]*)/i;
  412. libraryLocation = "";
  413. notFound = /Es wurde nichts gefunden/;
  414. break;
  415.  
  416. case 'ThULB':
  417. libraryUrlPatternA = "http://kataloge.thulb.uni-jena.de/DB=1/LNG=DU/CMD?ACT=SRCHA&PRS=PP%7F&SRT=YOP&TRM=num+";
  418. libraryUrlPatternB = "http://kataloge.thulb.uni-jena.de/DB=1/CMD?ACT=SRCHA&IKT=1016&SRT=YOP&TRM=num+";
  419. libraryName = GM_getValue("libraryName");
  420. libraryAvailability = /\d+&nbsp;von&nbsp;\d+/;
  421. libraryShelfmark = /<TD>209A\/\d\d<\/TD><TD>.*?\$a([^$<]*)/i;
  422. libraryLocation = "";
  423. notFound = /Es wurde nichts gefunden/;
  424. break;
  425.  
  426. case 'ULB Muenster':
  427. libraryUrlPatternA = "https://katalogix.uni-muenster.de/Katalog/start.do?Language=De&Query=540%3D%22";
  428. var libraryUrlPatternA2 = "%22";
  429. libraryUrlPatternB = "https://katalogix.uni-muenster.de/Katalog/start.do?Language=De&Query=540%3D%22";
  430. var libraryUrlPatternB2 = "%22";
  431. libraryName = GM_getValue("libraryName");
  432. libraryAvailability = /Katalog \(\d+(\/\d+)?\)/;
  433. libraryShelfmark = /\/qrcode\/\?size=150x150&data=(.*?)\|/i;
  434. libraryLocation = /\/qrcode\/\?size=150x150&data=.*?\|(.*?)\|/i;
  435. notFound = /Ihre Suche erzielte keine Treffer/;
  436. break;
  437.  
  438. case 'UBA':
  439. libraryUrlPatternA = "https://opac.bibliothek.uni-augsburg.de/InfoGuideClient.ubasis/start.do?Language=De&Query=540%3D%22";
  440. libraryUrlPatternA2 = "%22";
  441. libraryUrlPatternB = "https://opac.bibliothek.uni-augsburg.de/InfoGuideClient.ubasis/start.do?Language=De&Query=540%3D%22";
  442. libraryUrlPatternB2 = "%22";
  443. libraryName = GM_getValue("libraryName");
  444. libraryAvailability = /UB Augsburg \(\d+(\/\d+)?\)/;
  445. libraryShelfmark = /\/cgi-bin\/uba-cgi\/lageplan\/sto\?SIGN=(.*?)"/i;
  446. libraryLocation = /\/qrcode\/\?size=150x150&data=.*?\|(.*?)\|/i;
  447. notFound = /Ihre Suche erzielte keine Treffer/;
  448. break;
  449. }
  450.  
  451.  
  452. // Linkersetzung
  453. //
  454. // Da Autolink keine Links verarbeitet, muessen Links,
  455. // die eine ISBN enthalten, zunaechst durch ihren Linktext
  456. // ersetzt werden. Pruefung auf Validitaet der ISBN kann an
  457. // dieser Stelle noch unterbleiben.
  458.  
  459. // Regexp zur Ermittlung moeglicher ISBN-Kandidaten
  460. // (zuerst Prüfung auf ISBN13 anschließend auf ISBN10
  461. var patternISBN = /(97[89][\- ]?[\d\- ]{9,11}[\- ]?[\dxX]|[\d][\- \d]{8,10}[\- ]?[\- ]?[\dxX])/;
  462.  
  463. var allLinks = document.getElementsByTagName("a");
  464. // alert(allLinks.length); // Fuer Debugging: Ausgabe Anzahl Links
  465.  
  466. var link = "";
  467.  
  468. for (var i = allLinks.length - 1; i >=0; i--)
  469. {
  470. link = allLinks[i];
  471. if (patternISBN.exec(link.textContent)){
  472. // Linkersetzung
  473. link.parentNode.replaceChild(document.createTextNode(link.textContent), link);
  474.  
  475. // // Alternativ zur Linkersetzung: Einfügen eines zusätzlichen Links
  476. // link.parentNode.appendChild(document.createTextNode(link.textContent), link);
  477. }
  478. }
  479. //
  480. // Ende vorsorgliche Linkersetzung
  481. //
  482.  
  483. var page = '';
  484. var counter = 0;
  485.  
  486. const timeBefore = new Date();
  487.  
  488. /***********************************
  489. * Filters *
  490. ***********************************/
  491.  
  492. // This functions takes a string containing
  493. // a candidate for ISBN (ISBN-10 or ISBN-13) and returns
  494. // true if it's valid or false if it's invalid.
  495.  
  496. function validateISBN(isbn) {
  497. var isbnTest = ISBN.parse(isbn);
  498. if (isbnTest == null){
  499. return false;
  500. }
  501. if (isbnTest.isIsbn10()){
  502. return true;
  503. }
  504. else if (isbnTest.isIsbn13()){
  505. return true;
  506. }
  507. return false;
  508. }
  509.  
  510. // No change of Autolink algorithm although only one filter needed
  511.  
  512. const filters = [
  513. {
  514. name: "ISBN --> TIB",
  515. regexp: /\b(97[89][\- ]?[\d\- ]{9,11}[\- ]?[\dxX]|[\d][\- \d]{8,10}[\- ]?[\- ]?[\dxX])/g,
  516. href: function(match) {
  517. var isbx = alphanumerics(match[1]);
  518. if (validateISBN(isbx) == true) {
  519. if (libraryName == "TIB") {
  520. return libraryUrlPatternC + ISBN.asIsbn13(alphanumerics(match[1]));}
  521. else if (libraryName == "ULB Muenster" || libraryName == "UBA") {
  522. return libraryUrlPatternB + ISBN.asIsbn13(alphanumerics(match[1])) + libraryUrlPatternB2; }
  523. else {
  524. return libraryUrlPatternB + ISBN.asIsbn13(alphanumerics(match[1])) + "+or+" + ISBN.asIsbn10(alphanumerics(match[1])) + "&sourceid=autolink_tibub_tempelb"; }
  525. }
  526. }
  527. }
  528. ];
  529.  
  530. /***********************************
  531. * Helper function for filters *
  532. ***********************************/
  533.  
  534. function alphanumerics(s)
  535. {
  536. return s.replace(/[^0-9a-z]/ig, "");
  537. }
  538.  
  539. /***********************************
  540. * Link styling *
  541. ***********************************/
  542.  
  543. /*
  544.  
  545. You can make links generated by AutoLink look different from normal links
  546. by editing styleLink below and/or by setting up user style sheet rules.
  547.  
  548. Example: on squarefree.com, make autolinked plain text links orange. (Firefox trunk only.)
  549.  
  550. @-moz-document domain(squarefree.com) {
  551. .autolink-plain-text-link { color: orange ! important; }
  552. }
  553.  
  554. */
  555.  
  556. function styleLink(a, filter, color)
  557. {
  558. a.style.border = "1px solid " + color;
  559. a.style.padding ="1px";
  560. a.target = "_blank";
  561. }
  562.  
  563. /***********************************
  564. * Fix filters *
  565. ***********************************/
  566.  
  567. function fixFilters()
  568. {
  569. var i, r;
  570. for (i = 0; r = filters[i]; ++i) {
  571. // lowercase, and replace each run of non-alphanumerics with a single hyphen
  572. r.classNamePart = r.name.toLowerCase().replace(/[^0-9a-z]+/ig, "-");
  573. if(!r.regexp.global)
  574. alert("AutoLink-Filter " + r.name + " ist nicht als global definiert! Das gibt Probleme!!!");
  575. }
  576. }
  577. fixFilters();
  578.  
  579. /***********************************
  580. * When and where to run *
  581. ***********************************/
  582.  
  583. var moddingDOM = false;
  584.  
  585. window.addEventListener("load", init, false);
  586. function init(rightaway)
  587. {
  588. document.addEventListener("DOMNodeInserted", nodeInserted, false);
  589. if (rightaway)
  590. go(document.body);
  591. else
  592. window.setTimeout(go, 100, document.body);
  593. }
  594.  
  595. // This makes it work at Gmail.
  596. // 20% performance penalty on a plain text file with a link on almost every line.
  597. // Tiny performance penalty on pages with few automatically added links.
  598. function nodeInserted(e)
  599. {
  600. // our own modifications should not trigger this.
  601. // (we don't want our regular expression objects getting confused)
  602. // (we want better control over when we recurse)
  603.  
  604. //GM_log("Inserted: " + e.target);
  605.  
  606. if (!moddingDOM && e.target.nodeType != 3)
  607. go(e.target);
  608. }
  609.  
  610. /***********************************
  611. * DOM traversal *
  612. ***********************************/
  613.  
  614. /*
  615.  
  616. This script uses manual DOM traversal, in an iterative way without a stack!
  617.  
  618. Advantages of snapshot XPath:
  619. * Much less code
  620. * 20-40% faster
  621. * May be possible to get another speed boost by including the regexp in the XPath expression - http://www.developer.com/xml/article.php/10929_3344421_3
  622. * All the cool people are using it
  623.  
  624. Advantages of manual DOM traversal:
  625. * Lets us stop+continue (snapshot xpath doesn't let us)
  626. * Lets us modify DOM in strange ways without worrying.
  627. * Easier to control which elements we recurse into.
  628.  
  629. */
  630.  
  631.  
  632. // Ignore all children of these elements.
  633. const skippedElements = {
  634. a: true, // keeps us from screwing with existing links. keeps us from recursing to death :)
  635. noscript: true, // noscript has uninterpreted, unshown text children; don't waste time+sanity there.
  636. head: true,
  637. script: true,
  638. style: true,
  639. textarea: true,
  640. label: true,
  641. select: true,
  642. button: true
  643. };
  644.  
  645. const gmail = (window.location.host == "gmail.google.com");
  646.  
  647. function skipChildren(node)
  648. {
  649. if (node.tagName) // !
  650. {
  651. if (skippedElements[node.tagName.toLowerCase()]) {
  652. return true;
  653. }
  654.  
  655. if (gmail) {
  656. if (node.className == "ac") // gmail autocomplete (fake dropdown)
  657. return true;
  658. if (node.className == "ilc sxs") // invite foo to gmail (fake link/button)
  659. return true;
  660. }
  661. }
  662.  
  663. return false;
  664. }
  665.  
  666. function go(traversalRoot)
  667. {
  668. /* some documents don't have document.body - such as XML documents */
  669. /* if (traversalRoot == null)
  670. return;
  671. */
  672. var m;
  673.  
  674. // Ensure we're not already in a forbidden element.
  675. for (m = traversalRoot; m != undefined; m = m.parentNode) {
  676. if (!m || skipChildren(m)) {
  677. return;
  678. }
  679. }
  680.  
  681. // work around bug, or in case previous user scripts did crazy stuff
  682. traversalRoot.normalize();
  683.  
  684. function cont(n, didChildren)
  685. {
  686. var k = 0; // split work into chunks so Firefox doesn't freeze
  687. var q;
  688.  
  689. while (n && k < 100)
  690. {
  691. ++k;
  692.  
  693. // Do stuff at this node
  694. if (!didChildren && n.nodeType == 3) {
  695. if((q = runFiltersOnTextNode(n))) {
  696. n = q[0];
  697.  
  698. // if there were changes, run filters again on the new text node that's here
  699. if (q[1])
  700. continue;
  701. }
  702. }
  703.  
  704. // Traverse to the "next" node in depth-first order
  705.  
  706. if (!n.firstChild)
  707. didChildren = true;
  708.  
  709. if (didChildren && n == traversalRoot)
  710. break;
  711. else if (!didChildren && n.firstChild && !skipChildren(n)) {
  712. n = n.firstChild;
  713. // didChildren is already false and should stay false
  714. }
  715. else {
  716. if (n.nextSibling) {
  717. n = n.nextSibling;
  718. didChildren = false;
  719. }
  720. else {
  721. n = n.parentNode;
  722. didChildren = true;
  723. }
  724. }
  725. } // end while
  726.  
  727. if (!n) {
  728. //GM_log("Odd. traversalRoot was " + traversalRoot);
  729. }
  730. else if (n == traversalRoot) {
  731. //GM_log("Done");
  732. //alert("AutoLink time: " + (new Date() - timeBefore))
  733. }
  734. else {
  735. // Continue after 10ms.
  736. //GM_log("will have to continue");
  737. setTimeout(cont, 10, n, didChildren);
  738. }
  739.  
  740. } // end function cont
  741.  
  742. cont(traversalRoot, false);
  743. }
  744.  
  745. /***********************************
  746. * Running filters *
  747. ***********************************/
  748.  
  749. // runFiltersOnTextNode
  750. // Return: node at which to continue traversal, or |null| to mean no changes were made.
  751.  
  752. function runFiltersOnTextNode(node)
  753. {
  754. function genLink(filter, match)
  755. {
  756. try {
  757. return filter.href(match);
  758. }
  759. catch(er) {
  760. return "data:text/plain,Error running AutoLink function for filter: " + encodeURIComponent(filter.name) + "%0A%0A" + encodeURIComponent(er);
  761. }
  762. }
  763.  
  764. // Too many variables. Good hint that I need to split this function up :P
  765. var source, j, regexp, match, lastLastIndex, k, filter, href, anyChanges; // things
  766. var used, unused, firstUnused, lastUnused, a, parent, nextSibling; // nodes
  767.  
  768. source = node.data;
  769.  
  770. anyChanges = false;
  771.  
  772. // runFiltersOnTextNode has its own do-too-much-at-once avoider thingie.
  773. // assumption: if there is one text node with a lot of matches,
  774. // it's more important to finish quickly than be transparent.
  775. // (e.g. plain text file FULL of links)
  776. // assumption: 40 * 100 = 140.
  777. k=0;
  778.  
  779. for (j = 0; filter = filters[j]; ++j) {
  780. regexp = filter.regexp;
  781.  
  782. if (regexp.test(source)) {
  783.  
  784. parent = node.parentNode;
  785. nextSibling = node.nextSibling;
  786.  
  787. regexp.lastIndex = 0;
  788. firstUnused = null;
  789.  
  790. // Optimization from the linkify that came with Greasemonkey(?):
  791. // instead of splitting a text node multiple times, take advantage
  792. // of global regexps and substring.
  793.  
  794. for (match = null, lastLastIndex = 0; k < 40 && (match = regexp.exec(source)); ) {
  795.  
  796. href = genLink(filter, match);
  797.  
  798. if (href != null && href != location.href) {
  799. ++k;
  800. unused = document.createTextNode(source.substring(lastLastIndex, match.index));
  801. if (!anyChanges) {
  802. anyChanges = true;
  803. parent.removeChild(node);
  804. firstUnused = unused;
  805. moddingDOM = true;
  806. }
  807. parent.insertBefore(unused, nextSibling);
  808.  
  809. // Abfrage am Katalog der TIB
  810.  
  811. var isbnx = alphanumerics(match[0]);
  812. counter++;
  813. if (counter == maxisbns +1){
  814. var check = confirm("Die Seite scheint viele ISBNs zu enthalten.\nEs werden " + maxisbns + " ISBNs am Katalog geprüft.\nBestätigen Sie mit \"ok\", wenn das Skript\nohne Beschränkung weiterlaufen soll.");
  815. if (!check){
  816. exit();
  817. }
  818. }
  819.  
  820. libraryUrlLookup = libraryUrlPatternA + "(" + ISBN.asIsbn10(isbnx) + "+OR+" + ISBN.asIsbn13(isbnx) + ")";
  821. if (libraryName == "ULB Muenster" || libraryName == "UBA") {
  822. libraryUrlLookup = libraryUrlPatternA + ISBN.asIsbn13(isbnx) + libraryUrlPatternA2;
  823. }
  824. GM_xmlhttpRequest
  825. ({
  826. method:'GET',
  827. url: libraryUrlLookup,
  828. onload:function(results)
  829. {
  830. var page = results.responseText;
  831. var location, signatur, sst;
  832.  
  833. if ( notFound.test(page) )
  834. {
  835. used = document.createTextNode(isbnx + ' FEHLT ' + libraryName);
  836. if (libraryName == "TIB"){
  837. used = document.createTextNode(isbnx + ' FEHLT ' + libraryName + ': GVK?');
  838. }
  839. a = document.createElement("a");
  840. a.href = href;
  841. a.title = "Link eingesetzt von Autolink_TIB/UB";
  842. a.className = "autolink autolink-" + filter.classNamePart;
  843.  
  844. styleLink(a, filter, "red");
  845.  
  846. a.appendChild(used);
  847. parent.insertBefore(a, nextSibling);
  848. }
  849. else if ( libraryAvailability.test(page) ) {
  850. if (libraryLocation == "") { }
  851. else {
  852. location = libraryLocation.exec(page);
  853. }
  854. signatur = libraryShelfmark.exec(page);
  855. if (signatur) {
  856. if (location) {
  857. sst = location[1] + " ";
  858. }
  859. else {
  860. sst = "";
  861. }
  862. shelfmark = libraryName + " " + sst + signatur[1];
  863. }
  864. else {
  865. shelfmark = libraryName + "+";
  866. }
  867. used = document.createTextNode(isbnx + ' ' + shelfmark);
  868. a = document.createElement("a");
  869. a.href = href;
  870. a.title = "Link eingesetzt von Autolink_TIB/UB";
  871. a.className = "autolink autolink-" + filter.classNamePart;
  872. styleLink(a, filter, "blue");
  873. a.appendChild(used);
  874. parent.insertBefore(a, nextSibling);
  875. }
  876. else
  877. {
  878. alert(isbnx + "Sonstiger Fehler?!");
  879. }
  880. }
  881. });
  882. lastLastIndex = regexp.lastIndex;
  883. if (anyChanges) {
  884. lastUnused = document.createTextNode(source.substring(lastLastIndex));
  885. parent.insertBefore(lastUnused, nextSibling);
  886. moddingDOM = false;
  887. return [firstUnused, true];
  888. }
  889. return [node, false];
  890. }
  891. }
  892. }
  893. }
  894. return null;
  895. }
  896.  
  897. //
  898. // isbn.js
  899. //
  900. // The MIT License
  901. // Copyright (c) 2007, 2010 hetappi <hetappi.pm (a) gmail.com>
  902. //
  903.  
  904. var ISBN;
  905. (function () {
  906. ISBN = {
  907. VERSION: '0.01',
  908. GROUPS: {
  909. '0': {
  910. 'name': 'English speaking area',
  911. 'ranges': [['00', '19'], ['200', '699'], ['7000', '8499'], ['85000', '89999'], ['900000', '949999'], ['9500000', '9999999']]
  912. },
  913. '1': {
  914. 'name': 'English speaking area',
  915. 'ranges': [['00', '09'], ['100', '399'], ['4000', '5499'], ['55000', '86979'], ['869800', '998999']]
  916. },
  917. '4': {
  918. 'name': 'Japan',
  919. 'ranges': [['00','19'], ['200','699'], ['7000','8499'], ['85000','89999'], ['900000','949999'], ['9500000','9999999']]
  920. }
  921. },
  922.  
  923. isbn: function () {
  924. this.initialize.apply(this, arguments);
  925. },
  926.  
  927. parse: function(val, groups) {
  928. var me = new ISBN.isbn(val, groups ? groups : ISBN.GROUPS);
  929. return me.isValid() ? me : null;
  930. },
  931.  
  932. hyphenate: function(val) {
  933. var me = ISBN.parse(val);
  934. return me ? me.isIsbn13() ? me.asIsbn13(true) : me.asIsbn10(true) : null;
  935. },
  936. asIsbn13: function(val, hyphen) {
  937. var me = ISBN.parse(val);
  938. return me ? me.asIsbn13(hyphen) : null;
  939. },
  940. asIsbn10: function(val, hyphen) {
  941. var me = ISBN.parse(val);
  942. return me ? me.asIsbn10(hyphen) : null;
  943. }
  944. };
  945. ISBN.isbn.prototype = {
  946. isValid: function() {
  947. return this.codes && this.codes.isValid;
  948. },
  949. isIsbn13: function() {
  950. return this.isValid() && this.codes.isIsbn13;
  951. },
  952. isIsbn10: function() {
  953. return this.isValid() && this.codes.isIsbn10;
  954. },
  955. asIsbn10: function(hyphen) {
  956. return this.isValid() ? hyphen ? this.codes.isbn10h : this.codes.isbn10 : null;
  957. },
  958. asIsbn13: function(hyphen) {
  959. return this.isValid() ? hyphen ? this.codes.isbn13h : this.codes.isbn13 : null;
  960. },
  961. initialize: function(val, groups) {
  962. this.groups = groups;
  963. this.codes = this.parse(val);
  964. },
  965. merge: function(lobj, robj) {
  966. var key;
  967. if (!lobj || !robj) {
  968. return null;
  969. }
  970. for (key in robj) {
  971. if (robj.hasOwnProperty(key)) {
  972. lobj[key] = robj[key];
  973. }
  974. }
  975. return lobj;
  976. },
  977. parse: function(val) {
  978. var ret;
  979. // correct for misplaced hyphens
  980. // val = val.replace(/ -/,'');
  981. ret =
  982. val.match(/^\d{9}[\dX]$/) ?
  983. this.fill(
  984. this.merge({source: val, isValid: true, isIsbn10: true, isIsbn13: false}, this.split(val))) :
  985. val.length === 13 && val.match(/^(\d+)-(\d+)-(\d+)-([\dX])$/) ?
  986. this.fill({
  987. source: val, isValid: true, isIsbn10: true, isIsbn13: false, group: RegExp.$1, publisher: RegExp.$2,
  988. article: RegExp.$3, check: RegExp.$4}) :
  989. val.match(/^(978|979)(\d{9}[\dX]$)/) ?
  990. this.fill(
  991. this.merge({source: val, isValid: true, isIsbn10: false, isIsbn13: true, prefix: RegExp.$1},
  992. this.split(RegExp.$2))) :
  993. val.length === 17 && val.match(/^(978|979)-(\d+)-(\d+)-(\d+)-([\dX])$/) ?
  994. this.fill({
  995. source: val, isValid: true, isIsbn10: false, isIsbn13: true, prefix: RegExp.$1, group: RegExp.$2,
  996. publisher: RegExp.$3, article: RegExp.$4, check: RegExp.$5}) :
  997. null;
  998. if (!ret) {
  999. return {source: val, isValid: false};
  1000. }
  1001. return this.merge(ret, {isValid: ret.check === (ret.isIsbn13 ? ret.check13 : ret.check10)});
  1002. },
  1003. split: function(isbn) {
  1004. return (
  1005. !isbn ?
  1006. null :
  1007. isbn.length === 13 ?
  1008. this.merge(this.split(isbn.substr(3)), {prefix: isbn.substr(0, 3)}) :
  1009. isbn.length === 10 ?
  1010. this.splitToObject(isbn) :
  1011. null);
  1012. },
  1013. splitToArray: function(isbn10) {
  1014. var rec, key, rest, i, m;
  1015. rec = this.getGroupRecord(isbn10);
  1016. if (!rec) {
  1017. return null;
  1018. }
  1019. for (key, i = 0, m = rec.record.ranges.length; i < m; i += 1) {
  1020. key = rec.rest.substr(0, rec.record.ranges[i][0].length);
  1021. if (rec.record.ranges[i][0] <= key && rec.record.ranges[i][1] >= key) {
  1022. rest = rec.rest.substr(key.length);
  1023. return [rec.group, key, rest.substr(0, rest.length - 1), rest.charAt(rest.length - 1)];
  1024. }
  1025. }
  1026. return null;
  1027. },
  1028. splitToObject: function(isbn10) {
  1029. var a = this.splitToArray(isbn10);
  1030. if (!a || a.length !== 4) {
  1031. return null;
  1032. }
  1033. return {group: a[0], publisher: a[1], article: a[2], check: a[3]};
  1034. },
  1035. fill: function(codes) {
  1036. var rec, prefix, ck10, ck13, parts13, parts10;
  1037. if (!codes) {
  1038. return null;
  1039. }
  1040. rec = this.groups[codes.group];
  1041. if (!rec) {
  1042. return null;
  1043. }
  1044. prefix = codes.prefix ? codes.prefix : '978';
  1045. ck10 = this.calcCheckDigit([
  1046. codes.group, codes.publisher, codes.article].join(''));
  1047. if (!ck10) {
  1048. return null;
  1049. }
  1050. ck13 = this.calcCheckDigit([prefix, codes.group, codes.publisher, codes.article].join(''));
  1051. if (!ck13) {
  1052. return null;
  1053. }
  1054. parts13 = [prefix, codes.group, codes.publisher, codes.article, ck13];
  1055. this.merge(codes, {
  1056. isbn13: parts13.join(''),
  1057. isbn13h: parts13.join('-'),
  1058. check10: ck10,
  1059. check13: ck13,
  1060. groupname: rec.name
  1061. });
  1062. if (prefix === '978') {
  1063. parts10 = [codes.group, codes.publisher, codes.article, ck10];
  1064. this.merge(codes, {isbn10: parts10.join(''), isbn10h: parts10.join('-')});
  1065. }
  1066. return codes;
  1067. },
  1068. getGroupRecord: function(isbn10) {
  1069. var key;
  1070. for (key in this.groups) {
  1071. if (isbn10.match('^' + key + '(.+)')) {
  1072. return {group: key, record: this.groups[key], rest: RegExp.$1};
  1073. }
  1074. }
  1075. return null;
  1076. },
  1077. calcCheckDigit: function(isbn) {
  1078. var c, n;
  1079. if (isbn.match(/^\d{9}[\dX]?$/)) {
  1080. c = 0;
  1081. for (n = 0; n < 9; n += 1) {
  1082. c += (10 - n) * isbn.charAt(n);
  1083. }
  1084. c = (11 - c % 11) % 11;
  1085. return c === 10 ? 'X' : String(c);
  1086. } else if (isbn.match(/(?:978|979)\d{9}[\dX]?/)) {
  1087. c = 0;
  1088. for (n = 0; n < 12; n += 2) {
  1089. c += Number(isbn.charAt(n)) + 3 * isbn.charAt(n + 1);
  1090. }
  1091. return String((10 - c % 10) % 10);
  1092. }
  1093. return null;
  1094. }
  1095. };
  1096. }());
  1097.  
  1098. // referred: http://www.isbn-international.org/converter/ranges.htm
  1099. // frequently, you need to update the following table. what a nice specification!
  1100. // isbn-groups.js
  1101. // generated by mkgroups.pl
  1102.  
  1103. var ISBN = ISBN || {};
  1104. (function () {
  1105. // referred: http://www.isbn-international.org/converter/ranges.htm
  1106. // frequently, you need to update the following table. what a nice specification!
  1107. ISBN.GROUPS_VERSION = '20090504';
  1108. ISBN.GROUPS = {
  1109. "0": {
  1110. "name": "English speaking area",
  1111. "ranges": [["00", "19"], ["200", "699"], ["7000", "8499"], ["85000", "89999"], ["900000", "949999"], ["9500000", "9999999"]]
  1112. },
  1113. "1": {
  1114. "name": "English speaking area",
  1115. "ranges": [["00", "09"], ["100", "399"], ["4000", "5499"], ["55000", "86979"], ["869800", "998999"]]
  1116. },
  1117. "2": {
  1118. "name": "French speaking area",
  1119. "ranges": [["00", "19"], ["200", "349"], ["35000", "39999"], ["400", "699"], ["7000", "8399"], ["84000", "89999"], ["900000", "949999"], ["9500000", "9999999"]]
  1120. },
  1121. "3": {
  1122. "name": "German speaking area",
  1123. "ranges": [["00", "02"], ["030", "033"], ["0340", "0369"], ["03700", "03999"], ["04", "19"], ["200", "699"], ["7000", "8499"], ["85000", "89999"], ["900000", "949999"], ["9500000", "9539999"], ["95400", "96999"], ["9700000", "9899999"], ["99000", "99499"], ["99500", "99999"]]
  1124. },
  1125. "4": {
  1126. "name": "Japan",
  1127. "ranges": [["00", "19"], ["200", "699"], ["7000", "8499"], ["85000", "89999"], ["900000", "949999"], ["9500000", "9999999"]]
  1128. },
  1129. "5": {
  1130. "name": "Russian Federation",
  1131. "ranges": [["00", "19"], ["200", "420"], ["4210", "4299"], ["430", "430"], ["4310", "4399"], ["440", "440"], ["4410", "4499"], ["450", "699"], ["7000", "8499"], ["85000", "89999"], ["900000", "909999"], ["91000", "91999"], ["9200", "9299"], ["93000", "94999"], ["9500", "9799"], ["98000", "98999"], ["9900000", "9909999"], ["9910", "9999"]]
  1132. },
  1133. "600": {
  1134. "name": "Iran",
  1135. "ranges": [["00", "09"], ["100", "499"], ["5000", "8999"], ["90000", "99999"]]
  1136. },
  1137. "601": {
  1138. "name": "Kazakhstan",
  1139. "ranges": [["00", "19"], ["200", "699"], ["7000", "7999"], ["80000", "84999"], ["85", "99"]]
  1140. },
  1141. "602": {
  1142. "name": "Indonesia",
  1143. "ranges": [["00", "19"], ["200", "799"], ["8000", "9499"], ["95000", "99999"]]
  1144. },
  1145. "603": {
  1146. "name": "Saudi Arabia",
  1147. "ranges": [["00", "04"], ["500", "799"], ["8000", "8999"], ["90000", "99999"]]
  1148. },
  1149. "604": {
  1150. "name": "Vietnam",
  1151. "ranges": [["0", "4"], ["50", "89"], ["900", "979"], ["9800", "9999"]]
  1152. },
  1153. "605": {
  1154. "name": "Turkey",
  1155. "ranges": [["00", "09"], ["100", "399"], ["4000", "5999"], ["60000", "89999"]]
  1156. },
  1157. "606": {
  1158. "name": "Romania",
  1159. "ranges": [["0", "0"], ["10", "49"], ["500", "799"], ["8000", "9199"], ["92000", "99999"]]
  1160. },
  1161. "607": {
  1162. "name": "Mexico",
  1163. "ranges": [["00", "39"], ["400", "749"], ["7500", "9499"], ["95000", "99999"]]
  1164. },
  1165. "608": {
  1166. "name": "Macedonia",
  1167. "ranges": [["0", "0"], ["10", "19"], ["200", "449"], ["4500", "6499"], ["65000", "69999"], ["7", "9"]]
  1168. },
  1169. "609": {
  1170. "name": "Lithuania",
  1171. "ranges": [["00", "39"], ["400", "799"], ["8000", "9499"], ["95000", "99999"]]
  1172. },
  1173. "610": {
  1174. "name": "Thailand",
  1175. "ranges": [["00", "19"], ["200", "699"], ["7000", "8999"], ["90000", "99999"]]
  1176. },
  1177. "611": {
  1178. "name": "Ukraine",
  1179. "ranges": [["00", "49"], ["500", "699"], ["7000", "8999"], ["90000", "99999"]]
  1180. },
  1181. "612": {
  1182. "name": "Peru",
  1183. "ranges": [["00", "29"], ["300", "399"], ["4000", "4499"], ["45000", "49999"], ["50", "99"]]
  1184. },
  1185. "613": {
  1186. "name": "Mauritius",
  1187. "ranges": [["0", "9"]]
  1188. },
  1189. "614": {
  1190. "name": "Lebanon",
  1191. "ranges": [["00", "39"], ["400", "799"], ["8000", "9499"], ["95000", "99999"]]
  1192. },
  1193. "615": {
  1194. "name": "Hungary",
  1195. "ranges": [["00", "09"], ["100", "499"], ["5000", "7999"], ["80000", "89999"]]
  1196. },
  1197. "7": {
  1198. "name": "China, People's Republic",
  1199. "ranges": [["00", "09"], ["100", "499"], ["5000", "7999"], ["80000", "89999"], ["900000", "999999"]]
  1200. },
  1201. "80": {
  1202. "name": "Czech Republic; Slovakia",
  1203. "ranges": [["00", "19"], ["200", "699"], ["7000", "8499"], ["85000", "89999"], ["900000", "999999"]]
  1204. },
  1205. "81": {
  1206. "name": "India",
  1207. "ranges": [["00", "19"], ["200", "699"], ["7000", "8499"], ["85000", "89999"], ["900000", "999999"]]
  1208. },
  1209. "82": {
  1210. "name": "Norway",
  1211. "ranges": [["00", "19"], ["200", "699"], ["7000", "8999"], ["90000", "98999"], ["990000", "999999"]]
  1212. },
  1213. "83": {
  1214. "name": "Poland",
  1215. "ranges": [["00", "19"], ["200", "599"], ["60000", "69999"], ["7000", "8499"], ["85000", "89999"], ["900000", "999999"]]
  1216. },
  1217. "84": {
  1218. "name": "Spain",
  1219. "ranges": [["00", "19"], ["200", "699"], ["7000", "8499"], ["85000", "89999"], ["9000", "9199"], ["920000", "923999"], ["92400", "92999"], ["930000", "949999"], ["95000", "96999"], ["9700", "9999"]]
  1220. },
  1221. "85": {
  1222. "name": "Brazil",
  1223. "ranges": [["00", "19"], ["200", "599"], ["60000", "69999"], ["7000", "8499"], ["85000", "89999"], ["900000", "979999"], ["98000", "99999"]]
  1224. },
  1225. "86": {
  1226. "name": "Serbia and Montenegro",
  1227. "ranges": [["00", "29"], ["300", "599"], ["6000", "7999"], ["80000", "89999"], ["900000", "999999"]]
  1228. },
  1229. "87": {
  1230. "name": "Denmark",
  1231. "ranges": [["00", "29"], ["400", "649"], ["7000", "7999"], ["85000", "94999"], ["970000", "999999"]]
  1232. },
  1233. "88": {
  1234. "name": "Italian speaking area",
  1235. "ranges": [["00", "19"], ["200", "599"], ["6000", "8499"], ["85000", "89999"], ["900000", "949999"], ["95000", "99999"]]
  1236. },
  1237. "89": {
  1238. "name": "Korea",
  1239. "ranges": [["00", "24"], ["250", "549"], ["5500", "8499"], ["85000", "94999"], ["950000", "999999"]]
  1240. },
  1241. "90": {
  1242. "name": "Netherlands, Belgium (Flemish)",
  1243. "ranges": [["00", "19"], ["200", "499"], ["5000", "6999"], ["70000", "79999"], ["800000", "849999"], ["8500", "8999"], ["900000", "909999"], ["940000", "949999"]]
  1244. },
  1245. "91": {
  1246. "name": "Sweden",
  1247. "ranges": [["0", "1"], ["20", "49"], ["500", "649"], ["7000", "7999"], ["85000", "94999"], ["970000", "999999"]]
  1248. },
  1249. "92": {
  1250. "name": "International Publishers (Unesco, EU), European Community Organizations",
  1251. "ranges": [["0", "5"], ["60", "79"], ["800", "899"], ["9000", "9499"], ["95000", "98999"], ["990000", "999999"]]
  1252. },
  1253. "93": {
  1254. "name": "India",
  1255. "ranges": [["00", "09"], ["100", "499"], ["5000", "7999"], ["80000", "94999"], ["950000", "999999"]]
  1256. },
  1257. "94": {
  1258. "name": "Netherlands",
  1259. "ranges": [["000", "599"], ["6000", "8999"], ["90000", "99999"]]
  1260. },
  1261. "950": {
  1262. "name": "Argentina",
  1263. "ranges": [["00", "49"], ["500", "899"], ["9000", "9899"], ["99000", "99999"]]
  1264. },
  1265. "951": {
  1266. "name": "Finland",
  1267. "ranges": [["0", "1"], ["20", "54"], ["550", "889"], ["8900", "9499"], ["95000", "99999"]]
  1268. },
  1269. "952": {
  1270. "name": "Finland",
  1271. "ranges": [["00", "19"], ["200", "499"], ["5000", "5999"], ["60", "65"], ["6600", "6699"], ["67000", "69999"], ["7000", "7999"], ["80", "94"], ["9500", "9899"], ["99000", "99999"]]
  1272. },
  1273. "953": {
  1274. "name": "Croatia",
  1275. "ranges": [["0", "0"], ["10", "14"], ["150", "549"], ["55000", "59999"], ["6000", "9499"], ["95000", "99999"]]
  1276. },
  1277. "954": {
  1278. "name": "Bulgaria",
  1279. "ranges": [["00", "29"], ["300", "799"], ["8000", "8999"], ["90000", "92999"], ["9300", "9999"]]
  1280. },
  1281. "955": {
  1282. "name": "Sri Lanka",
  1283. "ranges": [["0000", "0999"], ["1000", "1999"], ["20", "54"], ["550", "799"], ["8000", "9499"], ["95000", "99999"]]
  1284. },
  1285. "956": {
  1286. "name": "Chile",
  1287. "ranges": [["00", "19"], ["200", "699"], ["7000", "9999"]]
  1288. },
  1289. "957": {
  1290. "name": "Taiwan, China",
  1291. "ranges": [["00", "02"], ["0300", "0499"], ["05", "19"], ["2000", "2099"], ["21", "27"], ["28000", "30999"], ["31", "43"], ["440", "819"], ["8200", "9699"], ["97000", "99999"]]
  1292. },
  1293. "958": {
  1294. "name": "Colombia",
  1295. "ranges": [["00", "56"], ["57000", "59999"], ["600", "799"], ["8000", "9499"], ["95000", "99999"]]
  1296. },
  1297. "959": {
  1298. "name": "Cuba",
  1299. "ranges": [["00", "19"], ["200", "699"], ["7000", "8499"]]
  1300. },
  1301. "960": {
  1302. "name": "Greece",
  1303. "ranges": [["00", "19"], ["200", "659"], ["6600", "6899"], ["690", "699"], ["7000", "8499"], ["85000", "99999"]]
  1304. },
  1305. "961": {
  1306. "name": "Slovenia",
  1307. "ranges": [["00", "19"], ["200", "599"], ["6000", "8999"], ["90000", "94999"]]
  1308. },
  1309. "962": {
  1310. "name": "Hong Kong",
  1311. "ranges": [["00", "19"], ["200", "699"], ["7000", "8499"], ["85000", "86999"], ["8700", "8999"], ["900", "999"]]
  1312. },
  1313. "963": {
  1314. "name": "Hungary",
  1315. "ranges": [["00", "19"], ["200", "699"], ["7000", "8499"], ["85000", "89999"], ["9000", "9999"]]
  1316. },
  1317. "964": {
  1318. "name": "Iran",
  1319. "ranges": [["00", "14"], ["150", "249"], ["2500", "2999"], ["300", "549"], ["5500", "8999"], ["90000", "96999"], ["970", "989"], ["9900", "9999"]]
  1320. },
  1321. "965": {
  1322. "name": "Israel",
  1323. "ranges": [["00", "19"], ["200", "599"], ["7000", "7999"], ["90000", "99999"]]
  1324. },
  1325. "966": {
  1326. "name": "Ukraine",
  1327. "ranges": [["00", "14"], ["1500", "1699"], ["170", "199"], ["2000", "2999"], ["300", "699"], ["7000", "8999"], ["90000", "99999"]]
  1328. },
  1329. "967": {
  1330. "name": "Malaysia",
  1331. "ranges": [["00", "29"], ["300", "499"], ["5000", "5999"], ["60", "89"], ["900", "989"], ["9900", "9989"], ["99900", "99999"]]
  1332. },
  1333. "968": {
  1334. "name": "Mexico",
  1335. "ranges": [["01", "39"], ["400", "499"], ["5000", "7999"], ["800", "899"], ["9000", "9999"]]
  1336. },
  1337. "969": {
  1338. "name": "Pakistan",
  1339. "ranges": [["0", "1"], ["20", "39"], ["400", "799"], ["8000", "9999"]]
  1340. },
  1341. "970": {
  1342. "name": "Mexico",
  1343. "ranges": [["01", "59"], ["600", "899"], ["9000", "9099"], ["91000", "96999"], ["9700", "9999"]]
  1344. },
  1345. "971": {
  1346. "name": "Philippines",
  1347. "ranges": [["000", "019"], ["02", "02"], ["0300", "0599"], ["06", "09"], ["10", "49"], ["500", "849"], ["8500", "9099"], ["91000", "99999"]]
  1348. },
  1349. "972": {
  1350. "name": "Portugal",
  1351. "ranges": [["0", "1"], ["20", "54"], ["550", "799"], ["8000", "9499"], ["95000", "99999"]]
  1352. },
  1353. "973": { "name": "Romania", "ranges": [["0", "0"], ["100", "169"], ["1700", "1999"], ["20", "54"], ["550", "759"], ["7600", "8499"], ["85000", "88999"], ["8900", "9499"], ["95000", "99999"]]
  1354. },
  1355. "974": { "name": "Thailand",
  1356. "ranges": [["00", "19"], ["200", "699"], ["7000", "8499"], ["85000", "89999"], ["90000", "94999"], ["9500", "9999"]] }, "975": { "name": "Turkey", "ranges": [["00000", "00999"], ["01", "24"], ["250", "599"], ["6000", "9199"], ["92000", "98999"], ["990", "999"]]
  1357. },
  1358. "976": {
  1359. "name": "Caribbean Community",
  1360. "ranges": [["0", "3"], ["40", "59"], ["600", "799"], ["8000", "9499"], ["95000", "99999"]]
  1361. },
  1362. "977": {
  1363. "name": "Egypr",
  1364. "ranges": [["00", "19"], ["200", "499"], ["5000", "6999"], ["700", "999"]]
  1365. },
  1366. "978": {
  1367. "name": "Nigeria",
  1368. "ranges": [["000", "199"], ["2000", "2999"], ["30000", "79999"], ["8000", "8999"], ["900", "999"]]
  1369. },
  1370. "979": {
  1371. "name": "Indonesia",
  1372. "ranges": [["000", "099"], ["1000", "1499"], ["15000", "19999"], ["20", "29"], ["3000", "3999"], ["400", "799"], ["8000", "9499"], ["95000", "99999"]]
  1373. },
  1374. "980": {
  1375. "name": "Venezuela",
  1376. "ranges": [["00", "19"], ["200", "599"], ["6000", "9999"]]
  1377. },
  1378. "981": {
  1379. "name": "Singapore",
  1380. "ranges": [["00", "11"], ["1200", "1999"], ["200", "289"], ["2900", "9999"]]
  1381. },
  1382. "982": {
  1383. "name": "South Pacific",
  1384. "ranges": [["00", "09"], ["100", "699"], ["70", "89"], ["9000", "9999"]]
  1385. },
  1386. "983": {
  1387. "name": "Malaysia",
  1388. "ranges": [["00", "01"], ["020", "199"], ["2000", "3999"], ["40000", "44999"], ["45", "49"], ["50", "79"], ["800", "899"], ["9000", "9899"], ["99000", "99999"]]
  1389. },
  1390. "984": {
  1391. "name": "Bangladesh",
  1392. "ranges": [["00", "39"], ["400", "799"], ["8000", "8999"], ["90000", "99999"]]
  1393. },
  1394. "985": {
  1395. "name": "Belarus",
  1396. "ranges": [["00", "39"], ["400", "599"], ["6000", "8999"], ["90000", "99999"]]
  1397. },
  1398. "986": {
  1399. "name": "Taiwan, China",
  1400. "ranges": [["00", "11"], ["120", "559"], ["5600", "7999"], ["80000", "99999"]]
  1401. },
  1402. "987": {
  1403. "name": "Argentina",
  1404. "ranges": [["00", "09"], ["1000", "1999"], ["20000", "29999"], ["30", "49"], ["500", "899"], ["9000", "9499"], ["95000", "99999"]]
  1405. },
  1406. "988": {
  1407. "name": "Hongkong",
  1408. "ranges": [["00", "16"], ["17000", "19999"], ["200", "799"], ["8000", "9699"], ["97000", "99999"]]
  1409. },
  1410. "989": {
  1411. "name": "Portugal",
  1412. "ranges": [["0", "1"], ["20", "54"], ["550", "799"], ["8000", "9499"], ["95000", "99999"]]
  1413. },
  1414. "9933": {
  1415. "name": "Syria",
  1416. "ranges": [["0", "0"], ["10", "39"], ["400", "899"], ["9000", "9999"]]
  1417. },
  1418. "9934": {
  1419. "name": "Latvia",
  1420. "ranges": [["0", "0"], ["10", "49"], ["500", "799"], ["8000", "9999"]]
  1421. },
  1422. "9935": {
  1423. "name": "Iceland",
  1424. "ranges": [["0", "0"], ["10", "39"], ["400", "899"], ["9000", "9999"]]
  1425. },
  1426. "9936": {
  1427. "name": "Afghanistan",
  1428. "ranges": [["0", "1"], ["20", "39"], ["400", "799"], ["8000", "9999"]]
  1429. },
  1430. "9937": {
  1431. "name": "Nepal",
  1432. "ranges": [["0", "2"], ["30", "49"], ["500", "799"], ["8000", "9999"]]
  1433. },
  1434. "9938": {
  1435. "name": "Tunisia",
  1436. "ranges": [["00", "79"], ["800", "949"], ["9500", "9999"]]
  1437. },
  1438. "9939": {
  1439. "name": "Armenia",
  1440. "ranges": [["0", "4"], ["50", "79"], ["800", "899"], ["9000", "9999"]]
  1441. },
  1442. "9940": {
  1443. "name": "Montenegro",
  1444. "ranges": [["0", "1"], ["20", "49"], ["500", "899"], ["9000", "9999"]]
  1445. },
  1446. "9941": {
  1447. "name": "Georgia",
  1448. "ranges": [["0", "0"], ["10", "39"], ["400", "899"], ["9000", "9999"]]
  1449. },
  1450. "9942": {
  1451. "name": "Ecuador",
  1452. "ranges": [["00", "89"], ["900", "994"], ["9950", "9999"]]
  1453. },
  1454. "9943": {
  1455. "name": "Uzbekistan",
  1456. "ranges": [["00", "29"], ["300", "399"], ["4000", "9999"]]
  1457. },
  1458. "9944": {
  1459. "name": "Turkey",
  1460. "ranges": [["0", "2"], ["300", "499"], ["5000", "5999"], ["60", "89"], ["900", "999"]]
  1461. },
  1462. "9945": {
  1463. "name": "Dominican Republic",
  1464. "ranges": [["00", "00"], ["010", "079"], ["08", "39"], ["400", "569"], ["57", "57"], ["580", "849"], ["8500", "9999"]]
  1465. },
  1466. "9946": {
  1467. "name": "Korea, P.D.R.",
  1468. "ranges": [["0", "1"], ["20", "39"], ["400", "899"], ["9000", "9999"]]
  1469. },
  1470. "9947": {
  1471. "name": "Algeria",
  1472. "ranges": [["0", "1"], ["20", "79"], ["800", "999"]]
  1473. },
  1474. "9948": {
  1475. "name": "United Arab Emirates",
  1476. "ranges": [["00", "39"], ["400", "849"], ["8500", "9999"]]
  1477. },
  1478. "9949": {
  1479. "name": "Estonia",
  1480. "ranges": [["0", "0"], ["10", "39"], ["400", "899"], ["9000", "9999"]]
  1481. },
  1482. "9950": {
  1483. "name": "Palestine",
  1484. "ranges": [["00", "29"], ["300", "840"], ["8500", "9999"]]
  1485. },
  1486. "9951": {
  1487. "name": "Kosova",
  1488. "ranges": [["00", "39"], ["400", "849"], ["8500", "9999"]]
  1489. },
  1490. "9952": {
  1491. "name": "Azerbaijan",
  1492. "ranges": [["0", "1"], ["20", "39"], ["400", "799"], ["8000", "9999"]]
  1493. },
  1494. "9953": {
  1495. "name": "Lebanon",
  1496. "ranges": [["0", "0"], ["10", "39"], ["400", "599"], ["60", "89"], ["9000", "9999"]]
  1497. },
  1498. "9954": {
  1499. "name": "Morocco",
  1500. "ranges": [["0", "1"], ["20", "39"], ["400", "799"], ["8000", "9999"]]
  1501. },
  1502. "9955": {
  1503. "name": "Lithuania",
  1504. "ranges": [["00", "39"], ["400", "929"], ["9300", "9999"]]
  1505. },
  1506. "9956": {
  1507. "name": "Cameroon",
  1508. "ranges": [["0", "0"], ["10", "39"], ["400", "899"], ["9000", "9999"]]
  1509. },
  1510. "9957": {
  1511. "name": "Jordan",
  1512. "ranges": [["00", "39"], ["400", "699"], ["70", "84"], ["8500", "9999"]]
  1513. },
  1514. "9958": {
  1515. "name": "Bosnia and Herzegovina",
  1516. "ranges": [["0", "0"], ["10", "49"], ["500", "899"], ["9000", "9999"]]
  1517. },
  1518. "9959": {
  1519. "name": "Libya",
  1520. "ranges": [["0", "1"], ["20", "79"], ["800", "949"], ["9500", "9999"]]
  1521. },
  1522. "9960": {
  1523. "name": "Saudi Arabia",
  1524. "ranges": [["00", "59"], ["600", "899"], ["9000", "9999"]]
  1525. },
  1526. "9961": {
  1527. "name": "Algeria",
  1528. "ranges": [["0", "2"], ["30", "69"], ["700", "949"], ["9500", "9999"]]
  1529. },
  1530. "9962": {
  1531. "name": "Panama",
  1532. "ranges": [["00", "54"], ["5500", "5599"], ["56", "59"], ["600", "849"], ["8500", "9999"]]
  1533. },
  1534. "9963": {
  1535. "name": "Cyprus",
  1536. "ranges": [["0", "2"], ["30", "54"], ["550", "749"], ["7500", "9999"]]
  1537. },
  1538. "9964": {
  1539. "name": "Ghana",
  1540. "ranges": [["0", "6"], ["70", "94"], ["950", "999"]]
  1541. },
  1542. "9965": {
  1543. "name": "Kazakhstan",
  1544. "ranges": [["00", "39"], ["400", "899"], ["9000", "9999"]]
  1545. },
  1546. "9966": {
  1547. "name": "Kenya",
  1548. "ranges": [["000", "199"], ["20", "69"], ["7000", "7499"], ["750", "959"], ["9600", "9999"]]
  1549. },
  1550. "9967": {
  1551. "name": "Kyrgyzstan",
  1552. "ranges": [["00", "39"], ["400", "899"], ["9000", "9999"]]
  1553. },
  1554. "9968": {
  1555. "name": "Costa Rica",
  1556. "ranges": [["00", "49"], ["500", "939"], ["9400", "9999"]]
  1557. },
  1558. "9970": {
  1559. "name": "Uganda",
  1560. "ranges": [["00", "39"], ["400", "899"], ["9000", "9999"]]
  1561. },
  1562. "9971": {
  1563. "name": "Singapore",
  1564. "ranges": [["0", "5"], ["60", "89"], ["900", "989"], ["9900", "9999"]]
  1565. },
  1566. "9972": {
  1567. "name": "Peru",
  1568. "ranges": [["00", "09"], ["1"], ["200", "249"], ["2500", "2999"], ["30", "59"], ["600", "899"], ["9000", "9999"]]
  1569. },
  1570. "9973": {
  1571. "name": "Tunisia",
  1572. "ranges": [["00", "05"], ["060", "089"], ["0900", "0999"], ["10", "69"], ["700", "969"], ["9700", "9999"]]
  1573. },
  1574. "9974": {
  1575. "name": "Uruguay",
  1576. "ranges": [["0", "2"], ["30", "54"], ["550", "749"], ["7500", "9499"], ["95", "99"]]
  1577. },
  1578. "9975": {
  1579. "name": "Moldova",
  1580. "ranges": [["0", "0"], ["100", "399"], ["4000", "4499"], ["45", "89"], ["900", "949"], ["9500", "9999"]]
  1581. },
  1582. "9976": { "name": "Tanzania", "ranges": [["0", "5"], ["60", "89"],
  1583. ["900", "989"], ["9990", "9999"]] },
  1584. "9977": {
  1585. "name": "Costa Rica",
  1586. "ranges": [["00", "89"], ["900", "989"], ["9900", "9999"]]
  1587. },
  1588. "9978": {
  1589. "name": "Ecuador",
  1590. "ranges": [["00", "29"], ["300", "399"], ["40", "94"], ["950", "989"], ["9900", "9999"]]
  1591. },
  1592. "9979": {
  1593. "name": "Iceland",
  1594. "ranges": [["0", "4"], ["50", "64"], ["650", "659"], ["66", "75"], ["760", "899"], ["9000", "9999"]]
  1595. },
  1596. "9980": {
  1597. "name": "Papua New Guinea",
  1598. "ranges": [["0", "3"], ["40", "89"], ["900", "989"], ["9900", "9999"]]
  1599. },
  1600. "9981": {
  1601. "name": "Morocco",
  1602. "ranges": [["00", "09"], ["100", "159"], ["1600", "1999"], ["20", "79"], ["800", "949"], ["9500", "9999"]]
  1603. },
  1604. "9982": {
  1605. "name": "Zambia",
  1606. "ranges": [["00", "79"], ["800", "989"], ["9900", "9999"]]
  1607. },
  1608. "9983": {
  1609. "name": "Gambia",
  1610. "ranges": [["80", "94"], ["950", "989"], ["9900", "9999"]]
  1611. },
  1612. "9984": {
  1613. "name": "Latvia",
  1614. "ranges": [["00", "49"], ["500", "899"], ["9000", "9999"]]
  1615. },
  1616. "9985": {
  1617. "name": "Estonia",
  1618. "ranges": [["0", "4"], ["50", "79"], ["800", "899"], ["9000", "9999"]]
  1619. },
  1620. "9986": {
  1621. "name": "Lithuania",
  1622. "ranges": [["00", "39"], ["400", "899"], ["9000", "9399"], ["940", "969"], ["97", "99"]]
  1623. },
  1624. "9987": {
  1625. "name": "Tanzania",
  1626. "ranges": [["00", "39"], ["400", "879"], ["8800", "9999"]]
  1627. },
  1628. "9988": {
  1629. "name": "Ghana",
  1630. "ranges": [["0", "2"], ["30", "54"], ["550", "749"], ["7500", "9999"]]
  1631. },
  1632. "9989": {
  1633. "name": "Macedonia",
  1634. "ranges": [["0", "0"], ["100", "199"], ["2000", "2999"], ["30", "59"], ["600", "949"], ["9500", "9999"]]
  1635. },
  1636. "99901": {
  1637. "name": "Bahrain",
  1638. "ranges": [["00", "49"], ["500", "799"], ["80", "99"]]
  1639. },
  1640. "99902": {
  1641. "name": "Gabon - no ranges fixed yet",
  1642. "ranges": []
  1643. },
  1644. "99903": {
  1645. "name": "Mauritius",
  1646. "ranges": [["0", "1"], ["20", "89"], ["900", "999"]]
  1647. },
  1648. "99904": {
  1649. "name": "Netherlands Antilles; Aruba, Neth. Ant",
  1650. "ranges": [["0", "5"], ["60", "89"], ["900", "999"]]
  1651. },
  1652. "99905": {
  1653. "name": "Bolivia",
  1654. "ranges": [["0", "3"], ["40", "79"], ["800", "999"]]
  1655. },
  1656. "99906": {
  1657. "name": "Kuwait",
  1658. "ranges": [["0", "2"], ["30", "59"], ["600", "699"], ["70", "89"], ["9", "9"]]
  1659. },
  1660. "99908": {
  1661. "name": "Malawi",
  1662. "ranges": [["0", "0"], ["10", "89"], ["900", "999"]]
  1663. },
  1664. "99909": {
  1665. "name": "Malta",
  1666. "ranges": [["0", "3"], ["40", "94"], ["950", "999"]]
  1667. },
  1668. "99910": {
  1669. "name": "Sierra Leone",
  1670. "ranges": [["0", "2"], ["30", "89"], ["900", "999"]]
  1671. },
  1672. "99911": {
  1673. "name": "Lesotho",
  1674. "ranges": [["00", "59"], ["600", "999"]]
  1675. },
  1676. "99912": {
  1677. "name": "Botswana",
  1678. "ranges": [["0", "3"], ["400", "599"], ["60", "89"], ["900", "999"]]
  1679. },
  1680. "99913": {
  1681. "name": "Andorra",
  1682. "ranges": [["0", "2"], ["30", "35"], ["600", "604"]]
  1683. },
  1684. "99914": {
  1685. "name": "Suriname",
  1686. "ranges": [["0", "4"], ["50", "89"], ["900", "949"]]
  1687. },
  1688. "99915": {
  1689. "name": "Maldives",
  1690. "ranges": [["0", "4"], ["50", "79"], ["800", "999"]]
  1691. },
  1692. "99916": {
  1693. "name": "Namibia",
  1694. "ranges": [["0", "2"], ["30", "69"], ["700", "999"]]
  1695. },
  1696. "99917": {
  1697. "name": "Brunei Darussalam",
  1698. "ranges": [["0", "2"], ["30", "89"], ["900", "999"]]
  1699. },
  1700. "99918": {
  1701. "name": "Faroe Islands",
  1702. "ranges": [["0", "3"], ["40", "79"], ["800", "999"]]
  1703. },
  1704. "99919": {
  1705. "name": "Benin",
  1706. "ranges": [["0", "2"], ["300", "399"], ["40", "69"], ["900", "999"]]
  1707. },
  1708. "99920": {
  1709. "name": "Andorra",
  1710. "ranges": [["0", "4"], ["50", "89"], ["900", "999"]]
  1711. },
  1712. "99921": {
  1713. "name": "Qatar",
  1714. "ranges": [["0", "1"], ["20", "69"], ["700", "799"], ["8", "8"], ["90", "99"]]
  1715. },
  1716. "99922": {
  1717. "name": "Guatemala",
  1718. "ranges": [["0", "3"], ["40", "69"], ["700", "999"]]
  1719. },
  1720. "99923": {
  1721. "name": "El Salvador",
  1722. "ranges": [["0", "1"], ["20", "79"], ["800", "999"]]
  1723. },
  1724. "99924": {
  1725. "name": "Nicaragua",
  1726. "ranges": [["0", "1"], ["20", "79"], ["800", "999"]]
  1727. },
  1728. "99925": {
  1729. "name": "Paraguay",
  1730. "ranges": [["0", "3"], ["40", "79"], ["800", "999"]]
  1731. },
  1732. "99926": {
  1733. "name": "Honduras",
  1734. "ranges": [["0", "0"], ["10", "59"], ["600", "999"]]
  1735. },
  1736. "99927": {
  1737. "name": "Albania",
  1738. "ranges": [["0", "2"], ["30", "59"], ["600", "999"]]
  1739. },
  1740. "99928": {
  1741. "name": "Georgia",
  1742. "ranges": [["0", "0"], ["10", "79"], ["800", "999"]]
  1743. },
  1744. "99929": {
  1745. "name": "Mongolia",
  1746. "ranges": [["0", "4"], ["50", "79"], ["800", "999"]]
  1747. },
  1748. "99930": {
  1749. "name": "Armenia",
  1750. "ranges": [["0", "4"], ["50", "79"], ["800", "999"]]
  1751. },
  1752. "99931": {
  1753. "name": "Seychelles",
  1754. "ranges": [["0", "4"], ["50", "79"], ["800", "999"]]
  1755. },
  1756. "99932": {
  1757. "name": "Malta",
  1758. "ranges": [["0", "0"], ["10", "59"], ["600", "699"], ["7", "7"], ["80", "99"]]
  1759. },
  1760. "99933": {
  1761. "name": "Nepal",
  1762. "ranges": [["0", "2"], ["30", "59"], ["600", "999"]]
  1763. },
  1764. "99934": {
  1765. "name": "Dominican Republic",
  1766. "ranges": [["0", "1"], ["20", "79"], ["800", "999"]]
  1767. },
  1768. "99935": {
  1769. "name": "Haiti",
  1770. "ranges": [["0", "2"], ["7", "8"], ["30", "59"], ["600", "699"], ["90", "99"]]
  1771. },
  1772. "99936": {
  1773. "name": "Bhutan",
  1774. "ranges": [["0", "0"], ["10", "59"], ["600", "999"]]
  1775. },
  1776. "99937": {
  1777. "name": "Macau",
  1778. "ranges": [["0", "1"], ["20", "59"], ["600", "999"]]
  1779. },
  1780. "99938": {
  1781. "name": "Srpska",
  1782. "ranges": [["0", "1"], ["20", "59"], ["600", "899"], ["90", "99"]]
  1783. },
  1784. "99939": {
  1785. "name": "Guatemala",
  1786. "ranges": [["0", "5"], ["60", "89"], ["900", "999"]]
  1787. },
  1788. "99940": {
  1789. "name": "Georgia",
  1790. "ranges": [["0", "0"], ["10", "69"], ["700", "999"]]
  1791. },
  1792. "99941": {
  1793. "name": "Armenia",
  1794. "ranges": [["0", "2"], ["30", "79"], ["800", "999"]]
  1795. },
  1796. "99942": {
  1797. "name": "Sudan",
  1798. "ranges": [["0", "4"], ["50", "79"], ["800", "999"]]
  1799. },
  1800. "99943": {
  1801. "name": "Alsbania",
  1802. "ranges": [["0", "2"], ["30", "59"], ["600", "999"]]
  1803. },
  1804. "99944": {
  1805. "name": "Ethiopia",
  1806. "ranges": [["0", "4"], ["50", "79"], ["800", "999"]]
  1807. },
  1808. "99945": {
  1809. "name": "Namibia",
  1810. "ranges": [["0", "5"], ["60", "89"], ["900", "999"]]
  1811. },
  1812. "99946": {
  1813. "name": "Nepal",
  1814. "ranges": [["0", "2"], ["30", "59"], ["600", "999"]]
  1815. },
  1816. "99947": {
  1817. "name": "Tajikistan",
  1818. "ranges": [["0", "2"], ["30", "69"], ["700", "999"]]
  1819. },
  1820. "99948": {
  1821. "name": "Eritrea",
  1822. "ranges": [["0", "4"], ["50", "79"], ["800", "999"]]
  1823. },
  1824. "99949": {
  1825. "name": "Mauritius",
  1826. "ranges": [["0", "1"], ["20", "89"], ["900", "999"]]
  1827. },
  1828. "99950": {
  1829. "name": "Cambodia",
  1830. "ranges": [["0", "4"], ["50", "79"], ["800", "999"]]
  1831. },
  1832. "99951": {
  1833. "name": "Congo - no ranges fixed yet",
  1834. "ranges": []
  1835. },
  1836. "99952": {
  1837. "name": "Mali",
  1838. "ranges": [["0", "4"], ["50", "79"], ["800", "999"]]
  1839. },
  1840. "99953": {
  1841. "name": "Paraguay",
  1842. "ranges": [["0", "2"], ["30", "79"], ["800", "999"]]
  1843. },
  1844. "99954": {
  1845. "name": "Bolivia",
  1846. "ranges": [["0", "2"], ["30", "69"], ["700", "999"]]
  1847. },
  1848. "99955": {
  1849. "name": "Srpska",
  1850. "ranges": [["0", "1"], ["20", "59"], ["600", "899"], ["90", "99"]]
  1851. },
  1852. "99956": {
  1853. "name": "Albania",
  1854. "ranges": [["00", "59"], ["600", "999"]]
  1855. },
  1856. "99957": {
  1857. "name": "Malta",
  1858. "ranges": [["0", "1"], ["20", "79"], ["800", "999"]]
  1859. },
  1860. "99958": {
  1861. "name": "Bahrain",
  1862. "ranges": [["0", "4"], ["50", "94"], ["950", "999"]]
  1863. },
  1864. "99959": {
  1865. "name": "Luxembourg",
  1866. "ranges": [["0", "2"], ["30", "59"], ["600", "999"]]
  1867. },
  1868. "99960": {
  1869. "name": "Malawi",
  1870. "ranges": [["0", "0"], ["10", "94"], ["950", "999"]]
  1871. },
  1872. "99961": {
  1873. "name": "El Salvador",
  1874. "ranges": [["0", "3"], ["40", "89"], ["900", "999"]]
  1875. },
  1876. "99962": {
  1877. "name": "Mongolia",
  1878. "ranges": [["0", "4"], ["50", "79"], ["800", "999"]]
  1879. },
  1880. "99963": {
  1881. "name": "Cambodia",
  1882. "ranges": [["00", "49"], ["500", "999"]]
  1883. }
  1884. };
  1885. }());
  1886.  
  1887. //
  1888. // Ende importiertes isbn.js
  1889. //

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址