110
|
1 /*
|
134
|
2
|
110
|
3 Copyright (C) 2003 WTWG, Uni Bern
|
|
4
|
|
5 This program is free software; you can redistribute it and/or
|
|
6 modify it under the terms of the GNU General Public License
|
|
7 as published by the Free Software Foundation; either version 2
|
|
8 of the License, or (at your option) any later version.
|
|
9
|
|
10 This program is distributed in the hope that it will be useful,
|
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 GNU General Public License for more details.
|
|
14
|
|
15 You should have received a copy of the GNU General Public License
|
|
16 along with this program; if not, write to the Free Software
|
|
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
18
|
134
|
19 Author: Christian Luginbuehl, 22.05.2003 , Version Alcatraz 0.4
|
|
20
|
110
|
21 */
|
31
|
22
|
134
|
23 /*************************************************************************
|
|
24 * pagesTotal.js : digilib-module *
|
|
25 * *
|
|
26 * desc: displaying the total number of pages in a designated frame, *
|
|
27 * when calling pagesTotal(). also overrides nextPage() and *
|
|
28 * page() functions, by adding last-page tests. *
|
|
29 * *
|
|
30 *************************************************************************/
|
31
|
31
|
|
32
|
|
33 /**
|
134
|
34 * shows 'page XX of YY' in a designated frame
|
31
|
35 */
|
134
|
36 function showTotalPages() {
|
|
37
|
|
38 var pf = parent.pageFrame;
|
31
|
39
|
134
|
40 if ( pf ) {
|
|
41 pf.document.open();
|
|
42 pf.document.write('<html><head></head>');
|
|
43 pf.document.write('<body bgcolor="#CCCCCC" topmargin="5" marginheight="5">');
|
|
44 pf.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: 11px">');
|
|
45 pf.document.write(dlParams.pn.value + '<b> of </b>' + dlParams.pt.value + '</p></body></html>');
|
|
46 pf.document.close();
|
|
47 }
|
|
48
|
31
|
49 }
|
|
50
|
|
51
|
|
52 /**
|
134
|
53 * extending init from novaigation.js
|
31
|
54 */
|
134
|
55 function init_pagesTotal() {
|
31
|
56
|
134
|
57 init();
|
|
58
|
|
59 showTotalPages();
|
31
|
60
|
|
61 }
|
|
62
|
|
63
|
|
64 /**
|
134
|
65 * overriding 'page' in navigation.js
|
31
|
66 */
|
134
|
67 function page(page, details) {
|
31
|
68
|
134
|
69 if ( details == null ) {
|
|
70 details = 1;
|
|
71 }
|
|
72
|
|
73 if ( page && page.indexOf('-') == 0 ) {
|
|
74 if ( dlParams.pn.value > 1 ) {
|
|
75 page = Math.max(parseInt(dlParams.pn.value) - parseInt(page.slice(1)), 1);
|
|
76 dlParams.pn.value = page;
|
|
77 display(details);
|
|
78 } else {
|
|
79 alert("You are already on the first page!");
|
|
80 }
|
31
|
81
|
134
|
82 } else if ( page && page.indexOf('+') == 0 ) {
|
|
83 if ( parseInt(dlParams.pn.value) < parseInt(dlParams.pt.value) ) {
|
|
84 page = Math.min(parseInt(dlParams.pn.value) + parseInt(page.slice(1)), dlParams.pt.value);
|
|
85 dlParams.pn.value = page;
|
|
86 display(details);
|
|
87 } else {
|
|
88 alert("You are already on the last page!");
|
|
89 }
|
|
90 } else if ( page && page == parseInt(page) ) {
|
|
91 if ( (page > 0) && (page <= parseInt(dlParams.pt.value)) ) {
|
|
92 dlParams.pn.value = parseInt(page);
|
|
93 display(details);
|
|
94 } else {
|
|
95 alert ("Illegal page number (1 - " + dlParams.pt.value + ")!");
|
|
96 }
|
|
97 }
|
31
|
98
|
134
|
99 } |