diff --git a/translators/ABC-CLIO Serials Web.js b/translators/ABC-CLIO Serials Web.js index b440e74b9..0381b8b0d 100644 --- a/translators/ABC-CLIO Serials Web.js +++ b/translators/ABC-CLIO Serials Web.js @@ -43,7 +43,7 @@ function doWeb(doc, url) { elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(title, checkbox) { checkbox = checkbox.name; - availableItems[checkbox] = Zotero.Utilities.cleanString(title.textContent).substr(6); + availableItems[checkbox] = Zotero.Utilities.trimInternal(title.textContent).substr(6); var links = doc.evaluate('./tbody/tr/td[b/text() = "Fulltext: ["]/a', elmt, nsResolver, XPathResult.ANY_TYPE, null); @@ -51,7 +51,7 @@ function doWeb(doc, url) { var attach = new Array(); while(link = links.iterateNext()) { - attach.push({url:link.href, title:Zotero.Utilities.cleanString(link.textContent)+" Full Text", + attach.push({url:link.href, title:Zotero.Utilities.trimInternal(link.textContent)+" Full Text", mimeType:"text/html"}); } availableAttachments[checkbox] = attach; diff --git a/translators/AGU Journals.js b/translators/AGU Journals.js index e92cd9bd0..06a5fcffe 100644 --- a/translators/AGU Journals.js +++ b/translators/AGU Journals.js @@ -45,7 +45,7 @@ function fixCaps(s) { if(s!='') { - words=Zotero.Utilities.cleanString(s).toLowerCase().split(" "); + words=Zotero.Utilities.trimInternal(s).toLowerCase().split(" "); for (var j = 0 ; j < words.length ; j++) { if (j==0||(words[j][0] ==words[j][0].toLowerCase()&&words[j]!="or"&&words[j]!="and"&&words[j]!="of"&&words[j]!="in")) @@ -80,7 +80,7 @@ function scrape(doc,url) temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { - temp=Zotero.Utilities.cleanString(temp.textContent).split(" ");; + temp=Zotero.Utilities.trimInternal(temp.textContent).split(" ");; newItem.date=temp[1]+" "+temp[0]+", "+temp[2]; } @@ -98,14 +98,14 @@ function scrape(doc,url) { for(var n=0;n<(3+2*count);n++) {temp2=temp.iterateNext();} - newItem.abstractNote=Zotero.Utilities.cleanString(temp2.textContent); + newItem.abstractNote=Zotero.Utilities.trimInternal(temp2.textContent); } xpath='//p[@id="runhead"]'; temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { - temp=Zotero.Utilities.cleanString(temp.textContent).split(", "); + temp=Zotero.Utilities.trimInternal(temp.textContent).split(", "); newItem.publicationTitle=fixCaps(temp[0]); for(var n=1;temp[n];n++) { @@ -124,7 +124,7 @@ function scrape(doc,url) temp=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE,null).iterateNext(); if(temp) { - temp=Zotero.Utilities.cleanString(temp.textContent.replace('Keywords:','')); + temp=Zotero.Utilities.trimInternal(temp.textContent.replace('Keywords:','')); newItem.tags=temp.replace('.','').split('; '); } xpath='//p[@id="citation"]/span[@id="journal"]'; @@ -225,7 +225,7 @@ function doWeb(doc,url) while(citerow=citerows.iterateNext()) { linkrow=linkrows.iterateNext(); - items[linkrow.href]=Zotero.Utilities.cleanString(citerow.textContent); + items[linkrow.href]=Zotero.Utilities.trimInternal(citerow.textContent); } return processList(items); } diff --git a/translators/ARTFL Encyclopedie.js b/translators/ARTFL Encyclopedie.js index 5a2cb87e2..454267758 100644 --- a/translators/ARTFL Encyclopedie.js +++ b/translators/ARTFL Encyclopedie.js @@ -113,13 +113,13 @@ function scrape (doc){ var tagstring = m[1].replace("&", "&", "g"); var tags = tagstring.split(";") for(var j in tags) { - newItem.tags.push(Zotero.Utilities.cleanString(tags[j])); + newItem.tags.push(Zotero.Utilities.trimInternal(tags[j])); } } var authorRe = new RegExp('>'+title+',([^,]*),', "i"); var m = authorRe.exec(text); var author = m[1]; - author = Zotero.Utilities.cleanString(author); + author = Zotero.Utilities.trimInternal(author); // reconcile author author = reconcileAuthor(author); if (author!="NA"){ // ignore unknown authors diff --git a/translators/AlterNet.js b/translators/AlterNet.js index 3c7bb19aa..2b7a8641d 100644 --- a/translators/AlterNet.js +++ b/translators/AlterNet.js @@ -19,14 +19,14 @@ function detectWeb(doc, url) { if (index != -1) { // ordinary aritcle var id = url.toString().substr(index + 1, 5); - Zotero.Utilities.cleanString(id); + Zotero.Utilities.trimInternal(id); if (Number(id)) { return "magazineArticle"; } //columnist or blog article index += url.toString().substr(index + 1).indexOf('/'); id = url.toString().substr(index + 2, 5); - Zotero.Utilities.cleanString(id); + Zotero.Utilities.trimInternal(id); if (Number(id) && url.toString().search('blog') == -1) { return "magazineArticle"; } @@ -44,14 +44,14 @@ function scrape(doc, url, title) { if (index != -1) { // ordinary aritcle var id = url.toString().substr(index + 1, 5); - Zotero.Utilities.cleanString(id); + Zotero.Utilities.trimInternal(id); if (Number(id)) { var newItem = new Zotero.Item("magazineArticle"); } //columnist or blog article index += url.toString().substr(index + 1).indexOf('/'); id = url.toString().substr(index + 2, 5); - Zotero.Utilities.cleanString(id); + Zotero.Utilities.trimInternal(id); if (Number(id) && url.toString().search('blog') == -1) { var newItem = new Zotero.Item("magazineArticle"); } @@ -154,7 +154,7 @@ function scrape(doc, url, title) { else { index += url.toString().substr(index + 1).indexOf('/'); id = url.toString().substr(index + 2, 5); - Zotero.Utilities.cleanString(id); + Zotero.Utilities.trimInternal(id); if (Number(id)) { printurl = "http://www.alternet.org/module/printversion/" + id; if (newItem.itemType == "blogPost") { diff --git a/translators/Amazon.com.js b/translators/Amazon.com.js index 6e37f2182..dd341a334 100644 --- a/translators/Amazon.com.js +++ b/translators/Amazon.com.js @@ -136,17 +136,17 @@ function doWeb(doc, url) { if (!xml..Errors.length()) { if (xml..Publisher.length()){ - publisher = Zotero.Utilities.cleanString(xml..Publisher[0].text().toString()); + publisher = Zotero.Utilities.trimInternal(xml..Publisher[0].text().toString()); } var binding = ""; if (xml..Binding.length()){ - binding = Zotero.Utilities.cleanString(xml..Binding[0].text().toString()); + binding = Zotero.Utilities.trimInternal(xml..Binding[0].text().toString()); } var productGroup = ""; if (xml..ProductGroup.length()){ - productGroup = Zotero.Utilities.cleanString(xml..ProductGroup[0].text().toString()); + productGroup = Zotero.Utilities.trimInternal(xml..ProductGroup[0].text().toString()); } if (productGroup=="Book") { @@ -178,7 +178,7 @@ function doWeb(doc, url) { } if(xml..RunningTime.length()){ - newItem.runningTime = Zotero.Utilities.cleanString(xml..RunningTime[0].text().toString()); + newItem.runningTime = Zotero.Utilities.trimInternal(xml..RunningTime[0].text().toString()); } // Retrieve authors and other creators @@ -192,31 +192,31 @@ function doWeb(doc, url) { } if (xml..PublicationDate.length()){ - newItem.date = Zotero.Utilities.cleanString(xml..PublicationDate[0].text().toString()); + newItem.date = Zotero.Utilities.trimInternal(xml..PublicationDate[0].text().toString()); } else if (xml..ReleaseDate.length()){ - newItem.date = Zotero.Utilities.cleanString(xml..ReleaseDate[0].text().toString()); + newItem.date = Zotero.Utilities.trimInternal(xml..ReleaseDate[0].text().toString()); } if (xml..Edition.length()){ - newItem.edition = Zotero.Utilities.cleanString(xml..Edition[0].text().toString()); + newItem.edition = Zotero.Utilities.trimInternal(xml..Edition[0].text().toString()); } if (xml..ISBN.length()){ - newItem.ISBN = Zotero.Utilities.cleanString(xml..ISBN[0].text().toString()); + newItem.ISBN = Zotero.Utilities.trimInternal(xml..ISBN[0].text().toString()); } // Uncomment when numPages field is added to schema // if (xml..NumberOfPages.length()){ -// newItem.numPages = Zotero.Utilities.cleanString(xml..NumberOfPages[0].text().toString()); +// newItem.numPages = Zotero.Utilities.trimInternal(xml..NumberOfPages[0].text().toString()); // } - var title = Zotero.Utilities.cleanString(xml..Title[0].text().toString()); + var title = Zotero.Utilities.trimInternal(xml..Title[0].text().toString()); if(title.lastIndexOf("(") != -1 && title.lastIndexOf(")") == title.length-1) { title = title.substring(0, title.lastIndexOf("(")-1); } if (xml..ASIN.length()){ - var url = "http://www.amazon." + suffix + "/dp/" + Zotero.Utilities.cleanString(xml..ASIN[0].text().toString()); + var url = "http://www.amazon." + suffix + "/dp/" + Zotero.Utilities.trimInternal(xml..ASIN[0].text().toString()); newItem.attachments.push({title:"Amazon.com Link", snapshot:false, mimeType:"text/html", url:url}); } if (xml..OriginalReleaseDate.length()){ - newItem.extra = Zotero.Utilities.cleanString(xml..OriginalReleaseDate[0].text().toString()); + newItem.extra = Zotero.Utilities.trimInternal(xml..OriginalReleaseDate[0].text().toString()); } newItem.title = title; diff --git a/translators/Ancestry.com US Federal Census.js b/translators/Ancestry.com US Federal Census.js index e9eaa320d..959167945 100644 --- a/translators/Ancestry.com US Federal Census.js +++ b/translators/Ancestry.com US Federal Census.js @@ -217,7 +217,7 @@ function doWeb(doc, url) { } link = "http://search.ancestry.com/cgi-bin/sse.dll?indiv=1&db="+db+"&fh=0&h="+recid; name = doc.evaluate('.//span[@class="srchHit"]', listElt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; - items[link] = Zotero.Utilities.cleanString(name); + items[link] = Zotero.Utilities.trimInternal(name); } items = Zotero.selectItems(items); diff --git a/translators/Australian Dictionary of Biography.js b/translators/Australian Dictionary of Biography.js index 28a8f9bbc..c65f6d769 100644 --- a/translators/Australian Dictionary of Biography.js +++ b/translators/Australian Dictionary of Biography.js @@ -52,10 +52,10 @@ function doWeb(doc, url) { } Zotero.Utilities.processDocuments(records, function(doc) { var item = new Zotero.Item("bookSection"); - var author = Zotero.Utilities.cleanString(doc.evaluate('//div[@id="content"]/p[strong="Author"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().lastChild.textContent); + var author = Zotero.Utilities.trimInternal(doc.evaluate('//div[@id="content"]/p[strong="Author"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().lastChild.textContent); item.creators.push(Zotero.Utilities.cleanAuthor(author, "author")); - item.title = Zotero.Utilities.cleanString(doc.evaluate('//h1', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); - var pubdetails = Zotero.Utilities.cleanString(doc.evaluate('//div[@id="content"]/p[strong="Print Publication Details"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); + item.title = Zotero.Utilities.trimInternal(doc.evaluate('//h1', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); + var pubdetails = Zotero.Utilities.trimInternal(doc.evaluate('//div[@id="content"]/p[strong="Print Publication Details"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); pubdetails = pubdetails.match(/Volume (\d+), ([\w ]+), (\d{4}), p+\.*\s+([\d-]+)/); item.volume = RegExp.$1; item.publisher = RegExp.$2; diff --git a/translators/Berkeley Library Catalog.js b/translators/Berkeley Library Catalog.js index 4b32741ff..03d21b02a 100644 --- a/translators/Berkeley Library Catalog.js +++ b/translators/Berkeley Library Catalog.js @@ -69,7 +69,7 @@ function doWeb(doc, url) { record.leader = "00000"+value; } else { var ind = value[3]+value[5]; - if (value.match(/^\d{1,2}\s{3}/)) value = Zotero.Utilities.cleanString(value.replace(/^\d{1,2}\s{3}/, "")); + if (value.match(/^\d{1,2}\s{3}/)) value = Zotero.Utilities.trimInternal(value.replace(/^\d{1,2}\s{3}/, "")); value = value.replace(/\$([a-z0-9]) /g, marc.subfieldDelimiter+"$1"); if(value[0] != marc.subfieldDelimiter) { value = marc.subfieldDelimiter+"a"+value; diff --git a/translators/BibTeX.js b/translators/BibTeX.js index 96425d59f..ca9d709f3 100644 --- a/translators/BibTeX.js +++ b/translators/BibTeX.js @@ -1729,7 +1729,7 @@ function getFieldValue(read) { } function beginRecord(type, closeChar) { - type = Zotero.Utilities.cleanString(type.toLowerCase()); + type = Zotero.Utilities.trimInternal(type.toLowerCase()); if(type != "string") { var zoteroType = bibtex2zoteroTypeMap[type]; if (!zoteroType) { diff --git a/translators/Cambridge Scientific Abstracts.js b/translators/Cambridge Scientific Abstracts.js index 574096d24..d2014c5e9 100644 --- a/translators/Cambridge Scientific Abstracts.js +++ b/translators/Cambridge Scientific Abstracts.js @@ -36,7 +36,7 @@ function detectWeb(doc, url) { var type = doc.evaluate('//tr[td[1][@class="data_heading"]/text() = "Publication Type"]/td[3]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(type) { - type = Zotero.Utilities.cleanString(type.textContent); + type = Zotero.Utilities.trimInternal(type.textContent); if(type == "Book Chapter") { return "bookSection"; } else if(type.substr(0, 4) == "Book") { diff --git a/translators/DTIC.js b/translators/DTIC.js index 5a17b1979..226569485 100644 --- a/translators/DTIC.js +++ b/translators/DTIC.js @@ -77,26 +77,26 @@ function doWeb(doc, url) { } if (citation.dc_date.length()) { var dates = citation.dc_date; - newItem.date = Zotero.Utilities.cleanString(dates[0].text().toString()); + newItem.date = Zotero.Utilities.trimInternal(dates[0].text().toString()); } if (citation.dc_description.length()) { var descriptions = citation.dc_description; for (var j=0; j-1) { var phrases=info.split(", "); @@ -177,7 +177,7 @@ function doWeb(doc, url) var row; while(row=rows.iterateNext()) { - if(Zotero.Utilities.cleanString(row.textContent.toLowerCase())=="travel") + if(Zotero.Utilities.trimInternal(row.textContent.toLowerCase())=="travel") {scrape(doc,url); return true;} } @@ -214,7 +214,7 @@ function doWeb(doc, url) if(count==0) {break;} if(row.href.indexOf("/travel/")<0) - {items[row.href]=Zotero.Utilities.cleanString(row.textContent);} + {items[row.href]=Zotero.Utilities.trimInternal(row.textContent);} count--; } diff --git a/translators/Library Catalog (SIRSI).js b/translators/Library Catalog (SIRSI).js index d215b4827..605833dd8 100644 --- a/translators/Library Catalog (SIRSI).js +++ b/translators/Library Catalog (SIRSI).js @@ -279,7 +279,7 @@ function doWeb(doc, url){ // Collect title var title = doc.evaluate("./td[2]", elmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; if(checkbox && title) { - items[checkbox.name] = Zotero.Utilities.cleanString(title); + items[checkbox.name] = Zotero.Utilities.trimInternal(title); } } while(elmt = elmts.iterateNext()); items = Zotero.selectItems(items); diff --git a/translators/Library Catalog (VTLS).js b/translators/Library Catalog (VTLS).js index 32925e14e..e5f021818 100644 --- a/translators/Library Catalog (VTLS).js +++ b/translators/Library Catalog (VTLS).js @@ -70,7 +70,7 @@ function doWeb(doc, url) { var value = doc.evaluate('./td', field, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(value) { - items[url] = Zotero.Utilities.cleanString(value.textContent); + items[url] = Zotero.Utilities.trimInternal(value.textContent); } } } diff --git a/translators/Library Catalog (Voyager).js b/translators/Library Catalog (Voyager).js index d5265aee3..41f44e282 100644 --- a/translators/Library Catalog (Voyager).js +++ b/translators/Library Catalog (Voyager).js @@ -78,7 +78,7 @@ function doWeb(doc, url) { if(tagRegexp.test(links[j].href)) { var text = links[j].textContent; if(text) { - text = Zotero.Utilities.cleanString(text); + text = Zotero.Utilities.trimInternal(text); if(!rejectRegexp.test(text)) { if(availableItems[i]) { availableItems[i] += " "+text; @@ -91,7 +91,7 @@ function doWeb(doc, url) { } // if no title, pull from second td if(!availableItems[i]) { - availableItems[i] = Zotero.Utilities.cleanString(doc.evaluate('./td[2]', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent); + availableItems[i] = Zotero.Utilities.trimInternal(doc.evaluate('./td[2]', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent); } } diff --git a/translators/Max Planck Institute for the History of Science Virtual Laboratory Library.js b/translators/Max Planck Institute for the History of Science Virtual Laboratory Library.js index 44c1ac4ef..47f5392a3 100644 --- a/translators/Max Planck Institute for the History of Science Virtual Laboratory Library.js +++ b/translators/Max Planck Institute for the History of Science Virtual Laboratory Library.js @@ -46,7 +46,7 @@ function doWeb(doc, url){ var availableItems = new Array(); var i = 0; while (searchElmt = searchElmts.iterateNext()){ - availableItems[i] = Zotero.Utilities.cleanString(searchElmt.textContent); + availableItems[i] = Zotero.Utilities.trimInternal(searchElmt.textContent); var docID = doc.evaluate('./@title', searchElmt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue; links.push("http://vlp.mpiwg-berlin.mpg.de/library/meta?id=" + docID); i++; diff --git a/translators/Melvyl.js b/translators/Melvyl.js index f9b9512f7..778e143ff 100644 --- a/translators/Melvyl.js +++ b/translators/Melvyl.js @@ -56,7 +56,7 @@ function doWeb(doc, url) { do { elmt = doc.evaluate(xpath, reviewRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); titleElmt = doc.evaluate(titleXpath, reviewRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); - items[elmt.href] = Zotero.Utilities.cleanString(titleElmt.textContent); + items[elmt.href] = Zotero.Utilities.trimInternal(titleElmt.textContent); } while (reviewRow = reviewRows.iterateNext()); } else { @@ -67,7 +67,7 @@ function doWeb(doc, url) { var titleElmts = doc.evaluate(titleXpath, doc, nsResolver, XPathResult.ANY_TYPE, null); var titleElmt; while ((elmt = elmts.iterateNext()) && (titleElmt = titleElmts.iterateNext())){ - items[elmt.href] = Zotero.Utilities.cleanString(titleElmt.textContent); + items[elmt.href] = Zotero.Utilities.trimInternal(titleElmt.textContent); } } diff --git a/translators/NASA ADS.js b/translators/NASA ADS.js index 6c3f4fe11..7a774650a 100644 --- a/translators/NASA ADS.js +++ b/translators/NASA ADS.js @@ -62,7 +62,7 @@ function doWeb(doc, url) { do { titleElmt = titleElmts.iterateNext(); //iterate a second time to avoid score - items[bibElmt.value] = Zotero.Utilities.cleanString(titleElmt.textContent); + items[bibElmt.value] = Zotero.Utilities.trimInternal(titleElmt.textContent); } while((bibElmt = bibElmts.iterateNext()) && (titleElmt = titleElmts.iterateNext())); items = Zotero.selectItems(items); if(!items) return true; diff --git a/translators/NYTimes.com.js b/translators/NYTimes.com.js index a933cc683..858e5c2fc 100644 --- a/translators/NYTimes.com.js +++ b/translators/NYTimes.com.js @@ -88,7 +88,7 @@ function scrape(doc, url) { associateMeta(newItem, metaTags, "articleid", "accessionNumber"); if(metaTags["byl"]) { - var author = Zotero.Utilities.cleanString(metaTags["byl"]); + var author = Zotero.Utilities.trimInternal(metaTags["byl"]); if(author.substr(0, 3).toLowerCase() == "by ") { author = author.substr(3); } diff --git a/translators/Nature.js b/translators/Nature.js index f748f5a87..b15009bc1 100644 --- a/translators/Nature.js +++ b/translators/Nature.js @@ -56,7 +56,7 @@ function doWeb(doc, url) { doc, nsResolver, XPathResult.ANY_TYPE, null); var tableRow, fulltextLink; while((tableRow = tableRows.iterateNext()) && (fulltextLink = fulltextLinks.iterateNext())) { - items[fulltextLink.href] = Zotero.Utilities.cleanString(tableRow.textContent); + items[fulltextLink.href] = Zotero.Utilities.trimInternal(tableRow.textContent); } items = Zotero.selectItems(items); diff --git a/translators/OCLC WorldCat FirstSearch.js b/translators/OCLC WorldCat FirstSearch.js index bfc9e1b55..e0b669d5f 100644 --- a/translators/OCLC WorldCat FirstSearch.js +++ b/translators/OCLC WorldCat FirstSearch.js @@ -81,10 +81,10 @@ function processURLs(urls) { } } } else { - newItem.creators.push(Zotero.Utilities.cleanString(match[2])); + newItem.creators.push(Zotero.Utilities.trimInternal(match[2])); } } else if(match[1] == 'Publication') { - match[2] = Zotero.Utilities.cleanString(match[2]); + match[2] = Zotero.Utilities.trimInternal(match[2]); if(match[2].substring(match[2].length-1) == ',') { match[2] = match[2].substring(0, match[2].length-1); } @@ -113,7 +113,7 @@ function processURLs(urls) { var tags = match[2].split("--"); for(var j in tags) { - newItem.tags.push(Zotero.Utilities.cleanString(tags[j])); + newItem.tags.push(Zotero.Utilities.trimInternal(tags[j])); } } else if(match[1] == "Accession No") { newItem.accessionNumber = Zotero.Utilities.superCleanString(match[2]); diff --git a/translators/Ovid.js b/translators/Ovid.js index f4fc67b19..d3a048461 100644 --- a/translators/Ovid.js +++ b/translators/Ovid.js @@ -67,7 +67,7 @@ function doWeb(doc, url) { if (prefix == 'x') return namespace; else return null; } : null; - var results = Zotero.Utilities.cleanString(doc.evaluate('//div[@class="bibheader-resultsrange"]/b', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent); + var results = Zotero.Utilities.trimInternal(doc.evaluate('//div[@class="bibheader-resultsrange"]/b', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent); var post = "S="+doc.evaluate('.//input[@name="S"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().value; if(results.indexOf("-") != -1) { @@ -83,7 +83,7 @@ function doWeb(doc, url) { while(tableRow = tableRows.iterateNext()) { var id = doc.evaluate('.//input[@name="R"]', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().value; - items[id] = Zotero.Utilities.cleanString(doc.evaluate('.//span[@class="titles-title"]', tableRow, + items[id] = Zotero.Utilities.trimInternal(doc.evaluate('.//span[@class="titles-title"]', tableRow, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent); } @@ -132,7 +132,7 @@ function doWeb(doc, url) { newItem = new Zotero.Item("journalArticle"); } else if(lines[i].substr(2, 4) == " - " && haveStarted) { var fieldCode = lines[i].substr(0, 2); - var fieldContent = Zotero.Utilities.cleanString(lines[i].substr(6)); + var fieldContent = Zotero.Utilities.trimInternal(lines[i].substr(6)); if(fieldCode == "TI") { newItem.title = fieldContent.replace(/\. \[\w+\]$/, ""); } else if(fieldCode == "AU") { diff --git a/translators/PLoS Biology and Medicine.js b/translators/PLoS Biology and Medicine.js index 10ff6bd1b..dcd5d6001 100644 --- a/translators/PLoS Biology and Medicine.js +++ b/translators/PLoS Biology and Medicine.js @@ -42,7 +42,7 @@ function doWeb(doc, url) { var articles = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null); var next_article = articles.iterateNext(); while (next_article) { - items[next_article.href] = Zotero.Utilities.cleanString(next_article.textContent); + items[next_article.href] = Zotero.Utilities.trimInternal(next_article.textContent); next_article = articles.iterateNext(); } items = Zotero.selectItems(items); diff --git a/translators/Patents - USPTO.js b/translators/Patents - USPTO.js index 96bd7da4f..ce33b542f 100644 --- a/translators/Patents - USPTO.js +++ b/translators/Patents - USPTO.js @@ -45,7 +45,7 @@ function scrape(doc) { tmpTitle = tmpTitle + " - " + fontTags[i].innerHTML; } } - tmpTitle = Zotero.Utilities.cleanString(tmpTitle); + tmpTitle = Zotero.Utilities.trimInternal(tmpTitle); tmpTitle = tmpTitle.replace(/<[^>]+>/g, ""); newItem.title = tmpTitle; diff --git a/translators/RSC Publishing.js b/translators/RSC Publishing.js index 2a86ff711..e43497138 100644 --- a/translators/RSC Publishing.js +++ b/translators/RSC Publishing.js @@ -63,7 +63,7 @@ function doChap(newItem, chaptext) { if(chapdata[pos].indexOf("Editors")!=-1) { var editors=chapdata[pos].split(","); for(var i=0; i<=editors.length-1; i++) { - editors[i]=Zotero.Utilities.cleanString(editors[i]); + editors[i]=Zotero.Utilities.trimInternal(editors[i]); var names=editors[i].split(" "); var creators=new Array(); if(i==0) @@ -78,7 +78,7 @@ function doChap(newItem, chaptext) { if(chapdata[pos].indexOf("Authors")!=-1) { var authors=chapdata[pos].split(","); for(var i=0; i<=authors.length-1; i++) { - authors[i]=Zotero.Utilities.cleanString(authors[i]); + authors[i]=Zotero.Utilities.trimInternal(authors[i]); var names=authors[i].split(" "); var creators=new Array(); if(i==0) @@ -107,7 +107,7 @@ function doBook(newItem, bookdata) { vol=fields[pos].substring(i+1); else vol=fields[pos].substring(fields[pos].lastIndexOf(" ")); - newItem.volume=Zotero.Utilities.cleanString(vol); + newItem.volume=Zotero.Utilities.trimInternal(vol); } if(fields[pos].indexOf("Edition")!=-1) { var i=fields[pos].lastIndexOf(";"); @@ -115,7 +115,7 @@ function doBook(newItem, bookdata) { ed=fields[pos].substring(i+1); else ed=fields[pos].substring(fields[pos].lastIndexOf(" ")); - newItem.edition=Zotero.Utilities.cleanString(ed); + newItem.edition=Zotero.Utilities.trimInternal(ed); } if(fields[pos].indexOf("Copyright")!=-1) { var i=fields[pos].lastIndexOf(";"); @@ -124,7 +124,7 @@ function doBook(newItem, bookdata) { date=fields[pos].substring(i+1); else date=fields[pos].substring(fields[pos].indexOf(":")+2); - newItem.date=Zotero.Utilities.cleanString(date); + newItem.date=Zotero.Utilities.trimInternal(date); } if(fields[pos].indexOf("ISBN")!=-1&&fields[pos].indexOf("print")!=-1) { var i=fields[pos].lastIndexOf(";"); @@ -133,12 +133,12 @@ function doBook(newItem, bookdata) { isbn=fields[pos].substring(i+1); else isbn=fields[pos].substring(fields[pos].indexOf(":")+2); - newItem.ISBN=Zotero.Utilities.cleanString(isbn); + newItem.ISBN=Zotero.Utilities.trimInternal(isbn); } if(fields[pos].indexOf("Author")!=-1||fields[pos].indexOf("Editor")!=-1) { var authors=fields[pos].split(","); for(var i=0; i<=authors.length-1; i++) { - authors[i]=Zotero.Utilities.cleanString(authors[i]); + authors[i]=Zotero.Utilities.trimInternal(authors[i]); var names=authors[i].split(" "); var creators=new Array(); creators.firstName=names[0]; @@ -170,7 +170,7 @@ function doWeb(doc, url) { var items=new Array(); var doi; while(doi=dois.iterateNext()) - items[doi.nodeValue]=Zotero.Utilities.cleanString(titles.iterateNext().textContent); + items[doi.nodeValue]=Zotero.Utilities.trimInternal(titles.iterateNext().textContent); items=Zotero.selectItems(items); var string="http://www.rsc.org/delivery/_ArticleLinking/refdownload.asp?"; for(var codes in items) { @@ -257,7 +257,7 @@ function doWeb(doc, url) { var authors=auth.split(","); if(newItem.title.indexOf("Interview")==-1) for(var i=0; i<=authors.length-1; i++) { - authors[i]=Zotero.Utilities.cleanString(authors[i]); + authors[i]=Zotero.Utilities.trimInternal(authors[i]); var names=authors[i].split(" "); var creator=new Array(); creator.firstName=names[0]; diff --git a/translators/RePEc.js b/translators/RePEc.js index 21fa0257d..93cf5abed 100644 --- a/translators/RePEc.js +++ b/translators/RePEc.js @@ -118,7 +118,7 @@ function doWeb(doc, url) { } ) - items[bibcode] = Zotero.Utilities.cleanString(titleElmt.textContent); + items[bibcode] = Zotero.Utilities.trimInternal(titleElmt.textContent); } while((bibElmt = bibElmts.iterateNext()) && (titleElmt = titleElmts.iterateNext())); diff --git a/translators/SPIRES.js b/translators/SPIRES.js index 5b76c2cf8..9150caf2b 100644 --- a/translators/SPIRES.js +++ b/translators/SPIRES.js @@ -47,7 +47,7 @@ function doWeb(doc, url) { // search page var items = new Object(); do { - items[citation.href] = Zotero.Utilities.cleanString(title.textContent); + items[citation.href] = Zotero.Utilities.trimInternal(title.textContent); } while((citation=citations.iterateNext()) && (title=titles.iterateNext())) items = Zotero.selectItems(items); diff --git a/translators/ScientificCommons.js b/translators/ScientificCommons.js index 895464651..8e287461a 100644 --- a/translators/ScientificCommons.js +++ b/translators/ScientificCommons.js @@ -62,7 +62,7 @@ function doWeb(doc, url) { id = doc.evaluate('./@id', listElt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue; link = host + "/export/ris/" + id; title = doc.evaluate('.//p[@class="title"]', listElt, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; - items[link] = Zotero.Utilities.cleanString(title); + items[link] = Zotero.Utilities.trimInternal(title); } items = Zotero.selectItems(items); diff --git a/translators/Scitation.js b/translators/Scitation.js index 493b37faf..cf7929577 100644 --- a/translators/Scitation.js +++ b/translators/Scitation.js @@ -44,7 +44,7 @@ function doWeb(doc, url) { var title; do { title = doc.evaluate('../../..//a[1]',multid, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); - items[multid.value] = Zotero.Utilities.cleanString(title.textContent); + items[multid.value] = Zotero.Utilities.trimInternal(title.textContent); } while (multid =multids.iterateNext()); items = Zotero.selectItems(items); diff --git a/translators/The New York Review of Books.js b/translators/The New York Review of Books.js index 8c7b17257..38f7048df 100644 --- a/translators/The New York Review of Books.js +++ b/translators/The New York Review of Books.js @@ -27,7 +27,7 @@ function detectWeb(doc, url) { function associateMeta(newItem, metaTags, field, zoteroField) { if(metaTags.namedItem(field)) { - newItem[zoteroField] = Zotero.Utilities.cleanString(metaTags.namedItem(field).getAttribute("content")); + newItem[zoteroField] = Zotero.Utilities.trimInternal(metaTags.namedItem(field).getAttribute("content")); } } @@ -59,7 +59,7 @@ function scrape(doc) { newItem.date = newItem.date.textContent; } - info = Zotero.Utilities.cleanString(info.textContent); + info = Zotero.Utilities.trimInternal(info.textContent); // get volume and issue var infoRe = /Volume ([0-9]+), Number ([0-9]+)/; diff --git a/translators/Time-Blog.com.js b/translators/Time-Blog.com.js index bcedcf479..dcbff699c 100644 --- a/translators/Time-Blog.com.js +++ b/translators/Time-Blog.com.js @@ -39,7 +39,7 @@ function scrape(doc, url) { } if (metaTags["description"]) { - newItem.abstractNote = Zotero.Utilities.cleanString(Zotero.Utilities.cleanTags(metaTags["description"])); + newItem.abstractNote = Zotero.Utilities.trimInternal(Zotero.Utilities.cleanTags(metaTags["description"])); } if (metaTags["date"]) { @@ -80,7 +80,7 @@ function scrape(doc, url) { } if (doc.evaluate('//span[@class="postedby"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { - var byline = Zotero.Utilities.cleanString(doc.evaluate('//span[@class="postedby"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); + var byline = Zotero.Utilities.trimInternal(doc.evaluate('//span[@class="postedby"]', doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); if (byline.substr(0,9).toLowerCase() == "posted by") { byline = byline.substr(10).split(" "); } else { diff --git a/translators/Unidade de Biologia da Conservaçao.js b/translators/Unidade de Biologia da Conservaçao.js index fdb9c16ad..1f761706e 100644 --- a/translators/Unidade de Biologia da Conservaçao.js +++ b/translators/Unidade de Biologia da Conservaçao.js @@ -44,8 +44,8 @@ function doWeb(doc, url) { function scrape(doc,url) { var xpath = "/html/body/div/div/div[3]/div[3]/table/tbody/tr/td" var xpathurl ="/html/body/div/div/div[3]/div[3]/table/tbody/tr/td/a[1]" - var allRefText = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); - var allRefTexturl = Zotero.Utilities.cleanString(doc.evaluate(xpathurl, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); + var allRefText = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); + var allRefTexturl = Zotero.Utilities.trimInternal(doc.evaluate(xpathurl, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent); diff --git a/translators/arXiv.org.js b/translators/arXiv.org.js index 3c7f0550e..f082dc155 100644 --- a/translators/arXiv.org.js +++ b/translators/arXiv.org.js @@ -74,7 +74,7 @@ function doWeb(doc, url) { newID = newID.replace(/arXiv:/, ""); newID = newID.replace(/\//g, "%2F"); newID = newID.replace(/v\d*/, ""); //remove version number - availableItems[i] = Zotero.Utilities.cleanString(title.textContent.replace(/^\s*Title:\s+/, "")); + availableItems[i] = Zotero.Utilities.trimInternal(title.textContent.replace(/^\s*Title:\s+/, "")); arXivIDs[i] = newID; i++; } while ((elmt = elmts.iterateNext()) && (title = titles.iterateNext())); @@ -123,7 +123,7 @@ function doWeb(doc, url) { var test = xml..responseDate.text().toString(); if (citation.dc_title.length()){ - title = Zotero.Utilities.cleanString(citation.dc_title.text().toString()); + title = Zotero.Utilities.trimInternal(citation.dc_title.text().toString()); newItem.title = title; } Zotero.debug("article title: " + title); @@ -137,26 +137,26 @@ function doWeb(doc, url) { } if (citation.dc_date.length()) { var dates = citation.dc_date; - newItem.date = Zotero.Utilities.cleanString(dates[0].text().toString()); + newItem.date = Zotero.Utilities.trimInternal(dates[0].text().toString()); } if (citation.dc_description.length()) { var descriptions = citation.dc_description; for (var j=0; j