annotate client/digitallibrary/navigation_o6.js @ 74:c64e9ae9c788

New servlet version 1.5b. Mostly cleanup. Global parameters for digilib now in DigilibConfiguration, per request parameters are now all in DigilibRequest. The DocuImage implementation can be selected by the configuration docuimage-class. Pixel-by-pixel view implemented with "mo=clip".
author robcast
date Fri, 24 Jan 2003 21:54:49 +0100
parents 866e798e2bef
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
1 // this global variable has to be initialised before the frist use of the functions below
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
2 // to fill in the attributes you can use the function init provided below
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
3 // - array with all attributes
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
4 var att = new Array();
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
5
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
6 // fill in the values of the "att"-array
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
7 function init(fn, pn, ws, mo, mk, wx, wy, ww, wh) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
8
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
9 // debug window to check the parameters passed
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
10 //alert ("DEBUG message (parameters in init):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
11
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
12 // attaching the values to the att-array
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
13 att[0] = fn;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
14 att[1] = parseInt(pn);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
15 att[2] = parseFloat(ws);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
16 att[3] = mo;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
17 att[4] = mk;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
18 att[5] = parseFloat(wx);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
19 att[6] = parseFloat(wy);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
20 att[7] = parseFloat(ww);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
21 att[8] = parseFloat(wh);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
22
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
23 // compatablility issue
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
24 if (att[3].indexOf("f") > -1) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
25 att[3] = "fit";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
26 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
27
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
28 // converts the old mark format (0-1000) to new format(0.0 - 1.0)
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
29 // could even be useless now
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
30 if (att[4] != "0/0") {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
31 var tmp = att[4].split(";");
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
32
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
33 att[4] = "";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
34
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
35 for (i = 0; i < tmp.length; i++) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
36 tmp[i] = tmp[i].split("/");
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
37
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
38 if (tmp[i][0] > 1 && tmp[i][1] > 1) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
39 tmp[i][0] /= 1000;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
40 tmp[i][1] /= 1000;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
41 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
42
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
43 att[4] += tmp[i][0] + "/" + tmp[i][1] + ";";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
44 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
45 att[4] = att[4].slice(0, -1);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
46 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
47
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
48 // initialisation stuff
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
49 // ====================
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
50
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
51 setMarks();
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
52
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
53 this.document.onkeypress = parseKeypress;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
54 focus();
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
55
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
56 // give a name to the window containing digilib - this way one can test if there is already a
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
57 // digilib-window open and replace the contents of it (ex. digicat)
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
58 top.window.name = "digilib";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
59 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
60
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
61
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
62 // function that launches the ScaleServlet
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
63 // the different detailGrades:
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
64 // 0 -> back, next, page
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
65 // 1 -> zoomout
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
66 // 2 -> zoomarea, zoompoint, moveto, scaledef
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
67
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
68 function loadPicture(detailGrade, keepArea) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
69
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
70 var newQuery = "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&mo=" + att[3];
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
71
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
72 if (detailGrade == 0) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
73 att[4] = "0/0";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
74 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
75
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
76 if ((detailGrade == 1) || (detailGrade == 0 && !keepArea)) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
77 att[5] = 0;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
78 att[6] = 0;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
79 att[7] = 1;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
80 att[8] = 1;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
81 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
82
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
83 newQuery += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
84 newQuery += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
85
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
86 // debug window - checking the parameters passed to the next image
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
87 //alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
88
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
89 location.href = location.pathname + "?" + newQuery;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
90 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
91
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
92
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
93 // constructor holding different values of a point
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
94 function Point(event) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
95
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
96 this.pageX = parseInt(event.clientX);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
97 this.pageY = parseInt(event.clientY);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
98
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
99 this.x = this.pageX-parseInt(document.getElementById("lay1").style.left);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
100 this.y = this.pageY-parseInt(document.getElementById("lay1").style.top);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
101
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
102 this.relX = cropFloat(att[5]+(att[7]*this.x/document.pic.offsetWidth));
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
103 this.relY = cropFloat(att[6]+(att[8]*this.y/document.pic.offsetHeight));
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
104
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
105 // alert ("page:\t" + this.pageX + "\t" + this.pageY + "\npic:\t" + this.x + "\t" + this.y + "\nrel:\t" + this.relX + "\t" + this.relY);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
106
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
107 return this;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
108 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
109
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
110
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
111 function backPage(keepArea) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
112
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
113 att[1] = parseInt(att[1]) - 1;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
114
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
115 if (att[1] > 0) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
116 loadPicture(0, keepArea);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
117 } else {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
118 att[1] = parseInt(att[1]) + 1;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
119 alert("You are already on the first page!");
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
120 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
121 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
122
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
123
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
124 function nextPage(keepArea) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
125
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
126 att[1] = parseInt(att[1]) + 1;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
127
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
128 loadPicture(0, keepArea);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
129 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
130
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
131
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
132 function page(keepArea) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
133
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
134 do {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
135 page = prompt("Goto Page:", 1);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
136 } while ((page != null) && (page < 1));
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
137
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
138 if (page != null && page != att[1]) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
139 att[1] = page;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
140 loadPicture(0, keepArea);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
141 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
142 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
143
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
144
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
145 function digicat() {
50
866e798e2bef 13.8.2002 - [different files] : roc
robcast
parents: 42
diff changeset
146 var url = "digicat.html?" + att[0] + "+" + att[1];
42
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
147 win = window.open(url, "digicat");
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
148 win.focus();
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
149 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
150
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
151
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
152 function ref(refselect) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
153
50
866e798e2bef 13.8.2002 - [different files] : roc
robcast
parents: 42
diff changeset
154 var hyperlinkRef = baseUrl + "digilib.jsp?";
42
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
155 hyperlinkRef += att[0] + "+" + att[1] + "+" + att[2] + "+" + att[3] + "+" + att[4];
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
156
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
157 if ((att[5] != 0) || (att[6] != 0) || (att[7] != 1) || (att[8] != 1)) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
158 hyperlinkRef += "+" + att[5] + "+" + att[6] + "+" + att[7] + "+" + att[8];
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
159 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
160
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
161 if (refselect == 1) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
162 prompt("Link for HTML--documents", hyperlinkRef);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
163 } else {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
164 prompt("Link for LaTeX--documents", "\\href{" + hyperlinkRef + "}{TEXT}");
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
165 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
166 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
167
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
168
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
169 function mark() {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
170
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
171 if (att[4].split(";").length > 7) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
172 alert("Only 8 marks are possible at the moment!");
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
173 return;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
174 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
175
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
176 function markEvent(event) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
177 var point = new Point(event);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
178
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
179 if ((att[4] != "") && (att[4] != "0/0")) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
180 att[4] += ";";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
181 } else {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
182 att[4] = "";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
183 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
184 att[4] += point.relX + "/" + point.relY;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
185
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
186 document.getElementById("lay1").onmousedown = false;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
187 setMarks();
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
188 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
189
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
190 document.getElementById("lay1").onmousedown = markEvent;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
191 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
192
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
193
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
194 function zoomArea() {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
195 var state = 0;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
196 var pt1, pt2;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
197
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
198 function click(event) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
199
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
200 if (state == 0) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
201 state = 1;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
202
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
203 pt1 = new Point(event);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
204 pt2 = pt1;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
205
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
206 document.getElementById("eck1").style.left = pt1.pageX;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
207 document.getElementById("eck1").style.top = pt1.pageY;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
208 document.getElementById("eck2").style.left = pt2.pageX-12;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
209 document.getElementById("eck2").style.top = pt1.pageY;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
210 document.getElementById("eck3").style.left = pt1.pageX;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
211 document.getElementById("eck3").style.top = pt2.pageY-12;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
212 document.getElementById("eck4").style.left = pt2.pageX-12;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
213 document.getElementById("eck4").style.top = pt2.pageY-12;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
214
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
215 document.getElementById("eck1").style.visibility="visible";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
216 document.getElementById("eck2").style.visibility="visible";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
217 document.getElementById("eck3").style.visibility="visible";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
218 document.getElementById("eck4").style.visibility="visible";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
219
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
220 document.getElementById("lay1").onmousemove = move;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
221 document.getElementById("eck4").onmousemove = move;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
222
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
223 } else {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
224
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
225 pt2 = new Point(event);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
226
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
227 document.getElementById("lay1").onmousedown = false;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
228 document.getElementById("eck4").onmousedown = false;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
229
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
230 document.getElementById("eck1").style.visibility="hidden";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
231 document.getElementById("eck2").style.visibility="hidden";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
232 document.getElementById("eck3").style.visibility="hidden";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
233 document.getElementById("eck4").style.visibility="hidden";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
234
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
235 att[5] = Math.min(pt1.relX, pt2.relX);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
236 att[6] = Math.min(pt1.relY, pt2.relY);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
237
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
238 att[7] = Math.abs(pt1.relX-pt2.relX);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
239 att[8] = Math.abs(pt1.relY-pt2.relY);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
240
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
241 if (att[7] != 0 && att[8] != 0) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
242 loadPicture(2);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
243 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
244 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
245 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
246
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
247 function move(event) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
248
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
249 pt2 = new Point(event);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
250
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
251 document.getElementById("eck1").style.left = ((pt1.pageX < pt2.pageX) ? pt1.pageX : pt2.pageX);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
252 document.getElementById("eck1").style.top = ((pt1.pageY < pt2.pageY) ? pt1.pageY : pt2.pageY);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
253 document.getElementById("eck2").style.left = ((pt1.pageX < pt2.pageX) ? pt2.pageX : pt1.pageX)-12;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
254 document.getElementById("eck2").style.top = ((pt1.pageY < pt2.pageY) ? pt1.pageY : pt2.pageY);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
255 document.getElementById("eck3").style.left = ((pt1.pageX < pt2.pageX) ? pt1.pageX : pt2.pageX);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
256 document.getElementById("eck3").style.top = ((pt1.pageY < pt2.pageY) ? pt2.pageY : pt1.pageY)-12;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
257 document.getElementById("eck4").style.left = ((pt1.pageX < pt2.pageX) ? pt2.pageX : pt1.pageX)-12;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
258 document.getElementById("eck4").style.top = ((pt1.pageY < pt2.pageY) ? pt2.pageY : pt1.pageY)-12;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
259 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
260
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
261 document.getElementById("lay1").onmousedown = click;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
262 document.getElementById("eck4").onmousedown = click;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
263 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
264
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
265
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
266 function zoomPoint() {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
267
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
268 function zoomPointEvent(event) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
269 var point = new Point(event);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
270
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
271 att[5] = cropFloat(point.relX-0.5*att[7]*0.7);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
272 att[6] = cropFloat(point.relY-0.5*att[8]*0.7);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
273
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
274 att[7] = cropFloat(att[7]*0.7);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
275 att[8] = cropFloat(att[8]*0.7);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
276
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
277 if (att[5] < 0) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
278 att[5] = 0;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
279 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
280 if (att[6] < 0) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
281 att[6] = 0;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
282 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
283 if (att[5]+att[7] > 1) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
284 att[5] = 1-att[7];
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
285 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
286 if (att[6]+att[8] > 1) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
287 att[6] = 1-att[8];
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
288 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
289
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
290 document.getElementById("lay1").onmousedown = false;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
291
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
292 loadPicture(2);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
293 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
294
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
295 document.getElementById("lay1").onmousedown = zoomPointEvent;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
296 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
297
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
298
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
299 function zoomOut() {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
300
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
301 loadPicture(1);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
302 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
303
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
304
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
305 function moveTo() {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
306
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
307 function moveToEvent(event) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
308
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
309 var point = new Point(event);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
310
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
311 att[5] = cropFloat(point.relX-0.5*att[7]);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
312 att[6] = cropFloat(point.relY-0.5*att[8]);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
313
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
314 if (att[5] < 0) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
315 att[5] = 0;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
316 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
317 if (att[6] < 0) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
318 att[6] = 0;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
319 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
320 if (att[5]+att[7] > 1) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
321 att[5] = 1-att[7];
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
322 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
323 if (att[6]+att[8] > 1) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
324 att[6] = 1-att[8];
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
325 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
326
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
327 document.getElementById("lay1").onmousedown = false;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
328
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
329 loadPicture(2);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
330 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
331
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
332 document.getElementById("lay1").onmousedown = moveToEvent;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
333 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
334
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
335
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
336 function scale(scaledef) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
337
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
338 att[2] = scaledef;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
339 loadPicture(2);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
340 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
341
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
342
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
343 function setMarks() {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
344
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
345 if (att[4] != "" && att[4] != "0/0") {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
346 var mark = att[4].split(";");
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
347
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
348 var countMarks = mark.length;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
349
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
350 // maximum of marks is 8
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
351 // we do not report this error because this is already done in func. "Mark"
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
352 if (countMarks > 8) countMarks = 8;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
353
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
354 var picWidth = document.pic.offsetWidth;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
355 var picHeight = document.pic.offsetHeight;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
356
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
357 // catch the cases where the picture had not been loaded already and
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
358 // make a timeout so that the coordinates are calculated with the real dimensions
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
359 if (document.pic.complete) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
360 var xoffset = parseInt(document.getElementById("lay1").style.left);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
361 var yoffset = parseInt(document.getElementById("lay1").style.top);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
362
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
363 for (var i = 0; i < countMarks; i++) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
364 mark[i] = mark[i].split("/");
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
365
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
366 if ((mark[i][0] > att[5]) && (mark[i][1] > att[6]) && (mark[i][0] < (att[5]+att[7])) && (mark[i][1] < (att[6]+att[8]))) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
367
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
368 mark[i][0] = parseInt(xoffset+picWidth*(mark[i][0]-att[5])/att[7]);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
369 mark[i][1] = parseInt(yoffset+picHeight*(mark[i][1]-att[6])/att[8]);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
370
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
371
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
372 document.getElementById("dot" + i).style.left = mark[i][0]-5;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
373 document.getElementById("dot" + i).style.top = mark[i][1]-5;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
374 document.getElementById("dot" + i).style.visibility = "visible";
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
375 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
376 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
377 } else {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
378 setTimeout("setMarks()", 100);
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
379 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
380 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
381 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
382
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
383 // capturing keypresses for next and previous page
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
384 // ascii-values of n = 110, b = 98
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
385 function parseKeypress (event) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
386
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
387 if (String.fromCharCode(event.which) == "n") {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
388 nextPage();
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
389 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
390
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
391 // does not work currently, because Opera catches this key on it's own
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
392 // have to change the key or find another way - luginbuehl
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
393 if (String.fromCharCode(event.which) == "b") {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
394 backPage();
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
395 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
396 }
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
397
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
398
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
399 // auxiliary function to crop senseless precicsion
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
400 function cropFloat(tmp) {
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
401 return parseInt(10000*tmp)/10000;
57874b52c2fc opera support done, bugfixes
luginbue
parents:
diff changeset
402 }