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