98
|
1 /*
|
|
2 Copyright (C) 2003 WTWG, Uni Bern
|
|
3
|
|
4 This program is free software; you can redistribute it and/or
|
|
5 modify it under the terms of the GNU General Public License
|
|
6 as published by the Free Software Foundation; either version 2
|
|
7 of the License, or (at your option) any later version.
|
|
8
|
|
9 This program is distributed in the hope that it will be useful,
|
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 GNU General Public License for more details.
|
|
13
|
|
14 You should have received a copy of the GNU General Public License
|
|
15 along with this program; if not, write to the Free Software
|
|
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
17
|
|
18 Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3
|
|
19 */
|
|
20 function rotate() {
|
|
21 value = prompt("Enter absolute rotation angle in degrees (clockwise orientation) :");
|
|
22
|
|
23 if (value) {
|
|
24 window.content.rotation(value);
|
|
25 }
|
|
26 }
|
|
27
|
|
28 function color_add() {
|
|
29
|
|
30 value = prompt("Enter the values you like to add to the red, green and blue color channel.\n\nFormat is R/G/B, where R,G,B are floating numbers between -255 and +255.");
|
|
31
|
|
32 if (value) {
|
|
33
|
|
34 values = value.split("/");
|
|
35
|
|
36 if (values.length != 3) alert("Illegal format");
|
|
37 else if ((values[0] < -255) || (values[0] > 255)) alert("Illegal value for red");
|
|
38 else if ((values[1] < -255) || (values[1] > 255)) alert("Illegal value for green");
|
|
39 else if ((values[2] < -255) || (values[2] > 255)) alert("Illegal value for blue");
|
|
40
|
|
41 else window.content.rgba(value);
|
|
42
|
|
43 }
|
|
44 }
|
|
45
|
|
46 function color_multiply() {
|
|
47
|
105
|
48 value = prompt("Enter the values you like to multiply with the different color channels.\n\nFormat is R/G/B, where R,G,B are floating numbers.");
|
98
|
49
|
|
50 if (value) {
|
|
51
|
|
52 values = value.split("/");
|
|
53
|
|
54 if (values.length != 3) alert("Illegal format");
|
|
55
|
|
56 else window.content.rgbm(value);
|
|
57
|
|
58 }
|
|
59 }
|
|
60
|
|
61 function showMetadata(myurl){
|
|
62 var arrUrl=myurl.split("?");
|
|
63 var strDigilib=arrUrl[0];
|
|
64 var strParams=arrUrl[1];
|
|
65 var strArguments=strParams.split("&");
|
|
66 var strDocDir="";
|
|
67 for (i=0;i<strArguments.length;i++){
|
|
68 var strArg=strArguments[i];
|
|
69 var intPos=strArg.indexOf("fn=");
|
|
70 if (intPos>=0){
|
|
71 strDocDir=strArg.substr(intPos+3);
|
|
72 }
|
|
73 }
|
|
74 if (strDocDir == ""){
|
|
75 alert("no metadata available");
|
|
76 }else{
|
|
77 window.open("showMetadata.jsp?docdir="+strDocDir,"Metadata "+strDocDir,"menubar=no scrollbars=yes height=400 width=600");
|
|
78 }
|
|
79 }
|
|
80
|
|
81
|
|
82 function checkBrowser() {
|
|
83
|
|
84 this.ua = navigator.userAgent;
|
|
85 this.ver = navigator.appVersion;
|
|
86 this.dom = ( document.getElementById );
|
|
87 this.opera = ( this.dom ) && ( this.ua.toLowerCase().indexOf("opera") > -1 );
|
|
88 this.ie4 = ( document.all ) && ( !this.dom );
|
|
89 this.ie5 = ( this.ver.indexOf("MSIE 5") > -1 ) && ( this.dom );
|
|
90 this.ie6 = ( this.ver.indexOf("MSIE 6") > -1 ) && ( this.dom );
|
|
91 this.ns4 = ( document.layers ) && ( !this.dom );
|
|
92 this.ns6 = ( this.dom ) && ( parseInt(this.ver) >= 5 ) && ( !this.opera );
|
|
93 this.ns = this.ns4 || this.ns6;
|
|
94 this.ie = this.ie4 || this.ie5 || this.ie6;
|
|
95
|
|
96 return this;
|
|
97 }
|
|
98
|
|
99 browser = new checkBrowser();
|
|
100
|
|
101 function overButton(n) {
|
|
102 if (showHelp) contextHelp(n);
|
|
103 }
|
|
104
|
|
105
|
|
106 // just to be sure, that no buffer overflow can arrive
|
|
107 var semaphor = true;
|
|
108
|
|
109 function contextHelp(n) {
|
|
110
|
|
111 if (helpWindow.closed) {
|
|
112 changeHelp();
|
|
113 return;
|
|
114 }
|
|
115
|
|
116 if ((navigator.appVersion.indexOf("Macintosh") < 0) && semaphor) {
|
|
117 semaphor = false;
|
|
118
|
|
119 var tmpHelp = helpText[n];
|
|
120 tmpHelp = tmpHelp.replace(/\(br\)/,"<br>");
|
|
121 var help = tmpHelp.split("|");
|
|
122
|
|
123 helpWindow.focus();
|
|
124 helpWindow.document.open();
|
|
125 helpWindow.document.write('<html><head><title>Context Help</title>');
|
|
126 helpWindow.document.write('<style type="text/css">');
|
|
127 helpWindow.document.write('.title {font-family: Verdana, sans-serif, Arial; font-size: 12px; font-weight: bold; color: #FFFFFF}');
|
|
128 helpWindow.document.write('.text {font-family: Verdana, sans-serif, Arial; font-size: 10px; color: #000000}');
|
|
129 helpWindow.document.write('</style></head><body bgcolor="#CCCCCC" leftmargin="7" topmargin="7" marginwidth="7" marginheight="7" onload="opener.semaphor = true;">');
|
|
130 helpWindow.document.write('<table width="99%" border="0" cellspacing="0" cellpadding="3"><tr><td bgcolor="#666666" class="title">');
|
|
131 helpWindow.document.write(help[0] + '</tr><tr><td class="text">');
|
|
132 helpWindow.document.write(help[1] + '</tr></td></table></body></html>');
|
|
133 helpWindow.document.close();
|
|
134
|
|
135
|
|
136 // stupid workaround because of netscape 6, that doesen't know the opener property
|
|
137 // this workaround is still ok because netscape 6 has eventbuffer checks so no overflow
|
|
138 if (browser.ns6) {
|
|
139 semaphor = true;
|
|
140 }
|
|
141
|
|
142 // next stupid workaround because of opera 6, that somehow don't start the 'onLoad'-
|
|
143 // attribute in the body tag (the helpwindow does not finish loading)
|
|
144 if (browser.opera) {
|
|
145 setTimeout("semaphor = true;", 50);
|
|
146 }
|
|
147
|
|
148 }
|
|
149
|
|
150 }
|
|
151
|
|
152 function openContextHelp() {
|
|
153 if (navigator.appVersion.indexOf("Macintosh") > -1) {
|
|
154 openContextHelpMac();
|
|
155 return;
|
|
156 }
|
|
157
|
|
158 semaphor = false;
|
|
159
|
|
160 var winWidth = 270;
|
|
161 var winHeight = 130;
|
|
162
|
|
163 var xScreen = 0.9*(screen.width-winWidth);
|
|
164 var yScreen = 0.8*(screen.height-winHeight);
|
|
165
|
|
166 helpWindow = window.open("", "ContextHelp", "width=" + winWidth + ",height=" + winHeight + ",screenX=" + xScreen + ",screenY=" + yScreen + ",left=" + xScreen + ",top=" + yScreen);
|
|
167
|
|
168 helpWindow.focus();
|
|
169 helpWindow.document.open();
|
|
170 helpWindow.document.write('<html><head><title>Context Help</title>');
|
|
171 helpWindow.document.write('<style type="text/css">');
|
|
172 helpWindow.document.write('.title {font-family: Verdana, sans-serif, Arial; font-size: 12px; font-weight: bold; color: #FFFFFF}');
|
|
173 helpWindow.document.write('.text {font-family: Verdana, sans-serif, Arial; font-size: 10px; color: #000000}');
|
|
174 helpWindow.document.write('</style></head><body bgcolor="#CCCCCC" leftmargin="7" topmargin="7" marginwidth="7" marginheight="7">');
|
|
175 helpWindow.document.write('<table width="99%" border="0" cellspacing="0" cellpadding="3"><tr><td bgcolor="#666666" class="title">');
|
|
176 helpWindow.document.write('Context Help</tr><tr><td class="text">');
|
|
177 helpWindow.document.write('Move over any button to get some more information about its function</tr></td></table></body></html>');
|
|
178 helpWindow.document.close();
|
|
179
|
|
180 // for some safety reason help-requests have to be blocked while opening the window
|
|
181 setTimeout("semaphor = true;", 200);
|
|
182 }
|
|
183
|
|
184 // because macs have a strange window focus behaviour we have to go a special
|
|
185
|
|
186 // way for them - just opening a window that contains all button-descriptions
|
|
187
|
|
188 function openContextHelpMac() {
|
|
189
|
|
190 var winWidth = 270;
|
|
191 var winHeight = 600;
|
|
192
|
|
193 var xScreen = 0.9*(screen.width-winWidth);
|
|
194 var yScreen = 0.8*(screen.height-winHeight);
|
|
195
|
|
196 helpWindow = window.open("", "ContextHelp", "width=" + winWidth + ",height=" + winHeight + ",screenX=" + xScreen + ",screenY=" + yScreen + ",left=" + xScreen + ",top=" + yScreen + ",scrollbars");
|
|
197
|
|
198 helpWindow.focus();
|
|
199 helpWindow.document.open();
|
|
200 helpWindow.document.write('<html><head><title>Context Help Macintosh</title>');
|
|
201 helpWindow.document.write('<style type="text/css">');
|
|
202 helpWindow.document.write('.title {font-family: Verdana, sans-serif, Arial; font-size: 12px; font-weight: bold; color: #FFFFFF}');
|
|
203 helpWindow.document.write('.text {font-family: Verdana, sans-serif, Arial; font-size: 10px; color: #000000}');
|
|
204 helpWindow.document.write('</style></head><body bgcolor="#CCCCCC" leftmargin="7" topmargin="7" marginwidth="7" marginheight="7">');
|
|
205 helpWindow.document.write('<table width="99%" border="0" cellspacing="0" cellpadding="3">');
|
|
206
|
|
207 for (n = 0; n < helpText.length; n++) {
|
|
208
|
|
209 help = helpText[n].split("|");
|
|
210 helpWindow.document.write('<tr><td bgcolor="#666666" class="title">');
|
|
211 helpWindow.document.write(help[0] + '</tr><tr><td class="text">');
|
|
212 helpWindow.document.write('<p>' + help[1] + '<br> </p></tr></td>');
|
|
213 }
|
|
214
|
|
215 helpWindow.document.write('</table></body></html>');
|
|
216 helpWindow.document.close();
|
|
217 }
|
|
218
|
|
219 function closeContextHelp() {
|
|
220 if (helpWindow != '' && !helpWindow.closed) {
|
|
221 helpWindow.close();
|
|
222 }
|
|
223
|
|
224 helpWindow = '';
|
|
225
|
|
226 }
|
|
227
|
|
228 function changeHelp() {
|
|
229 showHelp = !showHelp;
|
|
230 showHelp ? openContextHelp() : closeContextHelp();
|
|
231 }
|
|
232
|
|
233
|
|
234 // variable containing the contextwindow
|
|
235
|
105
|
236 var helpWindow = '';
|