{ "translatorID": "c73a4a8c-3ef1-4ec8-8229-7531ee384cc4", "label": "Open WorldCat", "creator": "Simon Kornblith, Sebastian Karcher", "target": "^https?://[^/]+\\.worldcat\\.org", "minVersion": "3.0.9", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 12, "browserSupport": "gcsbv", "lastUpdated": "2014-04-10 23:30:53" } /** * Gets Zotero item from a WorldCat icon src */ function getZoteroType(iconSrc) { // only specify types not specified in COinS if (iconSrc.indexOf("icon-rec") != -1) { return "audioRecording"; } if (iconSrc.indexOf("icon-com") != -1) { return "computerProgram"; } if (iconSrc.indexOf("icon-map") != -1) { return "map"; } return false; } /** * Generates a Zotero item from a single item WorldCat page, * or the first item on a multiple item page */ function generateItem(doc, co) { var item = new Zotero.Item(); ZU.parseContextObject(co, item); // if only one, first check for special types (audio & video recording) var type = ZU.xpathText(doc, '//img[@class="icn"][contains(@src, "icon-")][1]/@src'); if (type) { type = getZoteroType(type); if (type) item.itemType = type; } return item; } function getSearchResults(doc) { var results = doc.getElementsByClassName('result'); for(var i=0; i\s*Notes:\s*<\/strong>\s*
\s*/i, ''); if(notes) { itemData[oclcID] = { notes: ZU.unescapeHTML(ZU.unescapeHTML(notes)) //it's double-escaped on WorldCat }; } } } Zotero.selectItems(items, function(items) { if (!items) return true; for (var i in items) { scrape(i, itemData[i]); } }); } else { var oclcID = extractOCLCID(url); if(!oclcID) throw new Error("WorldCat: Failed to extract OCLC ID from URL: " + url); scrape(oclcID); } } function detectSearch(item) { if(item.ISBN && typeof(item.ISBN) == 'string') { return !!ZU.cleanISBN(item.ISBN); } } function doSearch(item) { var ISBN = item.ISBN && ZU.cleanISBN('' + item.ISBN); if(!ISBN) return; var url = "http://www.worldcat.org/search?qt=results_page&q=bn%3A" + encodeURIComponent(ISBN); ZU.processDocuments(url, function (doc) { //we take the first search result and run scrape on it var results = getSearchResults(doc); if (results.length > 0) { baseURL = "http://www.worldcat.org"; scrape(extractOCLCID(getTitleNode(results[0]).href)); } }); } /** BEGIN TEST CASES **/ var testCases = [ { "type": "web", "url": "http://www.worldcat.org/search?qt=worldcat_org_bks&q=argentina&fq=dt%3Abks", "items": "multiple" }, { "type": "web", "url": "http://www.worldcat.org/title/argentina/oclc/489605&referer=brief_results", "items": [ { "itemType": "book", "creators": [ { "lastName": "Whitaker", "firstName": "Arthur Preston", "creatorType": "author" } ], "notes": [], "tags": [], "seeAlso": [], "attachments": [], "libraryCatalog": "Open WorldCat", "language": "English", "title": "Argentina", "publisher": "Prentice-Hall", "place": "Englewood Cliffs, N.J.", "date": "1964" } ] }, { "type": "web", "url": "http://www.worldcat.org/title/dynamic-systems-approach-to-the-development-of-cognition-and-action/oclc/42854423&referer=brief_results", "items": [ { "itemType": "book", "creators": [ { "lastName": "Thelen", "firstName": "Esther", "creatorType": "author" }, { "lastName": "Smith", "firstName": "Linda B", "creatorType": "author" } ], "notes": [], "tags": [], "seeAlso": [], "attachments": [], "libraryCatalog": "Open WorldCat", "language": "English", "url": "http://search.ebscohost.com/login.aspx?direct=true&scope=site&db=nlebk&db=nlabk&AN=1712", "title": "A dynamic systems approach to the development of cognition and action", "publisher": "MIT Press", "place": "Cambridge, Mass.", "date": "1996", "ISBN": "0585030154 9780585030159", "accessDate": "CURRENT_TIMESTAMP" } ] }, { "type": "web", "url": "http://melvyl.worldcat.org/title/cambridge-companion-to-adam-smith/oclc/60321422&referer=brief_results", "items": [ { "itemType": "book", "creators": [ { "lastName": "Haakonssen", "firstName": "Knud", "creatorType": "author" } ], "notes": [], "tags": [], "seeAlso": [], "attachments": [], "libraryCatalog": "Open WorldCat", "language": "English", "title": "The Cambridge companion to Adam Smith", "publisher": "Cambridge University Press", "place": "Cambridge; New York", "date": "2006", "ISBN": "0521770599 0521779243 9780521770590 9780521779241", "abstractNote": "\"Adam Smith is best known as the founder of scientific economics and as an early proponent of the modern market economy. Political economy, however, was only one part of Smith's comprehensive intellectual system. Consisting of a theory of mind and its functions in language, arts, science, and social intercourse, Smith's system was a towering contribution to the Scottish Enlightenment. His ideas on social intercourse, in fact, also served as the basis for a moral theory that provided both historical and theoretical accounts of law, politics, and economics. This companion volume provides an up-to-date examination of all aspects of Smith's thought. Collectively, the essays take into account Smith's multiple contexts - Scottish, British, European, Atlantic, biographical, institutional, political, philosophical - and they draw on all his works, including student notes from his lectures. Pluralistic in approach, the volume provides a contextualist history of Smith, as well as direct philosophical engagement with his ideas.\"--Jacket." } ] }, { "type": "web", "url": "http://www.worldcat.org/title/from-lanka-eastwards-the-ramayana-in-the-literature-and-visual-arts-of-indonesia/oclc/765821302", "items": [ { "itemType": "book", "creators": [ { "lastName": "Acri", "firstName": "Andrea", "creatorType": "editor" }, { "lastName": "Creese", "firstName": "Helen", "creatorType": "editor" }, { "lastName": "Griffiths", "firstName": "Arlo", "creatorType": "editor" } ], "notes": [], "tags": [], "seeAlso": [], "attachments": [], "libraryCatalog": "Open WorldCat", "language": "English", "place": "Leiden", "ISBN": "9067183849 9789067183840", "shortTitle": "From Laṅkā eastwards", "title": "From Laṅkā eastwards: the Rāmāyaṇa in the literature and visual arts of Indonesia", "publisher": "KITLV Press", "date": "2011" } ] }, { "type": "web", "url": "http://www.worldcat.org/title/newmans-relation-to-modernism/oclc/676747555", "items": [ { "itemType": "book", "creators": [ { "lastName": "Smith", "firstName": "Sydney F", "creatorType": "author" } ], "notes": [], "tags": [], "seeAlso": [], "attachments": [], "libraryCatalog": "Open WorldCat", "language": "English", "url": "http://www.archive.org/details/a626827800smituoft/", "title": "Newman's relation to modernism", "publisher": "s.n.", "place": "London", "date": "1912", "accessDate": "CURRENT_TIMESTAMP" } ] }, { "type": "web", "url": "http://www.worldcat.org/title/cahokia-mounds-replicas/oclc/48394842&referer=brief_results", "items": [ { "itemType": "book", "creators": [ { "lastName": "Grimont", "firstName": "Martha LeeAnn", "creatorType": "author" }, { "lastName": "Mink", "firstName": "Claudia Gellman", "creatorType": "author" }, { "lastName": "Cahokia Mounds Museum Society", "creatorType": "author", "fieldMode": 1 } ], "notes": [], "tags": [], "seeAlso": [], "attachments": [], "libraryCatalog": "Open WorldCat", "language": "English", "place": "Collinsville, Ill.", "ISBN": "1881563022 9781881563020", "title": "[Cahokia Mounds replicas]", "publisher": "Cahokia Mounds Museum Society]", "date": "2000" } ] }, { "type": "search", "input": { "ISBN": "9780585030159" }, "items": [ { "itemType": "book", "creators": [ { "lastName": "Thelen", "firstName": "Esther", "creatorType": "author" }, { "lastName": "Smith", "firstName": "Linda B", "creatorType": "author" } ], "notes": [], "tags": [], "seeAlso": [], "attachments": [], "libraryCatalog": "Open WorldCat", "language": "English", "url": "http://search.ebscohost.com/login.aspx?direct=true&scope=site&db=nlebk&db=nlabk&AN=1712", "title": "A dynamic systems approach to the development of cognition and action", "publisher": "MIT Press", "place": "Cambridge, Mass.", "date": "1996", "ISBN": "0585030154 9780585030159", "accessDate": "CURRENT_TIMESTAMP" } ] } ] /** END TEST CASES **/