Mercurial > hg > digilib
comparison client/digitallibrary/oldskin/dclib.js @ 315:144ed40053f5
fixed bug with detecting window size in Safari 1.2
author | robcast |
---|---|
date | Mon, 01 Nov 2004 18:24:33 +0100 |
parents | 252068404035 |
children | 1be12036e67d |
comparison
equal
deleted
inserted
replaced
314:2882fb0c432c | 315:144ed40053f5 |
---|---|
29 | 29 |
30 var cells = null; | 30 var cells = null; |
31 | 31 |
32 | 32 |
33 function dc_init() { | 33 function dc_init() { |
34 | |
35 // put the query parameters (sans "?") in the parameters array | 34 // put the query parameters (sans "?") in the parameters array |
36 parseParameters(location.search.slice(1)); | 35 parseParameters(location.search.slice(1)); |
37 } | 36 } |
38 | 37 |
39 function display(detail) { | 38 function display(detail) { |
44 var queryString = getAllParameters(detail); | 43 var queryString = getAllParameters(detail); |
45 location.href = location.protocol + "//" + location.host + location.pathname + "?" + queryString; | 44 location.href = location.protocol + "//" + location.host + location.pathname + "?" + queryString; |
46 } | 45 } |
47 | 46 |
48 function dc_render(doc) { | 47 function dc_render(doc) { |
49 | 48 // creates the HTML for the image table |
50 var fWidth = document.body ? document.body.clientWidth : innerWidth; | 49 var wsize = getWinSize(); |
51 var fHeight = document.body ? document.body.clientHeight : innerHeight; | 50 var fWidth = wsize.width; |
51 var fHeight = wsize.height; | |
52 | 52 |
53 var mx = getParameter("mx"); | 53 var mx = getParameter("mx"); |
54 cells = mx.split('x'); | 54 cells = mx.split('x'); |
55 | 55 |
56 var dw = getParameter("dw"); | 56 var dw = getParameter("dw"); |
57 var dh = getParameter("dh"); | 57 var dh = getParameter("dh"); |
58 var pt = getParameter("pt"); | 58 var pt = getParameter("pt"); |
59 var pn = getParameter("pn"); | 59 var pn = parseInt(getParameter("pn")); |
60 var fn = getParameter("fn"); | |
61 var par_mo = (hasParameter("mo")) ? "mo="+getParameter("mo") : ""; | |
60 | 62 |
61 var picWidth = (dw != 0) ? dw : Math.floor((fWidth-30)/cells[0])-2*cells[0]-1; | 63 var picWidth = (dw != 0) ? dw : Math.floor((fWidth-30)/cells[0])-2*cells[0]-1; |
62 var picHeight = (dh != 0) ? dh : picWidth; | 64 var picHeight = (dh != 0) ? dh : picWidth; |
63 | 65 |
64 if (cells.length > 1) { | 66 if (cells.length > 1) { |
65 picHeight = (dh != 0) ? dh : Math.floor(((fHeight-30)-12*cells[1])/cells[1])-2*cells[1]-1; | 67 picHeight = (dh != 0) ? dh : Math.floor(((fHeight-30)-12*cells[1])/cells[1])-2*cells[1]-1; |
66 } else { | 68 } else { |
67 cells[1] = Math.ceil(pt/cells[0]); | 69 cells[1] = Math.ceil(pt/cells[0]); |
68 } | 70 } |
69 | 71 |
70 var cellWidth = parseInt(picWidth)+8; | 72 var cellWidth = parseInt(picWidth)+8; |
71 var cellHeight = parseInt(picHeight)+18; | 73 var cellHeight = parseInt(picHeight)+18; |
72 | 74 |
73 doc.writeln('<table width="100%" height="100%" border="0" cellspacing="1" cellpadding="0">'); | 75 doc.writeln('<table width="100%" height="100%" border="0" cellspacing="1" cellpadding="0">'); |
74 | 76 |
75 for (var j = 0; j < cells[1]; j++) { | 77 for (var j = 0; j < cells[1]; j++) { |
76 doc.writeln('<tr>'); | 78 doc.writeln('<tr>'); |
77 for (var i = 0; i < cells[0]; i++) { | 79 for (var i = 0; i < cells[0]; i++) { |
78 var idx = parseInt(pn)+i+j*cells[0]; | 80 var idx = pn+i+j*cells[0]; |
79 var img = baseUrl + "/servlet/Scaler?fn=" + getParameter("fn") + "&pn=" + idx; | 81 var img = baseUrl + "/servlet/Scaler?fn=" + fn + "&pn=" + idx; |
80 img += "&dw=" + picWidth + "&dh=" + picHeight + "&mo=" + getParameter("mo"); | 82 img += "&dw=" + picWidth + "&dh=" + picHeight + par_mo; |
81 doc.write('<td width="'+cellWidth+'" height="'+cellHeight+'">'); | 83 doc.write('<td width="'+cellWidth+'" height="'+cellHeight+'">'); |
82 if (idx <= pt) { | 84 if (idx <= pt) { |
83 doc.write('<a href="'+dl_link(idx)+'" target="_blank"><img src="'+img+'" border="0"></a><div class="number">'+idx+'</div>'); | 85 doc.write('<a href="'+dl_link(idx)+'" target="_blank"><img src="'+img+'" border="0"></a><div class="number">'+idx+'</div>'); |
84 } else { | 86 } else { |
85 doc.write('<div class="nonumber">'+idx+'</div>'); | 87 doc.write('<div class="nonumber">'+idx+'</div>'); |
86 } | 88 } |
87 doc.writeln('</td>'); | 89 doc.writeln('</td>'); |
88 } | 90 } |
89 doc.writeln(' </tr>'); | 91 doc.writeln(' </tr>'); |
90 } | 92 } |
91 doc.writeln('</table>'); | 93 doc.writeln('</table>'); |
92 } | 94 } |
93 | 95 |
94 | 96 |
95 function dl_link(i) { | 97 function dl_link(i) { |
96 var link = baseUrl+"/digilib.jsp?fn="+getParameter("fn")+"&pn="+i+"&mo="+getParameter("mo"); | 98 var link = baseUrl+"/digilib.jsp?fn="+getParameter("fn")+"&pn="+i+"&mo="+getParameter("mo"); |