Mercurial > hg > mgallery
annotate mgallery.js @ 166:d8387b48b08d
Improve yes/no prompt check.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 01 Mar 2018 14:01:49 +0200 |
parents | 0b87e7c1675c |
children | ba02d12cb4be |
rev | line source |
---|---|
149
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 // |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 // Yet Another Image Gallery |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 // -- Main Javascript utility functions file |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 // Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 // (C) Copyright 2015-2017 Tecnic Software productions (TNSP) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 // |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 |
154
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
9 function mgalAddEventOb(obname, evobj, evtype, evcallback) |
149
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 if (evobj == null || typeof(evobj) == 'undefined') |
154
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
12 { |
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
13 console.log("Event object '"+ obname +"' == null."); |
149
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 return; |
154
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
15 } |
149
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
16 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
17 if (evobj.addEventListener) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
18 evobj.addEventListener(evtype, evcallback, false); |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
19 else |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
20 if (evobj.attachEvent) |
154
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
21 evobj.attachEvent("on"+evtype, evcallback); |
149
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
22 else |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
23 evobj["on"+evtype] = evcallback; |
154
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
24 } |
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
25 |
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
26 |
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
27 function mgalAddEvent(obname, evtype, evcallback) |
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
28 { |
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
29 mgalAddEventOb(obname, document.getElementById(obname), evtype, evcallback); |
0b87e7c1675c
Improve the JavaScript event hook functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
152
diff
changeset
|
30 } |
149
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
31 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
32 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 function mgalNavigateTo(url) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
35 if (url != "") |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
36 window.location = url; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
39 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
40 function mgalProcessKeyPress(ev) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
41 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 ev = ev || window.event; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
43 var key = ev.keyCode ? ev.keyCode : ev.which; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
44 switch (key) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
45 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
46 case 37: |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
47 case 65: |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
48 case 52: |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
49 // left |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
50 mgalNavigateTo(mgalPrevURL); |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
51 break; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
52 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
53 case 39: |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
54 case 68: |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
55 case 54: |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
56 // right |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
57 mgalNavigateTo(mgalNextURL); |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
58 break; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
59 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
60 case 38: |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
61 case 56: |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
62 // up |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
63 mgalNavigateTo(mgalUpURL); |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
64 break; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
65 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
66 default: |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
67 return true; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
68 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
69 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
70 ev.preventDefault(); |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
71 return false; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
72 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
73 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
74 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
75 function mgalGetWindowSize() |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
76 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
77 var winW = 0, winH = 0; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
78 if (typeof(window.innerWidth) == 'number') |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
79 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
80 // Non-MSIE |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
81 winW = window.innerWidth; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
82 winH = window.innerHeight; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
83 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
84 else |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
85 if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
86 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
87 // MSIE 6+ in 'standards compliant mode' |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
88 winW = document.documentElement.clientWidth; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
89 winH = document.documentElement.clientHeight; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
90 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
91 else |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
92 if (document.body && (document.body.clientWidth || document.body.clientHeight)) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
93 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
94 // MSIE 4 compatible |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
95 winW = document.body.clientWidth; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
96 winH = document.body.clientHeight; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
97 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
98 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
99 return [winW, winH]; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
100 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
101 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
102 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
103 function mgalAdjustImageDo() |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
104 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
105 var eimg = document.getElementById("imageImage"); |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
106 var win = mgalGetWindowSize(); |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
107 var madj = 0.92; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
108 if (eimg) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
109 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
110 if (eimg.width > eimg.height) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
111 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
112 eimg.style.width = "100%"; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
113 eimg.style.height = "auto"; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
114 if (eimg.height > win[1] * madj) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
115 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
116 eimg.style.width = "auto"; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
117 eimg.style.height = (win[1] * madj)+"px"; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
118 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
119 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
120 else |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
121 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
122 eimg.style.width = "auto"; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
123 if (eimg.height > win[1] * madj) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
124 eimg.style.height = (win[1] * madj)+"px"; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
125 else |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
126 eimg.style.height = "100%"; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
127 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
128 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
129 adjustPID = -1; |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
130 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
131 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
132 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
133 function mgalAdjustImage() |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
134 { |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
135 if (adjustPID == -1) |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
136 adjustPID = setTimeout(mgalAdjustImageDo, 50); |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
137 } |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
138 |
b4751909c48f
Move some Javascript code to a separate file and make the location configurable.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
139 |
152
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
140 function mgalDisplayInfo(mvstate) |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
141 { |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
142 var mvbut = document.getElementById("pageInfoButton"); |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
143 var mvelem = document.getElementById("pageInfoHeader"); |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
144 mvelem.style.display = mvstate ? "block" : "none"; |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
145 mvbut.style.display = !mvstate ? "block" : "none"; |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
146 mvInfoOpen = mvstate; |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
147 } |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
148 |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
149 |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
150 function mgalOpenInfo() |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
151 { |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
152 mgalDisplayInfo(true); |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
153 } |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
154 |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
155 |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
156 function mgalCloseInfo() |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
157 { |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
158 mgalDisplayInfo(false); |
606b05c31d5e
Improve mobile experience and also desktop image display, maybe.
Matti Hamalainen <ccr@tnsp.org>
parents:
149
diff
changeset
|
159 } |