{ "translatorID":"05d07af9-105a-4572-99f6-a8e231c0daef", "translatorType":4, "label":"COinS", "creator":"Simon Kornblith", "target":null, "minVersion":"1.0.0b3.r1", "maxVersion":"", "priority":300, "inRepository":true, "lastUpdated":"2007-09-15 20:08:46" } function detectWeb(doc, url) { var spanTags = doc.getElementsByTagName("span"); var encounteredType = false; for(var i=0; i 1) { var selectArray = new Array(); for(var i in newItems) { selectArray[i] = newItems[i].title; } selectArray = Zotero.selectItems(selectArray); var useIndices = new Array(); for(var i in selectArray) { useIndices.push(i); } completeItems(newItems, useIndices, couldUseFullItems); } else if(newItems.length) { completeItems(newItems, [0], couldUseFullItems); } } function completeItems(newItems, useIndices, couldUseFullItems, doc) { if(!useIndices.length) { return; } var i = useIndices.shift(); // grab full item if the COinS was missing an author if(couldUseFullItems[i]) { Zotero.debug("looking up contextObject"); var search = Zotero.loadTranslator("search"); var firstItem = false; search.setHandler("itemDone", function(obj, newItem) { if(!firstItem) { // add doc as attachment newItem.attachments.push({document:doc}); newItem.complete(); firstItem = true; } }); search.setHandler("done", function(obj) { // if we didn't find anything, use what we had before (even if it // lacks the creator) if(!firstItem) { newItems[i].complete(); } // call next completeItems(newItems, useIndices, couldUseFullItems); }); search.setSearch(newItems[i]); var translators = search.getTranslators(); if(translators.length) { search.setTranslator(translators); search.translate(); } else { // add doc as attachment newItems[i].attachments.push({document:doc}); newItems[i].complete(); // call next completeItems(newItems, useIndices, couldUseFullItems); } } else { // add doc as attachment newItems[i].attachments.push({document:doc}); newItems[i].complete(); // call next completeItems(newItems, useIndices, couldUseFullItems); } } function doWeb(doc, url) { var newItems = new Array(); var needFullItems = new Array(); var couldUseFullItems = new Array(); var spanTags = doc.getElementsByTagName("span"); for(var i=0; i