annotate client/digitallibrary/navcat_n4.js @ 602:a1dd1d324d7d vendor

close old vendor branch
author robcast
date Tue, 11 Jan 2011 21:31:36 +0100
parents 85126da2ae21
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
254fca7a21ce First import of client module
robcast
parents:
diff changeset
1 // these two global variables have to be initialised before the frist use of the functions below
254fca7a21ce First import of client module
robcast
parents:
diff changeset
2 // to fill in the attributes you can use the function initPicture provided below
254fca7a21ce First import of client module
robcast
parents:
diff changeset
3 // - array with all attributes
254fca7a21ce First import of client module
robcast
parents:
diff changeset
4 var att = new Array();
254fca7a21ce First import of client module
robcast
parents:
diff changeset
5
254fca7a21ce First import of client module
robcast
parents:
diff changeset
6 // - variable to store the path to the frame, in which the pictures should be created
254fca7a21ce First import of client module
robcast
parents:
diff changeset
7 var whichFrame = parent.mainFrame;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
8
254fca7a21ce First import of client module
robcast
parents:
diff changeset
9 // give a name to the window containing digicat - this way one can test if there is already a
254fca7a21ce First import of client module
robcast
parents:
diff changeset
10 // digicat-window open and replace the contents of it (ex. digilib)
254fca7a21ce First import of client module
robcast
parents:
diff changeset
11 window.name = "digicat";
254fca7a21ce First import of client module
robcast
parents:
diff changeset
12
254fca7a21ce First import of client module
robcast
parents:
diff changeset
13 function loadThumbTable() {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
14 tableWidth = whichFrame.innerWidth-30;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
15 tableHeight = whichFrame.innerHeight-30;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
16
254fca7a21ce First import of client module
robcast
parents:
diff changeset
17 cellWidth = Math.floor(tableWidth/att[3])-6;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
18 cellHeight = Math.floor(tableHeight/att[2])-4;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
19
254fca7a21ce First import of client module
robcast
parents:
diff changeset
20 // alert(tableWidth + " " + tableHeight + "\n" + cellWidth + " " +cellHeight);
254fca7a21ce First import of client module
robcast
parents:
diff changeset
21
254fca7a21ce First import of client module
robcast
parents:
diff changeset
22 whichFrame.document.open();
254fca7a21ce First import of client module
robcast
parents:
diff changeset
23 whichFrame.document.write('<html><head>');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
24 whichFrame.document.write('<style type="text/css">.myFont {font-family: sans-serif, Arial; font-size: 11px; color: #FFFFFF}</style>');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
25 whichFrame.document.write('<script language="Javascript">');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
26 whichFrame.document.write('function loadDigilib(idx) {');
107
85126da2ae21 XUL: Digilib Buttons in chrome
engler
parents: 6
diff changeset
27 whichFrame.document.write('linkRef = "' + parent.baseUrl + '/digilib.jsp?' + parent.att[0] + '+" + idx;');
6
254fca7a21ce First import of client module
robcast
parents:
diff changeset
28 whichFrame.document.write('win = window.open(linkRef, "digilib");');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
29 whichFrame.document.write('win.focus();');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
30 whichFrame.document.write('}');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
31 whichFrame.document.write('</script>');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
32
254fca7a21ce First import of client module
robcast
parents:
diff changeset
33
254fca7a21ce First import of client module
robcast
parents:
diff changeset
34 whichFrame.document.write('</head><body bgcolor="#666666">');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
35 whichFrame.document.write('<table border="1" width="' + tableWidth + '" height="' + tableHeight + '">');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
36 for (i = 0; i < att[2]; i++) {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
37 whichFrame.document.write('<tr>');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
38 for (j = 0; j < att[3]; j++) {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
39 indexNr = parseInt(att[1])+i*parseInt(att[3])+j;
107
85126da2ae21 XUL: Digilib Buttons in chrome
engler
parents: 6
diff changeset
40 thumb = parent.baseUrl + "/servlet/Scaler/";
6
254fca7a21ce First import of client module
robcast
parents:
diff changeset
41 thumb += att[0] + "?" + "pn=" + indexNr + "&ws=1.0&mo=fit&dw=" + cellWidth + "&dh=" + (cellHeight-25);
254fca7a21ce First import of client module
robcast
parents:
diff changeset
42 whichFrame.document.write('<td align="center" valign="middle" width="' + cellWidth + '" height="' + cellHeight + '" class="myFont">');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
43 whichFrame.document.write('<a href="javascript:loadDigilib(' + indexNr + ')">');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
44 whichFrame.document.write('<img src="' + thumb + '" border="0">');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
45 whichFrame.document.write('</a><br>');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
46 whichFrame.document.write(indexNr + '</td>');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
47 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
48 whichFrame.document.write('</tr>');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
49 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
50 whichFrame.document.write('</table></body></html>');
254fca7a21ce First import of client module
robcast
parents:
diff changeset
51 whichFrame.document.close();
254fca7a21ce First import of client module
robcast
parents:
diff changeset
52 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
53
254fca7a21ce First import of client module
robcast
parents:
diff changeset
54
254fca7a21ce First import of client module
robcast
parents:
diff changeset
55 function Backpage() {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
56
254fca7a21ce First import of client module
robcast
parents:
diff changeset
57 if (att[1] <= 1) {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
58 att[1] = 1;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
59 alert("You are already on the first page!");
254fca7a21ce First import of client module
robcast
parents:
diff changeset
60 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
61
254fca7a21ce First import of client module
robcast
parents:
diff changeset
62 att[1] = parseInt(att[1])-parseInt(att[2]*att[3]);
254fca7a21ce First import of client module
robcast
parents:
diff changeset
63
254fca7a21ce First import of client module
robcast
parents:
diff changeset
64 if (att[1] < 1) {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
65 att[1] = 1;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
66 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
67 loadThumbTable();
254fca7a21ce First import of client module
robcast
parents:
diff changeset
68 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
69
254fca7a21ce First import of client module
robcast
parents:
diff changeset
70
254fca7a21ce First import of client module
robcast
parents:
diff changeset
71 function Nextpage() {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
72
254fca7a21ce First import of client module
robcast
parents:
diff changeset
73 att[1] = parseInt(att[1])+parseInt(att[2]*att[3]);
254fca7a21ce First import of client module
robcast
parents:
diff changeset
74 loadThumbTable();
254fca7a21ce First import of client module
robcast
parents:
diff changeset
75 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
76
254fca7a21ce First import of client module
robcast
parents:
diff changeset
77
254fca7a21ce First import of client module
robcast
parents:
diff changeset
78 // capturing keypresses for next and previous page
254fca7a21ce First import of client module
robcast
parents:
diff changeset
79 function parseKeypress(event) {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
80 var whichCode = (window.Event) ? event.which : event.keyCode;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
81 if (String.fromCharCode(whichCode) == "n") {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
82 Nextpage();
254fca7a21ce First import of client module
robcast
parents:
diff changeset
83 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
84 if (String.fromCharCode(whichCode) == "b") {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
85 Backpage();
254fca7a21ce First import of client module
robcast
parents:
diff changeset
86 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
87 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
88
254fca7a21ce First import of client module
robcast
parents:
diff changeset
89
254fca7a21ce First import of client module
robcast
parents:
diff changeset
90 // initialize browser specific things (keypress caputring)
254fca7a21ce First import of client module
robcast
parents:
diff changeset
91 function initScripts() {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
92 window.captureEvents(Event.KEYDOWN);
254fca7a21ce First import of client module
robcast
parents:
diff changeset
93 window.onkeydown = parseKeypress;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
94 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
95
254fca7a21ce First import of client module
robcast
parents:
diff changeset
96
254fca7a21ce First import of client module
robcast
parents:
diff changeset
97 // fill in the values of the "att"-array
254fca7a21ce First import of client module
robcast
parents:
diff changeset
98 function initPicture(picURL) {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
99 att = picURL.split("+");
254fca7a21ce First import of client module
robcast
parents:
diff changeset
100
254fca7a21ce First import of client module
robcast
parents:
diff changeset
101 if (att[0].lastIndexOf("/") == att[0].length-1) {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
102 att[0] = att[0].substring(0, att[0].length-1);
254fca7a21ce First import of client module
robcast
parents:
diff changeset
103 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
104
254fca7a21ce First import of client module
robcast
parents:
diff changeset
105 if (att.length < 2 || att[1] == "") {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
106 att[1] = 1;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
107 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
108 if (att.length < 3 || att[2] == "") {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
109 att[2] = 3;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
110 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
111
254fca7a21ce First import of client module
robcast
parents:
diff changeset
112 if (att.length < 4) {
254fca7a21ce First import of client module
robcast
parents:
diff changeset
113 att[3] = 4;
254fca7a21ce First import of client module
robcast
parents:
diff changeset
114 }
254fca7a21ce First import of client module
robcast
parents:
diff changeset
115 }