4 # A.k.a `Best web-album Of the world, Or your money back, Humerus'.
6 # The acronyn sucks, however this is a tribute to Dragon Ball by
7 # Akira Toriyama, where the last enemy beaten by heroes of Dragon
8 # Ball is named "Boo". But there was already a free software project
9 # called Boo, so this one will be it "Booh". Or whatever.
12 # Copyright (c) 2004 Guillaume Cottenceau <gc3 at bluewin.ch>
14 # This software may be freely redistributed under the terms of the GNU
15 # public license version 2.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 # holds static data to merge in the html "themes"
24 bindtextdomain("booh")
27 <link rev="made" href="http://zarb.org/~gc/html/booh.html" />
28 <script language="JavaScript1.1" type="text/JavaScript">
30 var images = new Array(~~images~~);
31 var captions = new Array(~~captions~~);
33 var images_ary = new Array();
34 var images_loaded = new Array();
37 var slideshow_pause = 3;
38 var slideshow_timer = null;
40 for (i = 0; i < images.length; i++) {
41 /* this array will contain 0 if image not yet loaded, 1 when loading,
47 document.getElementById('dbg_text').firstChild.data += t + "\n";
50 /* load image, return 1 if image is finished loading */
52 if (images_loaded[i] == 0) {
53 images_ary[i] = new Image();
54 images_ary[i].src = images[i];
57 if (images_loaded[i] == 1) {
58 if (images_ary[i].complete) {
69 /* favor current image, if user clicked on `last' or something */
72 for (i = 0; i < images.length; i++) {
73 /* don't blindly preload all images at the beginning,
74 * but rather load them one by one, in order to get
78 setTimeout("preload()", 500);
87 /* retrieve GET parameters */
88 all_params = location.href.split("?")
89 if (all_params.length > 1) {
90 params = all_params[1].split("&");
91 for (i = 0; i < params.length; i++) {
92 keyvalue = params[i].split("=");
93 if (keyvalue[0] == "slideshow_pause") {
94 slideshow_pause = keyvalue[1];
96 if (keyvalue[0] == "run_slideshow") {
103 function update_sensibilities() {
105 document.getElementById("b_first").disabled = true;
106 document.getElementById("b_previous").disabled = true;
107 document.getElementById("b_next").disabled = false;
108 document.getElementById("b_last").disabled = false;
109 } else if (current == images.length - 1) {
110 document.getElementById("b_first").disabled = false;
111 document.getElementById("b_previous").disabled = false;
112 document.getElementById("b_next").disabled = true;
113 document.getElementById("b_last").disabled = true;
115 document.getElementById("b_first").disabled = false;
116 document.getElementById("b_previous").disabled = false;
117 document.getElementById("b_next").disabled = false;
118 document.getElementById("b_last").disabled = false;
122 function set_cursor_(value, element) {
124 if (!element || !element.style) {
128 element.style.cursor = value;
130 children = element.childNodes;
131 for (i = 0; i < children.length; i++) {
132 set_cursor_(value, children.item[i]);
136 function set_cursor(value) {
137 set_cursor_(value, document.getElementById('body'));
140 function show_current_text() {
141 /* don't show text if image not yet loaded because navigator
142 * won't refresh it during load */
143 if (images_loaded[current] == 2) {
144 eval("document.getElementById('image_counter')" +
145 ".firstChild.data = '" + ( current + 1 ) + "/" + images.length + "'");
146 eval("document.getElementById('main_text')" +
147 ".firstChild.data = '" + ( captions[current] || images[current] ) + "'");
148 set_cursor("default");
150 setTimeout("show_current_text()", 100);
155 function display_current() {
156 eval("document.main_img.src = images[" + current + "]");
158 update_sensibilities();
162 if (slideshow == 1) {
163 toggle_slideshow(true);
171 if (slideshow == 1) {
172 toggle_slideshow(true);
175 if (current < images.length - 1) {
181 function previous() {
182 if (slideshow == 1) {
183 toggle_slideshow(true);
193 if (slideshow == 1) {
194 toggle_slideshow(true);
197 current = images.length - 1;
201 function toggle_slideshow(now) {
202 if (slideshow == 0) {
203 document.getElementById("b_slideshow").value = "~~stop_slideshow~~";
205 if (current == images.length - 1) {
212 setTimeout("run_slideshow()", slideshow_pause * 1000);
215 clearTimeout(slideshow_timer);
216 document.getElementById("b_slideshow").value = "~~run_slideshow~~";
221 function run_slideshow() {
222 if (slideshow == 0) {
226 if (images_loaded[current + 1] == 2) {
229 slideshow_timer = setTimeout("run_slideshow()", slideshow_pause * 1000);
231 slideshow_timer = setTimeout("run_slideshow()", 500);
234 if (current == images.length - 1) {
235 toggle_slideshow(true);
241 $head_code.sub!('~~run_slideshow~~', _('Run slideshow!'))
242 $head_code.sub!('~~stop_slideshow~~', _('Stop slideshow'))
244 $body_additions = <<'EOF'
245 onload="init()" id="body"
249 <form><input type="button"
251 value="' + _('<<- First') + '"
252 id="b_first"></form>';
255 <form><input type="button"
257 value="' + _('<- Previous') + '"
258 id="b_previous"></form>';
261 <form><input type="button"
263 value="' + _('Next ->') + '"
264 id="b_next"></form>';
267 <form><input type="button"
269 value="' + _('Last ->>') + '"
270 id="b_last"></form>';
272 $button_slideshow = '
273 <form><input type="button"
274 onclick="toggle_slideshow(true)"
275 value="' + _('Run slideshow!') + '"
280 <img name="main_img">
283 $image_counter_additions = <<'EOF'
287 $caption_additions = <<'EOF'
292 <script language="JavaScript1.1" type="text/JavaScript">