{
"translatorID": "076bd26a-1517-469d-85e9-31316a6f6cb0",
"label": "Wikisource",
"creator": "Philipp Zumstein",
"target": "^https?://en\\.wikisource\\.org/w",
"minVersion": "2.1.9",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2016-04-15 06:46:02"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2016 Philipp Zumstein
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 .
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (doc.getElementById("header_title_text")) {
var titleLink = ZU.xpath(doc, '//span[@id="header_title_text"]/a');
if (titleLink.length && (titleLink[0].textContent.match(/Encyclop(æ|ae|e)dia|Dictionary/) )) {
return "encyclopediaArticle";
}
if (doc.getElementById("ca-proofread-source")) {
if (doc.getElementById("header_section_text")) {
return "bookSection";
} else {
return "book";
}
} else {
return "manuscript";
}
} else if (getSearchResults(doc, true)) {
return "multiple";
}
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = ZU.xpath(doc, '//ul[contains(@class, "search-results")]//a');
for (var i=0; i 0) {
item.volume = ZU.xpathText(header, './a[2]');
}
if (doc.getElementById("header_section_text")) {
item.title = doc.getElementById("header_section_text").textContent;
} else {
item.title = ZU.xpathText(doc, '//*[@id="header_title_text"]/text()').replace(/(,|\n)/g,'');
}
} else {
item.title = doc.getElementById("header_title_text").textContent;
}
var creators = ZU.xpath(doc, '//span[@id="header_author_text"]');
for (var i=0; i