{
"translatorID": "5978580d-c58c-46c8-9755-9481a3e20f3f",
"label": "National Diet Library Catalogue",
"creator": "Philipp Zumstein",
"target": "^https?://iss\\.ndl\\.go\\.jp/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2015-08-15 16:07:22"
}
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 2015 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 (url.indexOf('/books/')>-1) {
var type = ZU.xpathText(doc, '//div[@id="thumbnail"]');
return getItemType(type);
} else if (url.indexOf('books?')>-1 && getSearchResults(doc, true)) {
return "multiple";
}
}
function getItemType(type) {
//http://www.ndl.go.jp/jp/aboutus/standards/meta/2011/12/ndl-type.rdf
if (type) {
switch (type.trim()) {
case "録音図書": //Audio Book
case "録音図書(CD・DVD)": //Audio Book In Sound Disc
case "録音図書(カセットテープ)": //Audio Book In Sound Tape
case "カセットテープ": //Cassette Tape
case "CD": //CD
case "視覚障害者向け資料": //Materials For Visually Handicapped People
case "音楽": //Music
case "レコード": //Record
case "音声再生用ディスク": //Sound Disc
case "音声再生用テープ": //Sound Tape
return "audioRecording";
break;
case "雑誌記事": //Article
case "記事・論文":
return "journalArticle";
break;
case "人工物": //Artifact
case "博物資料": //Museum Material
case "自然物": //Naturally Occurring Object
case "絵画": //Painting
case "写真": //Photograph
case "絵葉書": //Picture Postcard
case "ポスター": //Poster
return "artwork";
break;
case "CD-ROM": //CD-ROM
case "コンピュータディスク": //Computer Disc
case "コンピュータ・プログラム": //Computer Program
case "フォント": //Font
case "ゲーム": //Game
case "磁気ディスク": //Magnetic Disk
return "computerProgram";
break;
case "文書データ": //Document
case "手稿および書写資料": //Manuscript
return "manuscript";
break;
case "地図": //Map
return "map";
break;
case "スライド": //Slide
return "presentation";
break;
case "書誌データ": //Bibliographic Data
case "カード式資料": //Card Form
case "政府刊行物": //Government Publication
case "地方公共団体刊行物": //Local Publication
case "官公庁刊行物": //National Publication
case "国立国会図書館刊行物": //NDL Publication
case "数値データ": //Numeric Data
case "テクニカルリポート": //Technical Report
return "report";
break;
case "立法情報": //Legislative Information
case "レーザーディスク" : //LD
return "statute";
break;
case "博士論文": //Doctoral Dissertation
return "thesis";
break;
case "ブルーレイディスク": //Blu-ray Disc
case "DVD": //DVD
case "ビデオカセット": //Video Cassette
case "ビデオディスク": //Video Disc
return "videoRecording";
break;
case "パッケージ系電子資料": //Electronic Resource
case "オンライン資料": //Online Resource
case "オンラインジャーナル": //Online Journal
return "webpage";
break;
default:
return "book";
}
} else {
return "book";
}
}
function getSearchResults(doc, checkOnly) {
var items = {};
var found = false;
var rows = ZU.xpath(doc, '//li[contains(@class, "item_result")]//h3/a');
for (var i=0; i