{
"translatorID": "c59896bc-4beb-43ed-8109-a73a13251828",
"label": "Eastview",
"creator": "Sebastian Karcher",
"target": "^https?://dlib\\.eastview\\.com/(search/(advanced|simple)/|browse/(doc|favorites|issue))",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsb",
"lastUpdated": "2014-09-01 13:01:04"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2014 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 .
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url) {
if (url.search("/search/simple/articles?") != -1 || url.indexOf("/search/advanced/articles") != -1 || url.search(/browse\/(favorites|issue)/) != -1) {
if (ZU.xpath(doc, '//td[contains(@class, "title-cell")]/a').length) return "multiple";
} else {
return "newspaperArticle"
}
}
var typeMap = {
"Argumenty i fakty": "magazineArticle",
"Argumenty nedeli": "magazineArticle",
"Ekonomika i zhizn'": "magazineArticle",
"Ekspert": "magazineArticle",
"Izvestiia": "newspaperArticle",
"Kommersant. Daily": "newspaperArticle",
"Komsomol'skaia pravda": "newspaperArticle",
"Kul'tura": "magazineArticle",
"Literaturnaia gazeta": "magazineArticle",
"Moscow Times, The": "newspaperArticle",
"Moskovskaia pravda": "newspaperArticle",
"Moskovskii komsomolets": "newspaperArticle",
"New Times, The": "magazineArticle",
"Nezavisimaia gazeta": "newspaperArticle",
"Novaia gazeta": "newspaperArticle",
"Novye izvestiia": "newspaperArticle",
"Ogonek": "magazineArticle",
"Pravda": "newspaperArticle",
"President": "magazineArticle",
"Profil'": "magazineArticle",
"RBK Daily": "newspaperArticle",
"Rossiiskaia gazeta": "newspaperArticle",
"Rossiiskie vesti": "newspaperArticle",
"Russkii reporter": "magazineArticle",
"Sankt-Peterburgskie vedomosti": "newspaperArticle",
"Slovo": "magazineArticle",
"Sovetskaia Rossiia": "newspaperArticle",
"Trud": "newspaperArticle",
"Vecherniaia Moskva": "newspaperArticle",
"Vedomosti": "newspaperArticle",
"Zavtra": "newspaperArticle"
}
function permaLink(URL) {
var id = URL.match(/id=(\d+)/);
if (id) return "http://dlib.eastview.com/browse/doc/" + id[1];
else return URL
}
function scrape(doc, url) {
Z.debug(url)
var item = new Zotero.Item("newspaperArticle");
var publication = ZU.xpathText(doc, '//a[@class="path" and contains(@href, "browse/publication")]');
item.publication = publication;
var voliss = ZU.xpathText(doc, '//a[@class="path" and contains(@href, "browse/issue/")]');
if (voliss) {
var issue = voliss.match(/No\. (\d+)/);
if (issue) item.issue = issue[1];
var volume = voliss.match(/Vol\. (\d+)/);
if (volume) item.volume = volume[1];
}
var database = ZU.xpathText(doc, '//a[@class="path" and contains(@href, "browse/udb")]');
if (database) item.libraryCatalog = database.replace(/\(.+\)/, "") + "(Eastview)";
if (doc.getElementById('metatable')) {
//we have the metadata in a table
var metatable = doc.getElementById('metatable');
var title = ZU.xpathText(metatable, './/td[@class="hdr" and contains(text(), "Article Title")]/following-sibling::td[@class="val"]');
var source = ZU.xpathText(metatable, './/td[@class="hdr" and contains(text(), "Source")]/following-sibling::td[@class="val"]');
if (source) {
var date = source.match(/(January|February|March|April|May|Juni|July|August|September|October|November|December)\s+(\d{1,2},\s+)?\d{4}/);
if (date) item.date = ZU.trimInternal(date[0]);
var pages = source.match(/page\(s\): (\d+(?:-\d+)?)/);
if (pages) item.page = pages[1]
}
var author = ZU.xpathText(metatable, './/td[@class="hdr" and contains(text(), "Author(s)")]/following-sibling::td[@class="val"]');
if (author) {
//Z.debug(author)
authors = author.trim().split(/\s*,\s*/);
for (var i=0; i