{
"translatorID": "6c61897b-ca44-4ce6-87c1-2da68b44e6f7",
"label": "Summon 2",
"creator": "Caistarrin Mystical and Aurimas Vinckevicius",
"target": "^https?://([^/]+\\.)?summon\\.serialssolutions\\.com/",
"minVersion": "4.0",
"maxVersion": "",
"priority": 150,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsib",
"lastUpdated": "2017-06-24 21:11:06"
}
/*
Summon 2.0 Translator
Copyright (C) 2014 ProQuest LLC
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
function detectWeb(doc, url) {
var results = doc.getElementById('results');
var displayMultiple = false;
if (results) {
var ul = results.firstElementChild.firstElementChild;
if (ul) {
// This is currently broken in Zotero.
// Scrolling down one page ends up triggering Page Modified event
// 111 times and makes the page unusable after a while.
//Zotero.monitorDOMChanges(ul, {childList: true});
// temporary hack to display multiples
displayMultiple = true;
}
}
var detailPage = doc.getElementsByClassName('detailPage')[0];
if (detailPage) {
// Changes from visible to not by adding class ng-hide
Zotero.monitorDOMChanges(detailPage, {attributes: true, attributeFiler: ['class']});
if (detailPage.offsetHeight) {
// Visible details page
var id = getIDFromUrl(url);
if (id) return 'book';
}
}
if (getSearchResults(doc, true) || displayMultiple) {
return "multiple";
}
}
function getIDFromUrl(url) {
var m = url.match(/[&?]id=([^]+)/);
return m && m[1];
}
function getSearchResults(doc, checkOnly) {
var results = doc.getElementById('results');
if (!results) return false;
var titles = results.getElementsByClassName('customPrimaryLinkContainer');
var items = {}, found = false;
var numRollups = 0;
for (var i=0; i 0) {
item.abstractNote = ref.abstracts[0].abstract;
}
if (ref.issns) {
item.ISSN = ref.issns[0];
}
else if (ref.eissns) {
item.ISSN = ref.eissns[0];
}
if (ref.publication_places) {
item.place = ref.publication_places[0];
}
else if (ref.dissertation_schools) {
item.place = ref.dissertation_schools[0];
}
item.pages = ref.pages;
if (!item.pages && ref.start_pages) {
item.pages = ref.start_pages[0]
+ (ref.end_pages && ref.end_pages.length > 0
? "-" + ref.end_pages[0]
: ""
);
}
item.date = ref.publication_date;
if (!item.date && ref.publication_years) {
item.date = ref.publication_years[ref.publication_years.length - 1];
}
if (ref.editions && ref.editions.length > 0
&& ref.editions[0] != "1"
&& ref.editions[0].indexOf("1st") != 0
&& ref.editions[0].toLowerCase().indexOf("first") != 0
) {
// we don't care about the first edition
item.edition = ref.editions[0];
}
item.complete();
}
}
function getAuthors(ref) {
var itemAuthors = [];
var types = ['authors','corporate_authors'];
for (var j=0; j 0) {
if (isCorporate) {
itemAuthors.push({
lastName: name,
creatorType: "author",
fieldMode: 1
});
}
else {
itemAuthors.push(ZU.cleanAuthor(name, "author", name.indexOf(',') > -1));
}
}
}
}
}
return itemAuthors;
}
function getRefType(ref) {
switch (ref.content_type) {
case "Audio Recording":
case "Music Recording":
return "audioRecording";
case "Book":
case "eBook":
return "book";
case "Book Chapter":
return "bookSection";
case "Case":
return "case";
case "Conference Proceeding":
return "conferencePaper";
case "Dissertation":
return "thesis";
case "Image":
case "Photograph":
return "artwork";
case "Magazine":
case "Magazine Article":
return "magazineArticle";
case "Manuscript":
return "manuscript";
case "Map":
return "map";
case "Newspaper Article":
case "Newspaper":
return "newspaperArticle";
break;
case "Presentation":
return "presentation";
case "Reference":
case "Publication Article":
return "encyclopediaArticle";
case "Report":
case "Technical Report":
case "Data Set":
case "Market Research":
case "Trade Publication Article":
case "Paper":
return "report";
case "Video Recording":
return "videoRecording";
case "Web Resource":
return "webpage";
case "Poem":
case "Electronic Resource":
if (ref.isbn) {
return "book";
}
return "journalArticle";
case "Journal Article":
case "Journal":
case "eJournal":
case "Book Review":
case "Newsletter":
case "Archival Material":
case "Computer File":
case "Course Reading":
case "Government Document":
case "Kit":
case "Microform":
case "Music Score":
case "Publication":
case "Realia":
case "Research Guide":
case "Special Collection":
case "Standard":
case "Transcript":
default:
return "journalArticle";
}
}
/** BEGIN TEST CASES **/
var testCases = [
{
"type": "web",
"url": "http://dartmouth.summon.serialssolutions.com/?#!/search/document?ho=t&l=en&q=buddha&id=FETCHMERGED-dartmouth_catalog_b412227382",
"defer": true,
"items": [
{
"itemType": "book",
"title": "Buddha",
"creators": [
{
"firstName": "Osamu",
"lastName": "Tezuka",
"creatorType": "author"
}
],
"date": "2003",
"ISBN": "9781932234442",
"language": "English",
"libraryCatalog": "Dartmouth College Library, Summon 2.0",
"numPages": "8 v.",
"place": "New York, N.Y",
"publisher": "Vertical",
"attachments": [],
"notes": [],
"seeAlso": []
}
]
},
{
"type": "web",
"url": "http://dartmouth.summon.serialssolutions.com/?#!/search?ho=t&q=buddha&l=en",
"defer": true,
"items": "multiple"
}
]
/** END TEST CASES **/