-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathabs.js
54 lines (42 loc) · 1.46 KB
/
abs.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
// abs.js
// (C) Leo C. Stein ([email protected])
// 2013
//
// Part of the arXiv-keys extension
//
// This work is licensed as Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)
// For full details see http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US
//////////////////////////////////////////////////////////////////////
// /abs/ pages
//////////////////////////////////////////////////////////////////////
// Keep the namespace clean. Nothing to export.
(function(){
var PDFLink = null;
var sidebarLinks = document.getElementsByClassName("full-text")[0].getElementsByTagName("a");
for (var i = 0; i < sidebarLinks.length; i++)
if (sidebarLinks[i].accessKey == "f")
PDFLink = sidebarLinks[i];
function openPDF(inNewWin) {
if (PDFLink)
arXivKeys.openURL(PDFLink.href, inNewWin);
};
var links = document.getElementsByClassName("prevnext")[0]
.getElementsByTagName("a");
function getBrowseLinksKey(key) {
for (var i = 0; i < links.length; i++)
if (links[i].accessKey == key)
return links[i];
return null;
};
function goPrevPage(isShifted) {
arXivKeys.followLinkEl(getBrowseLinksKey('p'));
};
function goNextPage(isShifted) {
arXivKeys.followLinkEl(getBrowseLinksKey('n'));
};
////////////////////////////////////////////////////////////
// Install key handlers
arXivKeys.keyMap["OPENPDF"].act = openPDF;
arXivKeys.keyMap["PREVPAGE"].act = goPrevPage;
arXivKeys.keyMap["NEXTPAGE"].act = goNextPage;
}());