- merge WorldCat translators and fix search (for ISBNs, at least)
- make lookup button - podcast icon is now ipod_cast.png and radioBroadcast icon is now transmit.png, both from famfamfam
This commit is contained in:
parent
de67100f20
commit
34cd1103a0
15 changed files with 177 additions and 249 deletions
|
@ -8,18 +8,19 @@
|
|||
id="zotero-search-dialog"
|
||||
title="Search"
|
||||
orient="vertical"
|
||||
buttons="accept,cancel"
|
||||
ondialogaccept="return Zotero_Lookup.accept();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script src="include.js"/>
|
||||
<script src="lookup.js"/>
|
||||
|
||||
<description>&zotero.lookup.description;</description>
|
||||
<textbox id="lookup-textbox" flex="1"/>
|
||||
<description style="font-size: small">&zotero.lookup.description;</description>
|
||||
<textbox style="font-size: small" id="lookup-textbox" flex="1"/>
|
||||
<hbox id="dialog-button-box">
|
||||
<toolbarbutton class="zotero-small-progress-indicator" id="progress"/>
|
||||
<spacer flex="1"/>
|
||||
<button class="dialog-button" dlgtype="cancel"/>
|
||||
<button class="dialog-button" dlgtype="accept"/>
|
||||
<button class="dialog-button" style="font: menu" dlgtype="cancel"/>
|
||||
<button class="dialog-button" style="font: menu" dlgtype="accept"/>
|
||||
</hbox>
|
||||
</dialog>
|
||||
|
|
|
@ -181,7 +181,6 @@
|
|||
<!-- New Item drop-down built in overlay.js::onLoad() -->
|
||||
<menupopup>
|
||||
<menuseparator/>
|
||||
<menuitem label="&zotero.toolbar.lookup;" oncommand="window.openDialog('chrome://zotero/content/lookup.xul', 'lookup', 'chrome,modal')"/>
|
||||
<menuitem label="&zotero.toolbar.attachment.linked;" oncommand="ZoteroPane.addAttachmentFromDialog(true);" tooltiptext=""/>
|
||||
<menuitem label="&zotero.toolbar.attachment.add;" oncommand="ZoteroPane.addAttachmentFromDialog();" tooltiptext=""/>
|
||||
<menuseparator/>
|
||||
|
@ -191,6 +190,7 @@
|
|||
</menupopup>
|
||||
</toolbarbutton>
|
||||
<toolbarbutton id="zotero-tb-item-from-page" tooltiptext="&zotero.toolbar.newItemFromPage.label;" oncommand="ZoteroPane.addItemFromPage()"/>
|
||||
<toolbarbutton id="zotero-tb-lookup" tooltiptext="&zotero.toolbar.lookup.label;" oncommand="window.openDialog('chrome://zotero/content/lookup.xul', 'lookup', 'chrome,modal')"/>
|
||||
<toolbarseparator/>
|
||||
<toolbarbutton id="zotero-tb-link-page" tooltiptext="&zotero.toolbar.attachment.weblink;" oncommand="ZoteroPane.addAttachmentFromPage(true)"/>
|
||||
<toolbarbutton id="zotero-tb-snapshot-page" tooltiptext="&zotero.toolbar.attachment.snapshot;" oncommand="ZoteroPane.addAttachmentFromPage()"/>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
const Zotero_RecognizePDF_SUCCESS_IMAGE = "chrome://zotero/skin/tick.png";
|
||||
const Zotero_RecognizePDF_FAILURE_IMAGE = "chrome://zotero/skin/cross.png";
|
||||
const Zotero_RecognizePDF_LOADING_IMAGE = "chrome://zotero/skin/indicator.gif";
|
||||
const Zotero_RecognizePDF_LOADING_IMAGE = "chrome://global/skin/icons/loading_16.png";
|
||||
const DOIre = /\bdoi\: *([^\s]+)/i;
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
<!ENTITY zotero.toolbar.newItem.label "New Item">
|
||||
<!ENTITY zotero.toolbar.moreItemTypes.label "More">
|
||||
<!ENTITY zotero.toolbar.newItemFromPage.label "Create New Item from Current Page">
|
||||
<!ENTITY zotero.toolbar.lookup.label "Add Item by Identifier">
|
||||
<!ENTITY zotero.toolbar.removeItem.label "Remove Item...">
|
||||
<!ENTITY zotero.toolbar.newCollection.label "New Collection...">
|
||||
<!ENTITY zotero.toolbar.newSubcollection.label "New Subcollection...">
|
||||
|
@ -66,6 +67,7 @@
|
|||
<!ENTITY zotero.toolbar.actions.label "Actions">
|
||||
<!ENTITY zotero.toolbar.import.label "Import...">
|
||||
<!ENTITY zotero.toolbar.export.label "Export Library...">
|
||||
<!ENTITY zotero.toolbar.rtfScan.label "RTF Scan...">
|
||||
<!ENTITY zotero.toolbar.timeline.label "Create Timeline">
|
||||
<!ENTITY zotero.toolbar.duplicate.label "Show Duplicates">
|
||||
<!ENTITY zotero.toolbar.preferences.label "Preferences...">
|
||||
|
@ -100,7 +102,7 @@
|
|||
<!ENTITY zotero.tagSelector.renameTag "Rename Tag...">
|
||||
<!ENTITY zotero.tagSelector.deleteTag "Delete Tag...">
|
||||
|
||||
<!ENTITY zotero.lookup.description "Enter the DOI or PMID to look up in the box below.">
|
||||
<!ENTITY zotero.lookup.description "Enter the ISBN, DOI, or PMID to look up in the box below.">
|
||||
|
||||
<!ENTITY zotero.selectitems.title "Select Items">
|
||||
<!ENTITY zotero.selectitems.intro.label "Select which items you'd like to add to your library">
|
||||
|
@ -174,4 +176,12 @@
|
|||
<!ENTITY zotero.recognizePDF.cancel.label "Cancel">
|
||||
<!ENTITY zotero.recognizePDF.pdfName.label "PDF Name">
|
||||
<!ENTITY zotero.recognizePDF.itemName.label "Item Name">
|
||||
<!ENTITY zotero.recognizePDF.captcha.label "Type the text below to continue retrieving metadata.">
|
||||
<!ENTITY zotero.recognizePDF.captcha.label "Type the text below to continue retrieving metadata.">
|
||||
|
||||
<!ENTITY zotero.rtfScan.title "RTF Scan">
|
||||
<!ENTITY zotero.rtfScan.cancel.label "Cancel">
|
||||
<!ENTITY zotero.rtfScan.citation.label "Citation">
|
||||
<!ENTITY zotero.rtfScan.itemName.label "Item Name">
|
||||
<!ENTITY zotero.rtfScan.unmappedCitations.label "Unmapped Citations">
|
||||
<!ENTITY zotero.rtfScan.ambiguousCitations.label "Ambiguous Citations">
|
||||
<!ENTITY zotero.rtfScan.mappedCitations.label "Mapped Citations">
|
|
@ -532,5 +532,10 @@ recognizePDF.limit = Query limit reached. Try again later.
|
|||
recognizePDF.complete.label = Metadata Retrieval Complete.
|
||||
recognizePDF.close.label = Close
|
||||
|
||||
rtfScan.boxTitle = Select a file to scan
|
||||
rtfScan.scanning.label = Scanning RTF Document...
|
||||
rtfScan.saving.label = Formatting RTF Document...
|
||||
rtfScan.rtf = Rich Text Format (.rtf)
|
||||
|
||||
lookup.failure.title = Lookup Failed
|
||||
lookup.failure.description = Zotero could not find a record for the specified identifier. Please verify the identifier and try again.
|
||||
lookup.failure.description = Zotero could not find a record for the specified identifier. Please verify the identifier and try again.
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
|
@ -151,6 +151,11 @@ window[active="true"] #zotero-pane[fullscreenmode="true"][platform="mac"]
|
|||
list-style-image: url('chrome://zotero/skin/toolbar-item-add.png');
|
||||
}
|
||||
|
||||
#zotero-tb-lookup
|
||||
{
|
||||
list-style-image: url('chrome://zotero/skin/toolbar-lookup.png');
|
||||
}
|
||||
|
||||
#zotero-tb-item-from-page
|
||||
{
|
||||
list-style-image: url('chrome://zotero/skin/toolbar-item-from-page.png');
|
||||
|
@ -221,6 +226,20 @@ window[active="true"] #zotero-pane[fullscreenmode="true"][platform="mac"]
|
|||
list-style-image: url(chrome://zotero/skin/drive_network.png);
|
||||
}
|
||||
|
||||
#zotero-tb-sync {
|
||||
list-style-image: url(chrome://zotero/skin/arrow_rotate_static.png);
|
||||
margin-left: -2px;
|
||||
margin-right: -2px;
|
||||
}
|
||||
|
||||
#zotero-tb-sync[status=animate] {
|
||||
list-style-image: url(chrome://zotero/skin/arrow_rotate_animated.png);
|
||||
}
|
||||
|
||||
#zotero-tb-sync[status=error] {
|
||||
list-style-image: url(chrome://zotero/skin/arrow_rotate_error.png);
|
||||
}
|
||||
|
||||
#zotero-tb-sync #zotero-last-sync-time
|
||||
{
|
||||
color: gray;
|
||||
|
|
BIN
chrome/skin/default/zotero/toolbar-lookup.png
Executable file
BIN
chrome/skin/default/zotero/toolbar-lookup.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 746 B |
Binary file not shown.
Before Width: | Height: | Size: 749 B After Width: | Height: | Size: 711 B |
Binary file not shown.
Before Width: | Height: | Size: 498 B After Width: | Height: | Size: 749 B |
|
@ -225,15 +225,11 @@ zoteromergepane {
|
|||
|
||||
|
||||
.zotero-small-progress-indicator {
|
||||
list-style-image: url(chrome://zotero/skin/arrow_rotate_static.png);
|
||||
list-style-image: url(chrome://global/skin/icons/notloading_16.png);
|
||||
margin-left: -2px;
|
||||
margin-right: -2px;
|
||||
}
|
||||
|
||||
.zotero-small-progress-indicator[status=animate] {
|
||||
list-style-image: url(chrome://zotero/skin/arrow_rotate_animated.png);
|
||||
}
|
||||
|
||||
.zotero-small-progress-indicator[status=error] {
|
||||
list-style-image: url(chrome://zotero/skin/arrow_rotate_error.png);
|
||||
list-style-image: url(chrome://global/skin/icons/loading_16.png);
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
{
|
||||
"translatorID":"e07e9b8c-0e98-4915-bb5a-32a08cb2f365",
|
||||
"translatorType":12,
|
||||
"label":"Open WorldCat (Search)",
|
||||
"creator":"Simon Kornblith",
|
||||
"target":"http://partneraccess.oclc.org/",
|
||||
"minVersion":"1.0.0b3.r1",
|
||||
"maxVersion":"",
|
||||
"priority":100,
|
||||
"inRepository":true,
|
||||
"lastUpdated":"2007-03-22 18:15:00"
|
||||
}
|
||||
|
||||
function detectSearch(item) {
|
||||
if(item.itemType == "book" || item.itemType == "bookSection") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// creates an item from an Open WorldCat document
|
||||
function processOWC(doc) {
|
||||
var spanTags = doc.getElementsByTagName("span");
|
||||
for(var i=0; i<spanTags.length; i++) {
|
||||
var spanClass = spanTags[i].getAttribute("class");
|
||||
if(spanClass) {
|
||||
var spanClasses = spanClass.split(" ");
|
||||
if(Zotero.Utilities.inArray("Z3988", spanClasses)) {
|
||||
var spanTitle = spanTags[i].getAttribute("title");
|
||||
var item = new Zotero.Item();
|
||||
if(Zotero.Utilities.parseContextObject(spanTitle, item)) {
|
||||
if(item.title) {
|
||||
item.title = Zotero.Utilities.capitalizeTitle(item.title);
|
||||
} else {
|
||||
item.title = "[Untitled]";
|
||||
}
|
||||
|
||||
item.complete();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function doSearch(item) {
|
||||
if(item.contextObject) {
|
||||
var co = item.contextObject;
|
||||
} else {
|
||||
var co = Zotero.Utilities.createContextObject(item);
|
||||
}
|
||||
|
||||
Zotero.Utilities.loadDocument("http://partneraccess.oclc.org/wcpa/servlet/OpenUrl?"+co, function(doc) {
|
||||
// find new COinS in the Open WorldCat page
|
||||
if(processOWC(doc)) { // we got a single item page
|
||||
Zotero.done();
|
||||
} else { // assume we have a search results page
|
||||
var items = new Array();
|
||||
|
||||
var namespace = doc.documentElement.namespaceURI;
|
||||
var nsResolver = namespace ? function(prefix) {
|
||||
if (prefix == 'x') return namespace; else return null;
|
||||
} : null;
|
||||
|
||||
// first try to get only books
|
||||
var elmts = doc.evaluate('//table[@class="tableLayout"]/tbody/tr/td[@class="content"]/table[@class="tableResults"]/tbody/tr[td/img[@alt="Book"]]/td/div[@class="title"]/a', doc, nsResolver, Components.interfaces.nsIDOMXPathResult.ANY_TYPE,null);
|
||||
var elmt = elmts.iterateNext();
|
||||
if(!elmt) { // if that fails, look for other options
|
||||
var elmts = doc.evaluate('//table[@class="tableLayout"]/tbody/tr/td[@class="content"]/table[@class="tableResults"]/tbody/tr[td/img[@alt="Book"]]/td/div[@class="title"]/a', doc, nsResolver, Components.interfaces.nsIDOMXPathResult.ANY_TYPE,null);
|
||||
elmt = elmts.iterateNext()
|
||||
}
|
||||
|
||||
var urlsToProcess = new Array();
|
||||
do {
|
||||
urlsToProcess.push(elmt.href);
|
||||
} while(elmt = elmts.iterateNext());
|
||||
|
||||
Zotero.Utilities.processDocuments(urlsToProcess, function(doc) {
|
||||
// per URL
|
||||
processOWC(doc);
|
||||
}, function() { // done
|
||||
Zotero.done();
|
||||
});
|
||||
}
|
||||
}, null);
|
||||
|
||||
Zotero.wait();
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
{
|
||||
"translatorID":"c73a4a8c-3ef1-4ec8-8229-7531ee384cc4",
|
||||
"translatorType":4,
|
||||
"label":"Open WorldCat (Web)",
|
||||
"creator":"Sean Takats",
|
||||
"target":"^http://(?:www\\.)?worldcat\\.org/(?:search\\?|profiles/[^/]+/lists/)",
|
||||
"minVersion":"1.0.0b3.r1",
|
||||
"maxVersion":"",
|
||||
"priority":100,
|
||||
"inRepository":true,
|
||||
"lastUpdated":"2007-11-05 18:00:00"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url){
|
||||
var nsResolver = doc.createNSResolver(doc.documentElement);
|
||||
|
||||
var xpath = '//table[@class="tableResults" or @class="table-results"]/tbody/tr/td[3][@class="result"]/div[@class="name"]/a/strong';
|
||||
var results = doc.evaluate(xpath, doc,
|
||||
nsResolver, XPathResult.ANY_TYPE, null);
|
||||
if(results.iterateNext()) {
|
||||
return "multiple";
|
||||
}
|
||||
}
|
||||
|
||||
function processOWC(doc) {
|
||||
var spanTags = doc.getElementsByTagName("span");
|
||||
for(var i=0; i<spanTags.length; i++) {
|
||||
var spanClass = spanTags[i].getAttribute("class");
|
||||
if(spanClass) {
|
||||
var spanClasses = spanClass.split(" ");
|
||||
if(Zotero.Utilities.inArray("Z3988", spanClasses)) {
|
||||
var spanTitle = spanTags[i].getAttribute("title");
|
||||
var item = new Zotero.Item();
|
||||
if(Zotero.Utilities.parseContextObject(spanTitle, item)) {
|
||||
if(item.title) {
|
||||
item.title = Zotero.Utilities.capitalizeTitle(item.title);
|
||||
} else {
|
||||
item.title = "[Untitled]";
|
||||
}
|
||||
|
||||
item.complete();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function doWeb(doc, url){
|
||||
var nsResolver = doc.createNSResolver(doc.documentElement);
|
||||
|
||||
var urls = new Array();
|
||||
var items = new Array();
|
||||
var xpath = '//table[@class="tableResults" or @class="table-results"]/tbody/tr/td[3][@class="result"]/div[@class="name"]/a';
|
||||
var titles = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
var title;
|
||||
// Go through titles
|
||||
while(title = titles.iterateNext()) {
|
||||
items[title.href] = title.textContent;
|
||||
}
|
||||
|
||||
items = Zotero.selectItems(items);
|
||||
|
||||
if(!items) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for(var i in items) {
|
||||
urls.push(i);
|
||||
}
|
||||
|
||||
Zotero.Utilities.processDocuments(urls, function(doc) {
|
||||
processOWC(doc);}, function() {Zotero.done();});
|
||||
Zotero.wait();
|
||||
}
|
131
translators/Open WorldCat.js
Normal file
131
translators/Open WorldCat.js
Normal file
|
@ -0,0 +1,131 @@
|
|||
{
|
||||
"translatorID":"c73a4a8c-3ef1-4ec8-8229-7531ee384cc4",
|
||||
"translatorType":12,
|
||||
"label":"Open WorldCat",
|
||||
"creator":"Simon Kornblith",
|
||||
"target":"^http://www\.worldcat\.org/",
|
||||
"minVersion":"1.0.0b3.r1",
|
||||
"maxVersion":"",
|
||||
"priority":100,
|
||||
"inRepository":true,
|
||||
"lastUpdated":"2009-04-15 07:12:45"
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, node) {
|
||||
var item = new Zotero.Item();
|
||||
Zotero.Utilities.parseContextObject(node.nodeValue, item);
|
||||
|
||||
// if only one, first check for special types (audio & video recording)
|
||||
var type = false;
|
||||
try {
|
||||
type = doc.evaluate('//img[@class="icn"][contains(@src, "icon-")]/@src', doc, null, XPathResult.ANY_TYPE, null).iterateNext().nodeValue;
|
||||
} catch(e) {}
|
||||
|
||||
if(type) {
|
||||
type = getZoteroType(type);
|
||||
if(type) item.itemType = type;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
function detectWeb(doc) {
|
||||
var xpath = doc.evaluate('//span[@class="Z3988"]/@title', doc, null, XPathResult.ANY_TYPE, null);
|
||||
var node = xpath.iterateNext();
|
||||
if(!node) return false;
|
||||
|
||||
// see if there is more than one
|
||||
if(xpath.iterateNext()) {
|
||||
multiple = true;
|
||||
return "multiple";
|
||||
}
|
||||
|
||||
// generate item and return type
|
||||
return generateItem(doc, node).itemType;
|
||||
}
|
||||
|
||||
function detectSearch(item) {
|
||||
return !!item.ISBN;
|
||||
}
|
||||
|
||||
function doWeb(doc) {
|
||||
// otherwise, we need to get context objects and display select items dialog
|
||||
var elems = [];
|
||||
|
||||
// accumulate OpenURL contextObject nodes
|
||||
var xpath = doc.evaluate('//span[@class="Z3988"]/@title', doc, null, XPathResult.ANY_TYPE, null);
|
||||
while(elem = xpath.iterateNext()) {
|
||||
elems.push(elem);
|
||||
}
|
||||
|
||||
if(elems.length > 1) { // multiple items
|
||||
var items = [];
|
||||
var titles = [];
|
||||
for(var i in elems) {
|
||||
var item = new Zotero.Item();
|
||||
Zotero.Utilities.parseContextObject(elems[i].nodeValue, item);
|
||||
items.push(item);
|
||||
titles.push(item.title);
|
||||
}
|
||||
|
||||
titles = Zotero.selectItems(titles);
|
||||
if(!titles) return true;
|
||||
|
||||
// accumulate appropriate types
|
||||
var i = 0;
|
||||
try {
|
||||
var xpath = doc.evaluate('//div/img[@class="icn"][contains(@src, "icon-")][1]/@src', doc, null, XPathResult.ANY_TYPE, null);
|
||||
while(elem = xpath.iterateNext()) {
|
||||
var type = getZoteroType(elem.nodeValue);
|
||||
if(type) items[i].itemType = type;
|
||||
i++;
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
// complete items
|
||||
for(var i in titles) {
|
||||
items[i].complete();
|
||||
}
|
||||
} else { // single item
|
||||
generateItem(doc, elems[0]).complete();
|
||||
}
|
||||
}
|
||||
|
||||
function doSearch(item) {
|
||||
if(item.contextObject) {
|
||||
var co = item.contextObject;
|
||||
} else {
|
||||
var co = Zotero.Utilities.createContextObject(item);
|
||||
}
|
||||
|
||||
Zotero.Utilities.loadDocument("http://www.worldcat.org/search?q=isbn%3A"+item.ISBN+"&=Search&qt=results_page", function(doc) {
|
||||
var node = doc.evaluate('//span[@class="Z3988"]/@title', doc, null, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
if(!node) Zotero.done(false);
|
||||
|
||||
var item = generateItem(doc, node);
|
||||
item.complete();
|
||||
|
||||
Zotero.done();
|
||||
}, null);
|
||||
|
||||
Zotero.wait();
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
{
|
||||
"translatorID":"490909d7-7d79-4c7a-a136-77df618d4db2",
|
||||
"translatorType":4,
|
||||
"label":"Worldcat.org",
|
||||
"creator":"Michael Berkowitz",
|
||||
"target":"http://(www.)?worldcat.org/",
|
||||
"minVersion":"1.0.0b4.r5",
|
||||
"maxVersion":"",
|
||||
"priority":100,
|
||||
"inRepository":true,
|
||||
"lastUpdated":"2009-03-06 20:38:37"
|
||||
}
|
||||
|
||||
function detectWeb(doc, url) {
|
||||
if (url.match(/search?/) && doc.evaluate('//input[@id="itemid"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) {
|
||||
return "multiple";
|
||||
} else {
|
||||
var type = doc.evaluate('//tbody/tr/td[2][img]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent.toLowerCase().match(/(\w+);/)[1];
|
||||
switch (type) {
|
||||
case "book": return "book";
|
||||
case "article": return "journalArticle";
|
||||
case "recording":
|
||||
case "disc": return "audioRecording";
|
||||
case "tape": return "videoRecording";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ENify(str) {
|
||||
return str.match(/^[^&]+/)[0] + '?page=endnote&client=worldcat.org-detailed_record';
|
||||
}
|
||||
function doWeb(doc, url) {
|
||||
var n = doc.documentElement.namespaceURI;
|
||||
var ns = n ? function(prefix) {
|
||||
if (prefix == 'x') return n; else return null;
|
||||
} : null;
|
||||
|
||||
var books = new Array();
|
||||
if (detectWeb(doc, url) == "multiple") {
|
||||
var items = new Object();
|
||||
var titles = doc.evaluate('//div[@class="name"]/a', doc, ns, XPathResult.ANY_TYPE, null);
|
||||
var title;
|
||||
while (title = titles.iterateNext()) {
|
||||
items[title.href] = Zotero.Utilities.trimInternal(title.textContent);
|
||||
}
|
||||
items = Zotero.selectItems(items);
|
||||
for (var i in items) {
|
||||
books.push(ENify(i));
|
||||
}
|
||||
} else {
|
||||
var link = doc.evaluate('//a[contains(text(), "EndNote")]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().href;
|
||||
books = [link];
|
||||
}
|
||||
|
||||
Zotero.Utilities.HTTP.doGet(books, function(text) {
|
||||
text = text.replace("MUSIC", "PAMP");
|
||||
var translator = Zotero.loadTranslator("import");
|
||||
translator.setTranslator("32d59d2d-b65a-4da4-b0a3-bdd3cfb979e7");
|
||||
translator.setString(text);
|
||||
translator.translate();
|
||||
}, function () { Zotero.done(); });
|
||||
Zotero.wait();
|
||||
}
|
Loading…
Add table
Reference in a new issue