eliminate deprecated cleanString calls, and fix a namespace bug in eRDF
This commit is contained in:
parent
9e3f4576d2
commit
73102eb977
51 changed files with 124 additions and 124 deletions
translators
ABC-CLIO Serials Web.jsAGU Journals.jsARTFL Encyclopedie.jsAlterNet.jsAmazon.com.jsAncestry.com US Federal Census.jsAustralian Dictionary of Biography.jsBerkeley Library Catalog.jsBibTeX.jsCambridge Scientific Abstracts.jsDTIC.jsDigital Medievalist.jsERIC.jsESpacenet.jsEducation Week.jsEmbedded RDF.jsEpicurious.jsFactiva.jsFlickr.jsFlorida University Libraries (Endeca 1).jsGale Literature Resource Center.jsHighWire.jsIEEE Xplore.jsIRIS.jsInfoTrac.jsInternational Herald Tribune.jsLA Times.jsLibrary Catalog (SIRSI).jsLibrary Catalog (VTLS).jsLibrary Catalog (Voyager).jsMax Planck Institute for the History of Science Virtual Laboratory Library.jsMelvyl.jsNASA ADS.jsNYTimes.com.jsNature.jsOCLC WorldCat FirstSearch.jsOvid.jsPLoS Biology and Medicine.jsPatents - USPTO.jsRSC Publishing.jsRePEc.jsSPIRES.jsScientificCommons.jsScitation.jsThe New York Review of Books.jsTime-Blog.com.jsUnidade de Biologia da Conservaçao.jsarXiv.org.jseLibrary.ru.jseMJA.jswashingtonpost.com.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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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+'</a>,([^,]*),', "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
|
||||
|
|
|
@ -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") {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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") {
|
||||
|
|
|
@ -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<descriptions.length(); j++) {
|
||||
var noteStr = Zotero.Utilities.cleanString(descriptions[j].text().toString());
|
||||
var noteStr = Zotero.Utilities.trimInternal(descriptions[j].text().toString());
|
||||
newItem.notes.push({note:noteStr});
|
||||
}
|
||||
}
|
||||
if (citation.dc_subject.length()) {
|
||||
var subjects = citation.dc_subject;
|
||||
for (var j=0; j<subjects.length(); j++) {
|
||||
var subjectValue = Zotero.Utilities.cleanString(subjects[j].text().toString());
|
||||
var subjectValue = Zotero.Utilities.trimInternal(subjects[j].text().toString());
|
||||
newItem.tags.push(subjectValue);
|
||||
}
|
||||
}
|
||||
if (citation.dc_identifier.length()) {
|
||||
var identifiers = citation.dc_identifier;
|
||||
for (var j=0; j<identifiers.length(); j++) {
|
||||
var identifier = Zotero.Utilities.cleanString(identifiers[j].text().toString());
|
||||
var identifier = Zotero.Utilities.trimInternal(identifiers[j].text().toString());
|
||||
if (identifier.substr(0, 4) == "doi:") {
|
||||
newItem.DOI = identifier;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ function parseXML(text, itemUrlBase, doc) {
|
|||
newItem.tags[i] = kwords[i];
|
||||
}
|
||||
|
||||
//newItem.abstractNote = Zotero.Utilities.cleanString(xml..text.front.argument.(@n == "abstract").p.text().toString());
|
||||
//newItem.abstractNote = Zotero.Utilities.trimInternal(xml..text.front.argument.(@n == "abstract").p.text().toString());
|
||||
newItem.attachments.push({document:doc, title:doc.title});
|
||||
|
||||
newItem.complete();
|
||||
|
|
|
@ -73,7 +73,7 @@ function doWeb(doc, url) {
|
|||
title = doc.evaluate('./td[2]/a', row, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
|
||||
id = doc.evaluate('./td[6]', row, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent;
|
||||
Zotero.debug(title + id);
|
||||
items[id] = Zotero.Utilities.cleanTags(Zotero.Utilities.cleanString(title));
|
||||
items[id] = Zotero.Utilities.cleanTags(Zotero.Utilities.trimInternal(title));
|
||||
}
|
||||
} else {
|
||||
// We have normal search results
|
||||
|
@ -83,7 +83,7 @@ function doWeb(doc, url) {
|
|||
var titlerows=doc.evaluate(titlpath, doc, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
var id;
|
||||
while(id=ids.iterateNext())
|
||||
items[id.id]=Zotero.Utilities.cleanTags(Zotero.Utilities.cleanString(titlerows.iterateNext().textContent));
|
||||
items[id.id]=Zotero.Utilities.cleanTags(Zotero.Utilities.trimInternal(titlerows.iterateNext().textContent));
|
||||
}
|
||||
items=Zotero.selectItems(items);
|
||||
if (!items) return false;
|
||||
|
|
|
@ -65,7 +65,7 @@ function scrape(doc,url) {
|
|||
//Get title
|
||||
var xpath = "/html/body/table[2]/tbody/tr[1]/td[3]/h2";
|
||||
if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){
|
||||
var title = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var title = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
|
||||
var title1 = title.split(" ");
|
||||
for (var j in title1) {
|
||||
|
@ -77,37 +77,37 @@ function scrape(doc,url) {
|
|||
//Get Abstract
|
||||
var xpath = '//td[@id="abCell"]';
|
||||
if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){
|
||||
var abstract = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var abstract = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
}
|
||||
|
||||
//Get Applicant
|
||||
var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[4]/td[2]";
|
||||
if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){
|
||||
var applicantField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var applicantField = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
}
|
||||
|
||||
//Get application number
|
||||
var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[8]/td[2]";
|
||||
if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){
|
||||
var anumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var anumber = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
}
|
||||
|
||||
//Get patent number
|
||||
var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]";
|
||||
if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){
|
||||
var pnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var pnumber = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
}
|
||||
|
||||
//Get CIB
|
||||
var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[6]/td[2]";
|
||||
if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){
|
||||
var CIBnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var CIBnumber = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
}
|
||||
|
||||
//Get ECLA
|
||||
var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[7]/td[2]";
|
||||
if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){
|
||||
var tmpECLAnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var tmpECLAnumber = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
tmpECLAnumber = tmpECLAnumber.substr(24);
|
||||
tmpECLAnumber = tmpECLAnumber.replace(/\)+/g, '; ');
|
||||
var aus = tmpECLAnumber.split("; ");
|
||||
|
@ -120,20 +120,20 @@ function scrape(doc,url) {
|
|||
//Get priority number
|
||||
var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[9]/td[2]";
|
||||
if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){
|
||||
var prnumber = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var prnumber = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
}
|
||||
|
||||
|
||||
//Get date
|
||||
var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[2]/td[2]";
|
||||
if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){
|
||||
var date = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var date = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
}
|
||||
|
||||
//Get Creators
|
||||
var xpath = "//table[1]/tbody/tr/td[1]/table/tbody/tr[3]/td[2]";
|
||||
if(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext()){
|
||||
var inventorField = Zotero.Utilities.cleanString(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
var inventorField = Zotero.Utilities.trimInternal(doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null).iterateNext().textContent);
|
||||
}
|
||||
|
||||
//Create Zotero Ref
|
||||
|
|
|
@ -58,7 +58,7 @@ function scrape(doc, url) {
|
|||
|
||||
|
||||
if (metaTags["Authors"]) {
|
||||
var author = Zotero.Utilities.cleanString(metaTags["Authors"]);
|
||||
var author = Zotero.Utilities.trimInternal(metaTags["Authors"]);
|
||||
if (author.substr(0,3).toLowerCase() == "by ") {
|
||||
author = author.substr(3);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ function doWeb(doc, url) {
|
|||
for(var i=0; i<metaTags.length; i++) {
|
||||
var tag = metaTags[i].getAttribute("name");
|
||||
var value = metaTags[i].getAttribute("content");
|
||||
if(tag && value && tag.substr(0, 3).toLowerCase() == prefix) {
|
||||
if(tag && value && tag.substr(0, prefix.length).toLowerCase() == prefix) {
|
||||
if(tag == "dc.title") {
|
||||
foundTitle = true;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ function scrape(doc){
|
|||
xpath = '//div[@id="recipe_intro"]/p';
|
||||
if (elmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()){
|
||||
var abstract = elmt.textContent;
|
||||
abstract = Zotero.Utilities.cleanString(abstract);
|
||||
abstract = Zotero.Utilities.trimInternal(abstract);
|
||||
newItem.abstractNote = abstract;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ function doWeb(doc, url) {
|
|||
var hdl = doc.evaluate('.//input[@name="hdl"]', tableRow, nsResolver, XPathResult.ANY_TYPE,
|
||||
null).iterateNext().value;
|
||||
if(!singlePage){
|
||||
items[hdl] = Zotero.Utilities.cleanString(tableRow.getElementsByTagName("a")[0].textContent);
|
||||
items[hdl] = Zotero.Utilities.trimInternal(tableRow.getElementsByTagName("a")[0].textContent);
|
||||
} else {
|
||||
var m = doc.evaluate('.//td[@class="count"]', tableRow, nsResolver, XPathResult.ANY_TYPE,
|
||||
null).iterateNext().textContent.match(/[0-9]+/);
|
||||
|
@ -99,14 +99,14 @@ function doWeb(doc, url) {
|
|||
var article = ppsarticle.article;
|
||||
var newItem = new Zotero.Item("newspaperArticle");
|
||||
|
||||
newItem.title = Zotero.Utilities.cleanString(article.headline.paragraph.text().toString());
|
||||
newItem.publicationTitle = Zotero.Utilities.cleanString(article.sourceName.text().toString());
|
||||
newItem.title = Zotero.Utilities.trimInternal(article.headline.paragraph.text().toString());
|
||||
newItem.publicationTitle = Zotero.Utilities.trimInternal(article.sourceName.text().toString());
|
||||
for each(var tag in article..name) {
|
||||
newItem.tags.push(tag.text().toString());
|
||||
}
|
||||
newItem.date = Zotero.Utilities.formatDate(Zotero.Utilities.strToDate(article.publicationDate.date.text().toString()));
|
||||
if(article.byline.length()) {
|
||||
var byline = Zotero.Utilities.cleanString(article.byline.text().toString().replace(/By/i, ""));
|
||||
var byline = Zotero.Utilities.trimInternal(article.byline.text().toString().replace(/By/i, ""));
|
||||
var authors = byline.split(/ (?:\&|and) /i);
|
||||
for each(var author in authors) {
|
||||
newItem.creators.push(Zotero.Utilities.cleanAuthor(author, "author"));
|
||||
|
|
|
@ -113,14 +113,14 @@ function doWeb(doc, url) {
|
|||
var newItem = new Zotero.Item("artwork");
|
||||
var title = "";
|
||||
if (xml..title.length()){
|
||||
var title = Zotero.Utilities.cleanString(xml..title[0].text().toString());
|
||||
var title = Zotero.Utilities.trimInternal(xml..title[0].text().toString());
|
||||
if (title == ""){
|
||||
title = " ";
|
||||
}
|
||||
newItem.title = title;
|
||||
}
|
||||
for(var i=0; i<xml..tag.length(); i++) {
|
||||
newItem.tags.push(Zotero.Utilities.cleanString(xml..tag[i].text().toString()));
|
||||
newItem.tags.push(Zotero.Utilities.trimInternal(xml..tag[i].text().toString()));
|
||||
}
|
||||
if (xml..dates.length()){
|
||||
var date = xml..dates[0].@taken.toString();
|
||||
|
|
|
@ -43,7 +43,7 @@ function doWeb(doc, url){
|
|||
// search page
|
||||
var items = new Array();
|
||||
do {
|
||||
items[elmt.href] = Zotero.Utilities.cleanString(elmt.textContent);
|
||||
items[elmt.href] = Zotero.Utilities.trimInternal(elmt.textContent);
|
||||
} while (elmt = elmts.iterateNext());
|
||||
|
||||
items = Zotero.selectItems(items);
|
||||
|
|
|
@ -30,8 +30,8 @@ function detectWeb(doc, url) {
|
|||
}
|
||||
|
||||
function extractCitation(type, citation) {
|
||||
type = Zotero.Utilities.cleanString(type).toLowerCase();
|
||||
citation = Zotero.Utilities.cleanString(citation);
|
||||
type = Zotero.Utilities.trimInternal(type).toLowerCase();
|
||||
citation = Zotero.Utilities.trimInternal(citation);
|
||||
|
||||
if(type == "book article") {
|
||||
var item = new Zotero.Item("bookSection");
|
||||
|
|
|
@ -145,7 +145,7 @@ function doWeb(doc, url) {
|
|||
var links = doc.evaluate('.//a', tableRow, nsResolver, XPathResult.ANY_TYPE, null);
|
||||
while(link = links.iterateNext()) {
|
||||
// prefer Full Text snapshots, but take abstracts
|
||||
var textContent = Zotero.Utilities.cleanString(link.textContent);
|
||||
var textContent = Zotero.Utilities.trimInternal(link.textContent);
|
||||
if((textContent.substr(0, 8) == "Abstract" && !snapshot) || textContent.substr(0, 9) == "Full Text") {
|
||||
snapshot = link.href;
|
||||
} else if(textContent.substr(0, 3) == "PDF") {
|
||||
|
@ -157,7 +157,7 @@ function doWeb(doc, url) {
|
|||
snapshots[gca] = snapshot;
|
||||
pdfs[gca] = pdf;
|
||||
|
||||
items[gca] = Zotero.Utilities.cleanString(title);
|
||||
items[gca] = Zotero.Utilities.trimInternal(title);
|
||||
}
|
||||
|
||||
items = Zotero.selectItems(items);
|
||||
|
|
|
@ -51,7 +51,7 @@ function doWeb(doc, url) {
|
|||
}
|
||||
}
|
||||
|
||||
items[link] = Zotero.Utilities.cleanString(title);
|
||||
items[link] = Zotero.Utilities.trimInternal(title);
|
||||
}
|
||||
|
||||
items = Zotero.selectItems(items);
|
||||
|
|
|
@ -252,7 +252,7 @@ function scrape(doc) {
|
|||
// 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);
|
||||
|
|
|
@ -24,7 +24,7 @@ function detectWeb(doc, url) {
|
|||
var genre = doc.evaluate('//comment()[substring(., 1, 6) = " Genre"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext();
|
||||
|
||||
if(genre) {
|
||||
var value = Zotero.Utilities.cleanString(genre.nodeValue.substr(7));
|
||||
var value = Zotero.Utilities.trimInternal(genre.nodeValue.substr(7));
|
||||
if(value == "article") {
|
||||
return "journalArticle";
|
||||
} else if(value == "book") {
|
||||
|
|
|
@ -53,7 +53,7 @@ function scrape(doc, url) {
|
|||
associateMeta(newItem, metaTags, "Owner", "extra");
|
||||
|
||||
if (metaTags["Author"]) {
|
||||
var author = Zotero.Utilities.cleanString(metaTags["Author"]);
|
||||
var author = Zotero.Utilities.trimInternal(metaTags["Author"]);
|
||||
if (author.substr(0,3).toLowerCase() == "by ") {
|
||||
author = author.substr(3);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ function scrape(doc, url) {
|
|||
Zotero.debug(newItem.tags);
|
||||
for (var i in newItem.tags) {
|
||||
if (newItem.tags[i] != "") {
|
||||
newItem.tags[i] = Zotero.Utilities.cleanString(newItem.tags[i].replace(" ", ", "));
|
||||
newItem.tags[i] = Zotero.Utilities.trimInternal(newItem.tags[i].replace(" ", ", "));
|
||||
var words = newItem.tags[i].split(" ");
|
||||
for (var j = 0 ; j < words.length ; j++) {
|
||||
if (words[j][0] == words[j][0].toLowerCase()) {
|
||||
|
|
|
@ -30,7 +30,7 @@ function detectWeb(doc, url)
|
|||
var row;
|
||||
while(row=rows.iterateNext())
|
||||
{
|
||||
if(Zotero.Utilities.cleanString(row.textContent.toLowerCase())=="travel")
|
||||
if(Zotero.Utilities.trimInternal(row.textContent.toLowerCase())=="travel")
|
||||
{return "newspaperArticle";}
|
||||
}
|
||||
|
||||
|
@ -124,14 +124,14 @@ function scrape(doc,url)
|
|||
if(!test)
|
||||
{xpath='//p[@class="by-author"]';}
|
||||
var info=doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE,null).iterateNext().textContent;
|
||||
info=Zotero.Utilities.cleanString(info);
|
||||
info=Zotero.Utilities.trimInternal(info);
|
||||
var date=findDate(info);
|
||||
if(date)
|
||||
{
|
||||
newItem.date=date;
|
||||
info=info.replace(date,'');
|
||||
}
|
||||
info=Zotero.Utilities.cleanString(info);
|
||||
info=Zotero.Utilities.trimInternal(info);
|
||||
if(info.indexOf(", ")>-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--;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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") {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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()));
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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]+)/;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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<descriptions.length(); j++) {
|
||||
var noteStr = Zotero.Utilities.cleanString(descriptions[j].text().toString());
|
||||
var noteStr = Zotero.Utilities.trimInternal(descriptions[j].text().toString());
|
||||
newItem.notes.push({note:noteStr});
|
||||
}
|
||||
}
|
||||
if (citation.dc_subject.length()) {
|
||||
var subjects = citation.dc_subject;
|
||||
for (var j=0; j<subjects.length(); j++) {
|
||||
var subjectValue = Zotero.Utilities.cleanString(subjects[j].text().toString());
|
||||
var subjectValue = Zotero.Utilities.trimInternal(subjects[j].text().toString());
|
||||
newItem.tags.push(subjectValue);
|
||||
}
|
||||
}
|
||||
if (citation.dc_identifier.length()) {
|
||||
var identifiers = citation.dc_identifier;
|
||||
for (var j=0; j<identifiers.length(); j++) {
|
||||
var identifier = Zotero.Utilities.cleanString(identifiers[j].text().toString());
|
||||
var identifier = Zotero.Utilities.trimInternal(identifiers[j].text().toString());
|
||||
if (identifier.substr(0, 4) == "doi:") {
|
||||
newItem.DOI = identifier;
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ function scrape (doc) {
|
|||
if (abstractBlock)
|
||||
item.abstractNote = doc.evaluate('./tbody/tr/td[2]/table/tbody/tr/td/font', abstractBlock, ns, XPathResult.ANY_TYPE, null).iterateNext().textContent;
|
||||
/*if (referenceBlock) {
|
||||
var note = Zotero.Utilities.cleanString(
|
||||
var note = Zotero.Utilities.trimInternal(
|
||||
doc.evaluate('./tbody/tr/td[2]/table', referenceBlock, ns, XPathResult.ANY_TYPE, null)
|
||||
.iterateNext().textContent);
|
||||
Zotero.debug(note);
|
||||
|
|
|
@ -52,9 +52,9 @@ function doWeb(doc, url) {
|
|||
var title = titles.iterateNext();
|
||||
var link = links.iterateNext();
|
||||
while (title) {
|
||||
//Zotero.debug(Zotero.Utilities.cleanString(title.textContent));
|
||||
//Zotero.debug(Zotero.Utilities.cleanString(link.textContent));
|
||||
items[Zotero.Utilities.cleanString(link.textContent)] = Zotero.Utilities.cleanString(title.textContent).substring(6);
|
||||
//Zotero.debug(Zotero.Utilities.trimInternal(title.textContent));
|
||||
//Zotero.debug(Zotero.Utilities.trimInternal(link.textContent));
|
||||
items[Zotero.Utilities.trimInternal(link.textContent)] = Zotero.Utilities.trimInternal(title.textContent).substring(6);
|
||||
title = titles.iterateNext();
|
||||
link = links.iterateNext();
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ function doWeb(doc, url) {
|
|||
var things = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null);
|
||||
var next_thing = things.iterateNext();
|
||||
while (next_thing) {
|
||||
items[next_thing.href] = senCase(Zotero.Utilities.cleanString(next_thing.textContent));
|
||||
items[next_thing.href] = senCase(Zotero.Utilities.trimInternal(next_thing.textContent));
|
||||
next_thing = things.iterateNext();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ function scrape(doc) {
|
|||
while(font = fonts.iterateNext()) {
|
||||
var pageRe = /([^;]+);(?:[\xA0 ]+Pages?[\xA0 ]+([A-Z0-9\-]+))?/
|
||||
// grab pages and date
|
||||
Zotero.debug(Zotero.Utilities.cleanString(font.nodeValue));
|
||||
Zotero.debug(Zotero.Utilities.trimInternal(font.nodeValue));
|
||||
var m = pageRe.exec(font.nodeValue);
|
||||
if(m) {
|
||||
newItem.date = m[1];
|
||||
|
|
Loading…
Add table
Reference in a new issue