{ "translatorID": "b298ca93-0010-48f5-97fb-e9923519a380", "label": "KStudy", "creator": "Yunwoo Song, Frank Bennett, Philipp Zumstein", "target": "^https?://[^/]+\\.kstudy\\.com", "minVersion": "3.0", "maxVersion": "", "priority": 100, "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", "lastUpdated": "2018-01-03 13:10:00" } /* ***** BEGIN LICENSE BLOCK ***** KISS (Korean Studies Information Service System) Translator Copyright © 2017-2018 Yunwoo Song, Frank Bennett, and 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 (/\bkey=(\d+)\b/.test(url)) { if (url.includes('/thesis/thesis-view.asp')) { return "journalArticle"; } else if (url.includes('/public2-article.asp')) { // these are reports and working paper series but with publicaton name, // volume, issue numbers; thus handled as journal articles as well return "journalArticle"; } else if (url.includes('/public3-article.asp')) { return "report"; } } if (getSearchResults(doc, true)) { return "multiple"; } } function getSearchResults(doc, checkOnly) { var items = {}; var found = false; var rows = ZU.xpath(doc, '//div[contains(@class, "thesis-info")]/h5/a'); for (var i=0; i item.title.length/2 && item.title.toUpperCase() == item.title) { item.title = ZU.capitalizeTitle(item.title, true); } //remove space before colon in title item.title = item.title.replace(/\s+:/, ":"); // sometimes the author tags in RIS are empty and therefore we // try to scrape author names also directly if (item.creators.length == 0) { item.creators = scrapeAuthorsDirectly(doc, url); } else { // romanized Korean names with first and last name are splitted // wrongly into two AU tags in RIS and therefore we scrape // author names directly here let firstName = item.creators[0].lastName; let latinCharacters = firstName.match(/[\u{0000}-\u{00FF}]/ug); if (!item.creators[0].firstName && latinCharacters && latinCharacters.length == firstName.length) { item.creators = scrapeAuthorsDirectly(doc, url); } } if (item.issue && item.issue == "0") { delete item.issue; } item.language = "ko-KR"; item.complete(); }); translator.translate(); }); } function scrapeAuthorsDirectly(doc, url) { var creators = []; var writers = ZU.xpathText(doc, '//div[@class="writers"]'); if (writers) { var creatorsList = writers.split(','); for (var i=0; i