{ "translatorID":"af1af8fa-19dc-486f-a8cc-107acb849101", "label":"WilsonWeb", "creator":"Brinda Shah", "target":"^http://(vnweb|webbeta|verityqa|verityqa2|atg-dev05)\\.hwwilsonweb\\.com/hww/results/", "minVersion":"1.0", "maxVersion":"", "priority":100, "inRepository":"1", "translatorType":4, "lastUpdated":"2011-01-05 17:05:00" } var dispType='brief'; var titleObj= new Object(); var resultType = ''; var articles = new Array(); var pgSize; function detectWeb(doc, url) { var tClassObj; var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == "x" ) return namespace; else return null; } : null; if(doc.title.match("Search Results")) { var dispElePath = "//input[@name='displayType']"; var dispEle = doc.evaluate(dispElePath , doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(dispEle) { dispType=dispEle.value; } var cxpath = getXPath(dispType, 'cxpath'); tClassObj = doc.evaluate(cxpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if (!tClassObj) { cxpath = getXPath(dispType, 'cxpath1'); tClassObj = doc.evaluate(cxpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); } var tClass = tClassObj.textContent; if(tClass.match("BIBL")) resultType = "journalArticle"; else if(tClass.match("BOOK")) resultType = "book"; else if(tClass.match("ART")) resultType = "artwork"; var xpath = '//input[@name="pageSize"]'; var eleObj = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null); var ele; if(ele = eleObj.iterateNext()) { if(ele) { pgSize= ele.value; if(pgSize > 1) { //if(resultType == 'journalArticle') return "multiple"; } else return resultType; } } } } function doWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; if (detectWeb(doc, url) == "multiple") { var nextTitle; var c = 0; var titles = doc.evaluate(getXPath(dispType,'ti'), doc, nsResolver, XPathResult.ANY_TYPE, null); while (nextTitle= titles.iterateNext()) { c++; titleObj[c] = nextTitle.textContent; } titleObj = Zotero.selectItems(titleObj); for (var t in titleObj ) { articles.push(t); var newArticle = new Zotero.Item(resultType); newArticle.url = doc.location.href; newArticle.title = titleObj[t]; switch(resultType) { case 'journalArticle' : associateBIBLData(doc,newArticle,t); break; case 'book': associateBookData(doc, newArticle, t); break; case 'artwork' : associateArtData(doc, newArticle,t); break; } newArticle.complete(); } } else { //saves single page items articles = [url]; } Zotero.Utilities.processDocuments(articles, scrape, function(){Zotero.done();}); Zotero.wait(); } function associateBIBLData(doc,newArticle,t) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var host = doc.location.host; //author var authorPath = getXPath(dispType,'au',t); var authorObj = doc.evaluate(authorPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(authorObj) { associateAuthorData(newArticle, authorObj); } //journal var journalPath = getXPath(dispType, 'jn', t); var journalObj = doc.evaluate(journalPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(journalObj ) { associateFieldData(newArticle, journalObj, 'journalAbbreviation'); } //source var sourcePath = getXPath(dispType,'so',t); if(sourcePath != '') { var sourceObj = doc.evaluate(sourcePath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(sourceObj) associateSourceData(newArticle, sourceObj); } //subject var tagsContent = new Array(); var suPath = getXPath(dispType, 'su', t); if(suPath != '') { var suObj = doc.evaluate(suPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(suObj) { var subjects = suObj.textContent.split(';'); for (var i in subjects) { //Zotero.debug(subjects[i]); tagsContent.push(subjects[i]); } for (var i = 0; i < tagsContent.length; i++) { newArticle.tags[i] = tagsContent[i]; } } } //issn var issnPath = getXPath(dispType, 'issn', t); if(issnPath != '') { var issnObj = doc.evaluate(issnPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(issnObj) { associateFieldData(newArticle, issnObj, 'ISSN'); } } //la var laPath = getXPath(dispType, 'la', t); if(laPath != '') { var laObj = doc.evaluate(laPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(laObj) { associateFieldData(newArticle, laObj, 'language'); } } //abstract var absPath = getXPath(dispType, 'abs', t); if(absPath != '') { var absObj = doc.evaluate(absPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(absObj) { associateFieldData(newArticle, absObj, 'abstractNote'); } } //doi var doiPath = getXPath(dispType, 'doi', t); if(doiPath != '') { var doiObj = doc.evaluate(doiPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(doiObj) { associateFieldData(newArticle, doiObj, 'DOI'); } } //inst var instPath = getXPath(dispType, 'inst', t); if(instPath != '') { var instObj = doc.evaluate(instPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(instObj ) { associateFieldData(newArticle, instObj , 'institution'); } } //publisher var pbPath = getXPath(dispType, 'pb', t); if(pbPath != '') { var pbObj = doc.evaluate(pbPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(pbObj) { associateFieldData(newArticle, pbObj, 'publisher'); } } //note var ntPath = getXPath(dispType, 'nt', t); Zotero.debug("ntPath : " + ntPath); if(ntPath != '') { var ntObj = doc.evaluate(ntPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(ntObj) { associateFieldData(newArticle, ntObj, 'notes'); } } //date entered var dtPath = getXPath(dispType, 'der', t); if(dtPath != '') { var dtObj = doc.evaluate(dtPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(dtObj) { associateFieldData(newArticle, dtObj, 'dateAdded'); } } //date updated var udtPath = getXPath(dispType, 'ud', t); if(dtPath != '') { var udtObj = doc.evaluate(udtPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(udtObj) { associateFieldData(newArticle, udtObj, 'dateModified'); } } var pdfURL=''; var pdfLink = getXPath(dispType,'pdfLink',t); if(pdfLink != '') { var pdfObj = doc.evaluate(pdfLink, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(pdfObj ) { var pdf = pdfObj.textContent; pdfURL =pdf.match(/https?:[/]+([-\w\.]+)+(:\d+)?([/]([\w/_\.]*(\?\S+)?)?)?/); //Zotero.debug("pdfURL :" + pdfURL[0]); } } var snapShotURL=''; var recid = getXPath(dispType,'recid',t); if(recid != '') { var recObj= doc.evaluate(recid, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(recObj) { var rec = recObj.value; snapShotURL = 'http://' + host + '/hww/jumpstart.jhtml?recid=' + rec + '&fmt=S&DT=full'; //Zotero.debug("snapShotURL :" + snapShotURL ); } } if(pdfURL != null || snapShotURL != null) { newArticle.attachments = [ {url:snapShotURL, title:"WilsonWeb Snapshot", mimeType:"text/html"}, {url:pdfURL[0], title:"WilsonWeb Full Text PDF", mimeType:"application/pdf"} ]; } } function associateBookData( doc, newArticle, t) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var host = doc.location.host; //author var authorPath = getXPath(dispType,'au',t); var authorObj = doc.evaluate(authorPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(authorObj) { associateAuthorData(newArticle, authorObj); } //publisher var pbPath = getXPath(dispType, 'pb', t); if(pbPath != '') { var pbObj = doc.evaluate(pbPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(pbObj) { associateFieldData(newArticle, pbObj, 'publisher'); } } //pages var pgPath = getXPath(dispType, 'pa', t); if(pgPath != '') { var pgObj = doc.evaluate(pgPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(pgObj) { associateFieldData(newArticle, pgObj, 'numPages'); } } //la var laPath = getXPath(dispType, 'la', t); if(laPath != '') { var laObj = doc.evaluate(laPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(laObj) { associateFieldData(newArticle, laObj, 'language'); } } //isbn var isbnPath = getXPath(dispType, 'isbn', t); if(isbnPath != '') { var isbnObj = doc.evaluate(isbnPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(isbnObj) { associateFieldData(newArticle, isbnObj, 'ISBN'); } } //abstract var absPath = getXPath(dispType, 'abs', t); if(absPath != '') { var absObj = doc.evaluate(absPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(absObj) { associateFieldData(newArticle, absObj, 'abstractNote'); } } //subject var tagsContent = new Array(); var suPath = getXPath(dispType, 'su', t); if(suPath != '') { var suObj = doc.evaluate(suPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(suObj) { var subjects = suObj.textContent.split(';'); for (var i in subjects) { Zotero.debug(subjects[i]); tagsContent.push(subjects[i]); } for (var i = 0; i < tagsContent.length; i++) { newArticle.tags[i] = tagsContent[i]; } } } //note /*var noteContent = new Array(); var ntPath = getXPath(dispType, 'nt', t); Zotero.debug("ntPath : " + ntPath); if(ntPath != '') { var ntObj = doc.evaluate(ntPath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(ntObj) { var notes = ntObj.textContent.split(';'); for(var i in notes) { noteContent.push(notes[i]); } for (var i=0; i