annotate client/digitallibrary/modules/imago.js @ 224:c70823f5af75

new versions on modules and contexto tool to show text
author luginbue
date Fri, 09 Jul 2004 02:39:46 +0200
parents 7dc74e541d7c
children 4fac8dd28364
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
1 /*
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
2
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
3 Copyright (C) 2003 WTWG, Uni Bern
26e6b2715a15 Initial revision
engler
parents:
diff changeset
4
26e6b2715a15 Initial revision
engler
parents:
diff changeset
5 This program is free software; you can redistribute it and/or
26e6b2715a15 Initial revision
engler
parents:
diff changeset
6 modify it under the terms of the GNU General Public License
26e6b2715a15 Initial revision
engler
parents:
diff changeset
7 as published by the Free Software Foundation; either version 2
26e6b2715a15 Initial revision
engler
parents:
diff changeset
8 of the License, or (at your option) any later version.
26e6b2715a15 Initial revision
engler
parents:
diff changeset
9
26e6b2715a15 Initial revision
engler
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
26e6b2715a15 Initial revision
engler
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
13 GNU General Public License for more details.
26e6b2715a15 Initial revision
engler
parents:
diff changeset
14
26e6b2715a15 Initial revision
engler
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
26e6b2715a15 Initial revision
engler
parents:
diff changeset
16 along with this program; if not, write to the Free Software
26e6b2715a15 Initial revision
engler
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
26e6b2715a15 Initial revision
engler
parents:
diff changeset
18
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
19 Author: Christian Luginbuehl, 22.05.2003 , Version Alcatraz 0.4
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
20
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
21 */
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
22
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
23 /*************************************************************************
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
24 * imago.js : digilib-module *
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
25 * *
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
26 * desc: adds different image manipulation functions. *
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
27 * *
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
28 *************************************************************************/
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
29
26e6b2715a15 Initial revision
engler
parents:
diff changeset
30
26e6b2715a15 Initial revision
engler
parents:
diff changeset
31 /**
26e6b2715a15 Initial revision
engler
parents:
diff changeset
32 * brightness (value of brightness between -255 - +255)
26e6b2715a15 Initial revision
engler
parents:
diff changeset
33 */
26e6b2715a15 Initial revision
engler
parents:
diff changeset
34 function brightness(value) {
26e6b2715a15 Initial revision
engler
parents:
diff changeset
35
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
36 if ( (value >= -255) && (value <= 255) ) {
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
37
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
38 dlParams.brgt.value = value;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
39 display(3);
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
40
26e6b2715a15 Initial revision
engler
parents:
diff changeset
41 }
26e6b2715a15 Initial revision
engler
parents:
diff changeset
42
26e6b2715a15 Initial revision
engler
parents:
diff changeset
43 }
26e6b2715a15 Initial revision
engler
parents:
diff changeset
44
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
45
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
46 /**
26e6b2715a15 Initial revision
engler
parents:
diff changeset
47 * contrast (value of contrast - range?)
26e6b2715a15 Initial revision
engler
parents:
diff changeset
48 */
26e6b2715a15 Initial revision
engler
parents:
diff changeset
49 function contrast(value) {
26e6b2715a15 Initial revision
engler
parents:
diff changeset
50
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
51 dlParams.cont.value = parseFloat(value);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
52 display(3);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
53
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
54 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
55
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
56
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
57 /**
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
58 * brightness/contrast in one call
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
59 */
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
60 function brightnessContrast(brightness, contrast) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
61
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
62 dlParams.cont.value = parseFloat(contrast);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
63
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
64 if ( (brightness >= -255) && (brightness <= 255) ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
65
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
66 dlParams.brgt.value = parseFloat(brightness);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
67 display(3);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
68
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
69 }
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
70
26e6b2715a15 Initial revision
engler
parents:
diff changeset
71 }
26e6b2715a15 Initial revision
engler
parents:
diff changeset
72
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
73
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
74 /**
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
75 * mirror (horizontal or vertical)
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
76 */
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
77 function mirror(direction) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
78
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
79 if ( direction == 'v' ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
80 if ( dlParams.mo.value.indexOf('vmir') > -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
81 removeMoFlag('vmir');
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
82 } else {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
83 addMoFlag('vmir');
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
84 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
85 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
86
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
87 if ( direction == 'h' ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
88 if ( dlParams.mo.value.indexOf('hmir') > -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
89 removeMoFlag('hmir');
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
90 } else {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
91 addMoFlag('hmir');
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
92 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
93 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
94
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
95 display(3);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
96
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
97 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
98
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
99
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
100 /**
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
101 * rotation
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
102 */
26e6b2715a15 Initial revision
engler
parents:
diff changeset
103 function rotation(value) {
26e6b2715a15 Initial revision
engler
parents:
diff changeset
104
26e6b2715a15 Initial revision
engler
parents:
diff changeset
105 value = parseFloat(value) % 360;
26e6b2715a15 Initial revision
engler
parents:
diff changeset
106
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
107 if ( value < 0 ) {
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
108 value += 360;
26e6b2715a15 Initial revision
engler
parents:
diff changeset
109 }
26e6b2715a15 Initial revision
engler
parents:
diff changeset
110
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
111 dlParams.rot.value = value;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
112 display(3);
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
113
26e6b2715a15 Initial revision
engler
parents:
diff changeset
114 }
26e6b2715a15 Initial revision
engler
parents:
diff changeset
115
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
116
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
117 /**
26e6b2715a15 Initial revision
engler
parents:
diff changeset
118 * rgb add (r/g/b, each value from -255 to +255)
26e6b2715a15 Initial revision
engler
parents:
diff changeset
119 */
26e6b2715a15 Initial revision
engler
parents:
diff changeset
120 function rgba(value) {
26e6b2715a15 Initial revision
engler
parents:
diff changeset
121
26e6b2715a15 Initial revision
engler
parents:
diff changeset
122 values = value.split("/");
26e6b2715a15 Initial revision
engler
parents:
diff changeset
123
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
124 if ( values.length != 3 ) {
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
125 alert ("Illegal parameter format (r/g/b)");
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
126 } else if ( (values[0] < -255) || (values[0] > 255) ) {
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
127 alert ("Illegal red additioner (-255 to 255)");
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
128 } else if ( (values[1] < -255) || (values[1] > 255) ) {
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
129 alert ("Illegal green additioner (-255 to 255)");
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
130 } else if ( (values[2] < -255) || (values[2] > 255) ) {
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
131 alert ("Illegal blue additioner (-255 to 255)");
26e6b2715a15 Initial revision
engler
parents:
diff changeset
132 } else {
26e6b2715a15 Initial revision
engler
parents:
diff changeset
133
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
134 dlParams.rgba.value = value;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
135 display(3);
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
136
26e6b2715a15 Initial revision
engler
parents:
diff changeset
137 }
26e6b2715a15 Initial revision
engler
parents:
diff changeset
138 }
26e6b2715a15 Initial revision
engler
parents:
diff changeset
139
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
140
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
141 /**
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
142 * rgb mutiply (r/g/b, range?)
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
143 */
26e6b2715a15 Initial revision
engler
parents:
diff changeset
144 function rgbm(value) {
26e6b2715a15 Initial revision
engler
parents:
diff changeset
145
26e6b2715a15 Initial revision
engler
parents:
diff changeset
146 values = value.split("/");
26e6b2715a15 Initial revision
engler
parents:
diff changeset
147
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
148 if ( values.length != 3 ) {
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
149 alert ("Illegal parameter format (r/g/b)");
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
150 } else if ( !isFinite(values[0]) ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
151 alert ("Illegal red exponent");
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
152 } else if ( !isFinite(values[1]) ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
153 alert ("Illegal green exponent");
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
154 } else if ( !isFinite(values[2]) ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
155 alert ("Illegal blue exponent");
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
156 } else {
26e6b2715a15 Initial revision
engler
parents:
diff changeset
157
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
158 dlParams.rgbm.value = value;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
159 display(3);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
160
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
161 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
162 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
163
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
164
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
165 /**
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
166 * rgba/rgbm in one call
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
167 */
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
168 function colors(rgba, rgbm) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
169
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
170 add = rgba.split("/");
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
171 mult = rgba.split("/");
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
172
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
173 if ( (add.length) == 3 && (mult.length == 3) &&
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
174 (add[0] >= -255) && (add[0] <= 255) &&
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
175 (add[1] >= -255) && (add[1] <= 255) &&
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
176 (add[2] >= -255) && (add[2] <= 255) &&
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
177 (isFinite(mult[0])) &&
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
178 (isFinite(mult[1])) &&
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
179 (isFinite(mult[2])) ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
180
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
181 dlParams.rgba.value = rgba;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
182 dlParams.rgbm.value = rgbm;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
183
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
184 display(3);
102
26e6b2715a15 Initial revision
engler
parents:
diff changeset
185
26e6b2715a15 Initial revision
engler
parents:
diff changeset
186 }
26e6b2715a15 Initial revision
engler
parents:
diff changeset
187 }
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
188
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
189
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
190 /**
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
191 * pixel by pixel view of images
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
192 */
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
193 function pixelByPixel() {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
194
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
195 removeMoFlag('osize');
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
196
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
197 addMoFlag('clip');
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
198
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
199 // change scale to 1
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
200 dlParams.ws.value = 1.0;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
201
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
202 display(3);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
203
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
204 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
205
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
206
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
207 /**
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
208 * original size view of images
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
209 */
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
210 function originalSize(dpi_v, dpi_h) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
211
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
212 removeMoFlag('clip');
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
213
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
214 addMoFlag('osize');
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
215
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
216 // change scale to 1
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
217 dlParams.ws.value = 1.0;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
218
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
219 dlParams.ddpix.value = cropFloat(dpi_h);
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
220 dlParams.ddpiy.value = cropFloat(dpi_v);
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
221
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
222 display(3);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
223
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
224 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
225
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
226
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
227 /**
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
228 * scale (overriding old one)
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
229 * as pixel by pixel is some kind of scale, it does turn scale factor to 1
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
230 * if chosen. also if a scale factor is chosen,
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
231 * then pixel by pixel is turned off.
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
232 */
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
233 function scale(factor) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
234
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
235 dlParams.ws.value = factor;
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
236
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
237 removeMoFlag('clip');
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
238 removeMoFlag('osize');
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
239
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
240 display(3);
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
241
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
242 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
243
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
244
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
245 /**
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
246 * placeMarks (overriding old one)
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
247 * take care of rotation and mirroring when placing marks
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
248 */
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
249 function placeMarks() {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
250
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
251 if ( dlParams.mk.value != '' ) {
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
252
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
253 var mark = dlParams.mk.value.split(";");
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
254 var mark_count = mark.length;
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
255
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
256 // maximum of marks is 8
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
257 // we do not report this error because this is already done in function 'mark'
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
258 if ( mark_count > 8 ) mark_count = 8;
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
259
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
260 var picWidth = (document.all) ? parseInt(document.all.lay1.offsetWidth) : (typeof(document.getElementById) == "function") ? parseInt(document.pic.offsetWidth) : parseInt(document.lay1.clip.width);
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
261 var picHeight = (document.all) ? parseInt(document.all.lay1.offsetHeight) : (typeof(document.getElementById) == "function") ? parseInt(document.pic.offsetHeight) : parseInt(document.lay1.clip.height);
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
262
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
263 // catch the cases where the picture had not been loaded already and
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
264 // make a timeout so that the coordinates are calculated with the real dimensions
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
265 if ( (picWidth > 30) || (document.pic.complete) ) {
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
266
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
267 var xOffset = (document.all) ? parseInt(document.all.lay1.style.left) : (typeof(document.getElementById) == "function") ? parseInt(document.getElementById('lay1').style.left) : document.lay1.left;
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
268 var yOffset = (document.all) ? parseInt(document.all.lay1.style.top) : (typeof(document.getElementById) == "function") ? parseInt(document.getElementById('lay1').style.top) : document.lay1.top;
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
269
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
270 for (var i = 0; i < mark_count; i++) {
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
271 mark[i] = mark[i].split("/");
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
272
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
273 if ( (parseFloat(mark[i][0]) >= parseFloat(dlParams.wx.value)) &&
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
274 (parseFloat(mark[i][1]) >= parseFloat(dlParams.wy.value)) &&
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
275 (parseFloat(mark[i][0]) <= (parseFloat(dlParams.wx.value) + parseFloat(dlParams.ww.value))) &&
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
276 (parseFloat(mark[i][1]) <= (parseFloat(dlParams.wy.value) + parseFloat(dlParams.wh.value))) ) {
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
277
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
278 mark[i][0] = (mark[i][0] - dlParams.wx.value)/dlParams.ww.value;
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
279 mark[i][1] = (mark[i][1] - dlParams.wy.value)/dlParams.wh.value;
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
280
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
281 // mirror
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
282 if ( dlParams.mo.value.indexOf('hmir') > -1 ) {
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
283 mark[i][0] = 1 - mark[i][0];
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
284 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
285 if ( dlParams.mo.value.indexOf('vmir') > -1 ) {
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
286 mark[i][1] = 1 - mark[i][1];
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
287 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
288
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
289 // just the beginning - not working currently
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
290 var ang_rad = dlParams.rot.value*2*3.1415926/360;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
291
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
292 var ws = Math.sin(ang_rad)/(Math.cos(ang_rad)*dlParams.ww.value/dlParams.wh.value+Math.sin(ang_rad)) * picWidth;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
293 var wc = (Math.cos(ang_rad)*dlParams.ww.value/dlParams.wh.value)/(Math.cos(ang_rad)*dlParams.ww.value/dlParams.wh.value+Math.sin(ang_rad)) * picWidth;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
294
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
295 var hs = (Math.sin(ang_rad)*dlParams.ww.value/dlParams.wh.value)/(Math.sin(ang_rad)*dlParams.ww.value/dlParams.wh.value+Math.cos(ang_rad)) * picHeight;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
296 var hc = Math.cos(ang_rad)/(Math.sin(ang_rad)*dlParams.ww.value/dlParams.wh.value+Math.cos(ang_rad)) * picHeight;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
297
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
298 var origPicWidth = Math.sqrt(Math.pow(wc, 2) + Math.pow(hs, 2));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
299 var origPicHeight = Math.sqrt(Math.pow(ws, 2) + Math.pow(hc, 2));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
300 // end of the beginning ;-)
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
301
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
302 mark[i][0] = parseInt(xOffset + picWidth * mark[i][0]);
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
303 mark[i][1] = parseInt(yOffset + picHeight * mark[i][1]);
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
304
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
305 if ( (document.all) || (typeof(document.getElementById) == "function") ) {
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
306 // suboptimal to place -5 pixels and not half size of mark-image
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
307 // should be changed in the future
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
308 document.getElementById("dot" + i).style.left = mark[i][0]-5;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
309 document.getElementById("dot" + i).style.top = mark[i][1]-5;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
310 document.getElementById("dot" + i).style.visibility = "visible";
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
311 } else {
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
312 document.layers[i+1].moveTo(mark[i][0]-5, mark[i][1]-5);
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
313 document.layers[i+1].visibility = "show";
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
314 }
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
315 }
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
316 }
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
317
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
318 } else {
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
319 setTimeout("placeMarks()", 100);
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
320 }
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
321 }
131
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
322 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
323
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
324
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
325 /****
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
326 * helper functions
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
327 ****/
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
328
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
329 /**
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
330 * Point (overriding old one)
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
331 * constructor holding different values of a point
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
332 * depending also on mirror or rotation
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
333 */
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
334 function Point(evt) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
335
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
336 if ( document.all ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
337
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
338 this.pageX = parseInt(document.body.scrollLeft+event.clientX);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
339 this.pageY = parseInt(document.body.scrollLeft+event.clientY);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
340
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
341 this.x = this.pageX-parseInt(document.all.lay1.style.left);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
342 this.y = this.pageY-parseInt(document.all.lay1.style.top);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
343
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
344 // mirror
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
345 if ( dlParams.mo.value.indexOf('hmir') > -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
346 this.relX = cropFloat(parseFloat(parseFloat(dlParams.wx.value)+parseFloat(dlParams.ww.value))-(dlParams.ww.value*this.x/document.all.lay1.offsetWidth));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
347 } else {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
348 this.relX = cropFloat(parseFloat(dlParams.wx.value)+(dlParams.ww.value*this.x/document.all.lay1.offsetWidth));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
349 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
350 if ( dlParams.mo.value.indexOf('vmir') > -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
351 this.relY = cropFloat(parseFloat(parseFloat(dlParams.wy.value)+parseFloat(dlParams.wh.value))-(dlParams.wh.value*this.y/document.all.lay1.offsetHeight));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
352 } else {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
353 this.relY = cropFloat(parseFloat(dlParams.wy.value)+(dlParams.wh.value*this.y/document.all.lay1.offsetHeight));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
354 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
355
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
356 } else {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
357
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
358 this.pageX = parseInt(evt.pageX);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
359 this.pageY = parseInt(evt.pageY);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
360
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
361 if ( typeof(document.getElementById) == "function" ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
362
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
363 this.x = this.pageX-parseInt(document.getElementById("lay1").style.left);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
364 this.y = this.pageY-parseInt(document.getElementById("lay1").style.top);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
365
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
366 // mirror
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
367 if ( dlParams.mo.value.indexOf('hmir') > -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
368 this.relX = cropFloat(parseFloat(parseFloat(dlParams.wx.value)+parseFloat(dlParams.ww.value))-(dlParams.ww.value*this.x/document.pic.offsetWidth));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
369 } else {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
370 this.relX = cropFloat(parseFloat(dlParams.wx.value)+(dlParams.ww.value*this.x/document.pic.offsetWidth));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
371 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
372 if ( dlParams.mo.value.indexOf('vmir') > -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
373 this.relY = cropFloat(parseFloat(parseFloat(dlParams.wy.value)+parseFloat(dlParams.wh.value))-(dlParams.wh.value*this.y/document.pic.offsetHeight));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
374 } else {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
375 this.relY = cropFloat(parseFloat(dlParams.wy.value)+(dlParams.wh.value*this.y/document.pic.offsetHeight));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
376 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
377
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
378 } else {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
379
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
380 this.x = this.pageX-document.lay1.left;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
381 this.y = this.pageY-document.lay1.top;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
382
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
383 // mirror
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
384 if ( dlParams.mo.value.indexOf('hmir') > -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
385 this.relX = cropFloat(parseFloat(parseFloat(dlParams.wx.value)+parseFloat(dlParams.ww.value))-(dlParams.ww.value*this.x/document.lay1.clip.width));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
386 } else {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
387 this.relX = cropFloat(parseFloat(dlParams.wx.value)+(dlParams.ww.value*this.x/document.lay1.clip.width));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
388 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
389 if ( dlParams.mo.value.indexOf('vmir') > -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
390 this.relY = cropFloat(parseFloat(parseFloat(dlParams.wy.value)+parseFloat(dlParams.wh.value))-(dlParams.wh.value*this.y/document.lay1.clip.height));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
391 } else {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
392 this.relY = cropFloat(parseFloat(dlParams.wy.value)+(dlParams.wh.value*this.y/document.lay1.clip.height));
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
393 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
394
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
395 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
396
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
397 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
398
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
399 return this;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
400
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
401 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
402
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
403
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
404 /**
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
405 * removeMoFlag from mo parameter
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
406 */
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
407 function removeMoFlag(name) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
408
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
409 if ( dlParams.mo.value != '' ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
410
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
411 var idx_comma_after = dlParams.mo.value.indexOf(name + ',');
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
412 var idx_comma_before = dlParams.mo.value.indexOf(',' + name);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
413 var idx_nocomma = dlParams.mo.value.indexOf(name);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
414
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
415 if ( idx_comma_after > -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
416 dlParams.mo.value = dlParams.mo.value.slice(0, idx_comma_after) + dlParams.mo.value.slice(idx_comma_after+name.length+1);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
417 }else if ( idx_comma_before > -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
418 dlParams.mo.value = dlParams.mo.value.slice(0, idx_comma_before) + dlParams.mo.value.slice(idx_comma_before+name.length+1);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
419 } else if ( idx_nocomma > -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
420 dlParams.mo.value = dlParams.mo.value.slice(0, idx_nocomma) + dlParams.mo.value.slice(idx_nocomma+name.length);
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
421 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
422 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
423
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
424 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
425
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
426
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
427 /**
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
428 * addMoFlag from mo parameter
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
429 */
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
430 function addMoFlag(name) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
431
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
432 if ( dlParams.mo.value.indexOf(name) == -1 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
433
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
434 if ( dlParams.mo.value.length > 0 ) {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
435 dlParams.mo.value += ',' + name;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
436 } else {
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
437 dlParams.mo.value = name;
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
438 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
439 }
7dc74e541d7c unified scripts, nice xul sidebar, bugfixes
luginbue
parents: 102
diff changeset
440
224
c70823f5af75 new versions on modules and contexto tool to show text
luginbue
parents: 131
diff changeset
441 }