{
"translatorID": "2c98b8e6-6138-4b60-a999-15e3a7c8cb4b",
"label": "SAE Papers",
"creator": "Sebastian Karcher",
"target": "^https?://(www|papers)\\.sae\\.org/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-07-07 05:40:25"
}
/*
SAE Technical Papers Translator
Copyright (C) 2012-2015 Sebastian Karcher
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see .
*/
function detectWeb(doc, url) {
// Dryad search page
if (ZU.xpathText(doc, '//meta[@name="citation_journal_title"]/@content')){
return "journalArticle";
}
else if (ZU.xpathText(doc, '//meta[@name="citation_title"]/@content')){
return "report";
}
else if (getSearchResults(doc, true)){
return "multiple"
}
return false;
}
function doWeb(doc, url) {
var itemType = detectWeb(doc, url);
if (itemType === 'multiple') {
Zotero.selectItems(getSearchResults(doc), function(items) {
if (!items) return true;
var urls = [];
for (var i in items) {
urls.push(i);
}
ZU.processDocuments(urls, scrape);
})
}
else {
scrape(doc, url);
}
}
function getSearchResults(doc, checkOnly) {
var results = ZU.xpath(doc, '//div[@class="brw-i"]//div[@class="ct-b"]/a'),
items = {},
found = false;
for (var i=0; i