{ "translatorID": "b6d0a7a-d076-48ae-b2f0-b6de28b194e", "label": "ScienceDirect", "creator": "Michael Berkowitz and Aurimas Vinckevicius", "target": "^https?://[^/]*science-?direct\\.com[^/]*/science(?:/article/|\\?.*\\b_ob=ArticleListURL|/(?:journal|bookseries|book|handbooks|referenceworks)/\\d)", "minVersion": "3.0", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 4, "browserSupport": "gcsib", "lastUpdated": "2014-06-02 02:22:48" } function detectWeb(doc, url) { if ((url.indexOf("_ob=DownloadURL") !== -1) || doc.title == "ScienceDirect Login" || doc.title == "ScienceDirect - Dummy" || (url.indexOf("/science/advertisement/") !== -1)) { return false; } if((url.indexOf("pdf") !== -1 && url.indexOf("_ob=ArticleURL") === -1 && url.indexOf("/article/") === -1) || url.search(/\/(?:journal|bookseries|book|handbooks|referenceworks)\//) !== -1 || url.indexOf("_ob=ArticleListURL") !== -1) { if (getArticleList(doc).length > 0) { return "multiple"; } else { return false; } } else if(url.indexOf("pdf") === -1) { // Book sections have the ISBN in the URL if (url.indexOf("/B978") !== -1) { return "bookSection"; } else if(getISBN(doc)) { if(getArticleList(doc).length) { return "multiple"; } else { return "book"; } } else { return "journalArticle"; } } } function getExportLink(doc) { var link = ZU.xpath(doc, '//div[@class="icon_exportarticlesci_dir"]/a/@href'); return link.length ? link[0].textContent : false; } function getExportFormAction(doc) { var form = ZU.xpath(doc, '//div[@id="export_popup"]/form')[0]; return form ? form.action : false; } function getPDFLink(doc) { return ZU.xpathText(doc, '//div[@id="articleNav"]//div[contains(@class, "icon_pdf")]\ /a[not(@title="Purchase PDF")]/@href[1]'); } function getISBN(doc) { var isbn = ZU.xpathText(doc, '//td[@class="tablePubHead-Info"]\ //span[@class="txtSmall"]'); if(!isbn) return; isbn = isbn.match(/ISBN:\s*([-\d]+)/); if(!isbn) return; return isbn[1].replace(/[-\s]/g, ''); } function getFormValues(text, inputs) { var re = new RegExp("]+name=(['\"]?)(" + inputs.join('|') + ")\\1[^>]*>", 'g'); var input, val, params = {}; while(input = re.exec(text)) { val = input[0].match(/value=(['"]?)(.*?)\1[\s>]/); if(!val) continue; params[encodeURIComponent(input[2])] = encodeURIComponent(val[2]); } return params; } function getAbstract(doc) { var p = ZU.xpath(doc, '//div[contains(@class, "abstract") and not(contains(@class, "abstractHighlights"))]/p'); var paragraphs = []; for(var i=0; i