ee89dd8e9a90f7e360605540195b867b4fc1450a
[booh] / lib / booh / html-merges.rb
1 #
2 #                         *  BOOH  *
3 #
4 # A.k.a `Best web-album Of the world, Or your money back, Humerus'.
5 #
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.
10 #
11 #
12 # Copyright (c) 2004 Guillaume Cottenceau <gc3 at bluewin.ch>
13 #
14 # This software may be freely redistributed under the terms of the GNU
15 # public license version 2.
16 #
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.
20
21 # holds static data to merge in the html "themes"
22
23 require 'gettext'
24 bindtextdomain("booh")
25
26 require 'booh/booh-lib'
27 require 'booh/version.rb'
28 include Booh
29
30 $image_head_code = '<meta name="generator" content="Booh-' + $VERSION + <<'EOF'
31  http://booh.org/"/>
32
33 <script language="JavaScript1.1" type="text/JavaScript">
34 images = new Array(~~images~~);
35 ~~other_images~~
36 thumbnailspages = new Array(~~thumbnailspages~~);
37 other_sizes = new Array(~~other_sizes~~);
38 captions = new Array(~~captions~~);
39
40 dbltilda_current_size = '~~current_size~~';
41 dbltilda_theme = '~~theme~~';
42 dbltilda_stop_slideshow = '~~stop_slideshow~~';
43 dbltilda_run_slideshow = '~~run_slideshow~~';
44 </script>
45 EOF
46
47 $image_head_code.sub!('~~run_slideshow~~', utf8(_('Run slideshow!')))
48 $image_head_code.sub!('~~stop_slideshow~~', utf8(_('Stop slideshow')))
49
50 $body_additions = <<'EOF'
51 onload="init()" id="body"
52 EOF
53
54 $button_first = '
55     <form action="fake"><input type="button"
56                  onclick="first()"
57                  value="' + utf8(_('<<- First')) + '"
58                  id="b_first"/></form>'
59
60 $button_previous = '
61     <form action="fake"><input type="button"
62                  onclick="previous()"
63                  value="' + utf8(_('<- Previous')) + '"
64                  id="b_previous"/></form>'
65
66 $button_next = '
67     <form action="fake"><input type="button"
68                  onclick="next()"
69                  value="' + utf8(_('Next ->')) + '"
70                  id="b_next"/></form>'
71
72 $button_last = '
73     <form action="fake"><input type="button"
74                  onclick="last()"
75                  value="' + utf8(_('Last ->>')) + '"
76                  id="b_last"/></form>'
77
78 $button_slideshow = '
79     <input type="button"
80            onclick="toggle_slideshow(true)"
81            value="' + utf8(_('Run slideshow!')) + '"
82            id="b_slideshow"/>'
83
84 $pause_slideshow = '
85     <font size="-2">' + utf8(_('pause:')) + '<input type="text" id="secs" size="1" value="3"/>' + utf8(_('secs')) + '</font>'
86
87
88 $image = <<'EOF'
89   <img name="main_img" src="fake" alt="main image"/>
90 EOF
91
92 $image_counter_additions = <<'EOF'
93   id="image_counter"
94 EOF
95
96 $caption_additions = <<'EOF'
97   id="main_text"
98 EOF
99
100 $body_code = <<'EOF'
101 EOF
102
103
104 $thumbnails_head_code = '<meta name="generator" content="Booh-' + $VERSION + <<'EOF'
105  http://booh.org/"/>
106
107 <script language="JavaScript1.1" type="text/JavaScript">
108 function set_preferred_size(val) {
109     var expires = new Date(new Date().getTime() + (30 * 86400000));  // 30 days
110     document.cookie = 'booh-preferred-size-~~theme~~='
111                       + val
112                       + '; expires=' + expires.toGMTString()
113                       + '; path=/';
114 }
115 </script>
116 EOF
117
118
119 $preferred_size_reloader = <<'EOF'
120 <html>
121     <body>
122     </body>
123         <script language="JavaScript1.1" type="text/JavaScript">
124
125 var sizes = new Array(~~all_sizes~~);
126
127 function getPreferredSize() {
128     if (document.cookie) {
129         var index = document.cookie.indexOf('booh-preferred-size-~~theme~~');
130         if (index != -1) {
131             var oleft = document.cookie.indexOf('=', index) + 1;
132             var oright = document.cookie.indexOf(';', index);
133             if (oright == -1) {
134                 oright = document.cookie.length;
135             }
136             size = document.cookie.substring(oleft, oright);
137             for (i = 0; i < sizes.length; i++) {
138                 if (sizes[i] == size) {
139                     return 'thumbnails-' + size + '-0.html';
140                 }
141             }
142         }
143     }
144     w = document.body.offsetWidth;
145     ~~size_auto_chooser~~
146     return 'thumbnails-~~default_size~~-0.html';
147 }
148
149 window.location.href = getPreferredSize();
150
151         </script>
152
153         <meta http-equiv="refresh" content="0.1;url=thumbnails-~~default_size~~-nojs-0.html">
154 </html>
155 EOF
156
157
158 $index_head_code = '<meta name="generator" content="Booh-' + $VERSION + ' http://booh.org/"/>
159 <script language="JavaScript1.1" type="text/JavaScript">
160 function init() {
161     if (!document.cookie || document.cookie.indexOf("booh-not-a-newbie") == -1) {
162         document.getElementById("title").innerHTML += "<br/><br/>' + utf8(_("<i>Hint: you can click on the images to open the albums!</i>")) + '";
163     }
164     var expires = new Date(new Date().getTime() + (10 * 86400000));  // 10 days
165     document.cookie = "booh-not-a-newbie=true"
166                       + "; expires=" + expires.toGMTString()
167                       + "; path=/";
168 }
169 </script>'