rem
stringlengths 0
126k
| add
stringlengths 0
441k
| context
stringlengths 15
136k
|
---|---|---|
Zotero.Utilities.cleanString(id); | Zotero.Utilities.trimInternal(id); | function detectWeb(doc, url) { // identifies articles according to the presence of an article ID // number in the URL var index = url.toString().indexOf('.org/') + 5; index += url.toString().substr(index).indexOf('/'); if (index != -1) { // ordinary aritcle var id = url.toString().substr(index + 1, 5); Zotero.Utilities.cleanString(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); if (Number(id) && url.toString().search('blog') == -1) { return "magazineArticle"; } else if (Number(id)) { return "blogPost"; } } return null;} |
return "multiple"; } else if (doc.location.href.toLowerCase().indexOf("displaystory") != -1 || doc.location.href.indexOf("cityPage") != -1) { | } else if (doc.location.href.toLowerCase().indexOf("node") != -1) { | function detectWeb(doc, url) { if (doc.location.href.indexOf("search") != -1) { return "multiple"; } else if (doc.location.href.toLowerCase().indexOf("displaystory") != -1 || doc.location.href.indexOf("cityPage") != -1) { return "magazineArticle"; }} |
if (!url.match(/SEARCH=/) && !url.match(/searchargs?=/) && !url.match(/&FF/) && !url.match(/search~S[0-9]/) && !url.match(/\/search\/q\?/)) return false; | if (!url.match(/SEARCH=/) && !url.match(/searchargs?=/) && !url.match(/&FF/) && !url.match(/search~S[0-9]/) && !url.match(/\/search\/q\?/) && !url.match(/record=/)) return false; | function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null;//***********// URL MATCHING - translator should detect the following urls...// First page results// http://bearcat.baylor.edu/search~S7/?searchtype=t&searcharg=test&searchscope=7&sortdropdown=-&SORT=D&extended=0&SUBMIT=Search&searchlimits=&searchorigarg=tone+hundred+years+of+solitude// http://innopac.cooley.edu/search~S0/?searchtype=X&searcharg=test&SORT=DZ&extended=0&SUBMIT=Search&searchlimits=&searchorigarg=Xtest// TODO: get it working for this: http://opac.library.usyd.edu.au/search// n page results// http://bearcat.baylor.edu/search~S7?/ttest/ttest/1837%2C1838%2C2040%2CB/browse/indexsort=-// http://innopac.cooley.edu/search~S0?/Xtest&SORT=DZ/Xtest&SORT=DZ&SUBKEY=test/1%2C960%2C960%2CB/browse// Individual item from search// http://bearcat.baylor.edu/search~S7?/ttest/ttest/1837%2C1838%2C2040%2CB/frameset&FF=ttestteori+english&1%2C1%2C/indexsort=-// http://innopac.cooley.edu/search~S0?/Xtest&SORT=DZ/Xtest&SORT=DZ&SUBKEY=test/1%2C960%2C960%2CB/frameset&FF=Xtest&SORT=DZ&1%2C1%2C// Persistent URL for item// http://bearcat.baylor.edu/record=b1540169~S7// http://innopac.cooley.edu/record=b507916~S0// Specific search parameters// http://library.cooley.edu/search/q?author=shakespeare&title=hamlet//***********// Central Michigan University fix var xpath = '//div[@class="bibRecordLink"]'; var elmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(elmt) { return "book"; }// possibly disastrous edit to regular expression below if (!url.match(/SEARCH=/) && !url.match(/searchargs?=/) && !url.match(/&FF/) && !url.match(/search~S[0-9]/) && !url.match(/\/search\/q\?/)) return false; // First, check to see if the URL alone reveals InnoPAC, since some sites don't reveal the MARC button var matchRegexp = new RegExp('^https?://[^/]+/search[^/]*\\??/[^/]+/[^/]+/[^/]+\%2C[^/]+/frameset(.+)$'); if(matchRegexp.test(doc.location.href)) { if (!url.match("SEARCH") && !url.match("searchtype")) { return "book"; } } // Next, look for the MARC button xpath = '//a[img[@src="/screens/marcdisp.gif" or starts-with(@alt, "MARC ") or @src="/screens/regdisp.gif" or @alt="REGULAR RECORD DISPLAY"]]'; elmt = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(elmt) { return "book"; } // Also, check for links to an item display page var tags = doc.getElementsByTagName("a"); for(var i=0; i<tags.length; i++) { if(matchRegexp.test(tags[i].href) || tags[i].href.match(/^https?:\/\/([^/]+\/(?:search\??\/|record=?|search%7e\/)|frameset&FF=)/)) { return "multiple"; } } return false;} |
var articleRe = /detail.aspx/; var s = articleRe.exec(url); | var pattern = /detail.aspx/; | function detectWeb(doc, url) { var articleRe = /detail.aspx/; var s = articleRe.exec(url); if(s) { return "journalArticle"; } else { articleRe = /Brief.aspx/; s = articleRe.exec(url); if(s) return "multiple"; } return false;} |
if(s) { return "journalArticle"; } else { articleRe = /Brief.aspx/; s = articleRe.exec(url); if(s) return "multiple"; | if (pattern.test(url)) { var code = detectCode(url); if (code == "CJFQ" || code == "CJFD") { return "journalArticle"; } else if (code == "CDFD") { return "thesis"; } else if (code == "CMFD" || code == "CLKM") { return "thesis"; } else if (code == "CPFD") { return "conferencePaper"; } else if (code == "CCND") { return "newspaperArticle"; } } pattern = /brief/; if (pattern.test(url)) { return "multiple" | function detectWeb(doc, url) { var articleRe = /detail.aspx/; var s = articleRe.exec(url); if(s) { return "journalArticle"; } else { articleRe = /Brief.aspx/; s = articleRe.exec(url); if(s) return "multiple"; } return false;} |
var nsResolver = doc.createNSResolver(doc.documentElement); | function nsResolver() { return 'http: } | function detectWeb(doc, url) { // initialize variables unsearchedIds = []; foundIds = []; foundItems = []; foundFormat = []; foundFormatName = []; // Set the domain we're scraping domain = doc.location.href.match(/https?:\/\/([^/]+)/); var nsResolver = doc.createNSResolver(doc.documentElement); // look for a resolver unAPIResolver = doc.evaluate('//link[@rel="unapi-server"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(!unAPIResolver) return false; unAPIResolver = unAPIResolver.getAttribute("href"); // look for abbrs var abbrs = doc.getElementsByTagName("abbr"); for each(var abbr in abbrs) { if(abbr.getAttribute && abbr.getAttribute("class") && abbr.getAttribute("class").split(" ").indexOf("unapi-id") != -1 && abbr.getAttribute("title")) { // found an abbr unsearchedIds.push(escape(abbr.getAttribute("title"))); } } if(!unsearchedIds.length) return false; // now we need to see if the server actually gives us bibliographic metadata. Zotero.wait(); if(unsearchedIds.length == 1) { // if there's only one abbr tag, we should go ahead and retrieve types for it getItemType(); } else { // if there's more than one, we should first see if the resolver gives metadata for all of them Zotero.Utilities.HTTP.doGet(unAPIResolver, function(text) { var format = checkFormats(text); if(format) { // move unsearchedIds to foundIds foundIds = unsearchedIds; unsearchedIds = []; // save format and formatName foundFormat = format[0]; foundFormatName = format[1]; Zotero.done("multiple"); } else { getItemType(); } }); }} |
if (url.match(/(naid|QuotDisp)/)) { | if (url.match(/naid/)) { | function detectWeb(doc, url) { if (url.match(/(naid|QuotDisp)/)) { return "journalArticle"; } else if (doc.evaluate('//a[contains(@href, "QuotDisp") or contains(@href, "/naid/")]', doc, null, XPathResult.ANY_TYPE, null).iterateNext()) { return "multiple"; }} |
|| export_options[i].text == 'MARC communication format') { | || export_options[i].text == 'MARC communication format' || export_options[i].text == 'MARC Record') { | function detectWeb(doc, url) { var export_options = doc.forms.namedItem('frm').elements.namedItem('RD').options; for(var i in export_options) { if(export_options[i].text == 'Latin1 MARC' || export_options[i].text == 'Raw MARC' || export_options[i].text == 'MARC 8' || export_options[i].text == 'MARC-8' || export_options[i].text == 'UTF-8' || export_options[i].text == 'MARC (Unicode/UTF-8)' || export_options[i].text == 'MARC UTF-8' || export_options[i].text == 'UTF-8 MARC (Unicode)' || export_options[i].text == 'UTF8-Unicode' || export_options[i].text == 'MARC (non-Unicode/MARC-8)' || export_options[i].text == 'MARC communication format') { // We have an exportable single record if(doc.forms.namedItem('frm').elements.namedItem('RC')) { return "multiple"; } else { return "book"; } } }} |
Zotero.debug("detecting unAPI"); | function detectWeb(doc, url) { Zotero.debug("detecting unAPI"); // initialize variables unsearchedIds = []; foundIds = []; foundItems = []; foundFormat = []; foundFormatName = []; // Set the domain we're scraping domain = doc.location.href.match(/https?:\/\/([^/]+)/); var nsResolver = doc.createNSResolver(doc.documentElement); // look for a resolver unAPIResolver = doc.evaluate('//link[@rel="unapi-server"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(!unAPIResolver) return false; unAPIResolver = unAPIResolver.getAttribute("href"); // look for abbrs var abbrs = doc.getElementsByTagName("abbr"); for each(var abbr in abbrs) { if(abbr.getAttribute && abbr.getAttribute("class") && abbr.getAttribute("class").split(" ").indexOf("unapi-id") != -1 && abbr.getAttribute("title")) { // found an abbr unsearchedIds.push(escape(abbr.getAttribute("title"))); } } if(!unsearchedIds.length) return false; // now we need to see if the server actually gives us bibliographic metadata. Zotero.wait(); if(unsearchedIds.length == 1) { // if there's only one abbr tag, we should go ahead and retrieve types for it getItemType(); } else { // if there's more than one, we should first see if the resolver gives metadata for all of them Zotero.Utilities.HTTP.doGet(unAPIResolver, function(text) { Zotero.debug(text); var format = checkFormats(text); if(format) { // move unsearchedIds to foundIds foundIds = unsearchedIds; unsearchedIds = []; // save format and formatName foundFormat = format[0]; foundFormatName = format[1]; Zotero.done("multiple"); } else { getItemType(); } }); }} |
|
Zotero.debug(text); | function detectWeb(doc, url) { Zotero.debug("detecting unAPI"); // initialize variables unsearchedIds = []; foundIds = []; foundItems = []; foundFormat = []; foundFormatName = []; // Set the domain we're scraping domain = doc.location.href.match(/https?:\/\/([^/]+)/); var nsResolver = doc.createNSResolver(doc.documentElement); // look for a resolver unAPIResolver = doc.evaluate('//link[@rel="unapi-server"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(!unAPIResolver) return false; unAPIResolver = unAPIResolver.getAttribute("href"); // look for abbrs var abbrs = doc.getElementsByTagName("abbr"); for each(var abbr in abbrs) { if(abbr.getAttribute && abbr.getAttribute("class") && abbr.getAttribute("class").split(" ").indexOf("unapi-id") != -1 && abbr.getAttribute("title")) { // found an abbr unsearchedIds.push(escape(abbr.getAttribute("title"))); } } if(!unsearchedIds.length) return false; // now we need to see if the server actually gives us bibliographic metadata. Zotero.wait(); if(unsearchedIds.length == 1) { // if there's only one abbr tag, we should go ahead and retrieve types for it getItemType(); } else { // if there's more than one, we should first see if the resolver gives metadata for all of them Zotero.Utilities.HTTP.doGet(unAPIResolver, function(text) { Zotero.debug(text); var format = checkFormats(text); if(format) { // move unsearchedIds to foundIds foundIds = unsearchedIds; unsearchedIds = []; // save format and formatName foundFormat = format[0]; foundFormatName = format[1]; Zotero.done("multiple"); } else { getItemType(); } }); }} |
|
var xpath = ' var persistentLink = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); | var xpath = ' var persistentLink = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null); | function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; // The Scientific American Archive breaks this translator, disabling try { var databases = doc.evaluate("//span[@class = 'selected-databases']", doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; if(databases.indexOf("Scientific American Archive Online") != -1) { return false; } } catch(e) { } // See if this is a search results or folder results page var searchResult = doc.evaluate('//ul[@class="result-list" or @class="folder-list"]/li/div[@class="result-list-record" or @class="folder-item"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(searchResult) { return "multiple"; }/* var xpath = '//div[@class="citation-wrapping-div"]/dl[@class="citation-fields"]/dt[starts-with(text(), "Persistent link to this record")' +' or starts-with(text(), "Vínculo persistente a este informe")' +' or starts-with(text(), "Lien permanent à cette donnée")' +' or starts-with(text(), "Permanenter Link zu diesem Datensatz")' +' or starts-with(text(), "Link permanente al record")' +' or starts-with(text(), "Link permanente para este registro")' +' or starts-with(text(), "本記錄固定連結")' +' or starts-with(text(), "此记录的永久链接")' +' or starts-with(text(), "このレコードへのパーシスタント リンク")' +' or starts-with(text(), "레코드 링크 URL")' +' or starts-with(text(), "Постоянная ссылка на эту запись")' +' or starts-with(text(), "Bu kayda sürekli bağlantı")' +' or starts-with(text(), "Μόνιμος σύνδεσμος σε αυτό το αρχείο")]';*/ var xpath = '//input[@id="ctl00_ctl00_MainContentArea_MainContentArea_topDeliveryControl_deliveryButtonControl_lnkExportImage"]'; var persistentLink = doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(persistentLink) { return "journalArticle"; }} |
var value = Zotero.Utilities.cleanString(genre.nodeValue.substr(7)); | var value = Zotero.Utilities.trimInternal(genre.nodeValue.substr(7)); | function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; // ensure that there is an InfoTrac logo if(!doc.evaluate('//img[substring(@alt, 1, 8) = "InfoTrac"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) return false; if(doc.title.substring(0, 8) == "Article ") { 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)); if(value == "article") { return "journalArticle"; } else if(value == "book") { return "book"; } else if(value == "dissertation") { return "thesis"; } else if(value == "bookitem") { return "bookSection"; } } return "magazineArticle"; } else if(doc.title.substring(0, 10) == "Citations ") { return "multiple"; }} |
if (url.indexOf("toc") != -1) { | if (/\/toc\ | function detectWeb(doc, url) { if (url.indexOf("toc") != -1) { return "multiple"; } else { return "journalArticle"; }} |
var spans = doc.evaluate(' | function nsResolver() { return 'http: } var spans = doc.evaluate(' | function detectWeb(doc, url) { var spanTags = doc.getElementsByTagName("span"); var encounteredType = false; var spans = doc.evaluate('//span[contains(@class, " Z3988") or contains(@class, "Z3988 ") or @class="Z3988"][@title]', doc, null, XPathResult.ANY_TYPE, null); var span; while(span = spans.iterateNext()) { // determine if it's a valid type var item = new Zotero.Item; var success = Zotero.Utilities.parseContextObject(span.title, item); if(item.itemType) { if(encounteredType) { return "multiple"; } else { encounteredType = item.itemType; } } } return encounteredType;} |
var articleRegexp = /^http:\/\/chronicle\.com\/(daily|weekly|article|blogPost)\/[^/]+\ | var articleRegexp = /^http:\/\/chronicle\.com\/(daily|weekly|article|blogPost|blogs\/\w+)\/[^/]+\ | function detectWeb(doc, url) { /* The /daily/ and /weekly/ sections are leftover from the previous version of the translator; they don't appear to still be on the Chronicle site, but they might persist in older URLs. */ var articleRegexp = /^http:\/\/chronicle\.com\/(daily|weekly|article|blogPost)\/[^/]+\// ; if(articleRegexp.test(url)) { var section = url.match(articleRegexp); switch (section[1]) { case "weekly": case "daily": case "article": return "newspaperArticle"; case "blogPost": return "blogPost"; default: return false; } } else { // This approach, used again below, is pretty crude. var aTags = doc.getElementsByTagName("a"); for(var i=0; i<aTags.length; i++) { if(articleRegexp.test(aTags[i].href)) { return "multiple"; } } }} |
if (section[1].indexOf("blogs") !== -1) return "blogPost"; | function detectWeb(doc, url) { /* The /daily/ and /weekly/ sections are leftover from the previous version of the translator; they don't appear to still be on the Chronicle site, but they might persist in older URLs. */ var articleRegexp = /^http:\/\/chronicle\.com\/(daily|weekly|article|blogPost)\/[^/]+\// ; if(articleRegexp.test(url)) { var section = url.match(articleRegexp); switch (section[1]) { case "weekly": case "daily": case "article": return "newspaperArticle"; case "blogPost": return "blogPost"; default: return false; } } else { // This approach, used again below, is pretty crude. var aTags = doc.getElementsByTagName("a"); for(var i=0; i<aTags.length; i++) { if(articleRegexp.test(aTags[i].href)) { return "multiple"; } } }} |
|
var searchRe = new RegExp("^https?: | var searchRe = new RegExp("(^https?: | function detectWeb(doc, url) { var searchRe = new RegExp("^https?://[^/]+/search/results"); if(searchRe.test(url)) { return "multiple"; } else { return "journalArticle"; }} |
type = Zotero.Utilities.cleanString(type.textContent); | type = Zotero.Utilities.trimInternal(type.textContent); | function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; if(url.indexOf("/results.php") != -1) { var type = doc.evaluate('//td[@class="rt_tab_on"]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().textContent; if(type.substr(0, 15) == "Published Works") { return "multiple"; } } else { // default to journal var itemType = "journalArticle"; 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); if(type == "Book Chapter") { return "bookSection"; } else if(type.substr(0, 4) == "Book") { return "book"; } else if(type.substr(0, 12) == "Dissertation") { return "thesis"; } else if(type == "Catalog") { return "magazineArticle"; } } return "journalArticle"; } return false;} |
var singpath='contains( if(doc.evaluate(singpath, doc, nsResolver, XPathResult.ANY_TYPE, null).booleanValue) { var typepath=' | if(url.match(/ERICWebPortal\/search\/clipboard\.jsp/)) return "multiple"; if(url.match(/ERICWebPortal\/MyERIC\/clipboard\/viewFolder\.jsp\?folderIndex/)) return "multiple"; var singpath=' var res = doc.evaluate(singpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext(); if(res && res.textContent.indexOf("Record Details") !== -1) { var typepath=' | function detectWeb(doc, url) { var namespace=doc.documentElement.namespaceURI; var nsResolver=namespace?function(prefix) { return (prefix=="x")?namespace:null; }:null; var searchpath='//form[@name="searchResultsForm"][@id="searchResultsForm"]'; if(doc.evaluate(searchpath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) return "multiple"; //var singpath='//tr/td[@class="primaryHeader"][contains(text(), "Record Details")]'; var singpath='contains(//div[@id="titleBarBlue"]/text(), "Record Details")'; if(doc.evaluate(singpath, doc, nsResolver, XPathResult.ANY_TYPE, null).booleanValue) { var typepath='//tr[td/span/strong/text()="Pub Types:"]/td[2]/text()'; var typestr=doc.evaluate(typepath, doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext().nodeValue; var typereg=new RegExp("([^;/\-]+)"); var typearr=typereg.exec(typestr); if(typearr[1]=="Journal Articles") return "journalArticle"; if(typearr[1]=="Information Analyses") return "journalArticle"; if(typearr[1]="Machine") return "computerProgram"; if(typearr[1]="Computer Programs") return "computerProgram"; if(typearr[1]="Dissertations") return "thesis"; if(typearr[1]="Reports") return "report"; if(typearr[1]="Non") return "audioRecording"; if(typearr[1]="Legal") return "statute"; else return "book"; }} |
if(Zotero.Utilities.cleanString(row.textContent.toLowerCase())=="travel") | if(Zotero.Utilities.trimInternal(row.textContent.toLowerCase())=="travel") | function detectWeb(doc, url){ var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; var xpath = '//link[@title="Main"]'; if(doc.evaluate(xpath, doc, nsResolver, XPathResult.ANY_TYPE,null).iterateNext()) {return "newspaperArticle";} if(doc.title.indexOf("Search Results")>-1) {return "multiple";} xpath = '//h1'; var rows=doc.evaluate(xpath, doc, nsResolver,XPathResult.ANY_TYPE, null); var row; while(row=rows.iterateNext()) { if(Zotero.Utilities.cleanString(row.textContent.toLowerCase())=="travel") {return "newspaperArticle";} } return null;} |
if (doc.evaluate(' | if(doc.location.href.match(/[?&]q=/)) { | function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; if (doc.evaluate('//font[contains(./text(), "Result")]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { return "multiple"; } else if (doc.location.href.match("id")) { return "patent"; } } |
} else if (doc.location.href.match("id")) { | } else if(doc.location.href.match(/[?&]id=/)) { | function detectWeb(doc, url) { var namespace = doc.documentElement.namespaceURI; var nsResolver = namespace ? function(prefix) { if (prefix == 'x') return namespace; else return null; } : null; if (doc.evaluate('//font[contains(./text(), "Result")]', doc, nsResolver, XPathResult.ANY_TYPE, null).iterateNext()) { return "multiple"; } else if (doc.location.href.match("id")) { return "patent"; } } |
var book, | var book = 0, | determine_reference: function (ref) { var book, chapter, cv, zeros; /// First determine if it is likely a verse reference. if (!books_re.test(ref)) return false; book = 0; switch (ref.slice(0, 1).toLowerCase()) { case "j": if (book_arr_re[43].test(ref)) { /// John book = "43"; break; } else if (book_arr_re[32].test(ref)) { /// Jonah book = "32"; break; } else if (book_arr_re[59].test(ref)) { /// James book = "59"; break; } else if (book_arr_re[6].test(ref)) { /// Joshua book = "6"; break; } else if (book_arr_re[7].test(ref)) { /// Judges book = "7"; break; } else if (book_arr_re[18].test(ref)) { /// Job book = "18"; break; } else if (book_arr_re[65].test(ref)) { /// Jude book = "65"; break; } else if (book_arr_re[24].test(ref)) { /// Jeremiah book = "24"; break; } else if (book_arr_re[29].test(ref)) { /// Joel book = "29"; break; } break; case "r": if (book_arr_re[45].test(ref)) { /// Romans book = "45"; break; } else if (book_arr_re[66].test(ref)) { /// Revelation book = "66"; break; } else if (book_arr_re[8].test(ref)) { /// Ruth book = "8"; break; } break; case "g": if (book_arr_re[1].test(ref)) { /// Genesis book = "1"; break; } else if (book_arr_re[48].test(ref)) { /// Galatians book = "48"; break; } break; case "e": if (book_arr_re[2].test(ref)) { /// Exodus book = "2"; break; } else if (book_arr_re[49].test(ref)) { /// Ephesians book = "49"; break; } else if (book_arr_re[26].test(ref)) { /// Ezekiel book = "26"; break; } else if (book_arr_re[21].test(ref)) { /// Ecclesiastes book = "21"; break; } else if (book_arr_re[17].test(ref)) { /// Esther book = "17"; break; } else if (book_arr_re[15].test(ref)) { /// Ezra book = "15"; break; } break; case "m": if (book_arr_re[40].test(ref)) { /// Matthew book = "40"; break; } else if (book_arr_re[41].test(ref)) { /// Mark book = "41"; break; } else if (book_arr_re[39].test(ref)) { /// Malachi book = "39"; break; } else if (book_arr_re[33].test(ref)) { /// Micah book = "33"; break; } break; case "l": if (book_arr_re[42].test(ref)) { /// Luke book = "42"; break; } else if (book_arr_re[3].test(ref)) { /// Leviticus book = "3"; break; } else if (book_arr_re[25].test(ref)) { /// Lamentations book = "25"; break; } break; case "p": if (book_arr_re[19].test(ref)) { /// Psalms book = "19"; break; } else if (book_arr_re[20].test(ref)) { /// Proverbs book = "20"; break; } else if (book_arr_re[50].test(ref)) { /// Philippians book = "50"; break; } else if (book_arr_re[57].test(ref)) { /// Philemon book = "57"; break; } else if (book_arr_re[60].test(ref)) { /// 1 Peter (Peter) book = "60"; break; } break; case "d": if (book_arr_re[5].test(ref)) { /// Deuteronomy book = "5"; break; } else if (book_arr_re[27].test(ref)) { /// Daniel book = "27"; break; } break; case "i": if (book_arr_re[23].test(ref)) { /// Isaiah book = "23"; break; } ///NOTE: Don't break so that references like "I Kings" will be checked. case "1": case "f": if (book_arr_re[46].test(ref)) { /// 1 Corinthians | First Corinthians| I Corinthians book = "46"; break; } else if (book_arr_re[62].test(ref)) { /// 1 John | First John | I John book = "62"; break; } else if (book_arr_re[54].test(ref)) { /// 1 Timothy | First Timothy | I Timothy book = "54"; break; } else if (book_arr_re[52].test(ref)) { /// 1 Thessalonians | First Thessalonians | I Thessalonians book = "52"; break; } else if (book_arr_re[60].test(ref)) { /// 1 Peter | First Peter | I Peter book = "60"; break; } else if (book_arr_re[9].test(ref)) { /// 1 Samuel | First Samuel | I Samuel book = "9"; break; } else if (book_arr_re[11].test(ref)) { /// 1 Kings | First Kings | I Kings book = "11"; break; } else if (book_arr_re[13].test(ref)) { /// 1 Chronicles | First Chronicles | I Chronicles book = "13"; break; } ///NOTE: Don't break so that references like "II Kings" will be checked. case "2": case "s": if (book_arr_re[47].test(ref)) { /// 2 Corinthians | Second Corinthians| II Corinthians book = "47"; break; } else if (book_arr_re[63].test(ref)) { /// 2 John | Second John | II John book = "63"; break; } else if (book_arr_re[55].test(ref)) { /// 2 Timothy | Second Timothy | II Timothy book = "55"; break; } else if (book_arr_re[53].test(ref)) { /// 2 Thessalonians | Second Thessalonians | II Thessalonians book = "53"; break; } else if (book_arr_re[61].test(ref)) { /// 2 Peter | Second Peter | II Peter book = "61"; break; } else if (book_arr_re[22].test(ref)) { /// Song of Songs book = "22"; break; } else if (book_arr_re[10].test(ref)) { /// 2 Samuel | Second Samuel | II Samuel book = "10"; break; } else if (book_arr_re[12].test(ref)) { /// 2 Kings | Second Kings | II Kings book = "12"; break; } else if (book_arr_re[14].test(ref)) { /// 2 Chronicles | Second Chronicles | II Chronicles book = "14"; break; } else if (book_arr_re[9].test(ref)) { /// 1 Samuel (Samuel) book = "9"; break; } else if (book_arr_re[19].test(ref)) { /// Psalms (Salms) book = "19"; break; } ///NOTE: Don't break so that references like "III John" will be checked. case "3": case "t": if (book_arr_re[64].test(ref)) { /// 3 John | Third John | III John book = "64"; break; } else if (book_arr_re[56].test(ref)) { /// Titus book = "56"; break; } else if (book_arr_re[54].test(ref)) { /// 1 Timothy (Timothy) book = "54"; break; } else if (book_arr_re[52].test(ref)) { /// 1 Thessalonians (Thessalonians) book = "52"; break; } else if (book_arr_re[44].test(ref)) { /// The Acts of the Apostles book = "44"; break; } else if (book_arr_re[22].test(ref)) { /// The Song of Songs book = "22"; break; } break; case "a": if (book_arr_re[44].test(ref)) { /// Acts book = "44"; break; } else if (book_arr_re[30].test(ref)) { /// Amos book = "30"; break; } else if (book_arr_re[66].test(ref)) { /// Revelation (Apocalypse) book = "66"; break; } break; case "c": if (book_arr_re[51].test(ref)) { /// Colossians book = "51"; break; } else if (book_arr_re[46].test(ref)) { /// 1 Corinthians (Corinthians) book = "46"; break; } else if (book_arr_re[22].test(ref)) { /// Song of Songs (Canticles) book = "22"; break; } else if (book_arr_re[13].test(ref)) { /// 1 Chronicles (Chronicles) book = "13"; break; } break; case "h": if (book_arr_re[58].test(ref)) { /// Hebrews book = "58"; break; } else if (book_arr_re[28].test(ref)) { /// Hosea book = "28"; break; } else if (book_arr_re[35].test(ref)) { /// Habakkuk book = "35"; break; } else if (book_arr_re[37].test(ref)) { /// Haggai book = "37"; break; } break; case "n": if (book_arr_re[4].test(ref)) { /// Numbers book = "4"; break; } else if (book_arr_re[16].test(ref)) { /// Nehemiah book = "16"; break; } else if (book_arr_re[34].test(ref)) { /// Nahum book = "34"; break; } break; case "z": if (book_arr_re[38].test(ref)) { /// Zechariah book = "38"; break; } else if (book_arr_re[36].test(ref)) { /// Zephaniah book = "36"; break; } break; case "k": if (book_arr_re[11].test(ref)) { /// 1 Kings (Kings) book = "11"; break; } break; case "o": if (book_arr_re[31].test(ref)) { /// Obadiah book = "31"; break; } break; } if (book == 0) return false; chapter = "001", verse = "001"; /// Finally, we need to determine the chapter and/or verse reference is they are supplied. cv = ref.split(/\s*([0-9]{1,3})(?:[:.;,\s]([0-9]{0,3})[-0-9]*)?$/); if (cv.length > 1) { if (cv[1] != "") chapter = cv[1] + ""; if (cv[2] != "" && typeof cv[2] != "undefined") { verse = cv[2] + ""; } else { /// For books with only 1 chapter, the chapter reference is optional (i.e., Jude 4 == Jude 1:4). switch (book) { case "31": case "57": case "63": case "64": case "65": verse = chapter; chapter = "001"; } } zeros = ["", "00", "0", ""]; chapter = zeros[chapter.length] + chapter; verse = zeros[verse.length] + verse; } return book + chapter + verse; }, |
book = 0; | determine_reference: function (ref) { var book, chapter, cv, zeros; /// First determine if it is likely a verse reference. if (!books_re.test(ref)) return false; book = 0; switch (ref.slice(0, 1).toLowerCase()) { case "j": if (book_arr_re[43].test(ref)) { /// John book = "43"; break; } else if (book_arr_re[32].test(ref)) { /// Jonah book = "32"; break; } else if (book_arr_re[59].test(ref)) { /// James book = "59"; break; } else if (book_arr_re[6].test(ref)) { /// Joshua book = "6"; break; } else if (book_arr_re[7].test(ref)) { /// Judges book = "7"; break; } else if (book_arr_re[18].test(ref)) { /// Job book = "18"; break; } else if (book_arr_re[65].test(ref)) { /// Jude book = "65"; break; } else if (book_arr_re[24].test(ref)) { /// Jeremiah book = "24"; break; } else if (book_arr_re[29].test(ref)) { /// Joel book = "29"; break; } break; case "r": if (book_arr_re[45].test(ref)) { /// Romans book = "45"; break; } else if (book_arr_re[66].test(ref)) { /// Revelation book = "66"; break; } else if (book_arr_re[8].test(ref)) { /// Ruth book = "8"; break; } break; case "g": if (book_arr_re[1].test(ref)) { /// Genesis book = "1"; break; } else if (book_arr_re[48].test(ref)) { /// Galatians book = "48"; break; } break; case "e": if (book_arr_re[2].test(ref)) { /// Exodus book = "2"; break; } else if (book_arr_re[49].test(ref)) { /// Ephesians book = "49"; break; } else if (book_arr_re[26].test(ref)) { /// Ezekiel book = "26"; break; } else if (book_arr_re[21].test(ref)) { /// Ecclesiastes book = "21"; break; } else if (book_arr_re[17].test(ref)) { /// Esther book = "17"; break; } else if (book_arr_re[15].test(ref)) { /// Ezra book = "15"; break; } break; case "m": if (book_arr_re[40].test(ref)) { /// Matthew book = "40"; break; } else if (book_arr_re[41].test(ref)) { /// Mark book = "41"; break; } else if (book_arr_re[39].test(ref)) { /// Malachi book = "39"; break; } else if (book_arr_re[33].test(ref)) { /// Micah book = "33"; break; } break; case "l": if (book_arr_re[42].test(ref)) { /// Luke book = "42"; break; } else if (book_arr_re[3].test(ref)) { /// Leviticus book = "3"; break; } else if (book_arr_re[25].test(ref)) { /// Lamentations book = "25"; break; } break; case "p": if (book_arr_re[19].test(ref)) { /// Psalms book = "19"; break; } else if (book_arr_re[20].test(ref)) { /// Proverbs book = "20"; break; } else if (book_arr_re[50].test(ref)) { /// Philippians book = "50"; break; } else if (book_arr_re[57].test(ref)) { /// Philemon book = "57"; break; } else if (book_arr_re[60].test(ref)) { /// 1 Peter (Peter) book = "60"; break; } break; case "d": if (book_arr_re[5].test(ref)) { /// Deuteronomy book = "5"; break; } else if (book_arr_re[27].test(ref)) { /// Daniel book = "27"; break; } break; case "i": if (book_arr_re[23].test(ref)) { /// Isaiah book = "23"; break; } ///NOTE: Don't break so that references like "I Kings" will be checked. case "1": case "f": if (book_arr_re[46].test(ref)) { /// 1 Corinthians | First Corinthians| I Corinthians book = "46"; break; } else if (book_arr_re[62].test(ref)) { /// 1 John | First John | I John book = "62"; break; } else if (book_arr_re[54].test(ref)) { /// 1 Timothy | First Timothy | I Timothy book = "54"; break; } else if (book_arr_re[52].test(ref)) { /// 1 Thessalonians | First Thessalonians | I Thessalonians book = "52"; break; } else if (book_arr_re[60].test(ref)) { /// 1 Peter | First Peter | I Peter book = "60"; break; } else if (book_arr_re[9].test(ref)) { /// 1 Samuel | First Samuel | I Samuel book = "9"; break; } else if (book_arr_re[11].test(ref)) { /// 1 Kings | First Kings | I Kings book = "11"; break; } else if (book_arr_re[13].test(ref)) { /// 1 Chronicles | First Chronicles | I Chronicles book = "13"; break; } ///NOTE: Don't break so that references like "II Kings" will be checked. case "2": case "s": if (book_arr_re[47].test(ref)) { /// 2 Corinthians | Second Corinthians| II Corinthians book = "47"; break; } else if (book_arr_re[63].test(ref)) { /// 2 John | Second John | II John book = "63"; break; } else if (book_arr_re[55].test(ref)) { /// 2 Timothy | Second Timothy | II Timothy book = "55"; break; } else if (book_arr_re[53].test(ref)) { /// 2 Thessalonians | Second Thessalonians | II Thessalonians book = "53"; break; } else if (book_arr_re[61].test(ref)) { /// 2 Peter | Second Peter | II Peter book = "61"; break; } else if (book_arr_re[22].test(ref)) { /// Song of Songs book = "22"; break; } else if (book_arr_re[10].test(ref)) { /// 2 Samuel | Second Samuel | II Samuel book = "10"; break; } else if (book_arr_re[12].test(ref)) { /// 2 Kings | Second Kings | II Kings book = "12"; break; } else if (book_arr_re[14].test(ref)) { /// 2 Chronicles | Second Chronicles | II Chronicles book = "14"; break; } else if (book_arr_re[9].test(ref)) { /// 1 Samuel (Samuel) book = "9"; break; } else if (book_arr_re[19].test(ref)) { /// Psalms (Salms) book = "19"; break; } ///NOTE: Don't break so that references like "III John" will be checked. case "3": case "t": if (book_arr_re[64].test(ref)) { /// 3 John | Third John | III John book = "64"; break; } else if (book_arr_re[56].test(ref)) { /// Titus book = "56"; break; } else if (book_arr_re[54].test(ref)) { /// 1 Timothy (Timothy) book = "54"; break; } else if (book_arr_re[52].test(ref)) { /// 1 Thessalonians (Thessalonians) book = "52"; break; } else if (book_arr_re[44].test(ref)) { /// The Acts of the Apostles book = "44"; break; } else if (book_arr_re[22].test(ref)) { /// The Song of Songs book = "22"; break; } break; case "a": if (book_arr_re[44].test(ref)) { /// Acts book = "44"; break; } else if (book_arr_re[30].test(ref)) { /// Amos book = "30"; break; } else if (book_arr_re[66].test(ref)) { /// Revelation (Apocalypse) book = "66"; break; } break; case "c": if (book_arr_re[51].test(ref)) { /// Colossians book = "51"; break; } else if (book_arr_re[46].test(ref)) { /// 1 Corinthians (Corinthians) book = "46"; break; } else if (book_arr_re[22].test(ref)) { /// Song of Songs (Canticles) book = "22"; break; } else if (book_arr_re[13].test(ref)) { /// 1 Chronicles (Chronicles) book = "13"; break; } break; case "h": if (book_arr_re[58].test(ref)) { /// Hebrews book = "58"; break; } else if (book_arr_re[28].test(ref)) { /// Hosea book = "28"; break; } else if (book_arr_re[35].test(ref)) { /// Habakkuk book = "35"; break; } else if (book_arr_re[37].test(ref)) { /// Haggai book = "37"; break; } break; case "n": if (book_arr_re[4].test(ref)) { /// Numbers book = "4"; break; } else if (book_arr_re[16].test(ref)) { /// Nehemiah book = "16"; break; } else if (book_arr_re[34].test(ref)) { /// Nahum book = "34"; break; } break; case "z": if (book_arr_re[38].test(ref)) { /// Zechariah book = "38"; break; } else if (book_arr_re[36].test(ref)) { /// Zephaniah book = "36"; break; } break; case "k": if (book_arr_re[11].test(ref)) { /// 1 Kings (Kings) book = "11"; break; } break; case "o": if (book_arr_re[31].test(ref)) { /// Obadiah book = "31"; break; } break; } if (book == 0) return false; chapter = "001", verse = "001"; /// Finally, we need to determine the chapter and/or verse reference is they are supplied. cv = ref.split(/\s*([0-9]{1,3})(?:[:.;,\s]([0-9]{0,3})[-0-9]*)?$/); if (cv.length > 1) { if (cv[1] != "") chapter = cv[1] + ""; if (cv[2] != "" && typeof cv[2] != "undefined") { verse = cv[2] + ""; } else { /// For books with only 1 chapter, the chapter reference is optional (i.e., Jude 4 == Jude 1:4). switch (book) { case "31": case "57": case "63": case "64": case "65": verse = chapter; chapter = "001"; } } zeros = ["", "00", "0", ""]; chapter = zeros[chapter.length] + chapter; verse = zeros[verse.length] + verse; } return book + chapter + verse; }, |
|
if (book == 0) return false; chapter = "001", verse = "001"; | if (book === 0) return false; chapter = "001"; verse = "001"; | determine_reference: function (ref) { var book, chapter, cv, zeros; /// First determine if it is likely a verse reference. if (!books_re.test(ref)) return false; book = 0; switch (ref.slice(0, 1).toLowerCase()) { case "j": if (book_arr_re[43].test(ref)) { /// John book = "43"; break; } else if (book_arr_re[32].test(ref)) { /// Jonah book = "32"; break; } else if (book_arr_re[59].test(ref)) { /// James book = "59"; break; } else if (book_arr_re[6].test(ref)) { /// Joshua book = "6"; break; } else if (book_arr_re[7].test(ref)) { /// Judges book = "7"; break; } else if (book_arr_re[18].test(ref)) { /// Job book = "18"; break; } else if (book_arr_re[65].test(ref)) { /// Jude book = "65"; break; } else if (book_arr_re[24].test(ref)) { /// Jeremiah book = "24"; break; } else if (book_arr_re[29].test(ref)) { /// Joel book = "29"; break; } break; case "r": if (book_arr_re[45].test(ref)) { /// Romans book = "45"; break; } else if (book_arr_re[66].test(ref)) { /// Revelation book = "66"; break; } else if (book_arr_re[8].test(ref)) { /// Ruth book = "8"; break; } break; case "g": if (book_arr_re[1].test(ref)) { /// Genesis book = "1"; break; } else if (book_arr_re[48].test(ref)) { /// Galatians book = "48"; break; } break; case "e": if (book_arr_re[2].test(ref)) { /// Exodus book = "2"; break; } else if (book_arr_re[49].test(ref)) { /// Ephesians book = "49"; break; } else if (book_arr_re[26].test(ref)) { /// Ezekiel book = "26"; break; } else if (book_arr_re[21].test(ref)) { /// Ecclesiastes book = "21"; break; } else if (book_arr_re[17].test(ref)) { /// Esther book = "17"; break; } else if (book_arr_re[15].test(ref)) { /// Ezra book = "15"; break; } break; case "m": if (book_arr_re[40].test(ref)) { /// Matthew book = "40"; break; } else if (book_arr_re[41].test(ref)) { /// Mark book = "41"; break; } else if (book_arr_re[39].test(ref)) { /// Malachi book = "39"; break; } else if (book_arr_re[33].test(ref)) { /// Micah book = "33"; break; } break; case "l": if (book_arr_re[42].test(ref)) { /// Luke book = "42"; break; } else if (book_arr_re[3].test(ref)) { /// Leviticus book = "3"; break; } else if (book_arr_re[25].test(ref)) { /// Lamentations book = "25"; break; } break; case "p": if (book_arr_re[19].test(ref)) { /// Psalms book = "19"; break; } else if (book_arr_re[20].test(ref)) { /// Proverbs book = "20"; break; } else if (book_arr_re[50].test(ref)) { /// Philippians book = "50"; break; } else if (book_arr_re[57].test(ref)) { /// Philemon book = "57"; break; } else if (book_arr_re[60].test(ref)) { /// 1 Peter (Peter) book = "60"; break; } break; case "d": if (book_arr_re[5].test(ref)) { /// Deuteronomy book = "5"; break; } else if (book_arr_re[27].test(ref)) { /// Daniel book = "27"; break; } break; case "i": if (book_arr_re[23].test(ref)) { /// Isaiah book = "23"; break; } ///NOTE: Don't break so that references like "I Kings" will be checked. case "1": case "f": if (book_arr_re[46].test(ref)) { /// 1 Corinthians | First Corinthians| I Corinthians book = "46"; break; } else if (book_arr_re[62].test(ref)) { /// 1 John | First John | I John book = "62"; break; } else if (book_arr_re[54].test(ref)) { /// 1 Timothy | First Timothy | I Timothy book = "54"; break; } else if (book_arr_re[52].test(ref)) { /// 1 Thessalonians | First Thessalonians | I Thessalonians book = "52"; break; } else if (book_arr_re[60].test(ref)) { /// 1 Peter | First Peter | I Peter book = "60"; break; } else if (book_arr_re[9].test(ref)) { /// 1 Samuel | First Samuel | I Samuel book = "9"; break; } else if (book_arr_re[11].test(ref)) { /// 1 Kings | First Kings | I Kings book = "11"; break; } else if (book_arr_re[13].test(ref)) { /// 1 Chronicles | First Chronicles | I Chronicles book = "13"; break; } ///NOTE: Don't break so that references like "II Kings" will be checked. case "2": case "s": if (book_arr_re[47].test(ref)) { /// 2 Corinthians | Second Corinthians| II Corinthians book = "47"; break; } else if (book_arr_re[63].test(ref)) { /// 2 John | Second John | II John book = "63"; break; } else if (book_arr_re[55].test(ref)) { /// 2 Timothy | Second Timothy | II Timothy book = "55"; break; } else if (book_arr_re[53].test(ref)) { /// 2 Thessalonians | Second Thessalonians | II Thessalonians book = "53"; break; } else if (book_arr_re[61].test(ref)) { /// 2 Peter | Second Peter | II Peter book = "61"; break; } else if (book_arr_re[22].test(ref)) { /// Song of Songs book = "22"; break; } else if (book_arr_re[10].test(ref)) { /// 2 Samuel | Second Samuel | II Samuel book = "10"; break; } else if (book_arr_re[12].test(ref)) { /// 2 Kings | Second Kings | II Kings book = "12"; break; } else if (book_arr_re[14].test(ref)) { /// 2 Chronicles | Second Chronicles | II Chronicles book = "14"; break; } else if (book_arr_re[9].test(ref)) { /// 1 Samuel (Samuel) book = "9"; break; } else if (book_arr_re[19].test(ref)) { /// Psalms (Salms) book = "19"; break; } ///NOTE: Don't break so that references like "III John" will be checked. case "3": case "t": if (book_arr_re[64].test(ref)) { /// 3 John | Third John | III John book = "64"; break; } else if (book_arr_re[56].test(ref)) { /// Titus book = "56"; break; } else if (book_arr_re[54].test(ref)) { /// 1 Timothy (Timothy) book = "54"; break; } else if (book_arr_re[52].test(ref)) { /// 1 Thessalonians (Thessalonians) book = "52"; break; } else if (book_arr_re[44].test(ref)) { /// The Acts of the Apostles book = "44"; break; } else if (book_arr_re[22].test(ref)) { /// The Song of Songs book = "22"; break; } break; case "a": if (book_arr_re[44].test(ref)) { /// Acts book = "44"; break; } else if (book_arr_re[30].test(ref)) { /// Amos book = "30"; break; } else if (book_arr_re[66].test(ref)) { /// Revelation (Apocalypse) book = "66"; break; } break; case "c": if (book_arr_re[51].test(ref)) { /// Colossians book = "51"; break; } else if (book_arr_re[46].test(ref)) { /// 1 Corinthians (Corinthians) book = "46"; break; } else if (book_arr_re[22].test(ref)) { /// Song of Songs (Canticles) book = "22"; break; } else if (book_arr_re[13].test(ref)) { /// 1 Chronicles (Chronicles) book = "13"; break; } break; case "h": if (book_arr_re[58].test(ref)) { /// Hebrews book = "58"; break; } else if (book_arr_re[28].test(ref)) { /// Hosea book = "28"; break; } else if (book_arr_re[35].test(ref)) { /// Habakkuk book = "35"; break; } else if (book_arr_re[37].test(ref)) { /// Haggai book = "37"; break; } break; case "n": if (book_arr_re[4].test(ref)) { /// Numbers book = "4"; break; } else if (book_arr_re[16].test(ref)) { /// Nehemiah book = "16"; break; } else if (book_arr_re[34].test(ref)) { /// Nahum book = "34"; break; } break; case "z": if (book_arr_re[38].test(ref)) { /// Zechariah book = "38"; break; } else if (book_arr_re[36].test(ref)) { /// Zephaniah book = "36"; break; } break; case "k": if (book_arr_re[11].test(ref)) { /// 1 Kings (Kings) book = "11"; break; } break; case "o": if (book_arr_re[31].test(ref)) { /// Obadiah book = "31"; break; } break; } if (book == 0) return false; chapter = "001", verse = "001"; /// Finally, we need to determine the chapter and/or verse reference is they are supplied. cv = ref.split(/\s*([0-9]{1,3})(?:[:.;,\s]([0-9]{0,3})[-0-9]*)?$/); if (cv.length > 1) { if (cv[1] != "") chapter = cv[1] + ""; if (cv[2] != "" && typeof cv[2] != "undefined") { verse = cv[2] + ""; } else { /// For books with only 1 chapter, the chapter reference is optional (i.e., Jude 4 == Jude 1:4). switch (book) { case "31": case "57": case "63": case "64": case "65": verse = chapter; chapter = "001"; } } zeros = ["", "00", "0", ""]; chapter = zeros[chapter.length] + chapter; verse = zeros[verse.length] + verse; } return book + chapter + verse; }, |
var split_pos, morph_json, morph_attribute_json, morph_attributes, split_start, morph_search_term; | var morph_attribute_json, morph_attributes, morph_json, morph_search_term, split_start, split_pos; | function determine_search_type(search_terms) { var split_pos, morph_json, morph_attribute_json, morph_attributes, split_start, morph_search_term; /// Did the user use the morphological keyword in his search? if ((split_pos = search_terms.indexOf(lang.morph_marker)) != -1) { ///TODO: Determine what is better: a JSON array or POST/GET string (i.e., word1=word&grammar_type1=1&value1=3&include1=1&...). /// A JSON array is used to contain the information about the search. /// JSON format: '["WORD",[[GRAMMAR_TYPE1,VALUE1],[...]],[INCLUDE1,...]]' /// replace(/(["'])/g, "\\$1") adds slashes to sanitize the data. morph_search_term = search_terms.slice(0, split_pos); /// Is the user trying to find all words that match the morphological attributes? if (morph_search_term == "*") { /// Sphinx will find all words if no query is present, so we need to send a blank search request. morph_search_term = "" } morph_json = '["' + morph_search_term.replace(/(["'])/g, "\\$1") + '",['; /// These strings will be used to concatenate data. morph_attribute_json = "", exclude_json = ""; morph_attributes = search_terms.slice(split_pos + lang.morph_marker_len); split_start = 0; ///TODO: Determine if there is a benefit to using do() over while(). ///NOTE: An infinite loop is used because the data is returned when it reaches the end of the string. do { /// Find where the attributes separate (e.g., "NOUN, GENITIVE" would separate at character 4). split_pos = morph_attributes.indexOf(lang.morph_separator, split_start); /// Trim leading white space. if (morph_attributes.slice(split_start, split_start + 1) == " ") ++split_start; /// Is this morphological feature to be excluded? if (morph_attributes.slice(split_start, split_start + 1) == "-") { /// Skip the hyphen so that we just get the grammatical word (e.g., "love AS -NOUN" we just want "NOUN"). ++split_start; exclude_json += "1,"; } else { exclude_json += "0,"; } if (split_pos > -1) { morph_attribute_json += lang.morph_grammar[morph_attributes.slice(split_start, split_pos).trim()] + ","; split_start = split_pos + 1; } else { ///TODO: Determine if trim() is necessary or if there is a better implementation. ///NOTE: exclude_json.slice(0, -1) is used to remove the trailing comma. This could be unnecessary. return [MORPHOLOGICAL_SEARCH, morph_json + morph_attribute_json + lang.morph_grammar[morph_attributes.slice(split_start).trim()] + "],[" + exclude_json.slice(0, -1) + "]]"]; } } while (true); } /// The search is just a standard search. return [STANDARD_SEARCH]; } |
var morph_attribute_json, | var exclude_json = "", morph_attribute_json = "", | function determine_search_type(search_terms) { var morph_attribute_json, morph_attributes, morph_json, morph_search_term, split_start, split_pos; /// Did the user use the morphological keyword in his search? if ((split_pos = search_terms.indexOf(lang.morph_marker)) != -1) { ///TODO: Determine what is better: a JSON array or POST/GET string (i.e., word1=word&grammar_type1=1&value1=3&include1=1&...). /// A JSON array is used to contain the information about the search. /// JSON format: '["WORD",[[GRAMMAR_TYPE1,VALUE1],[...]],[INCLUDE1,...]]' /// replace(/(["'])/g, "\\$1") adds slashes to sanitize the data. morph_search_term = search_terms.slice(0, split_pos); /// Is the user trying to find all words that match the morphological attributes? if (morph_search_term == "*") { /// Sphinx will find all words if no query is present, so we need to send a blank search request. morph_search_term = "" } morph_json = '["' + morph_search_term.replace(/(["'])/g, "\\$1") + '",['; /// These strings will be used to concatenate data. morph_attribute_json = "", exclude_json = ""; morph_attributes = search_terms.slice(split_pos + lang.morph_marker_len); split_start = 0; ///TODO: Determine if there is a benefit to using do() over while(). ///NOTE: An infinite loop is used because the data is returned when it reaches the end of the string. do { /// Find where the attributes separate (e.g., "NOUN, GENITIVE" would separate at character 4). split_pos = morph_attributes.indexOf(lang.morph_separator, split_start); /// Trim leading white space. if (morph_attributes.slice(split_start, split_start + 1) == " ") ++split_start; /// Is this morphological feature to be excluded? if (morph_attributes.slice(split_start, split_start + 1) == "-") { /// Skip the hyphen so that we just get the grammatical word (e.g., "love AS -NOUN" we just want "NOUN"). ++split_start; exclude_json += "1,"; } else { exclude_json += "0,"; } if (split_pos > -1) { morph_attribute_json += lang.morph_grammar[morph_attributes.slice(split_start, split_pos).trim()] + ","; split_start = split_pos + 1; } else { ///TODO: Determine if trim() is necessary or if there is a better implementation. ///NOTE: exclude_json.slice(0, -1) is used to remove the trailing comma. This could be unnecessary. return [MORPHOLOGICAL_SEARCH, morph_json + morph_attribute_json + lang.morph_grammar[morph_attributes.slice(split_start).trim()] + "],[" + exclude_json.slice(0, -1) + "]]"]; } } while (true); } /// The search is just a standard search. return [STANDARD_SEARCH]; } |
morph_json, | morph_json = "", | function determine_search_type(search_terms) { var morph_attribute_json, morph_attributes, morph_json, morph_search_term, split_start, split_pos; /// Did the user use the morphological keyword in his search? if ((split_pos = search_terms.indexOf(lang.morph_marker)) != -1) { ///TODO: Determine what is better: a JSON array or POST/GET string (i.e., word1=word&grammar_type1=1&value1=3&include1=1&...). /// A JSON array is used to contain the information about the search. /// JSON format: '["WORD",[[GRAMMAR_TYPE1,VALUE1],[...]],[INCLUDE1,...]]' /// replace(/(["'])/g, "\\$1") adds slashes to sanitize the data. morph_search_term = search_terms.slice(0, split_pos); /// Is the user trying to find all words that match the morphological attributes? if (morph_search_term == "*") { /// Sphinx will find all words if no query is present, so we need to send a blank search request. morph_search_term = "" } morph_json = '["' + morph_search_term.replace(/(["'])/g, "\\$1") + '",['; /// These strings will be used to concatenate data. morph_attribute_json = "", exclude_json = ""; morph_attributes = search_terms.slice(split_pos + lang.morph_marker_len); split_start = 0; ///TODO: Determine if there is a benefit to using do() over while(). ///NOTE: An infinite loop is used because the data is returned when it reaches the end of the string. do { /// Find where the attributes separate (e.g., "NOUN, GENITIVE" would separate at character 4). split_pos = morph_attributes.indexOf(lang.morph_separator, split_start); /// Trim leading white space. if (morph_attributes.slice(split_start, split_start + 1) == " ") ++split_start; /// Is this morphological feature to be excluded? if (morph_attributes.slice(split_start, split_start + 1) == "-") { /// Skip the hyphen so that we just get the grammatical word (e.g., "love AS -NOUN" we just want "NOUN"). ++split_start; exclude_json += "1,"; } else { exclude_json += "0,"; } if (split_pos > -1) { morph_attribute_json += lang.morph_grammar[morph_attributes.slice(split_start, split_pos).trim()] + ","; split_start = split_pos + 1; } else { ///TODO: Determine if trim() is necessary or if there is a better implementation. ///NOTE: exclude_json.slice(0, -1) is used to remove the trailing comma. This could be unnecessary. return [MORPHOLOGICAL_SEARCH, morph_json + morph_attribute_json + lang.morph_grammar[morph_attributes.slice(split_start).trim()] + "],[" + exclude_json.slice(0, -1) + "]]"]; } } while (true); } /// The search is just a standard search. return [STANDARD_SEARCH]; } |
morph_search_term = "" | morph_search_term = ""; | function determine_search_type(search_terms) { var morph_attribute_json, morph_attributes, morph_json, morph_search_term, split_start, split_pos; /// Did the user use the morphological keyword in his search? if ((split_pos = search_terms.indexOf(lang.morph_marker)) != -1) { ///TODO: Determine what is better: a JSON array or POST/GET string (i.e., word1=word&grammar_type1=1&value1=3&include1=1&...). /// A JSON array is used to contain the information about the search. /// JSON format: '["WORD",[[GRAMMAR_TYPE1,VALUE1],[...]],[INCLUDE1,...]]' /// replace(/(["'])/g, "\\$1") adds slashes to sanitize the data. morph_search_term = search_terms.slice(0, split_pos); /// Is the user trying to find all words that match the morphological attributes? if (morph_search_term == "*") { /// Sphinx will find all words if no query is present, so we need to send a blank search request. morph_search_term = "" } morph_json = '["' + morph_search_term.replace(/(["'])/g, "\\$1") + '",['; /// These strings will be used to concatenate data. morph_attribute_json = "", exclude_json = ""; morph_attributes = search_terms.slice(split_pos + lang.morph_marker_len); split_start = 0; ///TODO: Determine if there is a benefit to using do() over while(). ///NOTE: An infinite loop is used because the data is returned when it reaches the end of the string. do { /// Find where the attributes separate (e.g., "NOUN, GENITIVE" would separate at character 4). split_pos = morph_attributes.indexOf(lang.morph_separator, split_start); /// Trim leading white space. if (morph_attributes.slice(split_start, split_start + 1) == " ") ++split_start; /// Is this morphological feature to be excluded? if (morph_attributes.slice(split_start, split_start + 1) == "-") { /// Skip the hyphen so that we just get the grammatical word (e.g., "love AS -NOUN" we just want "NOUN"). ++split_start; exclude_json += "1,"; } else { exclude_json += "0,"; } if (split_pos > -1) { morph_attribute_json += lang.morph_grammar[morph_attributes.slice(split_start, split_pos).trim()] + ","; split_start = split_pos + 1; } else { ///TODO: Determine if trim() is necessary or if there is a better implementation. ///NOTE: exclude_json.slice(0, -1) is used to remove the trailing comma. This could be unnecessary. return [MORPHOLOGICAL_SEARCH, morph_json + morph_attribute_json + lang.morph_grammar[morph_attributes.slice(split_start).trim()] + "],[" + exclude_json.slice(0, -1) + "]]"]; } } while (true); } /// The search is just a standard search. return [STANDARD_SEARCH]; } |
morph_attribute_json = "", exclude_json = ""; | function determine_search_type(search_terms) { var morph_attribute_json, morph_attributes, morph_json, morph_search_term, split_start, split_pos; /// Did the user use the morphological keyword in his search? if ((split_pos = search_terms.indexOf(lang.morph_marker)) != -1) { ///TODO: Determine what is better: a JSON array or POST/GET string (i.e., word1=word&grammar_type1=1&value1=3&include1=1&...). /// A JSON array is used to contain the information about the search. /// JSON format: '["WORD",[[GRAMMAR_TYPE1,VALUE1],[...]],[INCLUDE1,...]]' /// replace(/(["'])/g, "\\$1") adds slashes to sanitize the data. morph_search_term = search_terms.slice(0, split_pos); /// Is the user trying to find all words that match the morphological attributes? if (morph_search_term == "*") { /// Sphinx will find all words if no query is present, so we need to send a blank search request. morph_search_term = "" } morph_json = '["' + morph_search_term.replace(/(["'])/g, "\\$1") + '",['; /// These strings will be used to concatenate data. morph_attribute_json = "", exclude_json = ""; morph_attributes = search_terms.slice(split_pos + lang.morph_marker_len); split_start = 0; ///TODO: Determine if there is a benefit to using do() over while(). ///NOTE: An infinite loop is used because the data is returned when it reaches the end of the string. do { /// Find where the attributes separate (e.g., "NOUN, GENITIVE" would separate at character 4). split_pos = morph_attributes.indexOf(lang.morph_separator, split_start); /// Trim leading white space. if (morph_attributes.slice(split_start, split_start + 1) == " ") ++split_start; /// Is this morphological feature to be excluded? if (morph_attributes.slice(split_start, split_start + 1) == "-") { /// Skip the hyphen so that we just get the grammatical word (e.g., "love AS -NOUN" we just want "NOUN"). ++split_start; exclude_json += "1,"; } else { exclude_json += "0,"; } if (split_pos > -1) { morph_attribute_json += lang.morph_grammar[morph_attributes.slice(split_start, split_pos).trim()] + ","; split_start = split_pos + 1; } else { ///TODO: Determine if trim() is necessary or if there is a better implementation. ///NOTE: exclude_json.slice(0, -1) is used to remove the trailing comma. This could be unnecessary. return [MORPHOLOGICAL_SEARCH, morph_json + morph_attribute_json + lang.morph_grammar[morph_attributes.slice(split_start).trim()] + "],[" + exclude_json.slice(0, -1) + "]]"]; } } while (true); } /// The search is just a standard search. return [STANDARD_SEARCH]; } |
|
if (morph_attributes.slice(split_start, split_start + 1) == " ") ++split_start; | if (morph_attributes.slice(split_start, split_start + 1) === " ") ++split_start; | function determine_search_type(search_terms) { var morph_attribute_json, morph_attributes, morph_json, morph_search_term, split_start, split_pos; /// Did the user use the morphological keyword in his search? if ((split_pos = search_terms.indexOf(lang.morph_marker)) != -1) { ///TODO: Determine what is better: a JSON array or POST/GET string (i.e., word1=word&grammar_type1=1&value1=3&include1=1&...). /// A JSON array is used to contain the information about the search. /// JSON format: '["WORD",[[GRAMMAR_TYPE1,VALUE1],[...]],[INCLUDE1,...]]' /// replace(/(["'])/g, "\\$1") adds slashes to sanitize the data. morph_search_term = search_terms.slice(0, split_pos); /// Is the user trying to find all words that match the morphological attributes? if (morph_search_term == "*") { /// Sphinx will find all words if no query is present, so we need to send a blank search request. morph_search_term = "" } morph_json = '["' + morph_search_term.replace(/(["'])/g, "\\$1") + '",['; /// These strings will be used to concatenate data. morph_attribute_json = "", exclude_json = ""; morph_attributes = search_terms.slice(split_pos + lang.morph_marker_len); split_start = 0; ///TODO: Determine if there is a benefit to using do() over while(). ///NOTE: An infinite loop is used because the data is returned when it reaches the end of the string. do { /// Find where the attributes separate (e.g., "NOUN, GENITIVE" would separate at character 4). split_pos = morph_attributes.indexOf(lang.morph_separator, split_start); /// Trim leading white space. if (morph_attributes.slice(split_start, split_start + 1) == " ") ++split_start; /// Is this morphological feature to be excluded? if (morph_attributes.slice(split_start, split_start + 1) == "-") { /// Skip the hyphen so that we just get the grammatical word (e.g., "love AS -NOUN" we just want "NOUN"). ++split_start; exclude_json += "1,"; } else { exclude_json += "0,"; } if (split_pos > -1) { morph_attribute_json += lang.morph_grammar[morph_attributes.slice(split_start, split_pos).trim()] + ","; split_start = split_pos + 1; } else { ///TODO: Determine if trim() is necessary or if there is a better implementation. ///NOTE: exclude_json.slice(0, -1) is used to remove the trailing comma. This could be unnecessary. return [MORPHOLOGICAL_SEARCH, morph_json + morph_attribute_json + lang.morph_grammar[morph_attributes.slice(split_start).trim()] + "],[" + exclude_json.slice(0, -1) + "]]"]; } } while (true); } /// The search is just a standard search. return [STANDARD_SEARCH]; } |
d.extend({filter:function(a,b,e){if(e)a=":not("+a+")";return d.find.matches(a,b)},dir:function(a,b,e){var g=[];for(a=a[b];a&&a.nodeType!==9&&(e===v||!d(a).is(e));){a.nodeType===1&&g.push(a);a=a[b]}return g},nth:function(a,b,e){b=b||1;for(var g=0;a;a=a[e])if(a.nodeType===1&&++g===b)break;return a},sibling:function(a,b){for(var e=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&e.push(a);return e}});var ia=/[\n\t]/g,W=/\s+/,Ea=/\r/g,Fa=/href|src|style/,Ga=/(button|input)/i,Ha=/(button|input|object|select|textarea)/i, | (f=e);if(f&&typeof f==="string")h=c.filter(f,h);h=this.length>1?c.unique(h):h;if((this.length>1||Da.test(f))&&Ca.test(a))h=h.reverse();return this.pushStack(h,a,I.call(arguments).join(","))}});c.extend({filter:function(a,b,e){if(e)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,e){var f=[];for(a=a[b];a&&a.nodeType!==9&&(e===v||!c(a).is(e));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,e){b=b||1;for(var f=0;a;a=a[e])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a, | d.extend({filter:function(a,b,e){if(e)a=":not("+a+")";return d.find.matches(a,b)},dir:function(a,b,e){var g=[];for(a=a[b];a&&a.nodeType!==9&&(e===v||!d(a).is(e));){a.nodeType===1&&g.push(a);a=a[b]}return g},nth:function(a,b,e){b=b||1;for(var g=0;a;a=a[e])if(a.nodeType===1&&++g===b)break;return a},sibling:function(a,b){for(var e=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&e.push(a);return e}});var ia=/[\n\t]/g,W=/\s+/,Ea=/\r/g,Fa=/href|src|style/,Ga=/(button|input)/i,Ha=/(button|input|object|select|textarea)/i, |
CasesBPMAssets.closeAccessRightsSetterBox(event); | CasesBPMAssets.closeAccessRightsSetterBox(event, null); | CasesBPMAssets.disableAttachmentForAllRoles = function(event, fileHash, processInstanceId, taskInstanceId) { if (!window.confirm(CasesBPMAssets.Loc.CASE_GRID_STRING_ARE_YOU_SURE)) { return false; } BPMProcessAssets.disableAttachmentForAllRoles(fileHash, processInstanceId, taskInstanceId, { callback: function(result) { if (result) { CasesBPMAssets.closeAccessRightsSetterBox(event); } } });} |
{};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_TABULAR;return this.execute(a)},executeMultiDimensional:function(a){if(!a.properties)a.properties={};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_MULTIDIMENSIONAL;return this.execute(a)},discover:function(a){a=h(a,{method:Xmla.METHOD_DISCOVER},true);return this.request(a)},discoverDataSources:function(a){a=h(a,{requestType:Xmla.DISCOVER_DATASOURCES},true);return this.discover(a)},discoverProperties:function(a){a=h(a,{requestType:Xmla.DISCOVER_PROPERTIES}, | {};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_TABULAR;return this.execute(a)},executeMultiDimensional:function(a){if(!a.properties)a.properties={};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_MULTIDIMENSIONAL;return this.execute(a)},discover:function(a){a=g(a,{method:Xmla.METHOD_DISCOVER},true);return this.request(a)},discoverDataSources:function(a){a=g(a,{requestType:Xmla.DISCOVER_DATASOURCES},true);return this.discover(a)},discoverProperties:function(a){a=g(a,{requestType:Xmla.DISCOVER_PROPERTIES}, | {};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_TABULAR;return this.execute(a)},executeMultiDimensional:function(a){if(!a.properties)a.properties={};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_MULTIDIMENSIONAL;return this.execute(a)},discover:function(a){a=h(a,{method:Xmla.METHOD_DISCOVER},true);return this.request(a)},discoverDataSources:function(a){a=h(a,{requestType:Xmla.DISCOVER_DATASOURCES},true);return this.discover(a)},discoverProperties:function(a){a=h(a,{requestType:Xmla.DISCOVER_PROPERTIES}, |
if (this.ctx == null) { console.log('WGLWidget: failed to get a webgl context'); } | this.discoverContext = function() { if (canvas.getContext) { this.ctx = canvas.getContext('experimental-webgl'); if (this.ctx == null) { this.ctx = canvas.getContext('webgl'); } if (this.ctx == null) { console.log('WGLWidget: failed to get a webgl context'); } } return this.ctx; } |
|
this.ctx = canvas.getContext('webgl'); | this.ctx = canvas.getContext('webgl', {antialias: true}); | this.discoverContext = function(noGLHandler) { if (canvas.getContext) { try { this.ctx = canvas.getContext('webgl'); } catch (e) {} if (this.ctx == null) { try { this.ctx = canvas.getContext('experimental-webgl'); } catch (e) {} } if (this.ctx == null) { var alternative = canvas.firstChild; var parentNode = canvas.parentNode; parentNode.replaceChild(alternative, canvas); noGLHandler(); } } return this.ctx; }; |
WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(p,j){jQuery.data(j,"obj",this);var h=p.WT;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var f=null,g=null,k=null,l=0,m=0,c=null,n=0,o=0;this.discoverContext=function(){if(j.getContext){this.ctx=j.getContext("experimental-webgl");if(this.ctx==null)this.ctx=j.getContext("webgl");this.ctx==null&&console.log("WGLWidget: failed to get a webgl context")}console.log("ctx: "+this.ctx);return this.ctx};this.setLookAtParams=function(a,b,d, | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl");this.ctx==null&&console.log("WGLWidget: failed to get a webgl context")}return this.ctx};this.setLookAtParams=function(a, | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(p,j){jQuery.data(j,"obj",this);var h=p.WT;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var f=null,g=null,k=null,l=0,m=0,c=null,n=0,o=0;this.discoverContext=function(){if(j.getContext){this.ctx=j.getContext("experimental-webgl");if(this.ctx==null)this.ctx=j.getContext("webgl");this.ctx==null&&console.log("WGLWidget: failed to get a webgl context")}console.log("ctx: "+this.ctx);return this.ctx};this.setLookAtParams=function(a,b,d, |
this.discoverContext = function() { | this.discoverContext = function(noGLHandler) { | this.discoverContext = function() { if (canvas.getContext) { this.ctx = canvas.getContext('experimental-webgl'); if (this.ctx == null) { this.ctx = canvas.getContext('webgl'); } //if (this.ctx == null) { // console.log('WGLWidget: failed to get a webgl context'); //} } return this.ctx; } |
this.ctx = canvas.getContext('experimental-webgl'); | try { this.ctx = canvas.getContext('webgl'); } catch (e) {} | this.discoverContext = function() { if (canvas.getContext) { this.ctx = canvas.getContext('experimental-webgl'); if (this.ctx == null) { this.ctx = canvas.getContext('webgl'); } //if (this.ctx == null) { // console.log('WGLWidget: failed to get a webgl context'); //} } return this.ctx; } |
this.ctx = canvas.getContext('webgl'); | try { this.ctx = canvas.getContext('experimental-webgl'); } catch (e) {} | this.discoverContext = function() { if (canvas.getContext) { this.ctx = canvas.getContext('experimental-webgl'); if (this.ctx == null) { this.ctx = canvas.getContext('webgl'); } //if (this.ctx == null) { // console.log('WGLWidget: failed to get a webgl context'); //} } return this.ctx; } |
if (this.ctx == null) { var alternative = canvas.firstChild; var parentNode = canvas.parentNode; parentNode.replaceChild(alternative, canvas); noGLHandler(); } | this.discoverContext = function() { if (canvas.getContext) { this.ctx = canvas.getContext('experimental-webgl'); if (this.ctx == null) { this.ctx = canvas.getContext('webgl'); } //if (this.ctx == null) { // console.log('WGLWidget: failed to get a webgl context'); //} } return this.ctx; } |
|
} | }; | this.discoverContext = function() { if (canvas.getContext) { this.ctx = canvas.getContext('experimental-webgl'); if (this.ctx == null) { this.ctx = canvas.getContext('webgl'); } //if (this.ctx == null) { // console.log('WGLWidget: failed to get a webgl context'); //} } return this.ctx; } |
WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,j){jQuery.data(j,"obj",this);var f=r.WT,l=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(a){if(j.getContext){try{this.ctx=j.getContext("webgl")}catch(c){}if(this.ctx==null)try{this.ctx=j.getContext("experimental-webgl")}catch(d){}if(this.ctx==null){j.parentNode.replaceChild(j.firstChild,j);a()}}return this.ctx};this.setLookAtParams= | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,j){jQuery.data(j,"obj",this);var f=r.WT,l=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};this.resizeGL=function(){};this.updates=[];this.initialized=false;var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(a){if(j.getContext){try{this.ctx=j.getContext("webgl",{antialias:true})}catch(c){}if(this.ctx==null)try{this.ctx=j.getContext("experimental-webgl")}catch(d){}if(this.ctx== null){j.parentNode.replaceChild(j.firstChild,j);a()}}return this.ctx};this.setLookAtParams=function(a,c,d,g,k){e=a;i=c;m=d;n=g;o=k};this.mouseDragLookAt=function(a,c){if(this.ctx!=null){var d=f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=l.create();g[0]=e[0];g[1]=e[4];g[2]=e[8];var k=b.create();b.identity(k);b.translate(k,i);b.rotate(k,d*n,g);b.rotate(k,a*o,m);l.negate(i);b.translate(k,i);l.negate(i);b.multiply(e,k,e);this.paintGL();h=f.pageCoordinates(c)}};this.mouseWheelLookAt=function(a,c){if(this.ctx!= | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,j){jQuery.data(j,"obj",this);var f=r.WT,l=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(a){if(j.getContext){try{this.ctx=j.getContext("webgl")}catch(c){}if(this.ctx==null)try{this.ctx=j.getContext("experimental-webgl")}catch(d){}if(this.ctx==null){j.parentNode.replaceChild(j.firstChild,j);a()}}return this.ctx};this.setLookAtParams= |
WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl")}return this.ctx};this.setLookAtParams=function(a,c,d,g,j){e=a;i=c;m=d;n=g;o=j};this.mouseDragLookAt=function(a,c){var d= | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,j){jQuery.data(j,"obj",this);var f=r.WT,l=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(a){if(j.getContext){try{this.ctx=j.getContext("webgl")}catch(c){}if(this.ctx==null)try{this.ctx=j.getContext("experimental-webgl")}catch(d){}if(this.ctx==null){j.parentNode.replaceChild(j.firstChild,j);a()}}return this.ctx};this.setLookAtParams= | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl")}return this.ctx};this.setLookAtParams=function(a,c,d,g,j){e=a;i=c;m=d;n=g;o=j};this.mouseDragLookAt=function(a,c){var d= |
WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl");this.ctx==null&&console.log("WGLWidget: failed to get a webgl context")}return this.ctx};this.setLookAtParams=function(a, | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl")}return this.ctx};this.setLookAtParams=function(a,c,d,g,j){e=a;i=c;m=d;n=g;o=j};this.mouseDragLookAt=function(a,c){var d= | WT_DECLARE_WT_MEMBER(1,"WGLWidget",function(r,l){jQuery.data(l,"obj",this);var f=r.WT,k=f.glMatrix.vec3,b=f.glMatrix.mat4;this.ctx=null;this.initializeGL=function(){};this.paintGL=function(){};var h=null,i=null,m=null,n=0,o=0,e=null,p=0,q=0;this.discoverContext=function(){if(l.getContext){this.ctx=l.getContext("experimental-webgl");if(this.ctx==null)this.ctx=l.getContext("webgl");this.ctx==null&&console.log("WGLWidget: failed to get a webgl context")}return this.ctx};this.setLookAtParams=function(a, |
console.log('ctx: ' + this.ctx); | this.discoverContext = function() { if (canvas.getContext) { this.ctx = canvas.getContext('experimental-webgl'); if (this.ctx == null) { this.ctx = canvas.getContext('webgl'); } if (this.ctx == null) { console.log('WGLWidget: failed to get a webgl context'); } } console.log('ctx: ' + this.ctx); return this.ctx; } |
|
true);return this.discover(a)},discoverSchemaRowsets:function(a){a=h(a,{requestType:Xmla.DISCOVER_SCHEMA_ROWSETS},true);return this.discover(a)},discoverEnumerators:function(a){a=h(a,{requestType:Xmla.DISCOVER_ENUMERATORS},true);return this.discover(a)},discoverKeywords:function(a){a=h(a,{requestType:Xmla.DISCOVER_KEYWORDS},true);return this.discover(a)},discoverLiterals:function(a){a=h(a,{requestType:Xmla.DISCOVER_LITERALS},true);return this.discover(a)},discoverDBCatalogs:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_CATALOGS}, true);return this.discover(a)},discoverDBColumns:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_COLUMNS},true);return this.discover(a)},discoverDBProviderTypes:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_PROVIDER_TYPES},true);return this.discover(a)},discoverDBSchemata:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_SCHEMATA},true);return this.discover(a)},discoverDBTables:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES},true);return this.discover(a)},discoverDBTablesInfo:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES_INFO}, | true);return this.discover(a)},discoverSchemaRowsets:function(a){a=g(a,{requestType:Xmla.DISCOVER_SCHEMA_ROWSETS},true);return this.discover(a)},discoverEnumerators:function(a){a=g(a,{requestType:Xmla.DISCOVER_ENUMERATORS},true);return this.discover(a)},discoverKeywords:function(a){a=g(a,{requestType:Xmla.DISCOVER_KEYWORDS},true);return this.discover(a)},discoverLiterals:function(a){a=g(a,{requestType:Xmla.DISCOVER_LITERALS},true);return this.discover(a)},discoverDBCatalogs:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_CATALOGS}, true);return this.discover(a)},discoverDBColumns:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_COLUMNS},true);return this.discover(a)},discoverDBProviderTypes:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_PROVIDER_TYPES},true);return this.discover(a)},discoverDBSchemata:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_SCHEMATA},true);return this.discover(a)},discoverDBTables:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_TABLES},true);return this.discover(a)},discoverDBTablesInfo:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_TABLES_INFO}, | true);return this.discover(a)},discoverSchemaRowsets:function(a){a=h(a,{requestType:Xmla.DISCOVER_SCHEMA_ROWSETS},true);return this.discover(a)},discoverEnumerators:function(a){a=h(a,{requestType:Xmla.DISCOVER_ENUMERATORS},true);return this.discover(a)},discoverKeywords:function(a){a=h(a,{requestType:Xmla.DISCOVER_KEYWORDS},true);return this.discover(a)},discoverLiterals:function(a){a=h(a,{requestType:Xmla.DISCOVER_LITERALS},true);return this.discover(a)},discoverDBCatalogs:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_CATALOGS},true);return this.discover(a)},discoverDBColumns:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_COLUMNS},true);return this.discover(a)},discoverDBProviderTypes:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_PROVIDER_TYPES},true);return this.discover(a)},discoverDBSchemata:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_SCHEMATA},true);return this.discover(a)},discoverDBTables:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES},true);return this.discover(a)},discoverDBTablesInfo:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES_INFO}, |
true);return this.discover(a)},discoverDBColumns:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_COLUMNS},true);return this.discover(a)},discoverDBProviderTypes:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_PROVIDER_TYPES},true);return this.discover(a)},discoverDBSchemata:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_SCHEMATA},true);return this.discover(a)},discoverDBTables:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES},true);return this.discover(a)},discoverDBTablesInfo:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES_INFO}, | true);return this.discover(a)},discoverDBColumns:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_COLUMNS},true);return this.discover(a)},discoverDBProviderTypes:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_PROVIDER_TYPES},true);return this.discover(a)},discoverDBSchemata:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_SCHEMATA},true);return this.discover(a)},discoverDBTables:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_TABLES},true);return this.discover(a)},discoverDBTablesInfo:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_TABLES_INFO}, | true);return this.discover(a)},discoverDBColumns:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_COLUMNS},true);return this.discover(a)},discoverDBProviderTypes:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_PROVIDER_TYPES},true);return this.discover(a)},discoverDBSchemata:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_SCHEMATA},true);return this.discover(a)},discoverDBTables:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES},true);return this.discover(a)},discoverDBTablesInfo:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES_INFO}, |
true);return this.discover(a)},discoverDBColumns:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_COLUMNS},true);return this.discover(a)},discoverDBProviderTypes:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_PROVIDER_TYPES},true);return this.discover(a)},discoverDBSchemata:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_SCHEMATA},true);return this.discover(a)},discoverDBTables:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES},true);return this.discover(a)},discoverDBTablesInfo:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES_INFO}, true);return this.discover(a)},discoverMDActions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_ACTIONS},true);return this.discover(a)},discoverMDCubes:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_CUBES},true);return this.discover(a)},discoverMDDimensions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_DIMENSIONS},true);return this.discover(a)},discoverMDFunctions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_FUNCTIONS},true);return this.discover(a)},discoverMDHierarchies:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_HIERARCHIES}, | true);return this.discover(a)},discoverDBColumns:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_COLUMNS},true);return this.discover(a)},discoverDBProviderTypes:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_PROVIDER_TYPES},true);return this.discover(a)},discoverDBSchemata:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_SCHEMATA},true);return this.discover(a)},discoverDBTables:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_TABLES},true);return this.discover(a)},discoverDBTablesInfo:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_TABLES_INFO}, true);return this.discover(a)},discoverMDActions:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_ACTIONS},true);return this.discover(a)},discoverMDCubes:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_CUBES},true);return this.discover(a)},discoverMDDimensions:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_DIMENSIONS},true);return this.discover(a)},discoverMDFunctions:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_FUNCTIONS},true);return this.discover(a)},discoverMDHierarchies:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_HIERARCHIES}, | true);return this.discover(a)},discoverDBColumns:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_COLUMNS},true);return this.discover(a)},discoverDBProviderTypes:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_PROVIDER_TYPES},true);return this.discover(a)},discoverDBSchemata:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_SCHEMATA},true);return this.discover(a)},discoverDBTables:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES},true);return this.discover(a)},discoverDBTablesInfo:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_TABLES_INFO},true);return this.discover(a)},discoverMDActions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_ACTIONS},true);return this.discover(a)},discoverMDCubes:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_CUBES},true);return this.discover(a)},discoverMDDimensions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_DIMENSIONS},true);return this.discover(a)},discoverMDFunctions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_FUNCTIONS},true);return this.discover(a)},discoverMDHierarchies:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_HIERARCHIES}, |
true);return this.discover(a)},discoverSchemaRowsets:function(a){a=h(a,{requestType:Xmla.DISCOVER_SCHEMA_ROWSETS},true);return this.discover(a)},discoverEnumerators:function(a){a=h(a,{requestType:Xmla.DISCOVER_ENUMERATORS},true);return this.discover(a)},discoverKeywords:function(a){a=h(a,{requestType:Xmla.DISCOVER_KEYWORDS},true);return this.discover(a)},discoverLiterals:function(a){a=h(a,{requestType:Xmla.DISCOVER_LITERALS},true);return this.discover(a)},discoverDBCatalogs:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_CATALOGS}, | true);return this.discover(a)},discoverSchemaRowsets:function(a){a=g(a,{requestType:Xmla.DISCOVER_SCHEMA_ROWSETS},true);return this.discover(a)},discoverEnumerators:function(a){a=g(a,{requestType:Xmla.DISCOVER_ENUMERATORS},true);return this.discover(a)},discoverKeywords:function(a){a=g(a,{requestType:Xmla.DISCOVER_KEYWORDS},true);return this.discover(a)},discoverLiterals:function(a){a=g(a,{requestType:Xmla.DISCOVER_LITERALS},true);return this.discover(a)},discoverDBCatalogs:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_CATALOGS}, | true);return this.discover(a)},discoverSchemaRowsets:function(a){a=h(a,{requestType:Xmla.DISCOVER_SCHEMA_ROWSETS},true);return this.discover(a)},discoverEnumerators:function(a){a=h(a,{requestType:Xmla.DISCOVER_ENUMERATORS},true);return this.discover(a)},discoverKeywords:function(a){a=h(a,{requestType:Xmla.DISCOVER_KEYWORDS},true);return this.discover(a)},discoverLiterals:function(a){a=h(a,{requestType:Xmla.DISCOVER_LITERALS},true);return this.discover(a)},discoverDBCatalogs:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_CATALOGS}, |
true);return this.discover(a)},discoverMDActions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_ACTIONS},true);return this.discover(a)},discoverMDCubes:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_CUBES},true);return this.discover(a)},discoverMDDimensions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_DIMENSIONS},true);return this.discover(a)},discoverMDFunctions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_FUNCTIONS},true);return this.discover(a)},discoverMDHierarchies:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_HIERARCHIES}, | true);return this.discover(a)},discoverMDActions:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_ACTIONS},true);return this.discover(a)},discoverMDCubes:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_CUBES},true);return this.discover(a)},discoverMDDimensions:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_DIMENSIONS},true);return this.discover(a)},discoverMDFunctions:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_FUNCTIONS},true);return this.discover(a)},discoverMDHierarchies:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_HIERARCHIES}, | true);return this.discover(a)},discoverMDActions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_ACTIONS},true);return this.discover(a)},discoverMDCubes:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_CUBES},true);return this.discover(a)},discoverMDDimensions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_DIMENSIONS},true);return this.discover(a)},discoverMDFunctions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_FUNCTIONS},true);return this.discover(a)},discoverMDHierarchies:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_HIERARCHIES}, |
true);return this.discover(a)},discoverMDActions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_ACTIONS},true);return this.discover(a)},discoverMDCubes:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_CUBES},true);return this.discover(a)},discoverMDDimensions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_DIMENSIONS},true);return this.discover(a)},discoverMDFunctions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_FUNCTIONS},true);return this.discover(a)},discoverMDHierarchies:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_HIERARCHIES}, true);return this.discover(a)},discoverMDLevels:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_LEVELS},true);return this.discover(a)},discoverMDMeasures:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEASURES},true);return this.discover(a)},discoverMDMembers:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEMBERS},true);return this.discover(a)},discoverMDProperties:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_PROPERTIES},true);return this.discover(a)},discoverMDSets:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_SETS}, | true);return this.discover(a)},discoverMDActions:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_ACTIONS},true);return this.discover(a)},discoverMDCubes:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_CUBES},true);return this.discover(a)},discoverMDDimensions:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_DIMENSIONS},true);return this.discover(a)},discoverMDFunctions:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_FUNCTIONS},true);return this.discover(a)},discoverMDHierarchies:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_HIERARCHIES}, true);return this.discover(a)},discoverMDLevels:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_LEVELS},true);return this.discover(a)},discoverMDMeasures:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_MEASURES},true);return this.discover(a)},discoverMDMembers:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_MEMBERS},true);return this.discover(a)},discoverMDProperties:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_PROPERTIES},true);return this.discover(a)},discoverMDSets:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_SETS}, | true);return this.discover(a)},discoverMDActions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_ACTIONS},true);return this.discover(a)},discoverMDCubes:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_CUBES},true);return this.discover(a)},discoverMDDimensions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_DIMENSIONS},true);return this.discover(a)},discoverMDFunctions:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_FUNCTIONS},true);return this.discover(a)},discoverMDHierarchies:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_HIERARCHIES},true);return this.discover(a)},discoverMDLevels:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_LEVELS},true);return this.discover(a)},discoverMDMeasures:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEASURES},true);return this.discover(a)},discoverMDMembers:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEMBERS},true);return this.discover(a)},discoverMDProperties:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_PROPERTIES},true);return this.discover(a)},discoverMDSets:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_SETS}, |
true);return this.discover(a)},discoverMDLevels:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_LEVELS},true);return this.discover(a)},discoverMDMeasures:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEASURES},true);return this.discover(a)},discoverMDMembers:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEMBERS},true);return this.discover(a)},discoverMDProperties:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_PROPERTIES},true);return this.discover(a)},discoverMDSets:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_SETS}, | true);return this.discover(a)},discoverMDLevels:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_LEVELS},true);return this.discover(a)},discoverMDMeasures:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_MEASURES},true);return this.discover(a)},discoverMDMembers:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_MEMBERS},true);return this.discover(a)},discoverMDProperties:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_PROPERTIES},true);return this.discover(a)},discoverMDSets:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_SETS}, | true);return this.discover(a)},discoverMDLevels:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_LEVELS},true);return this.discover(a)},discoverMDMeasures:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEASURES},true);return this.discover(a)},discoverMDMembers:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEMBERS},true);return this.discover(a)},discoverMDProperties:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_PROPERTIES},true);return this.discover(a)},discoverMDSets:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_SETS}, |
true);return this.discover(a)},discoverMDLevels:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_LEVELS},true);return this.discover(a)},discoverMDMeasures:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEASURES},true);return this.discover(a)},discoverMDMembers:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEMBERS},true);return this.discover(a)},discoverMDProperties:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_PROPERTIES},true);return this.discover(a)},discoverMDSets:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_SETS}, true);return this.discover(a)}};function R(a){a=m(a,A,B,"complexType");var b=a.length,d,c;for(c=0;c<b;c++){d=a.item(c);if(d.getAttribute("name")==="row")return d}return null}Xmla.Rowset=function(a,b){this._initData(a,b);return this};Xmla.Rowset.MD_DIMTYPE_UNKNOWN=0;Xmla.Rowset.MD_DIMTYPE_TIME=1;Xmla.Rowset.MD_DIMTYPE_MEASURE=2;Xmla.Rowset.MD_DIMTYPE_OTHER=3;Xmla.Rowset.MD_DIMTYPE_QUANTITATIVE=5;Xmla.Rowset.MD_DIMTYPE_ACCOUNTS=6;Xmla.Rowset.MD_DIMTYPE_CUSTOMERS=7;Xmla.Rowset.MD_DIMTYPE_PRODUCTS=8; | true);return this.discover(a)},discoverMDLevels:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_LEVELS},true);return this.discover(a)},discoverMDMeasures:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_MEASURES},true);return this.discover(a)},discoverMDMembers:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_MEMBERS},true);return this.discover(a)},discoverMDProperties:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_PROPERTIES},true);return this.discover(a)},discoverMDSets:function(a){a=g(a,{requestType:Xmla.MDSCHEMA_SETS}, true);return this.discover(a)}};function R(a){a=o(a,z,A,"complexType");var b=a.length,d,c;for(c=0;c<b;c+=1){d=a.item(c);if(d.getAttribute("name")==="row")return d}return null}Xmla.Rowset=function(a,b){this._initData(a,b);return this};Xmla.Rowset.MD_DIMTYPE_UNKNOWN=0;Xmla.Rowset.MD_DIMTYPE_TIME=1;Xmla.Rowset.MD_DIMTYPE_MEASURE=2;Xmla.Rowset.MD_DIMTYPE_OTHER=3;Xmla.Rowset.MD_DIMTYPE_QUANTITATIVE=5;Xmla.Rowset.MD_DIMTYPE_ACCOUNTS=6;Xmla.Rowset.MD_DIMTYPE_CUSTOMERS=7;Xmla.Rowset.MD_DIMTYPE_PRODUCTS=8; | true);return this.discover(a)},discoverMDLevels:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_LEVELS},true);return this.discover(a)},discoverMDMeasures:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEASURES},true);return this.discover(a)},discoverMDMembers:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_MEMBERS},true);return this.discover(a)},discoverMDProperties:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_PROPERTIES},true);return this.discover(a)},discoverMDSets:function(a){a=h(a,{requestType:Xmla.MDSCHEMA_SETS},true);return this.discover(a)}};function R(a){a=m(a,A,B,"complexType");var b=a.length,d,c;for(c=0;c<b;c++){d=a.item(c);if(d.getAttribute("name")==="row")return d}return null}Xmla.Rowset=function(a,b){this._initData(a,b);return this};Xmla.Rowset.MD_DIMTYPE_UNKNOWN=0;Xmla.Rowset.MD_DIMTYPE_TIME=1;Xmla.Rowset.MD_DIMTYPE_MEASURE=2;Xmla.Rowset.MD_DIMTYPE_OTHER=3;Xmla.Rowset.MD_DIMTYPE_QUANTITATIVE=5;Xmla.Rowset.MD_DIMTYPE_ACCOUNTS=6;Xmla.Rowset.MD_DIMTYPE_CUSTOMERS=7;Xmla.Rowset.MD_DIMTYPE_PRODUCTS=8; |
{};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_TABULAR;return this.execute(a)},executeMultiDimensional:function(a){if(!a.properties)a.properties={};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_MULTIDIMENSIONAL;return this.execute(a)},discover:function(a){a=h(a,{method:Xmla.METHOD_DISCOVER},true);return this.request(a)},discoverDataSources:function(a){a=h(a,{requestType:Xmla.DISCOVER_DATASOURCES},true);return this.discover(a)},discoverProperties:function(a){a=h(a,{requestType:Xmla.DISCOVER_PROPERTIES}, true);return this.discover(a)},discoverSchemaRowsets:function(a){a=h(a,{requestType:Xmla.DISCOVER_SCHEMA_ROWSETS},true);return this.discover(a)},discoverEnumerators:function(a){a=h(a,{requestType:Xmla.DISCOVER_ENUMERATORS},true);return this.discover(a)},discoverKeywords:function(a){a=h(a,{requestType:Xmla.DISCOVER_KEYWORDS},true);return this.discover(a)},discoverLiterals:function(a){a=h(a,{requestType:Xmla.DISCOVER_LITERALS},true);return this.discover(a)},discoverDBCatalogs:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_CATALOGS}, | {};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_TABULAR;return this.execute(a)},executeMultiDimensional:function(a){if(!a.properties)a.properties={};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_MULTIDIMENSIONAL;return this.execute(a)},discover:function(a){a=g(a,{method:Xmla.METHOD_DISCOVER},true);return this.request(a)},discoverDataSources:function(a){a=g(a,{requestType:Xmla.DISCOVER_DATASOURCES},true);return this.discover(a)},discoverProperties:function(a){a=g(a,{requestType:Xmla.DISCOVER_PROPERTIES}, true);return this.discover(a)},discoverSchemaRowsets:function(a){a=g(a,{requestType:Xmla.DISCOVER_SCHEMA_ROWSETS},true);return this.discover(a)},discoverEnumerators:function(a){a=g(a,{requestType:Xmla.DISCOVER_ENUMERATORS},true);return this.discover(a)},discoverKeywords:function(a){a=g(a,{requestType:Xmla.DISCOVER_KEYWORDS},true);return this.discover(a)},discoverLiterals:function(a){a=g(a,{requestType:Xmla.DISCOVER_LITERALS},true);return this.discover(a)},discoverDBCatalogs:function(a){a=g(a,{requestType:Xmla.DBSCHEMA_CATALOGS}, | {};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_TABULAR;return this.execute(a)},executeMultiDimensional:function(a){if(!a.properties)a.properties={};a.properties[Xmla.PROP_FORMAT]=Xmla.PROP_FORMAT_MULTIDIMENSIONAL;return this.execute(a)},discover:function(a){a=h(a,{method:Xmla.METHOD_DISCOVER},true);return this.request(a)},discoverDataSources:function(a){a=h(a,{requestType:Xmla.DISCOVER_DATASOURCES},true);return this.discover(a)},discoverProperties:function(a){a=h(a,{requestType:Xmla.DISCOVER_PROPERTIES},true);return this.discover(a)},discoverSchemaRowsets:function(a){a=h(a,{requestType:Xmla.DISCOVER_SCHEMA_ROWSETS},true);return this.discover(a)},discoverEnumerators:function(a){a=h(a,{requestType:Xmla.DISCOVER_ENUMERATORS},true);return this.discover(a)},discoverKeywords:function(a){a=h(a,{requestType:Xmla.DISCOVER_KEYWORDS},true);return this.discover(a)},discoverLiterals:function(a){a=h(a,{requestType:Xmla.DISCOVER_LITERALS},true);return this.discover(a)},discoverDBCatalogs:function(a){a=h(a,{requestType:Xmla.DBSCHEMA_CATALOGS}, |
|| searchType.showArtifactContainer() ) | || searchType.showArtifactContainer( rec ) ) | displayArtifactInformation : function(selectionModel, index, rec) { var searchType = this.getSearchType(this.searchTypeButton.value); if ( typeof searchType.showArtifactContainer != 'function' || searchType.showArtifactContainer() ) { this.artifactContainer.updateArtifact(rec.data); } }, |
name : rec.data.hits[0].repositoryName, resourceURI : rec.data.hits[0].repositoryURL, format : rec.data.hits[0].repositoryContentClass, repoType : rec.data.hits[0].repositoryKind, | name : rec.data.artifactHits[0].repositoryName, resourceURI : rec.data.artifactHits[0].repositoryURL, format : rec.data.artifactHits[0].repositoryContentClass, repoType : rec.data.artifactHits[0].repositoryKind, | displayArtifactInformation : function(selectionModel, index, rec) { var searchType = this.getSearchType(this.searchTypeButton.value); if (typeof searchType.showArtifactContainer != 'function' || searchType.showArtifactContainer(rec)) { var payload = { data : { showCtx : true, name : rec.data.hits[0].repositoryName, resourceURI : rec.data.hits[0].repositoryURL, format : rec.data.hits[0].repositoryContentClass, repoType : rec.data.hits[0].repositoryKind, expandPath : this.getDefaultPath(rec) } } this.repoBrowserContainer.expand(); this.repoBrowserContainer.updatePayload(payload); } }, |
if(this.firstRun) { this.stack.push(this.currentContext); context = new this.Context(); this.currentContext = context; funcarray.each(function(func){ this.STEP(func); }.bind(this)); this.currentContext.insertStep({type:'loop'}); this.currentContext.step = 0; this.currentContext = this.stack.pop(); this.currentContext.insertStep({type:'do',data:context}); } return this; | this.stack.push(this.currentContext); context = new this.Context(); this.currentContext = context; funcarray.each(function(func){ this.step(func); }.bind(this)); this.currentContext.insertStep({type:'loop'}); this.currentContext.step = 0; | DO:function(funcarray) { var context; if(this.firstRun) { //only if in compile phase. this.stack.push(this.currentContext); context = new this.Context(); this.currentContext = context; funcarray.each(function(func){ this.STEP(func); }.bind(this)); this.currentContext.insertStep({type:'loop'}); this.currentContext.step = 0; //reset to start at begining of loop this.currentContext = this.stack.pop(); this.currentContext.insertStep({type:'do',data:context}); } return this; }, |
newItem.volume=Zotero.Utilities.cleanString(vol); | newItem.volume=Zotero.Utilities.trimInternal(vol); | function doBook(newItem, bookdata) { var fields=bookdata.split("<br>"); for(var pos=fields.length-2; pos>=0; pos--) { fields[pos]=Zotero.Utilities.cleanTags(fields[pos]); if(fields[pos].indexOf("Volume")!=-1) { var i=fields[pos].lastIndexOf(";"); var vol; if(i!=-1) vol=fields[pos].substring(i+1); else vol=fields[pos].substring(fields[pos].lastIndexOf(" ")); newItem.volume=Zotero.Utilities.cleanString(vol); } if(fields[pos].indexOf("Edition")!=-1) { var i=fields[pos].lastIndexOf(";"); if(i!=-1) ed=fields[pos].substring(i+1); else ed=fields[pos].substring(fields[pos].lastIndexOf(" ")); newItem.edition=Zotero.Utilities.cleanString(ed); } if(fields[pos].indexOf("Copyright")!=-1) { var i=fields[pos].lastIndexOf(";"); var date; if(i!=-1) date=fields[pos].substring(i+1); else date=fields[pos].substring(fields[pos].indexOf(":")+2); newItem.date=Zotero.Utilities.cleanString(date); } if(fields[pos].indexOf("ISBN")!=-1&&fields[pos].indexOf("print")!=-1) { var i=fields[pos].lastIndexOf(";"); var isbn; if(i!=-1) isbn=fields[pos].substring(i+1); else isbn=fields[pos].substring(fields[pos].indexOf(":")+2); newItem.ISBN=Zotero.Utilities.cleanString(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]); var names=authors[i].split(" "); var creators=new Array(); creators.firstName=names[0]; creators.lastName=names[names.length-2]; if(names[names.length-1]=="(Editor)") creators.creatorType="editor"; if(names[names.length-1]=="(Author)") creators.creatorType="author"; newItem.creators.push(creators); } } if(fields[pos].indexOf("DOI:")!=-1) newItem.itemID=fields[pos].substring(fields[pos].indexOf("1")); }} |
newItem.edition=Zotero.Utilities.cleanString(ed); | newItem.edition=Zotero.Utilities.trimInternal(ed); | function doBook(newItem, bookdata) { var fields=bookdata.split("<br>"); for(var pos=fields.length-2; pos>=0; pos--) { fields[pos]=Zotero.Utilities.cleanTags(fields[pos]); if(fields[pos].indexOf("Volume")!=-1) { var i=fields[pos].lastIndexOf(";"); var vol; if(i!=-1) vol=fields[pos].substring(i+1); else vol=fields[pos].substring(fields[pos].lastIndexOf(" ")); newItem.volume=Zotero.Utilities.cleanString(vol); } if(fields[pos].indexOf("Edition")!=-1) { var i=fields[pos].lastIndexOf(";"); if(i!=-1) ed=fields[pos].substring(i+1); else ed=fields[pos].substring(fields[pos].lastIndexOf(" ")); newItem.edition=Zotero.Utilities.cleanString(ed); } if(fields[pos].indexOf("Copyright")!=-1) { var i=fields[pos].lastIndexOf(";"); var date; if(i!=-1) date=fields[pos].substring(i+1); else date=fields[pos].substring(fields[pos].indexOf(":")+2); newItem.date=Zotero.Utilities.cleanString(date); } if(fields[pos].indexOf("ISBN")!=-1&&fields[pos].indexOf("print")!=-1) { var i=fields[pos].lastIndexOf(";"); var isbn; if(i!=-1) isbn=fields[pos].substring(i+1); else isbn=fields[pos].substring(fields[pos].indexOf(":")+2); newItem.ISBN=Zotero.Utilities.cleanString(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]); var names=authors[i].split(" "); var creators=new Array(); creators.firstName=names[0]; creators.lastName=names[names.length-2]; if(names[names.length-1]=="(Editor)") creators.creatorType="editor"; if(names[names.length-1]=="(Author)") creators.creatorType="author"; newItem.creators.push(creators); } } if(fields[pos].indexOf("DOI:")!=-1) newItem.itemID=fields[pos].substring(fields[pos].indexOf("1")); }} |
newItem.date=Zotero.Utilities.cleanString(date); | newItem.date=Zotero.Utilities.trimInternal(date); | function doBook(newItem, bookdata) { var fields=bookdata.split("<br>"); for(var pos=fields.length-2; pos>=0; pos--) { fields[pos]=Zotero.Utilities.cleanTags(fields[pos]); if(fields[pos].indexOf("Volume")!=-1) { var i=fields[pos].lastIndexOf(";"); var vol; if(i!=-1) vol=fields[pos].substring(i+1); else vol=fields[pos].substring(fields[pos].lastIndexOf(" ")); newItem.volume=Zotero.Utilities.cleanString(vol); } if(fields[pos].indexOf("Edition")!=-1) { var i=fields[pos].lastIndexOf(";"); if(i!=-1) ed=fields[pos].substring(i+1); else ed=fields[pos].substring(fields[pos].lastIndexOf(" ")); newItem.edition=Zotero.Utilities.cleanString(ed); } if(fields[pos].indexOf("Copyright")!=-1) { var i=fields[pos].lastIndexOf(";"); var date; if(i!=-1) date=fields[pos].substring(i+1); else date=fields[pos].substring(fields[pos].indexOf(":")+2); newItem.date=Zotero.Utilities.cleanString(date); } if(fields[pos].indexOf("ISBN")!=-1&&fields[pos].indexOf("print")!=-1) { var i=fields[pos].lastIndexOf(";"); var isbn; if(i!=-1) isbn=fields[pos].substring(i+1); else isbn=fields[pos].substring(fields[pos].indexOf(":")+2); newItem.ISBN=Zotero.Utilities.cleanString(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]); var names=authors[i].split(" "); var creators=new Array(); creators.firstName=names[0]; creators.lastName=names[names.length-2]; if(names[names.length-1]=="(Editor)") creators.creatorType="editor"; if(names[names.length-1]=="(Author)") creators.creatorType="author"; newItem.creators.push(creators); } } if(fields[pos].indexOf("DOI:")!=-1) newItem.itemID=fields[pos].substring(fields[pos].indexOf("1")); }} |
newItem.ISBN=Zotero.Utilities.cleanString(isbn); | newItem.ISBN=Zotero.Utilities.trimInternal(isbn); | function doBook(newItem, bookdata) { var fields=bookdata.split("<br>"); for(var pos=fields.length-2; pos>=0; pos--) { fields[pos]=Zotero.Utilities.cleanTags(fields[pos]); if(fields[pos].indexOf("Volume")!=-1) { var i=fields[pos].lastIndexOf(";"); var vol; if(i!=-1) vol=fields[pos].substring(i+1); else vol=fields[pos].substring(fields[pos].lastIndexOf(" ")); newItem.volume=Zotero.Utilities.cleanString(vol); } if(fields[pos].indexOf("Edition")!=-1) { var i=fields[pos].lastIndexOf(";"); if(i!=-1) ed=fields[pos].substring(i+1); else ed=fields[pos].substring(fields[pos].lastIndexOf(" ")); newItem.edition=Zotero.Utilities.cleanString(ed); } if(fields[pos].indexOf("Copyright")!=-1) { var i=fields[pos].lastIndexOf(";"); var date; if(i!=-1) date=fields[pos].substring(i+1); else date=fields[pos].substring(fields[pos].indexOf(":")+2); newItem.date=Zotero.Utilities.cleanString(date); } if(fields[pos].indexOf("ISBN")!=-1&&fields[pos].indexOf("print")!=-1) { var i=fields[pos].lastIndexOf(";"); var isbn; if(i!=-1) isbn=fields[pos].substring(i+1); else isbn=fields[pos].substring(fields[pos].indexOf(":")+2); newItem.ISBN=Zotero.Utilities.cleanString(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]); var names=authors[i].split(" "); var creators=new Array(); creators.firstName=names[0]; creators.lastName=names[names.length-2]; if(names[names.length-1]=="(Editor)") creators.creatorType="editor"; if(names[names.length-1]=="(Author)") creators.creatorType="author"; newItem.creators.push(creators); } } if(fields[pos].indexOf("DOI:")!=-1) newItem.itemID=fields[pos].substring(fields[pos].indexOf("1")); }} |
authors[i]=Zotero.Utilities.cleanString(authors[i]); | authors[i]=Zotero.Utilities.trimInternal(authors[i]); | function doBook(newItem, bookdata) { var fields=bookdata.split("<br>"); for(var pos=fields.length-2; pos>=0; pos--) { fields[pos]=Zotero.Utilities.cleanTags(fields[pos]); if(fields[pos].indexOf("Volume")!=-1) { var i=fields[pos].lastIndexOf(";"); var vol; if(i!=-1) vol=fields[pos].substring(i+1); else vol=fields[pos].substring(fields[pos].lastIndexOf(" ")); newItem.volume=Zotero.Utilities.cleanString(vol); } if(fields[pos].indexOf("Edition")!=-1) { var i=fields[pos].lastIndexOf(";"); if(i!=-1) ed=fields[pos].substring(i+1); else ed=fields[pos].substring(fields[pos].lastIndexOf(" ")); newItem.edition=Zotero.Utilities.cleanString(ed); } if(fields[pos].indexOf("Copyright")!=-1) { var i=fields[pos].lastIndexOf(";"); var date; if(i!=-1) date=fields[pos].substring(i+1); else date=fields[pos].substring(fields[pos].indexOf(":")+2); newItem.date=Zotero.Utilities.cleanString(date); } if(fields[pos].indexOf("ISBN")!=-1&&fields[pos].indexOf("print")!=-1) { var i=fields[pos].lastIndexOf(";"); var isbn; if(i!=-1) isbn=fields[pos].substring(i+1); else isbn=fields[pos].substring(fields[pos].indexOf(":")+2); newItem.ISBN=Zotero.Utilities.cleanString(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]); var names=authors[i].split(" "); var creators=new Array(); creators.firstName=names[0]; creators.lastName=names[names.length-2]; if(names[names.length-1]=="(Editor)") creators.creatorType="editor"; if(names[names.length-1]=="(Author)") creators.creatorType="author"; newItem.creators.push(creators); } } if(fields[pos].indexOf("DOI:")!=-1) newItem.itemID=fields[pos].substring(fields[pos].indexOf("1")); }} |
editors[i]=Zotero.Utilities.cleanString(editors[i]); | editors[i]=Zotero.Utilities.trimInternal(editors[i]); | function doChap(newItem, chaptext) { var chapdata=chaptext.split("<br>"); for(var pos=chapdata.length-2; pos>=0; pos--) { chapdata[pos]=Zotero.Utilities.cleanTags(chapdata[pos]); 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]); var names=editors[i].split(" "); var creators=new Array(); if(i==0) creators.firstName=names[1]; else creators.firstName=names[0]; creators.lastName=names[names.length-1]; creators.creatorType="editor"; newItem.creators.push(creators); } } 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]); var names=authors[i].split(" "); var creators=new Array(); if(i==0) creators.firstName=names[1]; else creators.firstName=names[0]; creators.lastName=names[names.length-1]; creators.creatorType="editor"; newItem.creators.push(creators); } } if(chapdata[pos].indexOf("DOI")!=-1) newItem.itemID=chapdata[pos].substring(chapdata[pos].indexOf("1")); if(chapdata[pos].indexOf("Book")!=-1) newItem.bookTitle=chapdata[pos].substring(chapdata[pos].indexOf(" ")+1); }} |
authors[i]=Zotero.Utilities.cleanString(authors[i]); | authors[i]=Zotero.Utilities.trimInternal(authors[i]); | function doChap(newItem, chaptext) { var chapdata=chaptext.split("<br>"); for(var pos=chapdata.length-2; pos>=0; pos--) { chapdata[pos]=Zotero.Utilities.cleanTags(chapdata[pos]); 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]); var names=editors[i].split(" "); var creators=new Array(); if(i==0) creators.firstName=names[1]; else creators.firstName=names[0]; creators.lastName=names[names.length-1]; creators.creatorType="editor"; newItem.creators.push(creators); } } 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]); var names=authors[i].split(" "); var creators=new Array(); if(i==0) creators.firstName=names[1]; else creators.firstName=names[0]; creators.lastName=names[names.length-1]; creators.creatorType="editor"; newItem.creators.push(creators); } } if(chapdata[pos].indexOf("DOI")!=-1) newItem.itemID=chapdata[pos].substring(chapdata[pos].indexOf("1")); if(chapdata[pos].indexOf("Book")!=-1) newItem.bookTitle=chapdata[pos].substring(chapdata[pos].indexOf(" ")+1); }} |
if (!gmlDocument) | if (!gmlDocument) { | var doesResponseContainsData = function(gmlDocument) { if (!gmlDocument) return false; // Making an assumption about namespace... if (gmlDocument.tagName !== 'wfs:FeatureCollection') return false; // Parse our number of features var numberOfFeaturesAttr = gmlDocument.attributes .getNamedItem("numberOfFeatures"); if (!numberOfFeaturesAttr) return false; return parseInt(numberOfFeaturesAttr.value) > 0; }; |
if (gmlDocument.tagName !== 'wfs:FeatureCollection') | if (gmlDocument.tagName !== 'wfs:FeatureCollection') { | var doesResponseContainsData = function(gmlDocument) { if (!gmlDocument) return false; // Making an assumption about namespace... if (gmlDocument.tagName !== 'wfs:FeatureCollection') return false; // Parse our number of features var numberOfFeaturesAttr = gmlDocument.attributes .getNamedItem("numberOfFeatures"); if (!numberOfFeaturesAttr) return false; return parseInt(numberOfFeaturesAttr.value) > 0; }; |
var numberOfFeaturesAttr = gmlDocument.attributes .getNamedItem("numberOfFeatures"); if (!numberOfFeaturesAttr) | var numberOfFeaturesAttr = gmlDocument.attributes.getNamedItem("numberOfFeatures"); if (!numberOfFeaturesAttr) { | var doesResponseContainsData = function(gmlDocument) { if (!gmlDocument) return false; // Making an assumption about namespace... if (gmlDocument.tagName !== 'wfs:FeatureCollection') return false; // Parse our number of features var numberOfFeaturesAttr = gmlDocument.attributes .getNamedItem("numberOfFeatures"); if (!numberOfFeaturesAttr) return false; return parseInt(numberOfFeaturesAttr.value) > 0; }; |
} | var doesResponseContainsData = function(gmlDocument) { if (!gmlDocument) return false; // Making an assumption about namespace... if (gmlDocument.tagName !== 'wfs:FeatureCollection') return false; // Parse our number of features var numberOfFeaturesAttr = gmlDocument.attributes .getNamedItem("numberOfFeatures"); if (!numberOfFeaturesAttr) return false; return parseInt(numberOfFeaturesAttr.value) > 0; }; |
|
if(item.numPages) { writeField("pages", item.numPages); } | function doExport() { //Zotero.write("% BibTeX export generated by Zotero "+Zotero.Utilities.getVersion()); // to make sure the BOM gets ignored Zotero.write("\n"); var first = true; var citekeys = new Object(); var item; while(item = Zotero.nextItem()) { // determine type var type = zotero2bibtexTypeMap[item.itemType]; if (typeof(type) == "function") { type = type(item); } if(!type) type = "misc"; // create a unique citation key var citekey = buildCiteKey(item, citekeys); // write citation key Zotero.write((first ? "" : ",\n\n") + "@"+type+"{"+citekey); first = false; for(var field in fieldMap) { if(item[fieldMap[field]]) { writeField(field, item[fieldMap[field]]); } } if(item.reportNumber || item.issue || item.seriesNumber) { writeField("number", item.reportNumber || item.issue || item.seriesNumber); } if(item.publicationTitle) { if(item.itemType == "bookSection" || item.itemType == "conferencePaper") { writeField("booktitle", item.publicationTitle); } else { writeField("journal", item.publicationTitle); } } if(item.publisher) { if(item.itemType == "thesis") { writeField("school", item.publisher); } else if(item.itemType =="report") { writeField("institution", item.publisher); } else { writeField("publisher", item.publisher); } } if(item.creators && item.creators.length) { // split creators into subcategories var author = ""; var editor = ""; var translator = ""; for each(var creator in item.creators) { var creatorString = creator.lastName; if (creator.firstName) { creatorString = creator.firstName + " " + creator.lastName; } if (creator.creatorType == "editor") { editor += " and "+creatorString; } else if (creator.creatorType == "translator") { translator += " and "+creatorString; } else { author += " and "+creatorString; } } if(author) { writeField("author", author.substr(5)); } if(editor) { writeField("editor", editor.substr(5)); } if(translator) { writeField("translator", translator.substr(5)); } } if(item.date) { var date = Zotero.Utilities.strToDate(item.date); // need to use non-localized abbreviation if(date.month) { writeField("month", months[date.month], true); } if(date.year) { writeField("year", date.year); } } if(item.extra) { writeField("note", item.extra); } if(item.tags && item.tags.length) { var tagString = ""; for each(var tag in item.tags) { tagString += ", "+tag.tag; } writeField("keywords", tagString.substr(2)); } if(item.pages) { writeField("pages", item.pages.replace("-","--")); } if(item.itemType == "webpage") { writeField("howpublished", item.url); } if (item.notes) { for each (var note in item.notes) { writeField("annote", note["note"]); } } Zotero.write("\n}"); }} |
|
marcGenre = "theses"; | marcGenre = "thesis"; | function doExport() { Zotero.setCharacterSet("utf-8"); var modsCollection = <modsCollection xmlns="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd" />; var item; while(item = Zotero.nextItem()) { var isPartialItem = Zotero.Utilities.inArray(item.itemType, partialItemTypes); var mods = <mods />; /** CORE FIELDS **/ // XML tag titleInfo; object field title if(item.title) { mods.titleInfo.title = item.title; } // XML tag typeOfResource/genre; object field type var modsType, marcGenre; if(item.itemType == "book" || item.itemType == "bookSection") { modsType = "text"; marcGenre = "book"; } else if(item.itemType == "journalArticle" || item.itemType == "magazineArticle") { modsType = "text"; marcGenre = "periodical"; } else if(item.itemType == "newspaperArticle") { modsType = "text"; marcGenre = "newspaper"; } else if(item.itemType == "thesis") { modsType = "text"; marcGenre = "theses"; } else if(item.itemType == "letter") { modsType = "text"; marcGenre = "letter"; } else if(item.itemType == "manuscript") { modsType = "text"; modsType.@manuscript = "yes"; } else if(item.itemType == "interview") { modsType = "text"; marcGenre = "interview"; } else if(item.itemType == "film") { modsType = "moving image"; marcGenre = "motion picture"; } else if(item.itemType == "artwork") { modsType = "still image"; marcGenre = "art original"; } else if(item.itemType == "webpage") { modsType = "multimedia"; marcGenre = "web site"; } else if(item.itemType == "note" || item.itemType == "attachment") { continue; } mods.typeOfResource = modsType; mods.genre += <genre authority="local">{item.itemType}</genre>; if(marcGenre) { mods.genre += <genre authority="marcgt">{marcGenre}</genre>; } // XML tag genre; object field thesisType, type if(item.thesisType) { mods.genre += <genre>{item.thesisType}</genre>; } if(item.type) { mods.genre += <genre>{item.type}</genre>; } // XML tag name; object field creators for(var j in item.creators) { var roleTerm = ""; if(item.creators[j].creatorType == "author") { roleTerm = "aut"; } else if(item.creators[j].creatorType == "editor") { roleTerm = "edt"; } else if(item.creators[j].creatorType == "creator") { roleTerm = "ctb"; } // FIXME - currently all names are personal mods.name += <name type="personal"> <namePart type="family">{item.creators[j].lastName}</namePart> <namePart type="given">{item.creators[j].firstName}</namePart> <role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role> </name>; } // XML tag recordInfo.recordOrigin; used to store our generator note //mods.recordInfo.recordOrigin = "Zotero for Firefox "+Zotero.Utilities.getVersion(); /** FIELDS ON NEARLY EVERYTHING BUT NOT A PART OF THE CORE **/ // XML tag recordInfo.recordContentSource; object field source if(item.source) { mods.recordInfo.recordContentSource = item.source; } // XML tag recordInfo.recordIdentifier; object field accessionNumber if(item.accessionNumber) { mods.recordInfo.recordIdentifier = item.accessionNumber; } // XML tag accessCondition; object field rights if(item.rights) { mods.accessCondition = item.rights; } /** SUPPLEMENTAL FIELDS **/ // Make part its own tag so we can figure out where it goes later var part = new XML(); // XML tag detail; object field volume if(item.volume) { if(Zotero.Utilities.isInt(item.volume)) { part += <detail type="volume"><number>{item.volume}</number></detail>; } else { part += <detail type="volume"><text>{item.volume}</text></detail>; } } // XML tag detail; object field number if(item.issue) { if(Zotero.Utilities.isInt(item.issue)) { part += <detail type="issue"><number>{item.issue}</number></detail>; } else { part += <detail type="issue"><text>{item.issue}</text></detail>; } } // XML tag detail; object field section if(item.section) { if(Zotero.Utilities.isInt(item.section)) { part += <detail type="section"><number>{item.section}</number></detail>; } else { part += <detail type="section"><text>{item.section}</text></detail>; } } // XML tag detail; object field pages if(item.pages) { var range = Zotero.Utilities.getPageRange(item.pages); part += <extent unit="pages"><start>{range[0]}</start><end>{range[1]}</end></extent>; } // Assign part if something was assigned if(part.length() != 1) { if(isPartialItem) { // For a journal article, bookSection, etc., the part is the host mods.relatedItem.part += <part>{part}</part>; } else { mods.part += <part>{part}</part>; } } // XML tag originInfo; object fields edition, place, publisher, year, date var originInfo = new XML(); if(item.edition) { originInfo += <edition>{item.edition}</edition>; } if(item.place) { originInfo += <place><placeTerm type="text">{item.place}</placeTerm></place>; } if(item.publisher) { originInfo += <publisher>{item.publisher}</publisher>; } else if(item.distributor) { originInfo += <publisher>{item.distributor}</publisher>; } if(item.date) { if(Zotero.Utilities.inArray(item.itemType, ["book", "bookSection"])) { // Assume year is copyright date var dateType = "copyrightDate"; } else if(Zotero.Utilities.inArray(item.itemType, ["journalArticle", "magazineArticle", "newspaperArticle"])) { // Assume date is date issued var dateType = "dateIssued"; } else { // Assume date is date created var dateType = "dateCreated"; } var tag = <{dateType}>{item.date}</{dateType}>; originInfo += tag; } if(item.accessDate) { originInfo += <dateCaptured>{item.accessDate}</dateCaptured>; } if(originInfo.length() != 1) { if(isPartialItem) { // For a journal article, bookSection, etc., this goes under the host mods.relatedItem.originInfo += <originInfo>{originInfo}</originInfo>; } else { mods.originInfo += <originInfo>{originInfo}</originInfo>; } } // XML tag identifier; object fields ISBN, ISSN if(isPartialItem) { var identifier = mods.relatedItem; } else { var identifier = mods; } if(item.ISBN) { identifier.identifier += <identifier type="isbn">{item.ISBN}</identifier>; } if(item.ISSN) { identifier.identifier += <identifier type="issn">{item.ISSN}</identifier>; } if(item.DOI) { mods.identifier += <identifier type="doi">{item.DOI}</identifier>; } // XML tag relatedItem.titleInfo; object field publication if(item.publicationTitle) { mods.relatedItem.titleInfo += <titleInfo><title>{item.publicationTitle}</title></titleInfo>; } // XML tag classification; object field callNumber if(item.callNumber) { mods.classification = item.callNumber; } // XML tag location.physicalLocation; object field archiveLocation if(item.archiveLocation) { mods.location.physicalLocation = item.archiveLocation; } // XML tag location.url; object field archiveLocation if(item.url) { mods.location.url = item.url; } // XML tag title.titleInfo; object field journalAbbreviation if(item.journalAbbreviation) { mods.relatedItem.titleInfo += <titleInfo type="abbreviated"><title>{item.journalAbbreviation}</title></titleInfo>; } // XML tag abstract; object field abstractNote if(item.abstractNote) { mods.abstract = item.abstractNote; } if(mods.relatedItem.length() == 1 && isPartialItem) { mods.relatedItem.@type = "host"; } /** NOTES **/ if(Zotero.getOption("exportNotes")) { for(var j in item.notes) { // Add note tag var note = <note type="content">{item.notes[j].note}</note>; mods.note += note; } } /** TAGS **/ for(var j in item.tags) { mods.subject += <subject><topic>{item.tags[j].tag}</topic></subject>; } // XML tag relatedItem.titleInfo; object field series if(item.seriesTitle || item.series || item.seriesNumber || item.seriesText) { var series = <relatedItem type="series"/>; if(item.series) { series.titleInfo.title = item.series; } if(item.seriesTitle) { series.titleInfo.partTitle = item.seriesTitle; } if(item.seriesText) { series.titleInfo.subTitle = item.seriesText; } if(item.seriesNumber) { series.titleInfo.partNumber = item.seriesNumber; } // TODO: make this work in import /*if(item.itemType == "bookSection") { // For a book section, series info must go inside host tag mods.relatedItem.relatedItem = series; } else {*/ mods.relatedItem += series; //} } modsCollection.mods += mods; } Zotero.write('<?xml version="1.0"?>'+"\n"); Zotero.write(modsCollection.toXMLString());} |
Zotero.debug(item); | function doExport() { // add namespaces [Zotero.RDF.addNamespace(i, n[i]) for(i in n)]; // compile references and create URIs var item; var items = {}; while(item = Zotero.nextItem()) { items[item.itemID] = item; } // now that we've collected our items, start building the RDF for each(var item in items) { Zotero.debug(item); // set type on item node var type = new Type(item.itemType, TYPES[item.itemType]); var nodes = type.createNodes(item); Zotero.debug(nodes); // add fields for(var field in item.uniqueFields) { if(item.uniqueFields[field] == "") continue; var property = new LiteralProperty(field); property.mapFromItem(item, nodes); } Zotero.debug("fields added"); // add creators var creatorLists = []; for each(var creator in item.creators) { // create creator var property = new CreatorProperty(creator.creatorType); property.mapFromCreator(item, creator, nodes); } Zotero.debug("creators added"); type.addNodeRelations(nodes); Zotero.debug("relations added"); }} |
|
Zotero.debug(nodes); | function doExport() { // add namespaces [Zotero.RDF.addNamespace(i, n[i]) for(i in n)]; // compile references and create URIs var item; var items = {}; while(item = Zotero.nextItem()) { items[item.itemID] = item; } // now that we've collected our items, start building the RDF for each(var item in items) { Zotero.debug(item); // set type on item node var type = new Type(item.itemType, TYPES[item.itemType]); var nodes = type.createNodes(item); Zotero.debug(nodes); // add fields for(var field in item.uniqueFields) { if(item.uniqueFields[field] == "") continue; var property = new LiteralProperty(field); property.mapFromItem(item, nodes); } Zotero.debug("fields added"); // add creators var creatorLists = []; for each(var creator in item.creators) { // create creator var property = new CreatorProperty(creator.creatorType); property.mapFromCreator(item, creator, nodes); } Zotero.debug("creators added"); type.addNodeRelations(nodes); Zotero.debug("relations added"); }} |
|
for each(var tag in item.tags) { var tagNode = (tag.type == 0 ? nodes[USERITEM] : nodes[ITEM]); Zotero.RDF.addStatement(tagNode, n.dcterms+"subject", tag.tag, true); } | function doExport() { // add namespaces [Zotero.RDF.addNamespace(i, n[i]) for(i in n)]; // compile references and create URIs var item; var items = {}; while(item = Zotero.nextItem()) { items[item.itemID] = item; } // now that we've collected our items, start building the RDF for each(var item in items) { Zotero.debug(item); // set type on item node var type = new Type(item.itemType, TYPES[item.itemType]); var nodes = type.createNodes(item); Zotero.debug(nodes); // add fields for(var field in item.uniqueFields) { if(item.uniqueFields[field] == "") continue; var property = new LiteralProperty(field); property.mapFromItem(item, nodes); } Zotero.debug("fields added"); // add creators var creatorLists = []; for each(var creator in item.creators) { // create creator var property = new CreatorProperty(creator.creatorType); property.mapFromCreator(item, creator, nodes); } Zotero.debug("creators added"); type.addNodeRelations(nodes); Zotero.debug("relations added"); }} |
|
if(item.filingDate) { var date = Zotero.Utilities.strToDate(item.filingDate); var string = date.year+"/"; if(date.month != undefined) { date.month++; if(date.month < 10) string += "0"; string += date.month; } string += "/"; if(date.day != undefined) { if(date.day < 10) string += "0"; string += date.day; } string += "/"; if(date.part != undefined) { string += date.part; } addTag("Y2", string); } | function doExport() { var item; while(item = Zotero.nextItem()) { // can't store independent notes in RIS if(item.itemType == "note" || item.itemType == "attachment") { continue; } // type addTag("TY", typeMap[item.itemType] ? typeMap[item.itemType] : "GEN"); // use field map for(var j in fieldMap) { if(item[fieldMap[j]]) addTag(j, item[fieldMap[j]]); } // creators for(var j in item.creators) { // only two types, primary and secondary var risTag; // authors and inventors are primary creators if (item.creators[j].creatorType == "author" || item.creators[j].creatorType == "inventor") { risTag = "A1"; } else if (item.creators[j].creatorType == "editor") { risTag = "ED"; } else { risTag = "A2"; } addTag(risTag, item.creators[j].lastName+","+item.creators[j].firstName); } // assignee (patent) if(item.assignee) { addTag("A2", item.assignee); } // volume (patent: applicationNumber) if(item.volume || item.applicationNumber) { var value = (item.volume) ? item.volume : item.applicationNumber; addTag("VL", value); } // issue (patent: patentNumber) if(item.issue || item.patentNumber) { var value = (item.issue) ? item.issue : item.patentNumber; addTag("IS", value); } // publisher (patent: references) if(item.publisher || item.references) { var value = (item.publisher) ? item.publisher : item.references; addTag("PB", value); } // date if(item.date) { var date = Zotero.Utilities.strToDate(item.date); var string = date.year+"/"; if(date.month != undefined) { // deal with javascript months date.month++; if(date.month < 10) string += "0"; string += date.month; } string += "/"; if(date.day != undefined) { if(date.day < 10) string += "0"; string += date.day; } string += "/"; if(date.part != undefined) { string += date.part; } addTag("PY", string); } // notes if(Zotero.getOption("exportNotes")) { for(var j in item.notes) { addTag("N1", item.notes[j].note.replace(/(?:\r\n?|\n)/g, "\r\n")); } } if(item.abstractNote) { addTag("N2", item.abstractNote.replace(/(?:\r\n?|\n)/g, "\r\n")); } else if(item.abstract) { // patent type has abstract addTag("N2", item.abstract.replace(/(?:\r\n?|\n)/g, "\r\n")); } // tags for each(var tag in item.tags) { addTag("KW", tag.tag); } // pages if(item.pages) { if(item.itemType == "book") { addTag("EP", item.pages); } else { var range = Zotero.Utilities.getPageRange(item.pages); addTag("SP", range[0]); addTag("EP", range[1]); } } // ISBN/ISSN addTag("SN", item.ISBN); addTag("SN", item.ISSN); // URL if(item.url) { addTag("UR", item.url); } else if(item.source && item.source.substr(0, 7) == "http://") { addTag("UR", item.source); } Zotero.write("ER - \r\n\r\n"); }} |
|
if(date.month) { | if(typeof date.month == "number") { | function doExport() { //Zotero.write("% BibTeX export generated by Zotero "+Zotero.Utilities.getVersion()); // to make sure the BOM gets ignored Zotero.write("\n"); var first = true; var citekeys = new Object(); var item; while(item = Zotero.nextItem()) { // determine type var type = zotero2bibtexTypeMap[item.itemType]; if (typeof(type) == "function") { type = type(item); } if(!type) type = "misc"; // create a unique citation key var citekey = buildCiteKey(item, citekeys); // write citation key Zotero.write((first ? "" : ",\n\n") + "@"+type+"{"+citekey); first = false; for(var field in fieldMap) { if(item[fieldMap[field]]) { writeField(field, item[fieldMap[field]]); } } if(item.reportNumber || item.issue || item.seriesNumber) { writeField("number", item.reportNumber || item.issue || item.seriesNumber); } if(item.publicationTitle) { if(item.itemType == "bookSection" || item.itemType == "conferencePaper") { writeField("booktitle", item.publicationTitle); } else { writeField("journal", item.publicationTitle); } } if(item.publisher) { if(item.itemType == "thesis") { writeField("school", item.publisher); } else if(item.itemType =="report") { writeField("institution", item.publisher); } else { writeField("publisher", item.publisher); } } if(item.creators && item.creators.length) { // split creators into subcategories var author = ""; var editor = ""; var translator = ""; for each(var creator in item.creators) { var creatorString = creator.lastName; if (creator.firstName) { creatorString = creator.firstName + " " + creator.lastName; } if (creator.creatorType == "editor") { editor += " and "+creatorString; } else if (creator.creatorType == "translator") { translator += " and "+creatorString; } else { author += " and "+creatorString; } } if(author) { writeField("author", author.substr(5)); } if(editor) { writeField("editor", editor.substr(5)); } if(translator) { writeField("translator", translator.substr(5)); } } if(item.date) { var date = Zotero.Utilities.strToDate(item.date); // need to use non-localized abbreviation if(date.month) { writeField("month", months[date.month], true); } if(date.year) { writeField("year", date.year); } } if(item.extra) { writeField("note", item.extra); } if(item.tags && item.tags.length) { var tagString = ""; for each(var tag in item.tags) { tagString += ", "+tag.tag; } writeField("keywords", tagString.substr(2)); } if(item.pages) { writeField("pages", item.pages.replace("-","--")); } if(item.numPages) { writeField("pages", item.numPages); } if(item.itemType == "webpage") { writeField("howpublished", item.url); } if (item.notes) { for each (var note in item.notes) { writeField("annote", note["note"]); } } Zotero.write("\n}"); }} |
if(item.attachments) { | if(item.attachments) { var attachmentString = ""; | function doExport() { //Zotero.write("% BibTeX export generated by Zotero "+Zotero.Utilities.getVersion()); // to make sure the BOM gets ignored Zotero.write("\n"); var first = true; var citekeys = new Object(); var item; while(item = Zotero.nextItem()) { // determine type var type = zotero2bibtexTypeMap[item.itemType]; if (typeof(type) == "function") { type = type(item); } if(!type) type = "misc"; // create a unique citation key var citekey = buildCiteKey(item, citekeys); // write citation key Zotero.write((first ? "" : ",\n\n") + "@"+type+"{"+citekey); first = false; for(var field in fieldMap) { if(item[fieldMap[field]]) { writeField(field, item[fieldMap[field]]); } } if(item.reportNumber || item.issue || item.seriesNumber) { writeField("number", item.reportNumber || item.issue || item.seriesNumber); } if(item.publicationTitle) { if(item.itemType == "bookSection" || item.itemType == "conferencePaper") { writeField("booktitle", item.publicationTitle); } else { writeField("journal", item.publicationTitle); } } if(item.publisher) { if(item.itemType == "thesis") { writeField("school", item.publisher); } else if(item.itemType =="report") { writeField("institution", item.publisher); } else { writeField("publisher", item.publisher); } } if(item.creators && item.creators.length) { // split creators into subcategories var author = ""; var editor = ""; var translator = ""; for each(var creator in item.creators) { var creatorString = creator.lastName; if (creator.firstName) { creatorString = creator.firstName + " " + creator.lastName; } if (creator.creatorType == "editor") { editor += " and "+creatorString; } else if (creator.creatorType == "translator") { translator += " and "+creatorString; } else { author += " and "+creatorString; } } if(author) { writeField("author", author.substr(5)); } if(editor) { writeField("editor", editor.substr(5)); } if(translator) { writeField("translator", translator.substr(5)); } } if(item.date) { var date = Zotero.Utilities.strToDate(item.date); // need to use non-localized abbreviation if(typeof date.month == "number") { writeField("month", months[date.month], true); } if(date.year) { writeField("year", date.year); } } if(item.extra) { writeField("note", item.extra); } if(item.tags && item.tags.length) { var tagString = ""; for each(var tag in item.tags) { tagString += ", "+tag.tag; } writeField("keywords", tagString.substr(2)); } if(item.pages) { writeField("pages", item.pages.replace("-","--")); } // Commented out, because we don't want a books number of pages in the BibTeX "pages" field for books. //if(item.numPages) { // writeField("pages", item.numPages); //} if(item.itemType == "webpage") { writeField("howpublished", item.url); } if (item.notes) { for each (var note in item.notes) { writeField("annote", note["note"]); } } if(Zotero.getOption("exportFileData")) { if(item.attachments) { for each(var attachment in item.attachments) { writeField("file", ":" + attachment.path + ":" + attachment.mimeType); } } } Zotero.write("\n}"); }} |
writeField("file", ":" + attachment.path + ":" + attachment.mimeType); | attachmentString += ";" + attachment.title + ":" + attachment.path + ":" + attachment.mimeType; | function doExport() { //Zotero.write("% BibTeX export generated by Zotero "+Zotero.Utilities.getVersion()); // to make sure the BOM gets ignored Zotero.write("\n"); var first = true; var citekeys = new Object(); var item; while(item = Zotero.nextItem()) { // determine type var type = zotero2bibtexTypeMap[item.itemType]; if (typeof(type) == "function") { type = type(item); } if(!type) type = "misc"; // create a unique citation key var citekey = buildCiteKey(item, citekeys); // write citation key Zotero.write((first ? "" : ",\n\n") + "@"+type+"{"+citekey); first = false; for(var field in fieldMap) { if(item[fieldMap[field]]) { writeField(field, item[fieldMap[field]]); } } if(item.reportNumber || item.issue || item.seriesNumber) { writeField("number", item.reportNumber || item.issue || item.seriesNumber); } if(item.publicationTitle) { if(item.itemType == "bookSection" || item.itemType == "conferencePaper") { writeField("booktitle", item.publicationTitle); } else { writeField("journal", item.publicationTitle); } } if(item.publisher) { if(item.itemType == "thesis") { writeField("school", item.publisher); } else if(item.itemType =="report") { writeField("institution", item.publisher); } else { writeField("publisher", item.publisher); } } if(item.creators && item.creators.length) { // split creators into subcategories var author = ""; var editor = ""; var translator = ""; for each(var creator in item.creators) { var creatorString = creator.lastName; if (creator.firstName) { creatorString = creator.firstName + " " + creator.lastName; } if (creator.creatorType == "editor") { editor += " and "+creatorString; } else if (creator.creatorType == "translator") { translator += " and "+creatorString; } else { author += " and "+creatorString; } } if(author) { writeField("author", author.substr(5)); } if(editor) { writeField("editor", editor.substr(5)); } if(translator) { writeField("translator", translator.substr(5)); } } if(item.date) { var date = Zotero.Utilities.strToDate(item.date); // need to use non-localized abbreviation if(typeof date.month == "number") { writeField("month", months[date.month], true); } if(date.year) { writeField("year", date.year); } } if(item.extra) { writeField("note", item.extra); } if(item.tags && item.tags.length) { var tagString = ""; for each(var tag in item.tags) { tagString += ", "+tag.tag; } writeField("keywords", tagString.substr(2)); } if(item.pages) { writeField("pages", item.pages.replace("-","--")); } // Commented out, because we don't want a books number of pages in the BibTeX "pages" field for books. //if(item.numPages) { // writeField("pages", item.numPages); //} if(item.itemType == "webpage") { writeField("howpublished", item.url); } if (item.notes) { for each (var note in item.notes) { writeField("annote", note["note"]); } } if(Zotero.getOption("exportFileData")) { if(item.attachments) { for each(var attachment in item.attachments) { writeField("file", ":" + attachment.path + ":" + attachment.mimeType); } } } Zotero.write("\n}"); }} |
writeField("file", attachmentString.substr(1)); | function doExport() { //Zotero.write("% BibTeX export generated by Zotero "+Zotero.Utilities.getVersion()); // to make sure the BOM gets ignored Zotero.write("\n"); var first = true; var citekeys = new Object(); var item; while(item = Zotero.nextItem()) { // determine type var type = zotero2bibtexTypeMap[item.itemType]; if (typeof(type) == "function") { type = type(item); } if(!type) type = "misc"; // create a unique citation key var citekey = buildCiteKey(item, citekeys); // write citation key Zotero.write((first ? "" : ",\n\n") + "@"+type+"{"+citekey); first = false; for(var field in fieldMap) { if(item[fieldMap[field]]) { writeField(field, item[fieldMap[field]]); } } if(item.reportNumber || item.issue || item.seriesNumber) { writeField("number", item.reportNumber || item.issue || item.seriesNumber); } if(item.publicationTitle) { if(item.itemType == "bookSection" || item.itemType == "conferencePaper") { writeField("booktitle", item.publicationTitle); } else { writeField("journal", item.publicationTitle); } } if(item.publisher) { if(item.itemType == "thesis") { writeField("school", item.publisher); } else if(item.itemType =="report") { writeField("institution", item.publisher); } else { writeField("publisher", item.publisher); } } if(item.creators && item.creators.length) { // split creators into subcategories var author = ""; var editor = ""; var translator = ""; for each(var creator in item.creators) { var creatorString = creator.lastName; if (creator.firstName) { creatorString = creator.firstName + " " + creator.lastName; } if (creator.creatorType == "editor") { editor += " and "+creatorString; } else if (creator.creatorType == "translator") { translator += " and "+creatorString; } else { author += " and "+creatorString; } } if(author) { writeField("author", author.substr(5)); } if(editor) { writeField("editor", editor.substr(5)); } if(translator) { writeField("translator", translator.substr(5)); } } if(item.date) { var date = Zotero.Utilities.strToDate(item.date); // need to use non-localized abbreviation if(typeof date.month == "number") { writeField("month", months[date.month], true); } if(date.year) { writeField("year", date.year); } } if(item.extra) { writeField("note", item.extra); } if(item.tags && item.tags.length) { var tagString = ""; for each(var tag in item.tags) { tagString += ", "+tag.tag; } writeField("keywords", tagString.substr(2)); } if(item.pages) { writeField("pages", item.pages.replace("-","--")); } // Commented out, because we don't want a books number of pages in the BibTeX "pages" field for books. //if(item.numPages) { // writeField("pages", item.numPages); //} if(item.itemType == "webpage") { writeField("howpublished", item.url); } if (item.notes) { for each (var note in item.notes) { writeField("annote", note["note"]); } } if(Zotero.getOption("exportFileData")) { if(item.attachments) { for each(var attachment in item.attachments) { writeField("file", ":" + attachment.path + ":" + attachment.mimeType); } } } Zotero.write("\n}"); }} |
|
} else if(item.creators[j].creatorType == "creator") { | } else { | function doExport() { Zotero.setCharacterSet("utf-8"); var modsCollection = <modsCollection xmlns="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd" />; var item; while(item = Zotero.nextItem()) { var isPartialItem = Zotero.Utilities.inArray(item.itemType, partialItemTypes); var mods = <mods />; /** CORE FIELDS **/ // XML tag titleInfo; object field title if(item.title) { mods.titleInfo.title = item.title; } // XML tag typeOfResource/genre; object field type var modsType, marcGenre; if(item.itemType == "book" || item.itemType == "bookSection") { modsType = "text"; marcGenre = "book"; } else if(item.itemType == "journalArticle" || item.itemType == "magazineArticle") { modsType = "text"; marcGenre = "periodical"; } else if(item.itemType == "newspaperArticle") { modsType = "text"; marcGenre = "newspaper"; } else if(item.itemType == "thesis") { modsType = "text"; marcGenre = "thesis"; } else if(item.itemType == "letter") { modsType = "text"; marcGenre = "letter"; } else if(item.itemType == "manuscript") { modsType = "text"; modsType.@manuscript = "yes"; } else if(item.itemType == "interview") { modsType = "text"; marcGenre = "interview"; } else if(item.itemType == "film") { modsType = "moving image"; marcGenre = "motion picture"; } else if(item.itemType == "artwork") { modsType = "still image"; marcGenre = "art original"; } else if(item.itemType == "webpage") { modsType = "multimedia"; marcGenre = "web site"; } else if(item.itemType == "note" || item.itemType == "attachment") { continue; } mods.typeOfResource = modsType; mods.genre += <genre authority="local">{item.itemType}</genre>; if(marcGenre) { mods.genre += <genre authority="marcgt">{marcGenre}</genre>; } // XML tag genre; object field thesisType, type if(item.thesisType) { mods.genre += <genre>{item.thesisType}</genre>; } if(item.type) { mods.genre += <genre>{item.type}</genre>; } // XML tag name; object field creators for(var j in item.creators) { var roleTerm = ""; if(item.creators[j].creatorType == "author") { roleTerm = "aut"; } else if(item.creators[j].creatorType == "editor") { roleTerm = "edt"; } else if(item.creators[j].creatorType == "creator") { roleTerm = "ctb"; } // FIXME - currently all names are personal mods.name += <name type="personal"> <namePart type="family">{item.creators[j].lastName}</namePart> <namePart type="given">{item.creators[j].firstName}</namePart> <role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role> </name>; } // XML tag recordInfo.recordOrigin; used to store our generator note //mods.recordInfo.recordOrigin = "Zotero for Firefox "+Zotero.Utilities.getVersion(); /** FIELDS ON NEARLY EVERYTHING BUT NOT A PART OF THE CORE **/ // XML tag recordInfo.recordContentSource; object field source if(item.source) { mods.recordInfo.recordContentSource = item.source; } // XML tag recordInfo.recordIdentifier; object field accessionNumber if(item.accessionNumber) { mods.recordInfo.recordIdentifier = item.accessionNumber; } // XML tag accessCondition; object field rights if(item.rights) { mods.accessCondition = item.rights; } /** SUPPLEMENTAL FIELDS **/ // Make part its own tag so we can figure out where it goes later var part = new XML(); // XML tag detail; object field volume if(item.volume) { if(parseInt(item.volume) == item.volume) { part += <detail type="volume"><number>{item.volume}</number></detail>; } else { part += <detail type="volume"><text>{item.volume}</text></detail>; } } // XML tag detail; object field number if(item.issue) { if(parseInt(item.issue) == item.issue) { part += <detail type="issue"><number>{item.issue}</number></detail>; } else { part += <detail type="issue"><text>{item.issue}</text></detail>; } } // XML tag detail; object field section if(item.section) { if(parseInt(item.section) == item.section) { part += <detail type="section"><number>{item.section}</number></detail>; } else { part += <detail type="section"><text>{item.section}</text></detail>; } } // XML tag detail; object field pages if(item.pages) { var range = Zotero.Utilities.getPageRange(item.pages); part += <extent unit="pages"><start>{range[0]}</start><end>{range[1]}</end></extent>; } // Assign part if something was assigned if(part.length() != 1) { if(isPartialItem) { // For a journal article, bookSection, etc., the part is the host mods.relatedItem.part += <part>{part}</part>; } else { mods.part += <part>{part}</part>; } } // XML tag originInfo; object fields edition, place, publisher, year, date var originInfo = new XML(); if(item.edition) { originInfo += <edition>{item.edition}</edition>; } if(item.place) { originInfo += <place><placeTerm type="text">{item.place}</placeTerm></place>; } if(item.publisher) { originInfo += <publisher>{item.publisher}</publisher>; } else if(item.distributor) { originInfo += <publisher>{item.distributor}</publisher>; } if(item.date) { if(Zotero.Utilities.inArray(item.itemType, ["book", "bookSection"])) { // Assume year is copyright date var dateType = "copyrightDate"; } else if(Zotero.Utilities.inArray(item.itemType, ["journalArticle", "magazineArticle", "newspaperArticle"])) { // Assume date is date issued var dateType = "dateIssued"; } else { // Assume date is date created var dateType = "dateCreated"; } var tag = <{dateType}>{item.date}</{dateType}>; originInfo += tag; } if(item.accessDate) { originInfo += <dateCaptured>{item.accessDate}</dateCaptured>; } if(originInfo.length() != 1) { if(isPartialItem) { // For a journal article, bookSection, etc., this goes under the host mods.relatedItem.originInfo += <originInfo>{originInfo}</originInfo>; } else { mods.originInfo += <originInfo>{originInfo}</originInfo>; } } // XML tag identifier; object fields ISBN, ISSN if(isPartialItem) { var identifier = mods.relatedItem; } else { var identifier = mods; } if(item.ISBN) { identifier.identifier += <identifier type="isbn">{item.ISBN}</identifier>; } if(item.ISSN) { identifier.identifier += <identifier type="issn">{item.ISSN}</identifier>; } if(item.DOI) { mods.identifier += <identifier type="doi">{item.DOI}</identifier>; } // XML tag relatedItem.titleInfo; object field publication if(item.publicationTitle) { mods.relatedItem.titleInfo += <titleInfo><title>{item.publicationTitle}</title></titleInfo>; } // XML tag classification; object field callNumber if(item.callNumber) { mods.classification = item.callNumber; } // XML tag location.physicalLocation; object field archiveLocation if(item.archiveLocation) { mods.location.physicalLocation = item.archiveLocation; } // XML tag location.url; object field archiveLocation if(item.url) { mods.location.url = item.url; } // XML tag title.titleInfo; object field journalAbbreviation if(item.journalAbbreviation) { mods.relatedItem.titleInfo += <titleInfo type="abbreviated"><title>{item.journalAbbreviation}</title></titleInfo>; } // XML tag abstract; object field abstractNote if(item.abstractNote) { mods.abstract = item.abstractNote; } if(mods.relatedItem.length() == 1 && isPartialItem) { mods.relatedItem.@type = "host"; } /** NOTES **/ if(Zotero.getOption("exportNotes")) { for(var j in item.notes) { // Add note tag var note = <note type="content">{item.notes[j].note}</note>; mods.note += note; } } /** TAGS **/ for(var j in item.tags) { mods.subject += <subject><topic>{item.tags[j].tag}</topic></subject>; } // XML tag relatedItem.titleInfo; object field series if(item.seriesTitle || item.series || item.seriesNumber || item.seriesText) { var series = <relatedItem type="series"/>; if(item.series) { series.titleInfo.title = item.series; } if(item.seriesTitle) { series.titleInfo.partTitle = item.seriesTitle; } if(item.seriesText) { series.titleInfo.subTitle = item.seriesText; } if(item.seriesNumber) { series.titleInfo.partNumber = item.seriesNumber; } // TODO: make this work in import /*if(item.itemType == "bookSection") { // For a book section, series info must go inside host tag mods.relatedItem.relatedItem = series; } else {*/ mods.relatedItem += series; //} } modsCollection.mods += mods; } Zotero.write('<?xml version="1.0"?>'+"\n"); Zotero.write(modsCollection.toXMLString());} |
mods.name += <name type="personal"> <namePart type="family">{item.creators[j].lastName}</namePart> <namePart type="given">{item.creators[j].firstName}</namePart> <role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role> </name>; | if(item.creators[j].fieldMode == 1) { mods.name += <name type="personal"> <namePart>{item.creators[j].lastName}</namePart> <role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role> </name>; } else { mods.name += <name type="personal"> <namePart type="family">{item.creators[j].lastName}</namePart> <namePart type="given">{item.creators[j].firstName}</namePart> <role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role> </name>; } | function doExport() { Zotero.setCharacterSet("utf-8"); var modsCollection = <modsCollection xmlns="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd" />; var item; while(item = Zotero.nextItem()) { var isPartialItem = Zotero.Utilities.inArray(item.itemType, partialItemTypes); var mods = <mods />; /** CORE FIELDS **/ // XML tag titleInfo; object field title if(item.title) { mods.titleInfo.title = item.title; } // XML tag typeOfResource/genre; object field type var modsType, marcGenre; if(item.itemType == "book" || item.itemType == "bookSection") { modsType = "text"; marcGenre = "book"; } else if(item.itemType == "journalArticle" || item.itemType == "magazineArticle") { modsType = "text"; marcGenre = "periodical"; } else if(item.itemType == "newspaperArticle") { modsType = "text"; marcGenre = "newspaper"; } else if(item.itemType == "thesis") { modsType = "text"; marcGenre = "thesis"; } else if(item.itemType == "letter") { modsType = "text"; marcGenre = "letter"; } else if(item.itemType == "manuscript") { modsType = "text"; modsType.@manuscript = "yes"; } else if(item.itemType == "interview") { modsType = "text"; marcGenre = "interview"; } else if(item.itemType == "film") { modsType = "moving image"; marcGenre = "motion picture"; } else if(item.itemType == "artwork") { modsType = "still image"; marcGenre = "art original"; } else if(item.itemType == "webpage") { modsType = "multimedia"; marcGenre = "web site"; } else if(item.itemType == "note" || item.itemType == "attachment") { continue; } mods.typeOfResource = modsType; mods.genre += <genre authority="local">{item.itemType}</genre>; if(marcGenre) { mods.genre += <genre authority="marcgt">{marcGenre}</genre>; } // XML tag genre; object field thesisType, type if(item.thesisType) { mods.genre += <genre>{item.thesisType}</genre>; } if(item.type) { mods.genre += <genre>{item.type}</genre>; } // XML tag name; object field creators for(var j in item.creators) { var roleTerm = ""; if(item.creators[j].creatorType == "author") { roleTerm = "aut"; } else if(item.creators[j].creatorType == "editor") { roleTerm = "edt"; } else if(item.creators[j].creatorType == "creator") { roleTerm = "ctb"; } // FIXME - currently all names are personal mods.name += <name type="personal"> <namePart type="family">{item.creators[j].lastName}</namePart> <namePart type="given">{item.creators[j].firstName}</namePart> <role><roleTerm type="code" authority="marcrelator">{roleTerm}</roleTerm></role> </name>; } // XML tag recordInfo.recordOrigin; used to store our generator note //mods.recordInfo.recordOrigin = "Zotero for Firefox "+Zotero.Utilities.getVersion(); /** FIELDS ON NEARLY EVERYTHING BUT NOT A PART OF THE CORE **/ // XML tag recordInfo.recordContentSource; object field source if(item.source) { mods.recordInfo.recordContentSource = item.source; } // XML tag recordInfo.recordIdentifier; object field accessionNumber if(item.accessionNumber) { mods.recordInfo.recordIdentifier = item.accessionNumber; } // XML tag accessCondition; object field rights if(item.rights) { mods.accessCondition = item.rights; } /** SUPPLEMENTAL FIELDS **/ // Make part its own tag so we can figure out where it goes later var part = new XML(); // XML tag detail; object field volume if(item.volume) { if(parseInt(item.volume) == item.volume) { part += <detail type="volume"><number>{item.volume}</number></detail>; } else { part += <detail type="volume"><text>{item.volume}</text></detail>; } } // XML tag detail; object field number if(item.issue) { if(parseInt(item.issue) == item.issue) { part += <detail type="issue"><number>{item.issue}</number></detail>; } else { part += <detail type="issue"><text>{item.issue}</text></detail>; } } // XML tag detail; object field section if(item.section) { if(parseInt(item.section) == item.section) { part += <detail type="section"><number>{item.section}</number></detail>; } else { part += <detail type="section"><text>{item.section}</text></detail>; } } // XML tag detail; object field pages if(item.pages) { var range = Zotero.Utilities.getPageRange(item.pages); part += <extent unit="pages"><start>{range[0]}</start><end>{range[1]}</end></extent>; } // Assign part if something was assigned if(part.length() != 1) { if(isPartialItem) { // For a journal article, bookSection, etc., the part is the host mods.relatedItem.part += <part>{part}</part>; } else { mods.part += <part>{part}</part>; } } // XML tag originInfo; object fields edition, place, publisher, year, date var originInfo = new XML(); if(item.edition) { originInfo += <edition>{item.edition}</edition>; } if(item.place) { originInfo += <place><placeTerm type="text">{item.place}</placeTerm></place>; } if(item.publisher) { originInfo += <publisher>{item.publisher}</publisher>; } else if(item.distributor) { originInfo += <publisher>{item.distributor}</publisher>; } if(item.date) { if(Zotero.Utilities.inArray(item.itemType, ["book", "bookSection"])) { // Assume year is copyright date var dateType = "copyrightDate"; } else if(Zotero.Utilities.inArray(item.itemType, ["journalArticle", "magazineArticle", "newspaperArticle"])) { // Assume date is date issued var dateType = "dateIssued"; } else { // Assume date is date created var dateType = "dateCreated"; } var tag = <{dateType}>{item.date}</{dateType}>; originInfo += tag; } if(item.accessDate) { originInfo += <dateCaptured>{item.accessDate}</dateCaptured>; } if(originInfo.length() != 1) { if(isPartialItem) { // For a journal article, bookSection, etc., this goes under the host mods.relatedItem.originInfo += <originInfo>{originInfo}</originInfo>; } else { mods.originInfo += <originInfo>{originInfo}</originInfo>; } } // XML tag identifier; object fields ISBN, ISSN if(isPartialItem) { var identifier = mods.relatedItem; } else { var identifier = mods; } if(item.ISBN) { identifier.identifier += <identifier type="isbn">{item.ISBN}</identifier>; } if(item.ISSN) { identifier.identifier += <identifier type="issn">{item.ISSN}</identifier>; } if(item.DOI) { mods.identifier += <identifier type="doi">{item.DOI}</identifier>; } // XML tag relatedItem.titleInfo; object field publication if(item.publicationTitle) { mods.relatedItem.titleInfo += <titleInfo><title>{item.publicationTitle}</title></titleInfo>; } // XML tag classification; object field callNumber if(item.callNumber) { mods.classification = item.callNumber; } // XML tag location.physicalLocation; object field archiveLocation if(item.archiveLocation) { mods.location.physicalLocation = item.archiveLocation; } // XML tag location.url; object field archiveLocation if(item.url) { mods.location.url = item.url; } // XML tag title.titleInfo; object field journalAbbreviation if(item.journalAbbreviation) { mods.relatedItem.titleInfo += <titleInfo type="abbreviated"><title>{item.journalAbbreviation}</title></titleInfo>; } // XML tag abstract; object field abstractNote if(item.abstractNote) { mods.abstract = item.abstractNote; } if(mods.relatedItem.length() == 1 && isPartialItem) { mods.relatedItem.@type = "host"; } /** NOTES **/ if(Zotero.getOption("exportNotes")) { for(var j in item.notes) { // Add note tag var note = <note type="content">{item.notes[j].note}</note>; mods.note += note; } } /** TAGS **/ for(var j in item.tags) { mods.subject += <subject><topic>{item.tags[j].tag}</topic></subject>; } // XML tag relatedItem.titleInfo; object field series if(item.seriesTitle || item.series || item.seriesNumber || item.seriesText) { var series = <relatedItem type="series"/>; if(item.series) { series.titleInfo.title = item.series; } if(item.seriesTitle) { series.titleInfo.partTitle = item.seriesTitle; } if(item.seriesText) { series.titleInfo.subTitle = item.seriesText; } if(item.seriesNumber) { series.titleInfo.partNumber = item.seriesNumber; } // TODO: make this work in import /*if(item.itemType == "bookSection") { // For a book section, series info must go inside host tag mods.relatedItem.relatedItem = series; } else {*/ mods.relatedItem += series; //} } modsCollection.mods += mods; } Zotero.write('<?xml version="1.0"?>'+"\n"); Zotero.write(modsCollection.toXMLString());} |
$('success_count').update(num_success); $('fail_count').update(num_fail); | $('success_count').innerHTML = num_success; $('fail_count').innerHTML = num_fail; | function doGradeTest(url, failed_tests, passed_tests, pass) { var failed = $(failed_tests); var passed = $(passed_tests); var selection = pass ? failed.options[failed.selectedIndex] : passed.options[passed.selectedIndex]; var value = selection.innerHTML; var num_success = parseInt($('success_count').innerHTML); var num_fail = parseInt($('fail_count').innerHTML); selection.remove(); if (pass) { passed.appendChild(selection); num_success++; num_fail--; } else { failed.appendChild(selection); num_success--; num_fail++; } $('success_count').update(num_success); $('fail_count').update(num_fail); new Ajax.Request(url, {parameters: {pass: pass, value: value, authenticity_token: window.authenticity_token}});} |
"web site":"webpage" "yearbook":"book", | "web site":"webpage", "yearbook":"book" | function doImport() { var marcGenres = {// "abstract or summary":XXX,// "abstract":XXX,// "summary":XXX, "art reproduction":"artwork", "article":"journalArticle", "autobiography":"book", "bibliography":"book", "biography":"book", "book":"book",// "calendar":XXX,// "catalog":XXX, "chart":"artwork", "comic or graphic novel":"book", "comic":"book", "graphic novel":"book", "comic strip":"artwork", "conference publication":"conferencePaper",// "database":XXX, "dictionary":"dictionaryEntry", "diorama":"artwork",// "directory":XXX, "drama":"book", "encyclopedia":"encyclopediaArticle",// "essay":XXX, "festschrift":"book", "fiction":"book",// "filmography":XXX, "filmstrip":"videoRecording",// "findingaid":XXX,// "flash card":XXX, "folktale":"book",// "font":XXX,// "game":XXX, "government publication":"book", "graphic":"artwork", "globe":"map", "handbook":"book", "history":"book", "hymnal":"book", "humor,satire":"book", "humor":"book", "satire":"book",// "index":XXX,// "instruction":XXX,// "interview":XXX,// "issue":XXX, "journal":"journalArticle", "kit":"artwork",// "language instruction":XXX, "law report or digest":"journalArticle", "law report":"journalArticle", "digest":"journalArticle", "law digest":"journalArticle", "legal article":"journalArticle", "legal case and case notes":"case", "legal case":"case", "case notes":"case", "legislation":"statute", "loose-leaf":"manuscript", "map":"map", "memoir":"book", "microscope slide":"artwork", "model":"artwork",// "multivolume monograph":XXX, "novel":"book",// "numeric data":XXX,// "offprint":XXX, "online system or service":"webpage", "online system":"webpage", "service":"webpage", "online service":"webpage", "patent":"patent", "periodical":"journalArticle", "picture":"artwork",// "poetry":XXX,// "programmed text":XXX, "realia":"artwork",// "rehearsal":XXX,// "remote sensing image":XXX,// "reporting":XXX,// "review":XXX, "script":"book",// "series":XXX,// "short story":XXX, "slide":"artwork", "sound":"audioRecording", "speech":"audioRecording",// "standard or specification":XXX,// "standard":XXX,// "specification":XXX,// "statistics":XXX,// "survey of literature":XXX, "technical report":"report", "newspaper":"newspaperArticle", "theses":"thesis", "thesis":"thesis",// "toy":XXX, "transparency":"artwork",// "treaty":XXX, "videorecording":"videoRecording", "letter":"letter", "motion picture":"film", "art original":"artwork", "web site":"webpage" "yearbook":"book", }; // parse with E4X var m = new Namespace("http://www.loc.gov/mods/v3"); // why does this default namespace declaration not work!? default xml namespace = m; var xml = Zotero.getXML(); if(xml.m::mods.length()) { var modsElements = xml.m::mods; } else { var modsElements = [xml]; } for each(var mods in modsElements) { var newItem = new Zotero.Item(); // title for each(var titleInfo in mods.m::titleInfo) { // dropping other title types so they don't overwrite the main title // we have same behaviour in the MARC translator if([email protected]()) { if (titleInfo.m::title.length()){ newItem.title = titleInfo.m::title.text().toString(); if (titleInfo.m::subTitle.length()) { newItem.title = newItem.title + ": " + titleInfo.m::subTitle.text().toString(); } } else { newItem.title = titleInfo.*.text(); // including text from sub elements } } // try to get genre from local genre for each(var genre in mods.m::genre) { if(genre.@authority == "local" && Zotero.Utilities.itemTypeExists(genre)) { newItem.itemType = genre.text().toString(); } else if(!newItem.itemType && (genre.@authority == "marcgt" || genre.@authority == "marc")) { // otherwise, look at the marc genre newItem.itemType = marcGenres[genre.text().toString()]; } } if(!newItem.itemType) { // try to get genre data from host for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var genre in relatedItem.m::genre) { if(genre.@authority == "marcgt" || genre.@authority == "marc") { newItem.itemType = marcGenres[genre.text().toString()]; break; } } } } if(!newItem.itemType) newItem.itemType = "document"; } var isPartialItem = Zotero.Utilities.inArray(newItem.itemType, partialItemTypes); // TODO: thesisType, type for each(var name in mods.m::name) { // TODO: institutional authors var creator = {}; creator.firstName = ""; for each(var namePart in name.m::namePart) { if(namePart.@type == "given") { if(creator.firstName != "") creator.firstName = creator.firstName + " "; creator.firstName = creator.firstName + namePart.text().toString(); } else if(namePart.@type == "family") { creator.lastName = namePart.text().toString(); } else if(namePart.@type == "date" || namePart.@type == "termsOfAddress") { // ignore these non name types for now } else { var backupName = namePart.text().toString(); } } if(backupName && !creator.firstName && !creator.lastName) { creator = Zotero.Utilities.cleanAuthor(backupName, "author", true); } // look for roles for(var role in name.m::role.m::roleTerm) { if(role.@type == "code" && role.@authority == "marcrelator") { if(role == "edt") { creator.creatorType = "editor"; } else if(role == "ctb") { creator.creatorType = "contributor"; } else if(role == "trl") { creator.creatorType = "translator"; } } } if(!creator.creatorType) creator.creatorType = "author"; newItem.creators.push(creator); } // source newItem.source = mods.m::recordInfo.m::recordContentSource.text().toString(); // accessionNumber newItem.accessionNumber = mods.m::recordInfo.m::recordIdentifier.text().toString(); // rights newItem.rights = mods.m::accessCondition.text().toString(); /** SUPPLEMENTAL FIELDS **/ var part = false, originInfo = false; // series for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var titleInfo in relatedItem.m::titleInfo) { if(titleInfo.@type == "abbreviated") { newItem.journalAbbreviation = titleInfo.m::title.text().toString(); if(!newItem.publicationTitle) newItem.publicationTitle = newItem.journalAbbreviation; } else { newItem.publicationTitle = titleInfo.m::title.text().toString(); } } part = relatedItem.m::part; originInfo = relatedItem.m::originInfo; processIdentifiers(newItem, relatedItem.m::identifier); } else if(relatedItem.@type == "series") { newItem.series = relatedItem.m::titleInfo.m::title.text().toString(); newItem.seriesTitle = relatedItem.m::titleInfo.m::partTitle.text().toString(); newItem.seriesText = relatedItem.m::titleInfo.m::subTitle.text().toString(); newItem.seriesNumber = relatedItem.m::titleInfo.m::partNumber.text().toString(); } } // get part if(!part) { part = mods.m::part; originInfo = mods.m::originInfo; } if(part) { for each(var detail in part.m::detail) { // volume if(detail.@type == "volume") { newItem.volume = detail.m::number.text().toString(); if(!newItem.volume) { newItem.volume = detail.m::text.text().toString(); } } // number if(detail.@type == "issue") { newItem.issue = detail.m::number.text().toString(); if(!newItem.issue) { newItem.issue = detail.m::text.text().toString(); } } // section if(detail.@type == "section") { newItem.section = detail.m::number.text().toString(); if(!newItem.section) { newItem.section = detail.m::text.text().toString(); } } } // pages for each(var extent in part.m::extent) { if(extent.@unit == "pages" || extent.@unit == "page") { var pagesStart = extent.m::start.text().toString(); var pagesEnd = extent.m::end.text().toString(); if(pagesStart || pagesEnd) { if(pagesStart == pagesEnd) { newItem.pages = pagesStart; } else if(pagesStart && pagesEnd) { newItem.pages = pagesStart+"-"+pagesEnd; } else { newItem.pages = pagesStart+pagesEnd; } } } } } // identifier processIdentifiers(newItem, mods.m::identifier); // edition newItem.edition = originInfo.m::edition.text().toString(); // place for each(var placeTerm in originInfo.m::place.m::placeTerm) { if(placeTerm.@type == "text") { newItem.place = placeTerm.text().toString(); } } // publisher/distributor if(originInfo.m::publisher.length()) { if(newItem.itemType == "webpage" || newItem.itemType == "website") { newItem.publicationTitle = originInfo.m::publisher[0].text().toString(); } else { newItem.publisher = originInfo.m::publisher[0].text().toString(); } } // date if(originInfo.m::copyrightDate.length()) { newItem.date = originInfo.m::copyrightDate[0].text().toString(); } else if(originInfo.m::dateIssued.length()) { newItem.date = originInfo.m::dateIssued[0].text().toString(); } else if(originInfo.m::dateCreated.length()) { newItem.date = originInfo.m::dateCreated[0].text().toString(); } // lastModified newItem.lastModified = originInfo.m::dateModified.text().toString(); // accessDate newItem.accessDate = originInfo.m::dateCaptured.text().toString(); // call number newItem.callNumber = mods.m::classification.text().toString(); // archiveLocation newItem.archiveLocation = mods.m::location.m::physicalLocation.text().toString(); // attachments and url for each(var url in mods.m::location.m::url) { var value = url.text().toString(); if (url.@access == "raw object") { var filetitle; if (url.@displayLabel){ filetitle = url.@displayLabel; } else { filetitle = "Attachment"; } if (value.substr(-4,4)==".pdf") { newItem.attachments.push({url:value, mimeType:"application/pdf", title:filetitle, downloadable:true}); } else { newItem.attachments.push({url:value, title:filetitle, downloadable:true}); } } else { newItem.url = value; } } // abstract newItem.abstractNote = mods.m::abstract.text().toString(); /** NOTES **/ for each(var note in mods.m::note) { newItem.notes.push({note:note.text().toString()}); } /** TAGS **/ for each(var subject in mods.m::subject.m::topic) { newItem.tags.push(subject.text().toString()); } // Language // create an array of languages var languages = new Array(); // E4X filter might need to be updated to include languageTerms that are @type="code" only for each(var language in mods.m::language.m::languageTerm.(@type == "text")) { languages.push(language.text().toString()); } // join the list separated by semicolons & add it to zotero item newItem.language = languages.join('; '); Zotero.debug(newItem); newItem.complete(); }} |
newItem.title = titleInfo.*.text(); } | newItem.title = titleInfo.*.text(); } } | function doImport() { var marcGenres = {// "abstract or summary":XXX,// "abstract":XXX,// "summary":XXX, "art reproduction":"artwork", "article":"journalArticle", "autobiography":"book", "bibliography":"book", "biography":"book", "book":"book",// "calendar":XXX,// "catalog":XXX, "chart":"artwork", "comic or graphic novel":"book", "comic":"book", "graphic novel":"book", "comic strip":"artwork", "conference publication":"conferencePaper",// "database":XXX, "dictionary":"dictionaryEntry", "diorama":"artwork",// "directory":XXX, "drama":"book", "encyclopedia":"encyclopediaArticle",// "essay":XXX, "festschrift":"book", "fiction":"book",// "filmography":XXX, "filmstrip":"videoRecording",// "findingaid":XXX,// "flash card":XXX, "folktale":"book",// "font":XXX,// "game":XXX, "government publication":"book", "graphic":"artwork", "globe":"map", "handbook":"book", "history":"book", "hymnal":"book", "humor,satire":"book", "humor":"book", "satire":"book",// "index":XXX,// "instruction":XXX,// "interview":XXX,// "issue":XXX, "journal":"journalArticle", "kit":"artwork",// "language instruction":XXX, "law report or digest":"journalArticle", "law report":"journalArticle", "digest":"journalArticle", "law digest":"journalArticle", "legal article":"journalArticle", "legal case and case notes":"case", "legal case":"case", "case notes":"case", "legislation":"statute", "loose-leaf":"manuscript", "map":"map", "memoir":"book", "microscope slide":"artwork", "model":"artwork",// "multivolume monograph":XXX, "novel":"book",// "numeric data":XXX,// "offprint":XXX, "online system or service":"webpage", "online system":"webpage", "service":"webpage", "online service":"webpage", "patent":"patent", "periodical":"journalArticle", "picture":"artwork",// "poetry":XXX,// "programmed text":XXX, "realia":"artwork",// "rehearsal":XXX,// "remote sensing image":XXX,// "reporting":XXX,// "review":XXX, "script":"book",// "series":XXX,// "short story":XXX, "slide":"artwork", "sound":"audioRecording", "speech":"audioRecording",// "standard or specification":XXX,// "standard":XXX,// "specification":XXX,// "statistics":XXX,// "survey of literature":XXX, "technical report":"report", "newspaper":"newspaperArticle", "theses":"thesis", "thesis":"thesis",// "toy":XXX, "transparency":"artwork",// "treaty":XXX, "videorecording":"videoRecording", "letter":"letter", "motion picture":"film", "art original":"artwork", "web site":"webpage" "yearbook":"book", }; // parse with E4X var m = new Namespace("http://www.loc.gov/mods/v3"); // why does this default namespace declaration not work!? default xml namespace = m; var xml = Zotero.getXML(); if(xml.m::mods.length()) { var modsElements = xml.m::mods; } else { var modsElements = [xml]; } for each(var mods in modsElements) { var newItem = new Zotero.Item(); // title for each(var titleInfo in mods.m::titleInfo) { // dropping other title types so they don't overwrite the main title // we have same behaviour in the MARC translator if([email protected]()) { if (titleInfo.m::title.length()){ newItem.title = titleInfo.m::title.text().toString(); if (titleInfo.m::subTitle.length()) { newItem.title = newItem.title + ": " + titleInfo.m::subTitle.text().toString(); } } else { newItem.title = titleInfo.*.text(); // including text from sub elements } } // try to get genre from local genre for each(var genre in mods.m::genre) { if(genre.@authority == "local" && Zotero.Utilities.itemTypeExists(genre)) { newItem.itemType = genre.text().toString(); } else if(!newItem.itemType && (genre.@authority == "marcgt" || genre.@authority == "marc")) { // otherwise, look at the marc genre newItem.itemType = marcGenres[genre.text().toString()]; } } if(!newItem.itemType) { // try to get genre data from host for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var genre in relatedItem.m::genre) { if(genre.@authority == "marcgt" || genre.@authority == "marc") { newItem.itemType = marcGenres[genre.text().toString()]; break; } } } } if(!newItem.itemType) newItem.itemType = "document"; } var isPartialItem = Zotero.Utilities.inArray(newItem.itemType, partialItemTypes); // TODO: thesisType, type for each(var name in mods.m::name) { // TODO: institutional authors var creator = {}; creator.firstName = ""; for each(var namePart in name.m::namePart) { if(namePart.@type == "given") { if(creator.firstName != "") creator.firstName = creator.firstName + " "; creator.firstName = creator.firstName + namePart.text().toString(); } else if(namePart.@type == "family") { creator.lastName = namePart.text().toString(); } else if(namePart.@type == "date" || namePart.@type == "termsOfAddress") { // ignore these non name types for now } else { var backupName = namePart.text().toString(); } } if(backupName && !creator.firstName && !creator.lastName) { creator = Zotero.Utilities.cleanAuthor(backupName, "author", true); } // look for roles for(var role in name.m::role.m::roleTerm) { if(role.@type == "code" && role.@authority == "marcrelator") { if(role == "edt") { creator.creatorType = "editor"; } else if(role == "ctb") { creator.creatorType = "contributor"; } else if(role == "trl") { creator.creatorType = "translator"; } } } if(!creator.creatorType) creator.creatorType = "author"; newItem.creators.push(creator); } // source newItem.source = mods.m::recordInfo.m::recordContentSource.text().toString(); // accessionNumber newItem.accessionNumber = mods.m::recordInfo.m::recordIdentifier.text().toString(); // rights newItem.rights = mods.m::accessCondition.text().toString(); /** SUPPLEMENTAL FIELDS **/ var part = false, originInfo = false; // series for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var titleInfo in relatedItem.m::titleInfo) { if(titleInfo.@type == "abbreviated") { newItem.journalAbbreviation = titleInfo.m::title.text().toString(); if(!newItem.publicationTitle) newItem.publicationTitle = newItem.journalAbbreviation; } else { newItem.publicationTitle = titleInfo.m::title.text().toString(); } } part = relatedItem.m::part; originInfo = relatedItem.m::originInfo; processIdentifiers(newItem, relatedItem.m::identifier); } else if(relatedItem.@type == "series") { newItem.series = relatedItem.m::titleInfo.m::title.text().toString(); newItem.seriesTitle = relatedItem.m::titleInfo.m::partTitle.text().toString(); newItem.seriesText = relatedItem.m::titleInfo.m::subTitle.text().toString(); newItem.seriesNumber = relatedItem.m::titleInfo.m::partNumber.text().toString(); } } // get part if(!part) { part = mods.m::part; originInfo = mods.m::originInfo; } if(part) { for each(var detail in part.m::detail) { // volume if(detail.@type == "volume") { newItem.volume = detail.m::number.text().toString(); if(!newItem.volume) { newItem.volume = detail.m::text.text().toString(); } } // number if(detail.@type == "issue") { newItem.issue = detail.m::number.text().toString(); if(!newItem.issue) { newItem.issue = detail.m::text.text().toString(); } } // section if(detail.@type == "section") { newItem.section = detail.m::number.text().toString(); if(!newItem.section) { newItem.section = detail.m::text.text().toString(); } } } // pages for each(var extent in part.m::extent) { if(extent.@unit == "pages" || extent.@unit == "page") { var pagesStart = extent.m::start.text().toString(); var pagesEnd = extent.m::end.text().toString(); if(pagesStart || pagesEnd) { if(pagesStart == pagesEnd) { newItem.pages = pagesStart; } else if(pagesStart && pagesEnd) { newItem.pages = pagesStart+"-"+pagesEnd; } else { newItem.pages = pagesStart+pagesEnd; } } } } } // identifier processIdentifiers(newItem, mods.m::identifier); // edition newItem.edition = originInfo.m::edition.text().toString(); // place for each(var placeTerm in originInfo.m::place.m::placeTerm) { if(placeTerm.@type == "text") { newItem.place = placeTerm.text().toString(); } } // publisher/distributor if(originInfo.m::publisher.length()) { if(newItem.itemType == "webpage" || newItem.itemType == "website") { newItem.publicationTitle = originInfo.m::publisher[0].text().toString(); } else { newItem.publisher = originInfo.m::publisher[0].text().toString(); } } // date if(originInfo.m::copyrightDate.length()) { newItem.date = originInfo.m::copyrightDate[0].text().toString(); } else if(originInfo.m::dateIssued.length()) { newItem.date = originInfo.m::dateIssued[0].text().toString(); } else if(originInfo.m::dateCreated.length()) { newItem.date = originInfo.m::dateCreated[0].text().toString(); } // lastModified newItem.lastModified = originInfo.m::dateModified.text().toString(); // accessDate newItem.accessDate = originInfo.m::dateCaptured.text().toString(); // call number newItem.callNumber = mods.m::classification.text().toString(); // archiveLocation newItem.archiveLocation = mods.m::location.m::physicalLocation.text().toString(); // attachments and url for each(var url in mods.m::location.m::url) { var value = url.text().toString(); if (url.@access == "raw object") { var filetitle; if (url.@displayLabel){ filetitle = url.@displayLabel; } else { filetitle = "Attachment"; } if (value.substr(-4,4)==".pdf") { newItem.attachments.push({url:value, mimeType:"application/pdf", title:filetitle, downloadable:true}); } else { newItem.attachments.push({url:value, title:filetitle, downloadable:true}); } } else { newItem.url = value; } } // abstract newItem.abstractNote = mods.m::abstract.text().toString(); /** NOTES **/ for each(var note in mods.m::note) { newItem.notes.push({note:note.text().toString()}); } /** TAGS **/ for each(var subject in mods.m::subject.m::topic) { newItem.tags.push(subject.text().toString()); } // Language // create an array of languages var languages = new Array(); // E4X filter might need to be updated to include languageTerms that are @type="code" only for each(var language in mods.m::language.m::languageTerm.(@type == "text")) { languages.push(language.text().toString()); } // join the list separated by semicolons & add it to zotero item newItem.language = languages.join('; '); Zotero.debug(newItem); newItem.complete(); }} |
if(!newItem.itemType) { for each(var form in mods.m::physicalDescription.m::form) { if(form.@authority == "marcform" || form.@authority == "marc") { if(form.text().toString() == "electronic") { newItem.itemType = "webpage"; break; } } } if(!newItem.itemType) newItem.itemType = "document"; } | if(!newItem.itemType) newItem.itemType = "document"; | function doImport() { var marcGenres = {// "abstract or summary":XXX,// "abstract":XXX,// "summary":XXX, "art reproduction":"artwork", "article":"journalArticle", "autobiography":"book", "bibliography":"book", "biography":"book", "book":"book",// "calendar":XXX,// "catalog":XXX, "chart":"artwork", "comic or graphic novel":"book", "comic":"book", "graphic novel":"book", "comic strip":"artwork", "conference publication":"conferencePaper",// "database":XXX, "dictionary":"dictionaryEntry", "diorama":"artwork",// "directory":XXX, "drama":"book", "encyclopedia":"encyclopediaArticle",// "essay":XXX, "festschrift":"book", "fiction":"book",// "filmography":XXX, "filmstrip":"videoRecording",// "findingaid":XXX,// "flash card":XXX, "folktale":"book",// "font":XXX,// "game":XXX, "government publication":"book", "graphic":"artwork", "globe":"map", "handbook":"book", "history":"book", "hymnal":"book", "humor,satire":"book", "humor":"book", "satire":"book",// "index":XXX,// "instruction":XXX,// "interview":XXX,// "issue":XXX, "journal":"journalArticle", "kit":"artwork",// "language instruction":XXX, "law report or digest":"journalArticle", "law report":"journalArticle", "digest":"journalArticle", "law digest":"journalArticle", "legal article":"journalArticle", "legal case and case notes":"case", "legal case":"case", "case notes":"case", "legislation":"statute", "loose-leaf":"manuscript", "map":"map", "memoir":"book", "microscope slide":"artwork", "model":"artwork",// "multivolume monograph":XXX, "novel":"book",// "numeric data":XXX,// "offprint":XXX, "online system or service":"webpage", "online system":"webpage", "service":"webpage", "online service":"webpage", "patent":"patent", "periodical":"journalArticle", "picture":"artwork",// "poetry":XXX,// "programmed text":XXX, "realia":"artwork",// "rehearsal":XXX,// "remote sensing image":XXX,// "reporting":XXX,// "review":XXX, "script":"book",// "series":XXX,// "short story":XXX, "slide":"artwork", "sound":"audioRecording", "speech":"audioRecording",// "standard or specification":XXX,// "standard":XXX,// "specification":XXX,// "statistics":XXX,// "survey of literature":XXX, "technical report":"report", "newspaper":"newspaperArticle", "theses":"thesis", "thesis":"thesis",// "toy":XXX, "transparency":"artwork",// "treaty":XXX, "videorecording":"videoRecording", "letter":"letter", "motion picture":"film", "art original":"artwork", "web site":"webpage" "yearbook":"book", }; // parse with E4X var m = new Namespace("http://www.loc.gov/mods/v3"); // why does this default namespace declaration not work!? default xml namespace = m; var xml = Zotero.getXML(); if(xml.m::mods.length()) { var modsElements = xml.m::mods; } else { var modsElements = [xml]; } for each(var mods in modsElements) { var newItem = new Zotero.Item(); // title for each(var titleInfo in mods.m::titleInfo) { // dropping other title types so they don't overwrite the main title // we have same behaviour in the MARC translator if([email protected]()) { newItem.title = titleInfo.*.text(); // including text from sub elements } } // try to get genre from local genre for each(var genre in mods.m::genre) { if(genre.@authority == "local" && Zotero.Utilities.itemTypeExists(genre)) { newItem.itemType = genre.text().toString(); } else if(!newItem.itemType && (genre.@authority == "marcgt" || genre.@authority == "marc")) { // otherwise, look at the marc genre newItem.itemType = marcGenres[genre.text().toString()]; } } if(!newItem.itemType) { // try to get genre data from host for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var genre in relatedItem.m::genre) { if(genre.@authority == "marcgt" || genre.@authority == "marc") { newItem.itemType = marcGenres[genre.text().toString()]; break; } } } } // check if this is an electronic resource if(!newItem.itemType) { for each(var form in mods.m::physicalDescription.m::form) { if(form.@authority == "marcform" || form.@authority == "marc") { if(form.text().toString() == "electronic") { newItem.itemType = "webpage"; break; } } } if(!newItem.itemType) newItem.itemType = "document"; } } var isPartialItem = Zotero.Utilities.inArray(newItem.itemType, partialItemTypes); // TODO: thesisType, type for each(var name in mods.m::name) { // TODO: institutional authors var creator = {}; creator.firstName = ""; for each(var namePart in name.m::namePart) { if(namePart.@type == "given") { if(creator.firstName != "") creator.firstName = creator.firstName + " "; creator.firstName = creator.firstName + namePart.text().toString(); } else if(namePart.@type == "family") { creator.lastName = namePart.text().toString(); } else if(namePart.@type == "date" || namePart.@type == "termsOfAddress") { // ignore these non name types for now } else { var backupName = namePart.text().toString(); } } if(backupName && !creator.firstName && !creator.lastName) { creator = Zotero.Utilities.cleanAuthor(backupName, "author", true); } // look for roles for(var role in name.m::role.m::roleTerm) { if(role.@type == "code" && role.@authority == "marcrelator") { if(role == "edt") { creator.creatorType = "editor"; } else if(role == "ctb") { creator.creatorType = "contributor"; } else if(role == "trl") { creator.creatorType = "translator"; } } } if(!creator.creatorType) creator.creatorType = "author"; newItem.creators.push(creator); } // source newItem.source = mods.m::recordInfo.m::recordContentSource.text().toString(); // accessionNumber newItem.accessionNumber = mods.m::recordInfo.m::recordIdentifier.text().toString(); // rights newItem.rights = mods.m::accessCondition.text().toString(); /** SUPPLEMENTAL FIELDS **/ var part = false, originInfo = false; // series for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var titleInfo in relatedItem.m::titleInfo) { if(titleInfo.@type == "abbreviated") { newItem.journalAbbreviation = titleInfo.m::title.text().toString(); if(!newItem.publicationTitle) newItem.publicationTitle = newItem.journalAbbreviation; } else { newItem.publicationTitle = titleInfo.m::title.text().toString(); } } part = relatedItem.m::part; originInfo = relatedItem.m::originInfo; processIdentifiers(newItem, relatedItem.m::identifier); } else if(relatedItem.@type == "series") { newItem.series = relatedItem.m::titleInfo.m::title.text().toString(); newItem.seriesTitle = relatedItem.m::titleInfo.m::partTitle.text().toString(); newItem.seriesText = relatedItem.m::titleInfo.m::subTitle.text().toString(); newItem.seriesNumber = relatedItem.m::titleInfo.m::partNumber.text().toString(); } } // get part if(!part) { part = mods.m::part; originInfo = mods.m::originInfo; } if(part) { for each(var detail in part.m::detail) { // volume if(detail.@type == "volume") { newItem.volume = detail.m::number.text().toString(); if(!newItem.volume) { newItem.volume = detail.m::text.text().toString(); } } // number if(detail.@type == "issue") { newItem.issue = detail.m::number.text().toString(); if(!newItem.issue) { newItem.issue = detail.m::text.text().toString(); } } // section if(detail.@type == "section") { newItem.section = detail.m::number.text().toString(); if(!newItem.section) { newItem.section = detail.m::text.text().toString(); } } } // pages for each(var extent in part.m::extent) { if(extent.@unit == "pages" || extent.@unit == "page") { var pagesStart = extent.m::start.text().toString(); var pagesEnd = extent.m::end.text().toString(); if(pagesStart || pagesEnd) { if(pagesStart == pagesEnd) { newItem.pages = pagesStart; } else if(pagesStart && pagesEnd) { newItem.pages = pagesStart+"-"+pagesEnd; } else { newItem.pages = pagesStart+pagesEnd; } } } } } // identifier processIdentifiers(newItem, mods.m::identifier); // edition newItem.edition = originInfo.m::edition.text().toString(); // place for each(var placeTerm in originInfo.m::place.m::placeTerm) { if(placeTerm.@type == "text") { newItem.place = placeTerm.text().toString(); } } // publisher/distributor if(originInfo.m::publisher.length()) { if(newItem.itemType == "webpage" || newItem.itemType == "website") { newItem.publicationTitle = originInfo.m::publisher[0].text().toString(); } else { newItem.publisher = originInfo.m::publisher[0].text().toString(); } } // date if(originInfo.m::copyrightDate.length()) { newItem.date = originInfo.m::copyrightDate[0].text().toString(); } else if(originInfo.m::dateIssued.length()) { newItem.date = originInfo.m::dateIssued[0].text().toString(); } else if(originInfo.m::dateCreated.length()) { newItem.date = originInfo.m::dateCreated[0].text().toString(); } // lastModified newItem.lastModified = originInfo.m::dateModified.text().toString(); // accessDate newItem.accessDate = originInfo.m::dateCaptured.text().toString(); // call number newItem.callNumber = mods.m::classification.text().toString(); // archiveLocation newItem.archiveLocation = mods.m::location.m::physicalLocation.text().toString(); // attachments and url for each(var url in mods.m::location.m::url) { var value = url.text().toString(); if (url.@access == "raw object") { var filetitle; if (url.@displayLabel){ filetitle = url.@displayLabel; } else { filetitle = "Attachment"; } if (value.substr(-4,4)==".pdf") { newItem.attachments.push({url:value, mimeType:"application/pdf", title:filetitle, downloadable:true}); } else { newItem.attachments.push({url:value, title:filetitle, downloadable:true}); } } else { newItem.url = value; } } // abstract newItem.abstractNote = mods.m::abstract.text().toString(); /** NOTES **/ for each(var note in mods.m::note) { newItem.notes.push({note:note.text().toString()}); } /** TAGS **/ for each(var subject in mods.m::subject.m::topic) { newItem.tags.push(subject.text().toString()); } // Language // create an array of languages var languages = new Array(); // E4X filter might need to be updated to include languageTerms that are @type="code" only for each(var language in mods.m::language.m::languageTerm.(@type == "text")) { languages.push(language.text().toString()); } // join the list separated by semicolons & add it to zotero item newItem.language = languages.join('; '); Zotero.debug(newItem); newItem.complete(); }} |
if(!newItem.itemType) newItem.itemType = "book"; | if(!newItem.itemType) newItem.itemType = "document"; | function doImport() { var marcGenres = { "book":"book", "periodical":"journalArticle", "newspaper":"newspaperArticle", "theses":"thesis", "letter":"letter", "motion picture":"film", "art original":"artwork", "web site":"webpage" }; // parse with E4X var m = new Namespace("http://www.loc.gov/mods/v3"); // why does this default namespace declaration not work!? default xml namespace = m; var xml = Zotero.getXML(); if(xml.m::mods.length()) { var modsElements = xml.m::mods; } else { var modsElements = [xml]; } for each(var mods in modsElements) { var newItem = new Zotero.Item(); // title for each(var titleInfo in mods.m::titleInfo) { // dropping other title types so they don't overwrite the main title // we have same behaviour in the MARC translator if([email protected]()) { newItem.title = titleInfo.*.text(); // including text from sub elements } } // try to get genre from local genre for each(var genre in mods.m::genre) { if(genre.@authority == "local" && Zotero.Utilities.itemTypeExists(genre)) { newItem.itemType = genre.text().toString(); } else if(!newItem.itemType && (genre.@authority == "marcgt" || genre.@authority == "marc")) { // otherwise, look at the marc genre newItem.itemType = marcGenres[genre.text().toString()]; } } if(!newItem.itemType) { // try to get genre data from host for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var genre in relatedItem.m::genre) { if(genre.@authority == "marcgt" || genre.@authority == "marc") { newItem.itemType = marcGenres[genre.text().toString()]; break; } } } } // check if this is an electronic resource if(!newItem.itemType) { for each(var form in mods.m::physicalDescription.m::form) { if(form.@authority == "marcform" || form.@authority == "marc") { if(form.text().toString() == "electronic") { newItem.itemType = "webpage"; break; } } } if(!newItem.itemType) newItem.itemType = "book"; } } var isPartialItem = Zotero.Utilities.inArray(newItem.itemType, partialItemTypes); // TODO: thesisType, type for each(var name in mods.m::name) { // TODO: institutional authors var creator = {}; creator.firstName = ""; for each(var namePart in name.m::namePart) { if(namePart.@type == "given") { if(creator.firstName != "") creator.firstName = creator.firstName + " "; creator.firstName = creator.firstName + namePart.text().toString(); } else if(namePart.@type == "family") { creator.lastName = namePart.text().toString(); } else if(namePart.@type == "date" || namePart.@type == "termsOfAddress") { // ignore these non name types for now } else { var backupName = namePart.text().toString(); } } if(backupName && !creator.firstName && !creator.lastName) { creator = Zotero.Utilities.cleanAuthor(backupName, "author", true); } // look for roles for(var role in name.m::role.m::roleTerm) { if(role.@type == "code" && role.@authority == "marcrelator") { if(role == "edt") { creator.creatorType = "editor"; } else if(role == "ctb") { creator.creatorType = "contributor"; } else if(role == "trl") { creator.creatorType = "translator"; } } } if(!creator.creatorType) creator.creatorType = "author"; newItem.creators.push(creator); } // source newItem.source = mods.m::recordInfo.m::recordContentSource.text().toString(); // accessionNumber newItem.accessionNumber = mods.m::recordInfo.m::recordIdentifier.text().toString(); // rights newItem.rights = mods.m::accessCondition.text().toString(); /** SUPPLEMENTAL FIELDS **/ var part = false, originInfo = false; // series for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var titleInfo in relatedItem.m::titleInfo) { if(titleInfo.@type == "abbreviated") { newItem.journalAbbreviation = titleInfo.m::title.text().toString(); if(!newItem.publicationTitle) newItem.publicationTitle = newItem.journalAbbreviation; } else { newItem.publicationTitle = titleInfo.m::title.text().toString(); } } part = relatedItem.m::part; originInfo = relatedItem.m::originInfo; processIdentifiers(newItem, relatedItem.m::identifier); } else if(relatedItem.@type == "series") { newItem.series = relatedItem.m::titleInfo.m::title.text().toString(); newItem.seriesTitle = relatedItem.m::titleInfo.m::partTitle.text().toString(); newItem.seriesText = relatedItem.m::titleInfo.m::subTitle.text().toString(); newItem.seriesNumber = relatedItem.m::titleInfo.m::partNumber.text().toString(); } } // get part if(!part) { part = mods.m::part; originInfo = mods.m::originInfo; } if(part) { for each(var detail in part.m::detail) { // volume if(detail.@type == "volume") { newItem.volume = detail.m::number.text().toString(); if(!newItem.volume) { newItem.volume = detail.m::text.text().toString(); } } // number if(detail.@type == "issue") { newItem.issue = detail.m::number.text().toString(); if(!newItem.issue) { newItem.issue = detail.m::text.text().toString(); } } // section if(detail.@type == "section") { newItem.section = detail.m::number.text().toString(); if(!newItem.section) { newItem.section = detail.m::text.text().toString(); } } } // pages for each(var extent in part.m::extent) { if(extent.@unit == "pages" || extent.@unit == "page") { var pagesStart = extent.m::start.text().toString(); var pagesEnd = extent.m::end.text().toString(); if(pagesStart || pagesEnd) { if(pagesStart == pagesEnd) { newItem.pages = pagesStart; } else if(pagesStart && pagesEnd) { newItem.pages = pagesStart+"-"+pagesEnd; } else { newItem.pages = pagesStart+pagesEnd; } } } } } // identifier processIdentifiers(newItem, mods.m::identifier); // edition newItem.edition = originInfo.m::edition.text().toString(); // place for each(var placeTerm in originInfo.m::place.m::placeTerm) { if(placeTerm.@type == "text") { newItem.place = placeTerm.text().toString(); } } // publisher/distributor if(originInfo.m::publisher.length()) { if(newItem.itemType == "webpage" || newItem.itemType == "website") { newItem.publicationTitle = originInfo.m::publisher[0].text().toString(); } else { newItem.publisher = originInfo.m::publisher[0].text().toString(); } } // date if(originInfo.m::copyrightDate.length()) { newItem.date = originInfo.m::copyrightDate[0].text().toString(); } else if(originInfo.m::dateIssued.length()) { newItem.date = originInfo.m::dateIssued[0].text().toString(); } else if(originInfo.m::dateCreated.length()) { newItem.date = originInfo.m::dateCreated[0].text().toString(); } // lastModified newItem.lastModified = originInfo.m::dateModified.text().toString(); // accessDate newItem.accessDate = originInfo.m::dateCaptured.text().toString(); // call number newItem.callNumber = mods.m::classification.text().toString(); // archiveLocation newItem.archiveLocation = mods.m::location.m::physicalLocation.text().toString(); // attachments and url for each(var url in mods.m::location.m::url) { var value = url.text().toString(); if (url.@access == "raw object") { var filetitle; if (url.@displayLabel){ filetitle = url.@displayLabel; } else { filetitle = "Attachment"; } if (value.substr(-4,4)==".pdf") { newItem.attachments.push({url:value, mimeType:"application/pdf", title:filetitle, downloadable:true}); } else { newItem.attachments.push({url:value, title:filetitle, downloadable:true}); } } else { newItem.url = value; } } // abstract newItem.abstractNote = mods.m::abstract.text().toString(); /** NOTES **/ for each(var note in mods.m::note) { newItem.notes.push({note:note.text().toString()}); } /** TAGS **/ for each(var subject in mods.m::subject.m::topic) { newItem.tags.push(subject.text().toString()); } // Language // create an array of languages var languages = new Array(); // E4X filter might need to be updated to include languageTerms that are @type="code" only for each(var language in mods.m::language.m::languageTerm.(@type == "text")) { languages.push(language.text().toString()); } // join the list separated by semicolons & add it to zotero item newItem.language = languages.join('; '); Zotero.debug(newItem); newItem.complete(); }} |
Zotero.debug([i+" = "+nodes[i].toString() for(i in nodes)]); | function doImport() { // collapse list of BIBO-only types var collapsedTypes = {}; for(var unprefixedBiboType in BIBO_TYPES) { var biboType = n.bibo+unprefixedBiboType; var type = new Type(BIBO_TYPES[unprefixedBiboType], [[[RDF_TYPE, n.bibo+biboType]], null, null]); if(!collapsedTypes[biboType]) { collapsedTypes[biboType] = [type]; } else { collapsedTypes[biboType].push(type); } } // collapse Zotero-to-BIBO type mappings for(var zoteroType in TYPES) { var type = new Type(zoteroType, TYPES[zoteroType]); for each(var pair in TYPES[zoteroType][0]) { if(!collapsedTypes[pair[1]]) { collapsedTypes[pair[1]] = [type]; } else { collapsedTypes[pair[1]].push(type); } } } // collapse list of field mappings var collapsedProperties = {1:{}, 2:{}, 3:{}, 4:{}, 5:{}, 6:{}, 7:{}}; var functionProperties = {}; for(var zoteroField in FIELDS) { if(typeof FIELDS[zoteroField][0] == "function") { functionProperties[zoteroField] = new LiteralProperty(zoteroField); } else { var domain = FIELDS[zoteroField][0]; var predicate = FIELDS[zoteroField][1]; if(typeof predicate == "object") predicate = predicate[0]; var prop = new LiteralProperty(zoteroField); if(collapsedProperties[domain][predicate]) { collapsedProperties[domain][predicate].push(prop); } else { collapsedProperties[domain][predicate] = [prop]; } } } // collapse list of creators for(var creatorType in CREATORS) { var domain = CREATORS[creatorType][0]; var predicate = CREATORS[creatorType][2]; if(typeof predicate == "object") predicate = predicate[0]; var prop = new CreatorProperty(creatorType); if(collapsedProperties[domain][predicate]) { collapsedProperties[domain][predicate].unshift(prop); } else { collapsedProperties[domain][predicate] = [prop]; } } // Go through all type arcs to find items var itemNode, predicateNode, objectNode; var rdfTypes = Zotero.RDF.getStatementsMatching(null, RDF_TYPE, null); var itemNodes = {}; for each(var rdfType in rdfTypes) { [itemNode, predicateNode, objectNode] = rdfType; if(!objectNode.uri || !collapsedTypes[objectNode.uri]) continue; itemNodes[Zotero.RDF.getResourceURI(itemNode)] = itemNode; } // Look through found items to see if their rdf:type matches a Zotero item type URI, and if so, // subject to further processing for each(var itemNode in itemNodes) { // check whether the relationship to another item precludes us from extracting this as // top-level var skip = false; for each(var arc in Zotero.RDF.getArcsIn(itemNode)) { if(SAME_ITEM_RELATIONS.indexOf(arc) !== -1) { skip = true; break; } } if(skip) continue; var itemRDFTypes = Zotero.RDF.getStatementsMatching(itemNode, RDF_TYPE, null); // score types by the number of triples they share with our types var bestTypeScore = -9999; var bestType, score, nodes, bestNodes; for each(var rdfType in itemRDFTypes) { if(!rdfType[2].uri) continue; for each(var type in collapsedTypes[rdfType[2].uri]) { [score, nodes] = type.getMatchScore(itemNode); Zotero.debug("Type "+type.zoteroType+" has score "+score); // check if this is the best we can do if(score > bestTypeScore) { bestTypeScore = score; bestType = type; bestNodes = nodes; } } } // skip if this doesn't fit any type very well if(bestTypeScore < 1) { Zotero.debug("No good type mapping; best type was "+bestType.zoteroType+" with score "+bestTypeScore); continue; } Zotero.debug("Got item of type "+bestType.zoteroType+" with score "+bestTypeScore); nodes = bestNodes; bestType.getItemSeriesNodes(nodes); Zotero.debug([i+" = "+nodes[i].toString() for(i in nodes)]); // create item var zoteroType = bestType.zoteroType; var newItem = new Zotero.Item(zoteroType); // handle ordinary properties var allCreators = {} for(var i in nodes) { var propertiesHandled = {}; var properties = Zotero.RDF.getArcsOut(nodes[i]); for each(var property in properties) { // only handle each property once if(propertiesHandled[property]) continue; propertiesHandled[property] = true; Zotero.debug("handling "+property); var propertyMappings = collapsedProperties[i][property]; Zotero.debug(propertyMappings); if(propertyMappings) { for each(var propertyMapping in propertyMappings) { if(propertyMapping.mapToItem) { // LiteralProperty propertyMapping.mapToItem(newItem, nodes); } else if(propertyMapping.mapToCreator) { // CreatorProperty var creators, creatorNodes; [creators, creatorNodes] = propertyMapping.mapToCreators(nodes[i], zoteroType); Zotero.debug(creators); if(creators.length) { for(var j in creators) { var creatorNodeURI = Zotero.RDF.getResourceURI(creatorNodes[j]); if(!allCreators[creatorNodeURI]) { allCreators[creatorNodeURI] = creators[j]; } } } } } } } } // handle function properties for each(var functionProperty in functionProperties) { functionProperty.mapToItem(newItem, nodes); } // get indicies of creators and add var creatorLists = {}; var creatorsAdded = {}; for(var i in nodes) { for(var j in CREATOR_LISTS) { var statements = Zotero.RDF.getStatementsMatching(nodes[i], CREATOR_LISTS[j], null); for each(var stmt in statements) { var creatorListURI = Zotero.RDF.getResourceURI(stmt[2]); if(creatorLists[creatorListURI]) continue; creatorLists[creatorListURI] = true; var creatorNodes = Zotero.RDF.getContainerElements(stmt[2]); for each(var creatorNode in creatorNodes) { var creatorNodeURI = Zotero.RDF.getResourceURI(creatorNode); if(!creatorsAdded[creatorNodeURI]) { creatorsAdded[creatorNodeURI] = true; if(allCreators[creatorNodeURI]) { // just add to creators list newItem.creators.push(allCreators[creatorNodeURI]); } else { // creator not already processed, use default for this list type if(j == AUTHOR_LIST) { Zotero.debug("WARNING: creator in authorList lacks relationship to item in Bibliontology RDF; treating as primary creator"); var prop = new CreatorProperty("author"); } else if(j == EDITOR_LIST) { Zotero.debug("WARNING: creator in editorList lacks relationship to item in Bibliontology RDF; treating as editor"); var prop = new CreatorProperty("editor"); } else { Zotero.debug("WARNING: creator in contributorList lacks relationship to item in Bibliontology RDF; treating as contributor"); var prop = new CreatorProperty("contributor"); } var creator = prop.mapToCreator(creatorNode, zoteroType); if(creator) newItem.creators.push(creator); } } } } } } for(var creatorNodeURI in allCreators) { if(!creatorsAdded[creatorNodeURI]) { newItem.creators.push(allCreators[creatorNodeURI]); } } Zotero.debug(newItem); newItem.complete(); }} |
|
Zotero.debug(propertyMappings); | function doImport() { // collapse list of BIBO-only types var collapsedTypes = {}; for(var unprefixedBiboType in BIBO_TYPES) { var biboType = n.bibo+unprefixedBiboType; var type = new Type(BIBO_TYPES[unprefixedBiboType], [[[RDF_TYPE, n.bibo+biboType]], null, null]); if(!collapsedTypes[biboType]) { collapsedTypes[biboType] = [type]; } else { collapsedTypes[biboType].push(type); } } // collapse Zotero-to-BIBO type mappings for(var zoteroType in TYPES) { var type = new Type(zoteroType, TYPES[zoteroType]); for each(var pair in TYPES[zoteroType][0]) { if(!collapsedTypes[pair[1]]) { collapsedTypes[pair[1]] = [type]; } else { collapsedTypes[pair[1]].push(type); } } } // collapse list of field mappings var collapsedProperties = {1:{}, 2:{}, 3:{}, 4:{}, 5:{}, 6:{}, 7:{}}; var functionProperties = {}; for(var zoteroField in FIELDS) { if(typeof FIELDS[zoteroField][0] == "function") { functionProperties[zoteroField] = new LiteralProperty(zoteroField); } else { var domain = FIELDS[zoteroField][0]; var predicate = FIELDS[zoteroField][1]; if(typeof predicate == "object") predicate = predicate[0]; var prop = new LiteralProperty(zoteroField); if(collapsedProperties[domain][predicate]) { collapsedProperties[domain][predicate].push(prop); } else { collapsedProperties[domain][predicate] = [prop]; } } } // collapse list of creators for(var creatorType in CREATORS) { var domain = CREATORS[creatorType][0]; var predicate = CREATORS[creatorType][2]; if(typeof predicate == "object") predicate = predicate[0]; var prop = new CreatorProperty(creatorType); if(collapsedProperties[domain][predicate]) { collapsedProperties[domain][predicate].unshift(prop); } else { collapsedProperties[domain][predicate] = [prop]; } } // Go through all type arcs to find items var itemNode, predicateNode, objectNode; var rdfTypes = Zotero.RDF.getStatementsMatching(null, RDF_TYPE, null); var itemNodes = {}; for each(var rdfType in rdfTypes) { [itemNode, predicateNode, objectNode] = rdfType; if(!objectNode.uri || !collapsedTypes[objectNode.uri]) continue; itemNodes[Zotero.RDF.getResourceURI(itemNode)] = itemNode; } // Look through found items to see if their rdf:type matches a Zotero item type URI, and if so, // subject to further processing for each(var itemNode in itemNodes) { // check whether the relationship to another item precludes us from extracting this as // top-level var skip = false; for each(var arc in Zotero.RDF.getArcsIn(itemNode)) { if(SAME_ITEM_RELATIONS.indexOf(arc) !== -1) { skip = true; break; } } if(skip) continue; var itemRDFTypes = Zotero.RDF.getStatementsMatching(itemNode, RDF_TYPE, null); // score types by the number of triples they share with our types var bestTypeScore = -9999; var bestType, score, nodes, bestNodes; for each(var rdfType in itemRDFTypes) { if(!rdfType[2].uri) continue; for each(var type in collapsedTypes[rdfType[2].uri]) { [score, nodes] = type.getMatchScore(itemNode); Zotero.debug("Type "+type.zoteroType+" has score "+score); // check if this is the best we can do if(score > bestTypeScore) { bestTypeScore = score; bestType = type; bestNodes = nodes; } } } // skip if this doesn't fit any type very well if(bestTypeScore < 1) { Zotero.debug("No good type mapping; best type was "+bestType.zoteroType+" with score "+bestTypeScore); continue; } Zotero.debug("Got item of type "+bestType.zoteroType+" with score "+bestTypeScore); nodes = bestNodes; bestType.getItemSeriesNodes(nodes); Zotero.debug([i+" = "+nodes[i].toString() for(i in nodes)]); // create item var zoteroType = bestType.zoteroType; var newItem = new Zotero.Item(zoteroType); // handle ordinary properties var allCreators = {} for(var i in nodes) { var propertiesHandled = {}; var properties = Zotero.RDF.getArcsOut(nodes[i]); for each(var property in properties) { // only handle each property once if(propertiesHandled[property]) continue; propertiesHandled[property] = true; Zotero.debug("handling "+property); var propertyMappings = collapsedProperties[i][property]; Zotero.debug(propertyMappings); if(propertyMappings) { for each(var propertyMapping in propertyMappings) { if(propertyMapping.mapToItem) { // LiteralProperty propertyMapping.mapToItem(newItem, nodes); } else if(propertyMapping.mapToCreator) { // CreatorProperty var creators, creatorNodes; [creators, creatorNodes] = propertyMapping.mapToCreators(nodes[i], zoteroType); Zotero.debug(creators); if(creators.length) { for(var j in creators) { var creatorNodeURI = Zotero.RDF.getResourceURI(creatorNodes[j]); if(!allCreators[creatorNodeURI]) { allCreators[creatorNodeURI] = creators[j]; } } } } } } } } // handle function properties for each(var functionProperty in functionProperties) { functionProperty.mapToItem(newItem, nodes); } // get indicies of creators and add var creatorLists = {}; var creatorsAdded = {}; for(var i in nodes) { for(var j in CREATOR_LISTS) { var statements = Zotero.RDF.getStatementsMatching(nodes[i], CREATOR_LISTS[j], null); for each(var stmt in statements) { var creatorListURI = Zotero.RDF.getResourceURI(stmt[2]); if(creatorLists[creatorListURI]) continue; creatorLists[creatorListURI] = true; var creatorNodes = Zotero.RDF.getContainerElements(stmt[2]); for each(var creatorNode in creatorNodes) { var creatorNodeURI = Zotero.RDF.getResourceURI(creatorNode); if(!creatorsAdded[creatorNodeURI]) { creatorsAdded[creatorNodeURI] = true; if(allCreators[creatorNodeURI]) { // just add to creators list newItem.creators.push(allCreators[creatorNodeURI]); } else { // creator not already processed, use default for this list type if(j == AUTHOR_LIST) { Zotero.debug("WARNING: creator in authorList lacks relationship to item in Bibliontology RDF; treating as primary creator"); var prop = new CreatorProperty("author"); } else if(j == EDITOR_LIST) { Zotero.debug("WARNING: creator in editorList lacks relationship to item in Bibliontology RDF; treating as editor"); var prop = new CreatorProperty("editor"); } else { Zotero.debug("WARNING: creator in contributorList lacks relationship to item in Bibliontology RDF; treating as contributor"); var prop = new CreatorProperty("contributor"); } var creator = prop.mapToCreator(creatorNode, zoteroType); if(creator) newItem.creators.push(creator); } } } } } } for(var creatorNodeURI in allCreators) { if(!creatorsAdded[creatorNodeURI]) { newItem.creators.push(allCreators[creatorNodeURI]); } } Zotero.debug(newItem); newItem.complete(); }} |
|
Zotero.debug(creators); | function doImport() { // collapse list of BIBO-only types var collapsedTypes = {}; for(var unprefixedBiboType in BIBO_TYPES) { var biboType = n.bibo+unprefixedBiboType; var type = new Type(BIBO_TYPES[unprefixedBiboType], [[[RDF_TYPE, n.bibo+biboType]], null, null]); if(!collapsedTypes[biboType]) { collapsedTypes[biboType] = [type]; } else { collapsedTypes[biboType].push(type); } } // collapse Zotero-to-BIBO type mappings for(var zoteroType in TYPES) { var type = new Type(zoteroType, TYPES[zoteroType]); for each(var pair in TYPES[zoteroType][0]) { if(!collapsedTypes[pair[1]]) { collapsedTypes[pair[1]] = [type]; } else { collapsedTypes[pair[1]].push(type); } } } // collapse list of field mappings var collapsedProperties = {1:{}, 2:{}, 3:{}, 4:{}, 5:{}, 6:{}, 7:{}}; var functionProperties = {}; for(var zoteroField in FIELDS) { if(typeof FIELDS[zoteroField][0] == "function") { functionProperties[zoteroField] = new LiteralProperty(zoteroField); } else { var domain = FIELDS[zoteroField][0]; var predicate = FIELDS[zoteroField][1]; if(typeof predicate == "object") predicate = predicate[0]; var prop = new LiteralProperty(zoteroField); if(collapsedProperties[domain][predicate]) { collapsedProperties[domain][predicate].push(prop); } else { collapsedProperties[domain][predicate] = [prop]; } } } // collapse list of creators for(var creatorType in CREATORS) { var domain = CREATORS[creatorType][0]; var predicate = CREATORS[creatorType][2]; if(typeof predicate == "object") predicate = predicate[0]; var prop = new CreatorProperty(creatorType); if(collapsedProperties[domain][predicate]) { collapsedProperties[domain][predicate].unshift(prop); } else { collapsedProperties[domain][predicate] = [prop]; } } // Go through all type arcs to find items var itemNode, predicateNode, objectNode; var rdfTypes = Zotero.RDF.getStatementsMatching(null, RDF_TYPE, null); var itemNodes = {}; for each(var rdfType in rdfTypes) { [itemNode, predicateNode, objectNode] = rdfType; if(!objectNode.uri || !collapsedTypes[objectNode.uri]) continue; itemNodes[Zotero.RDF.getResourceURI(itemNode)] = itemNode; } // Look through found items to see if their rdf:type matches a Zotero item type URI, and if so, // subject to further processing for each(var itemNode in itemNodes) { // check whether the relationship to another item precludes us from extracting this as // top-level var skip = false; for each(var arc in Zotero.RDF.getArcsIn(itemNode)) { if(SAME_ITEM_RELATIONS.indexOf(arc) !== -1) { skip = true; break; } } if(skip) continue; var itemRDFTypes = Zotero.RDF.getStatementsMatching(itemNode, RDF_TYPE, null); // score types by the number of triples they share with our types var bestTypeScore = -9999; var bestType, score, nodes, bestNodes; for each(var rdfType in itemRDFTypes) { if(!rdfType[2].uri) continue; for each(var type in collapsedTypes[rdfType[2].uri]) { [score, nodes] = type.getMatchScore(itemNode); Zotero.debug("Type "+type.zoteroType+" has score "+score); // check if this is the best we can do if(score > bestTypeScore) { bestTypeScore = score; bestType = type; bestNodes = nodes; } } } // skip if this doesn't fit any type very well if(bestTypeScore < 1) { Zotero.debug("No good type mapping; best type was "+bestType.zoteroType+" with score "+bestTypeScore); continue; } Zotero.debug("Got item of type "+bestType.zoteroType+" with score "+bestTypeScore); nodes = bestNodes; bestType.getItemSeriesNodes(nodes); Zotero.debug([i+" = "+nodes[i].toString() for(i in nodes)]); // create item var zoteroType = bestType.zoteroType; var newItem = new Zotero.Item(zoteroType); // handle ordinary properties var allCreators = {} for(var i in nodes) { var propertiesHandled = {}; var properties = Zotero.RDF.getArcsOut(nodes[i]); for each(var property in properties) { // only handle each property once if(propertiesHandled[property]) continue; propertiesHandled[property] = true; Zotero.debug("handling "+property); var propertyMappings = collapsedProperties[i][property]; Zotero.debug(propertyMappings); if(propertyMappings) { for each(var propertyMapping in propertyMappings) { if(propertyMapping.mapToItem) { // LiteralProperty propertyMapping.mapToItem(newItem, nodes); } else if(propertyMapping.mapToCreator) { // CreatorProperty var creators, creatorNodes; [creators, creatorNodes] = propertyMapping.mapToCreators(nodes[i], zoteroType); Zotero.debug(creators); if(creators.length) { for(var j in creators) { var creatorNodeURI = Zotero.RDF.getResourceURI(creatorNodes[j]); if(!allCreators[creatorNodeURI]) { allCreators[creatorNodeURI] = creators[j]; } } } } } } } } // handle function properties for each(var functionProperty in functionProperties) { functionProperty.mapToItem(newItem, nodes); } // get indicies of creators and add var creatorLists = {}; var creatorsAdded = {}; for(var i in nodes) { for(var j in CREATOR_LISTS) { var statements = Zotero.RDF.getStatementsMatching(nodes[i], CREATOR_LISTS[j], null); for each(var stmt in statements) { var creatorListURI = Zotero.RDF.getResourceURI(stmt[2]); if(creatorLists[creatorListURI]) continue; creatorLists[creatorListURI] = true; var creatorNodes = Zotero.RDF.getContainerElements(stmt[2]); for each(var creatorNode in creatorNodes) { var creatorNodeURI = Zotero.RDF.getResourceURI(creatorNode); if(!creatorsAdded[creatorNodeURI]) { creatorsAdded[creatorNodeURI] = true; if(allCreators[creatorNodeURI]) { // just add to creators list newItem.creators.push(allCreators[creatorNodeURI]); } else { // creator not already processed, use default for this list type if(j == AUTHOR_LIST) { Zotero.debug("WARNING: creator in authorList lacks relationship to item in Bibliontology RDF; treating as primary creator"); var prop = new CreatorProperty("author"); } else if(j == EDITOR_LIST) { Zotero.debug("WARNING: creator in editorList lacks relationship to item in Bibliontology RDF; treating as editor"); var prop = new CreatorProperty("editor"); } else { Zotero.debug("WARNING: creator in contributorList lacks relationship to item in Bibliontology RDF; treating as contributor"); var prop = new CreatorProperty("contributor"); } var creator = prop.mapToCreator(creatorNode, zoteroType); if(creator) newItem.creators.push(creator); } } } } } } for(var creatorNodeURI in allCreators) { if(!creatorsAdded[creatorNodeURI]) { newItem.creators.push(allCreators[creatorNodeURI]); } } Zotero.debug(newItem); newItem.complete(); }} |
|
Zotero.debug(newItem); | function doImport() { // collapse list of BIBO-only types var collapsedTypes = {}; for(var unprefixedBiboType in BIBO_TYPES) { var biboType = n.bibo+unprefixedBiboType; var type = new Type(BIBO_TYPES[unprefixedBiboType], [[[RDF_TYPE, n.bibo+biboType]], null, null]); if(!collapsedTypes[biboType]) { collapsedTypes[biboType] = [type]; } else { collapsedTypes[biboType].push(type); } } // collapse Zotero-to-BIBO type mappings for(var zoteroType in TYPES) { var type = new Type(zoteroType, TYPES[zoteroType]); for each(var pair in TYPES[zoteroType][0]) { if(!collapsedTypes[pair[1]]) { collapsedTypes[pair[1]] = [type]; } else { collapsedTypes[pair[1]].push(type); } } } // collapse list of field mappings var collapsedProperties = {1:{}, 2:{}, 3:{}, 4:{}, 5:{}, 6:{}, 7:{}}; var functionProperties = {}; for(var zoteroField in FIELDS) { if(typeof FIELDS[zoteroField][0] == "function") { functionProperties[zoteroField] = new LiteralProperty(zoteroField); } else { var domain = FIELDS[zoteroField][0]; var predicate = FIELDS[zoteroField][1]; if(typeof predicate == "object") predicate = predicate[0]; var prop = new LiteralProperty(zoteroField); if(collapsedProperties[domain][predicate]) { collapsedProperties[domain][predicate].push(prop); } else { collapsedProperties[domain][predicate] = [prop]; } } } // collapse list of creators for(var creatorType in CREATORS) { var domain = CREATORS[creatorType][0]; var predicate = CREATORS[creatorType][2]; if(typeof predicate == "object") predicate = predicate[0]; var prop = new CreatorProperty(creatorType); if(collapsedProperties[domain][predicate]) { collapsedProperties[domain][predicate].unshift(prop); } else { collapsedProperties[domain][predicate] = [prop]; } } // Go through all type arcs to find items var itemNode, predicateNode, objectNode; var rdfTypes = Zotero.RDF.getStatementsMatching(null, RDF_TYPE, null); var itemNodes = {}; for each(var rdfType in rdfTypes) { [itemNode, predicateNode, objectNode] = rdfType; if(!objectNode.uri || !collapsedTypes[objectNode.uri]) continue; itemNodes[Zotero.RDF.getResourceURI(itemNode)] = itemNode; } // Look through found items to see if their rdf:type matches a Zotero item type URI, and if so, // subject to further processing for each(var itemNode in itemNodes) { // check whether the relationship to another item precludes us from extracting this as // top-level var skip = false; for each(var arc in Zotero.RDF.getArcsIn(itemNode)) { if(SAME_ITEM_RELATIONS.indexOf(arc) !== -1) { skip = true; break; } } if(skip) continue; var itemRDFTypes = Zotero.RDF.getStatementsMatching(itemNode, RDF_TYPE, null); // score types by the number of triples they share with our types var bestTypeScore = -9999; var bestType, score, nodes, bestNodes; for each(var rdfType in itemRDFTypes) { if(!rdfType[2].uri) continue; for each(var type in collapsedTypes[rdfType[2].uri]) { [score, nodes] = type.getMatchScore(itemNode); Zotero.debug("Type "+type.zoteroType+" has score "+score); // check if this is the best we can do if(score > bestTypeScore) { bestTypeScore = score; bestType = type; bestNodes = nodes; } } } // skip if this doesn't fit any type very well if(bestTypeScore < 1) { Zotero.debug("No good type mapping; best type was "+bestType.zoteroType+" with score "+bestTypeScore); continue; } Zotero.debug("Got item of type "+bestType.zoteroType+" with score "+bestTypeScore); nodes = bestNodes; bestType.getItemSeriesNodes(nodes); Zotero.debug([i+" = "+nodes[i].toString() for(i in nodes)]); // create item var zoteroType = bestType.zoteroType; var newItem = new Zotero.Item(zoteroType); // handle ordinary properties var allCreators = {} for(var i in nodes) { var propertiesHandled = {}; var properties = Zotero.RDF.getArcsOut(nodes[i]); for each(var property in properties) { // only handle each property once if(propertiesHandled[property]) continue; propertiesHandled[property] = true; Zotero.debug("handling "+property); var propertyMappings = collapsedProperties[i][property]; Zotero.debug(propertyMappings); if(propertyMappings) { for each(var propertyMapping in propertyMappings) { if(propertyMapping.mapToItem) { // LiteralProperty propertyMapping.mapToItem(newItem, nodes); } else if(propertyMapping.mapToCreator) { // CreatorProperty var creators, creatorNodes; [creators, creatorNodes] = propertyMapping.mapToCreators(nodes[i], zoteroType); Zotero.debug(creators); if(creators.length) { for(var j in creators) { var creatorNodeURI = Zotero.RDF.getResourceURI(creatorNodes[j]); if(!allCreators[creatorNodeURI]) { allCreators[creatorNodeURI] = creators[j]; } } } } } } } } // handle function properties for each(var functionProperty in functionProperties) { functionProperty.mapToItem(newItem, nodes); } // get indicies of creators and add var creatorLists = {}; var creatorsAdded = {}; for(var i in nodes) { for(var j in CREATOR_LISTS) { var statements = Zotero.RDF.getStatementsMatching(nodes[i], CREATOR_LISTS[j], null); for each(var stmt in statements) { var creatorListURI = Zotero.RDF.getResourceURI(stmt[2]); if(creatorLists[creatorListURI]) continue; creatorLists[creatorListURI] = true; var creatorNodes = Zotero.RDF.getContainerElements(stmt[2]); for each(var creatorNode in creatorNodes) { var creatorNodeURI = Zotero.RDF.getResourceURI(creatorNode); if(!creatorsAdded[creatorNodeURI]) { creatorsAdded[creatorNodeURI] = true; if(allCreators[creatorNodeURI]) { // just add to creators list newItem.creators.push(allCreators[creatorNodeURI]); } else { // creator not already processed, use default for this list type if(j == AUTHOR_LIST) { Zotero.debug("WARNING: creator in authorList lacks relationship to item in Bibliontology RDF; treating as primary creator"); var prop = new CreatorProperty("author"); } else if(j == EDITOR_LIST) { Zotero.debug("WARNING: creator in editorList lacks relationship to item in Bibliontology RDF; treating as editor"); var prop = new CreatorProperty("editor"); } else { Zotero.debug("WARNING: creator in contributorList lacks relationship to item in Bibliontology RDF; treating as contributor"); var prop = new CreatorProperty("contributor"); } var creator = prop.mapToCreator(creatorNode, zoteroType); if(creator) newItem.creators.push(creator); } } } } } } for(var creatorNodeURI in allCreators) { if(!creatorsAdded[creatorNodeURI]) { newItem.creators.push(allCreators[creatorNodeURI]); } } Zotero.debug(newItem); newItem.complete(); }} |
|
for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var genre in relatedItem.m::genre) { if(genre.@authority == "marcgt" || genre.@authority == "marc") { newItem.itemType = marcGenres[genre.text().toString()]; break; | for each(var typeOfResource in mods.m::typeOfResource) { newItem.itemType = modsTypeOfResources[typeOfResource.text().toString()]; } if(!newItem.itemType) { for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var genre in relatedItem.m::genre) { if(genre.@authority == "marcgt" || genre.@authority == "marc") { newItem.itemType = marcGenres[genre.text().toString()]; break; } | function doImport() { var marcGenres = {// "abstract or summary":XXX,// "abstract":XXX,// "summary":XXX, "art reproduction":"artwork", "article":"journalArticle", "autobiography":"book", "bibliography":"book", "biography":"book", "book":"book",// "calendar":XXX,// "catalog":XXX, "chart":"artwork", "comic or graphic novel":"book", "comic":"book", "graphic novel":"book", "comic strip":"artwork", "conference publication":"conferencePaper",// "database":XXX, "dictionary":"dictionaryEntry", "diorama":"artwork",// "directory":XXX, "drama":"book", "encyclopedia":"encyclopediaArticle",// "essay":XXX, "festschrift":"book", "fiction":"book",// "filmography":XXX, "filmstrip":"videoRecording",// "findingaid":XXX,// "flash card":XXX, "folktale":"book",// "font":XXX,// "game":XXX, "government publication":"book", "graphic":"artwork", "globe":"map", "handbook":"book", "history":"book", "hymnal":"book", "humor,satire":"book", "humor":"book", "satire":"book",// "index":XXX,// "instruction":XXX,// "interview":XXX,// "issue":XXX, "journal":"journalArticle", "kit":"artwork",// "language instruction":XXX, "law report or digest":"journalArticle", "law report":"journalArticle", "digest":"journalArticle", "law digest":"journalArticle", "legal article":"journalArticle", "legal case and case notes":"case", "legal case":"case", "case notes":"case", "legislation":"statute", "loose-leaf":"manuscript", "map":"map", "memoir":"book", "microscope slide":"artwork", "model":"artwork",// "multivolume monograph":XXX, "novel":"book",// "numeric data":XXX,// "offprint":XXX, "online system or service":"webpage", "online system":"webpage", "service":"webpage", "online service":"webpage", "patent":"patent", "periodical":"journalArticle", "picture":"artwork",// "poetry":XXX,// "programmed text":XXX, "realia":"artwork",// "rehearsal":XXX,// "remote sensing image":XXX,// "reporting":XXX,// "review":XXX, "script":"book",// "series":XXX,// "short story":XXX, "slide":"artwork", "sound":"audioRecording", "speech":"audioRecording",// "standard or specification":XXX,// "standard":XXX,// "specification":XXX,// "statistics":XXX,// "survey of literature":XXX, "technical report":"report", "newspaper":"newspaperArticle", "theses":"thesis", "thesis":"thesis",// "toy":XXX, "transparency":"artwork",// "treaty":XXX, "videorecording":"videoRecording", "letter":"letter", "motion picture":"film", "art original":"artwork", "web site":"webpage", "yearbook":"book" }; // parse with E4X var m = new Namespace("http://www.loc.gov/mods/v3"); // why does this default namespace declaration not work!? default xml namespace = m; var xml = Zotero.getXML(); if(xml.m::mods.length()) { var modsElements = xml.m::mods; } else { var modsElements = [xml]; } for each(var mods in modsElements) { var newItem = new Zotero.Item(); // title for each(var titleInfo in mods.m::titleInfo) { // dropping other title types so they don't overwrite the main title // we have same behaviour in the MARC translator if([email protected]()) { if(titleInfo.m::title.length()) { newItem.title = titleInfo.m::title.text().toString(); if(titleInfo.m::subTitle.length()) { newItem.title = newItem.title + ": " + titleInfo.m::subTitle.text().toString(); } } else { newItem.title = titleInfo.*.text(); // including text from sub elements } } } // try to get genre from local genre for each(var genre in mods.m::genre) { if(genre.@authority == "local" && Zotero.Utilities.itemTypeExists(genre)) { newItem.itemType = genre.text().toString(); } else if(!newItem.itemType && (genre.@authority == "marcgt" || genre.@authority == "marc")) { // otherwise, look at the marc genre newItem.itemType = marcGenres[genre.text().toString()]; } } if(!newItem.itemType) { // try to get genre data from host for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var genre in relatedItem.m::genre) { if(genre.@authority == "marcgt" || genre.@authority == "marc") { newItem.itemType = marcGenres[genre.text().toString()]; break; } } } } if(!newItem.itemType) newItem.itemType = "document"; } var isPartialItem = Zotero.Utilities.inArray(newItem.itemType, partialItemTypes); // TODO: thesisType, type for each(var name in mods.m::name) { // TODO: institutional authors var creator = {}; creator.firstName = ""; for each(var namePart in name.m::namePart) { if(namePart.@type == "given") { if(creator.firstName != "") creator.firstName = creator.firstName + " "; creator.firstName = creator.firstName + namePart.text().toString(); } else if(namePart.@type == "family") { creator.lastName = namePart.text().toString(); } else if(namePart.@type == "date" || namePart.@type == "termsOfAddress") { // ignore these non name types for now } else { var backupName = namePart.text().toString(); } } if(backupName && !creator.firstName && !creator.lastName) { creator = Zotero.Utilities.cleanAuthor(backupName, "author", true); } // look for roles for(var role in name.m::role.m::roleTerm) { if(role.@type == "code" && role.@authority == "marcrelator") { if(role == "edt") { creator.creatorType = "editor"; } else if(role == "ctb") { creator.creatorType = "contributor"; } else if(role == "trl") { creator.creatorType = "translator"; } } } if(!creator.creatorType) creator.creatorType = "author"; newItem.creators.push(creator); } // source newItem.source = mods.m::recordInfo.m::recordContentSource.text().toString(); // accessionNumber newItem.accessionNumber = mods.m::recordInfo.m::recordIdentifier.text().toString(); // rights newItem.rights = mods.m::accessCondition.text().toString(); /** SUPPLEMENTAL FIELDS **/ var part = false, originInfo = false; // series for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var titleInfo in relatedItem.m::titleInfo) { if(titleInfo.@type == "abbreviated") { newItem.journalAbbreviation = titleInfo.m::title.text().toString(); if(!newItem.publicationTitle) newItem.publicationTitle = newItem.journalAbbreviation; } else { newItem.publicationTitle = titleInfo.m::title.text().toString(); } } part = relatedItem.m::part; originInfo = relatedItem.m::originInfo; processIdentifiers(newItem, relatedItem.m::identifier); } else if(relatedItem.@type == "series") { newItem.series = relatedItem.m::titleInfo.m::title.text().toString(); newItem.seriesTitle = relatedItem.m::titleInfo.m::partTitle.text().toString(); newItem.seriesText = relatedItem.m::titleInfo.m::subTitle.text().toString(); newItem.seriesNumber = relatedItem.m::titleInfo.m::partNumber.text().toString(); } } // get part if(!part) { part = mods.m::part; originInfo = mods.m::originInfo; } if(part) { for each(var detail in part.m::detail) { // volume if(detail.@type == "volume") { newItem.volume = detail.m::number.text().toString(); if(!newItem.volume) { newItem.volume = detail.m::text.text().toString(); } } // number if(detail.@type == "issue") { newItem.issue = detail.m::number.text().toString(); if(!newItem.issue) { newItem.issue = detail.m::text.text().toString(); } } // section if(detail.@type == "section") { newItem.section = detail.m::number.text().toString(); if(!newItem.section) { newItem.section = detail.m::text.text().toString(); } } } // pages for each(var extent in part.m::extent) { if(extent.@unit == "pages" || extent.@unit == "page") { var pagesStart = extent.m::start.text().toString(); var pagesEnd = extent.m::end.text().toString(); if(pagesStart || pagesEnd) { if(pagesStart == pagesEnd) { newItem.pages = pagesStart; } else if(pagesStart && pagesEnd) { newItem.pages = pagesStart+"-"+pagesEnd; } else { newItem.pages = pagesStart+pagesEnd; } } } } } // identifier processIdentifiers(newItem, mods.m::identifier); // edition newItem.edition = originInfo.m::edition.text().toString(); // place for each(var placeTerm in originInfo.m::place.m::placeTerm) { if(placeTerm.@type == "text") { newItem.place = placeTerm.text().toString(); } } // publisher/distributor if(originInfo.m::publisher.length()) { if(newItem.itemType == "webpage" || newItem.itemType == "website") { newItem.publicationTitle = originInfo.m::publisher[0].text().toString(); } else { newItem.publisher = originInfo.m::publisher[0].text().toString(); } } // date if(originInfo.m::copyrightDate.length()) { newItem.date = originInfo.m::copyrightDate[0].text().toString(); } else if(originInfo.m::dateIssued.length()) { newItem.date = originInfo.m::dateIssued[0].text().toString(); } else if(originInfo.m::dateCreated.length()) { newItem.date = originInfo.m::dateCreated[0].text().toString(); } // lastModified newItem.lastModified = originInfo.m::dateModified.text().toString(); // accessDate newItem.accessDate = originInfo.m::dateCaptured.text().toString(); // call number newItem.callNumber = mods.m::classification.text().toString(); // archiveLocation newItem.archiveLocation = mods.m::location.m::physicalLocation.text().toString(); // attachments and url for each(var url in mods.m::location.m::url) { var value = url.text().toString(); if (url.@access == "raw object") { var filetitle; if (url.@displayLabel){ filetitle = url.@displayLabel; } else { filetitle = "Attachment"; } if (value.substr(-4,4)==".pdf") { newItem.attachments.push({url:value, mimeType:"application/pdf", title:filetitle, downloadable:true}); } else { newItem.attachments.push({url:value, title:filetitle, downloadable:true}); } } else { newItem.url = value; } } // abstract newItem.abstractNote = mods.m::abstract.text().toString(); /** NOTES **/ for each(var note in mods.m::note) { newItem.notes.push({note:note.text().toString()}); } /** TAGS **/ for each(var subject in mods.m::subject.m::topic) { newItem.tags.push(subject.text().toString()); } // Language // create an array of languages var languages = new Array(); // E4X filter might need to be updated to include languageTerms that are @type="code" only for each(var language in mods.m::language.m::languageTerm.(@type == "text")) { languages.push(language.text().toString()); } // join the list separated by semicolons & add it to zotero item newItem.language = languages.join('; '); Zotero.debug(newItem); newItem.complete(); }} |
creator.fieldMode = 1; | function doImport() { var marcGenres = {// "abstract or summary":XXX,// "abstract":XXX,// "summary":XXX, "art reproduction":"artwork", "article":"journalArticle", "autobiography":"book", "bibliography":"book", "biography":"book", "book":"book",// "calendar":XXX,// "catalog":XXX, "chart":"artwork", "comic or graphic novel":"book", "comic":"book", "graphic novel":"book", "comic strip":"artwork", "conference publication":"conferencePaper",// "database":XXX, "dictionary":"dictionaryEntry", "diorama":"artwork",// "directory":XXX, "drama":"book", "encyclopedia":"encyclopediaArticle",// "essay":XXX, "festschrift":"book", "fiction":"book",// "filmography":XXX, "filmstrip":"videoRecording",// "findingaid":XXX,// "flash card":XXX, "folktale":"book",// "font":XXX,// "game":XXX, "government publication":"book", "graphic":"artwork", "globe":"map", "handbook":"book", "history":"book", "hymnal":"book", "humor,satire":"book", "humor":"book", "satire":"book",// "index":XXX,// "instruction":XXX,// "interview":XXX,// "issue":XXX, "journal":"journalArticle", "kit":"artwork",// "language instruction":XXX, "law report or digest":"journalArticle", "law report":"journalArticle", "digest":"journalArticle", "law digest":"journalArticle", "legal article":"journalArticle", "legal case and case notes":"case", "legal case":"case", "case notes":"case", "legislation":"statute", "loose-leaf":"manuscript", "map":"map", "memoir":"book", "microscope slide":"artwork", "model":"artwork",// "multivolume monograph":XXX, "novel":"book",// "numeric data":XXX,// "offprint":XXX, "online system or service":"webpage", "online system":"webpage", "service":"webpage", "online service":"webpage", "patent":"patent", "periodical":"journalArticle", "picture":"artwork",// "poetry":XXX,// "programmed text":XXX, "realia":"artwork",// "rehearsal":XXX,// "remote sensing image":XXX,// "reporting":XXX,// "review":XXX, "script":"book",// "series":XXX,// "short story":XXX, "slide":"artwork", "sound":"audioRecording", "speech":"audioRecording",// "standard or specification":XXX,// "standard":XXX,// "specification":XXX,// "statistics":XXX,// "survey of literature":XXX, "technical report":"report", "newspaper":"newspaperArticle", "theses":"thesis", "thesis":"thesis",// "toy":XXX, "transparency":"artwork",// "treaty":XXX, "videorecording":"videoRecording", "letter":"letter", "motion picture":"film", "art original":"artwork", "web site":"webpage", "yearbook":"book" }; // parse with E4X var m = new Namespace("http://www.loc.gov/mods/v3"); // why does this default namespace declaration not work!? default xml namespace = m; var xml = Zotero.getXML(); if(xml.m::mods.length()) { var modsElements = xml.m::mods; } else { var modsElements = [xml]; } for each(var mods in modsElements) { var newItem = new Zotero.Item(); // title for each(var titleInfo in mods.m::titleInfo) { // dropping other title types so they don't overwrite the main title // we have same behaviour in the MARC translator if([email protected]()) { if(titleInfo.m::title.length()) { newItem.title = titleInfo.m::title.text().toString(); if(titleInfo.m::subTitle.length()) { newItem.title = newItem.title + ": " + titleInfo.m::subTitle.text().toString(); } } else { newItem.title = titleInfo.*.text(); // including text from sub elements } } } // try to get genre from local genre for each(var genre in mods.m::genre) { if(genre.@authority == "local" && Zotero.Utilities.itemTypeExists(genre)) { newItem.itemType = genre.text().toString(); } else if(!newItem.itemType && (genre.@authority == "marcgt" || genre.@authority == "marc")) { // otherwise, look at the marc genre newItem.itemType = marcGenres[genre.text().toString()]; } } if(!newItem.itemType) { // try to get genre data from host for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var genre in relatedItem.m::genre) { if(genre.@authority == "marcgt" || genre.@authority == "marc") { newItem.itemType = marcGenres[genre.text().toString()]; break; } } } } if(!newItem.itemType) newItem.itemType = "document"; } var isPartialItem = Zotero.Utilities.inArray(newItem.itemType, partialItemTypes); // TODO: thesisType, type for each(var name in mods.m::name) { // TODO: institutional authors var creator = {}; creator.firstName = ""; for each(var namePart in name.m::namePart) { if(namePart.@type == "given") { if(creator.firstName != "") creator.firstName = creator.firstName + " "; creator.firstName = creator.firstName + namePart.text().toString(); } else if(namePart.@type == "family") { creator.lastName = namePart.text().toString(); } else if(namePart.@type == "date" || namePart.@type == "termsOfAddress") { // ignore these non name types for now } else { var backupName = namePart.text().toString(); } } if(backupName && !creator.firstName && !creator.lastName) { creator = Zotero.Utilities.cleanAuthor(backupName, "author", true); } // look for roles for(var role in name.m::role.m::roleTerm) { if(role.@type == "code" && role.@authority == "marcrelator") { if(role == "edt") { creator.creatorType = "editor"; } else if(role == "ctb") { creator.creatorType = "contributor"; } else if(role == "trl") { creator.creatorType = "translator"; } } } if(!creator.creatorType) creator.creatorType = "author"; newItem.creators.push(creator); } // source newItem.source = mods.m::recordInfo.m::recordContentSource.text().toString(); // accessionNumber newItem.accessionNumber = mods.m::recordInfo.m::recordIdentifier.text().toString(); // rights newItem.rights = mods.m::accessCondition.text().toString(); /** SUPPLEMENTAL FIELDS **/ var part = false, originInfo = false; // series for each(var relatedItem in mods.m::relatedItem) { if(relatedItem.@type == "host") { for each(var titleInfo in relatedItem.m::titleInfo) { if(titleInfo.@type == "abbreviated") { newItem.journalAbbreviation = titleInfo.m::title.text().toString(); if(!newItem.publicationTitle) newItem.publicationTitle = newItem.journalAbbreviation; } else { newItem.publicationTitle = titleInfo.m::title.text().toString(); } } part = relatedItem.m::part; originInfo = relatedItem.m::originInfo; processIdentifiers(newItem, relatedItem.m::identifier); } else if(relatedItem.@type == "series") { newItem.series = relatedItem.m::titleInfo.m::title.text().toString(); newItem.seriesTitle = relatedItem.m::titleInfo.m::partTitle.text().toString(); newItem.seriesText = relatedItem.m::titleInfo.m::subTitle.text().toString(); newItem.seriesNumber = relatedItem.m::titleInfo.m::partNumber.text().toString(); } } // get part if(!part) { part = mods.m::part; originInfo = mods.m::originInfo; } if(part) { for each(var detail in part.m::detail) { // volume if(detail.@type == "volume") { newItem.volume = detail.m::number.text().toString(); if(!newItem.volume) { newItem.volume = detail.m::text.text().toString(); } } // number if(detail.@type == "issue") { newItem.issue = detail.m::number.text().toString(); if(!newItem.issue) { newItem.issue = detail.m::text.text().toString(); } } // section if(detail.@type == "section") { newItem.section = detail.m::number.text().toString(); if(!newItem.section) { newItem.section = detail.m::text.text().toString(); } } } // pages for each(var extent in part.m::extent) { if(extent.@unit == "pages" || extent.@unit == "page") { var pagesStart = extent.m::start.text().toString(); var pagesEnd = extent.m::end.text().toString(); if(pagesStart || pagesEnd) { if(pagesStart == pagesEnd) { newItem.pages = pagesStart; } else if(pagesStart && pagesEnd) { newItem.pages = pagesStart+"-"+pagesEnd; } else { newItem.pages = pagesStart+pagesEnd; } } } } } // identifier processIdentifiers(newItem, mods.m::identifier); // edition newItem.edition = originInfo.m::edition.text().toString(); // place for each(var placeTerm in originInfo.m::place.m::placeTerm) { if(placeTerm.@type == "text") { newItem.place = placeTerm.text().toString(); } } // publisher/distributor if(originInfo.m::publisher.length()) { if(newItem.itemType == "webpage" || newItem.itemType == "website") { newItem.publicationTitle = originInfo.m::publisher[0].text().toString(); } else { newItem.publisher = originInfo.m::publisher[0].text().toString(); } } // date if(originInfo.m::copyrightDate.length()) { newItem.date = originInfo.m::copyrightDate[0].text().toString(); } else if(originInfo.m::dateIssued.length()) { newItem.date = originInfo.m::dateIssued[0].text().toString(); } else if(originInfo.m::dateCreated.length()) { newItem.date = originInfo.m::dateCreated[0].text().toString(); } // lastModified newItem.lastModified = originInfo.m::dateModified.text().toString(); // accessDate newItem.accessDate = originInfo.m::dateCaptured.text().toString(); // call number newItem.callNumber = mods.m::classification.text().toString(); // archiveLocation newItem.archiveLocation = mods.m::location.m::physicalLocation.text().toString(); // attachments and url for each(var url in mods.m::location.m::url) { var value = url.text().toString(); if (url.@access == "raw object") { var filetitle; if (url.@displayLabel){ filetitle = url.@displayLabel; } else { filetitle = "Attachment"; } if (value.substr(-4,4)==".pdf") { newItem.attachments.push({url:value, mimeType:"application/pdf", title:filetitle, downloadable:true}); } else { newItem.attachments.push({url:value, title:filetitle, downloadable:true}); } } else { newItem.url = value; } } // abstract newItem.abstractNote = mods.m::abstract.text().toString(); /** NOTES **/ for each(var note in mods.m::note) { newItem.notes.push({note:note.text().toString()}); } /** TAGS **/ for each(var subject in mods.m::subject.m::topic) { newItem.tags.push(subject.text().toString()); } // Language // create an array of languages var languages = new Array(); // E4X filter might need to be updated to include languageTerms that are @type="code" only for each(var language in mods.m::language.m::languageTerm.(@type == "text")) { languages.push(language.text().toString()); } // join the list separated by semicolons & add it to zotero item newItem.language = languages.join('; '); Zotero.debug(newItem); newItem.complete(); }} |
|
with (window) { eval(js); } | window.eval(js); | function doJavaScript(js) { if (js) if (window.execScript) window.execScript(js); else with (window) { eval(js); } _$_APP_CLASS_$_._p_.autoJavaScript();} |
with (window) { if (js) eval(js); _$_APP_CLASS_$_._p_.autoJavaScript(); } | if (js) if (window.execScript) window.execScript(js); else with (window) { eval(js); } _$_APP_CLASS_$_._p_.autoJavaScript(); | function doJavaScript(js) { with (window) { if (js) eval(js); _$_APP_CLASS_$_._p_.autoJavaScript(); }} |
calculateMeta(null, $(this)); | $.fn.doMeta = function(options) { // define defaults var defaults = {}; // extend options var options = $.extend(defaults, options); // loop all elements return this.each(function() { // init var var element = $(this); // initialize calculateMeta(null, $(this)); // bind keypress $(this).bind('keyup', calculateMeta); // bind change on the checkboxes if($('#pageTitle').length > 0 && $('#pageTitleOverwrite').length > 0) { $('#pageTitleOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#pageTitle').val(element.val()); } }); } if($('#navigationTitle').length > 0 && $('#navigationTitleOverwrite').length > 0) { $('#navigationTitleOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#navigationTitle').val(element.val()); } }); } $('#metaDescriptionOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#metaDescription').val(element.val()); } }); $('#metaKeywordsOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#metaKeywords').val(element.val()); } }); $('#urlOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#url').val(utils.string.urlise(element.val())); $('#generatedUrl').html(utils.string.urlise(element.val())); } }); // calculate meta function calculateMeta(evt, element) { if(typeof element != 'undefined') var title = element.val(); else var title = $(this).val(); if($('#pageTitle').length > 0 && $('#pageTitleOverwrite').length > 0) { if(!$('#pageTitleOverwrite').is(':checked')) { $('#pageTitle').val(title); } } if($('#navigationTitle').length > 0 && $('#navigationTitleOverwrite').length > 0) { if(!$('#navigationTitleOverwrite').is(':checked')) { $('#navigationTitle').val(title); } } if(!$('#metaDescriptionOverwrite').is(':checked')) { $('#metaDescription').val(title); } if(!$('#metaKeywordsOverwrite').is(':checked')) { $('#metaKeywords').val(title); } if(!$('#urlOverwrite').is(':checked')) { $('#url').val(utils.string.urlise(title)); $('#generatedUrl').html(utils.string.urlise(title)); } } }); }; |
|
$('#url').val(utils.string.urlise(title)); $('#generatedUrl').html(utils.string.urlise(title)); | if(typeof pageID == 'undefined' || pageID != 1) { $('#url').val(utils.string.urlise(title)); $('#generatedUrl').html(utils.string.urlise(title)); } | $.fn.doMeta = function(options) { // define defaults var defaults = {}; // extend options var options = $.extend(defaults, options); // loop all elements return this.each(function() { // init var var element = $(this); // initialize calculateMeta(null, $(this)); // bind keypress $(this).bind('keyup', calculateMeta); // bind change on the checkboxes if($('#pageTitle').length > 0 && $('#pageTitleOverwrite').length > 0) { $('#pageTitleOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#pageTitle').val(element.val()); } }); } if($('#navigationTitle').length > 0 && $('#navigationTitleOverwrite').length > 0) { $('#navigationTitleOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#navigationTitle').val(element.val()); } }); } $('#metaDescriptionOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#metaDescription').val(element.val()); } }); $('#metaKeywordsOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#metaKeywords').val(element.val()); } }); $('#urlOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#url').val(utils.string.urlise(element.val())); $('#generatedUrl').html(utils.string.urlise(element.val())); } }); // calculate meta function calculateMeta(evt, element) { if(typeof element != 'undefined') var title = element.val(); else var title = $(this).val(); if($('#pageTitle').length > 0 && $('#pageTitleOverwrite').length > 0) { if(!$('#pageTitleOverwrite').is(':checked')) { $('#pageTitle').val(title); } } if($('#navigationTitle').length > 0 && $('#navigationTitleOverwrite').length > 0) { if(!$('#navigationTitleOverwrite').is(':checked')) { $('#navigationTitle').val(title); } } if(!$('#metaDescriptionOverwrite').is(':checked')) { $('#metaDescription').val(title); } if(!$('#metaKeywordsOverwrite').is(':checked')) { $('#metaKeywords').val(title); } if(!$('#urlOverwrite').is(':checked')) { $('#url').val(utils.string.urlise(title)); $('#generatedUrl').html(utils.string.urlise(title)); } } }); }; |
if($('#pageTitle').length > 0 && $('#pageTitleOverwrite').length > 0) { $('#pageTitleOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#pageTitle').val(element.val()); } }); } if($('#navigationTitle').length > 0 && $('#navigationTitleOverwrite').length > 0) { $('#navigationTitleOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#navigationTitle').val(element.val()); } }); } $('#metaDescriptionOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#metaDescription').val(element.val()); } }); $('#metaKeywordsOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#metaKeywords').val(element.val()); } }); $('#urlOverwrite').change(function(evt) { if(!$(this).is(':checked')) { $('#url').val(utils.string.urlise(element.val())); $('#generatedUrl').html(utils.string.urlise(element.val())); } }); | $.fn.doMeta = function(options) { // define defaults var defaults = {}; // extend options var options = $.extend(defaults, options); // loop all elements return this.each(function() { // initialize calculateMeta(null, $(this)); // bind keypress $(this).bind('keyup', calculateMeta); // calculate meta function calculateMeta(evt, element) { if(typeof element != 'undefined') var title = element.val(); else var title = $(this).val(); if($('#pageTitle').length > 0 && $('#pageTitleOverwrite').length > 0) { if(!$('#pageTitleOverwrite').is(':checked')) { $('#pageTitle').val(title); } } if($('#navigationTitle').length > 0 && $('#navigationTitleOverwrite').length > 0) { if(!$('#navigationTitleOverwrite').is(':checked')) { $('#navigationTitle').val(title); } } if(!$('#metaDescriptionOverwrite').is(':checked')) { $('#metaDescription').val(title); } if(!$('#metaKeywordsOverwrite').is(':checked')) { $('#metaKeywords').val(title); } if(!$('#urlOverwrite').is(':checked')) { $('#url').val(utils.string.urlise(title)); $('#generatedUrl').html(utils.string.urlise(title)); } } }); }; |
|
this.each(function(h){var k=d(this),l=k.html();k.empty().append(function(){return a.call(this,h,l)})}):this.empty().append(a);return this},replaceWith:function(a){return this[0]&&this[0].parentNode?this.each(function(){var b=this.nextSibling,e=this.parentNode;d(this).remove();b?d(b).before(a):d(e).append(a)}):this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,e){function g(w){return d.nodeName(w,"table")?w.getElementsByTagName("tbody")[0]|| w.appendChild(w.ownerDocument.createElement("tbody")):w}var h,k,l=a[0],q=[];if(d.isFunction(l))return this.each(function(w){var A=d(this);a[0]=l.call(this,w,b?A.html():v);return A.domManip(a,b,e)});if(this[0]){h=a[0]&&a[0].parentNode&&a[0].parentNode.nodeType===11?{fragment:a[0].parentNode}:aa(a,this,q);if(k=h.fragment.firstChild){b=b&&d.nodeName(k,"tr");for(var p=0,o=this.length;p<o;p++)e.call(b?g(this[p],k):this[p],h.cacheable||this.length>1||p>0?h.fragment.cloneNode(true):h.fragment)}q&&d.each(q, ra)}return this}});d.fragments={};d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(e){var g=[];e=d(e);for(var h=0,k=e.length;h<k;h++){var l=(h>0?this.clone(true):this).get();d.fn[b].apply(d(e[h]),l);g=g.concat(l)}return this.pushStack(g,a,e.selector)}});d.each({remove:function(a,b){if(!a||d.filter(a,[this]).length){if(!b&&this.nodeType===1){M(this.getElementsByTagName("*"));M([this])}this.parentNode&&this.parentNode.removeChild(this)}}, | true)},domManip:function(a,b,e){function f(w){return c.nodeName(w,"table")?w.getElementsByTagName("tbody")[0]||w.appendChild(w.ownerDocument.createElement("tbody")):w}var h,k,l=a[0],q=[];if(c.isFunction(l))return this.each(function(w){var A=c(this);a[0]=l.call(this,w,b?A.html():v);return A.domManip(a,b,e)});if(this[0]){h=a[0]&&a[0].parentNode&&a[0].parentNode.nodeType===11?{fragment:a[0].parentNode}:aa(a,this,q);if(k=h.fragment.firstChild){b=b&&c.nodeName(k,"tr");for(var p=0,o=this.length;p<o;p++)e.call(b? f(this[p],k):this[p],h.cacheable||this.length>1||p>0?h.fragment.cloneNode(true):h.fragment)}q&&c.each(q,ra)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(e){var f=[];e=c(e);for(var h=0,k=e.length;h<k;h++){var l=(h>0?this.clone(true):this).get();c.fn[b].apply(c(e[h]),l);f=f.concat(l)}return this.pushStack(f,a,e.selector)}});c.each({remove:function(a,b){if(!a||c.filter(a, | this.each(function(h){var k=d(this),l=k.html();k.empty().append(function(){return a.call(this,h,l)})}):this.empty().append(a);return this},replaceWith:function(a){return this[0]&&this[0].parentNode?this.each(function(){var b=this.nextSibling,e=this.parentNode;d(this).remove();b?d(b).before(a):d(e).append(a)}):this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,e){function g(w){return d.nodeName(w,"table")?w.getElementsByTagName("tbody")[0]||w.appendChild(w.ownerDocument.createElement("tbody")):w}var h,k,l=a[0],q=[];if(d.isFunction(l))return this.each(function(w){var A=d(this);a[0]=l.call(this,w,b?A.html():v);return A.domManip(a,b,e)});if(this[0]){h=a[0]&&a[0].parentNode&&a[0].parentNode.nodeType===11?{fragment:a[0].parentNode}:aa(a,this,q);if(k=h.fragment.firstChild){b=b&&d.nodeName(k,"tr");for(var p=0,o=this.length;p<o;p++)e.call(b?g(this[p],k):this[p],h.cacheable||this.length>1||p>0?h.fragment.cloneNode(true):h.fragment)}q&&d.each(q,ra)}return this}});d.fragments={};d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(e){var g=[];e=d(e);for(var h=0,k=e.length;h<k;h++){var l=(h>0?this.clone(true):this).get();d.fn[b].apply(d(e[h]),l);g=g.concat(l)}return this.pushStack(g,a,e.selector)}});d.each({remove:function(a,b){if(!a||d.filter(a,[this]).length){if(!b&&this.nodeType===1){M(this.getElementsByTagName("*"));M([this])}this.parentNode&&this.parentNode.removeChild(this)}}, |
DONE:function(result) { if($type(result)) this.result = result; | DONE:function() { | DONE:function(result) { if($type(result)) this.result = result; this.next = 'done'; return this; }, |
DONE:function() { | DONE:function(result) { if($type(result)) this.result = result; | DONE:function() { this.next = 'done'; return this; }, |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.