This repository has been archived by the owner on Jan 3, 2020. It is now read-only.
forked from zotero/translators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathio-port.js
68 lines (59 loc) · 2.01 KB
/
io-port.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
"translatorID": "1c0c63d9-4a95-44d4-b441-173cdc1b8688",
"label": "io-port",
"creator": "Sebastian Karcher",
"target": "^https?://www\\.zentralblatt-math\\.org/ioport/",
"minVersion": "3.0",
"maxVersion": "",
"priority": 100,
"inRepository": true,
"translatorType": 4,
"browserSupport": "g",
"lastUpdated": "2014-03-08 16:26:00"
}
/*
***** BEGIN LICENSE BLOCK *****
io-portal translator
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 <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
function detectWeb(doc, url){
if (ZU.xpath(doc, '//div[@class="content_search_result_item"]').length>0) return "multiple";
}
function doWeb(doc, url){
var rows = ZU.xpath(doc, '//div[@class="content_search_result_item"]')
var title;
var link;
var items= {};
var urls = []
for (var i=0; i<rows.length; i++){
title = ZU.xpathText(rows[i], './div[@class="content_search_result_item_meta"]/div[@class="bold"]');
link = ZU.xpathText(rows[i], './div[@class="content_search_result_function"]/a[contains(@href, "type=bib")]/@href');
items[link]=title.trim();
}
Zotero.selectItems(items, function(items) {
if(!items) {
return true;
}
for (var i in items) {
urls.push(i)
};
ZU.doGet(urls, function(text){
var translator = Zotero.loadTranslator("import");
translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4");
translator.setString(text);
translator.translate();
})
});
}