workaround exif crash
[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 var images = new Array(~~images~~);
35 var types = new Array(~~types~~);
36 var videos = new Array(~~videos~~);
37 var widths = new Array(~~widths~~);
38 var heights = new Array(~~heights~~);
39 ~~other_images~~
40 var thumbnailspages = new Array(~~thumbnailspages~~);
41 var other_sizes = new Array(~~other_sizes~~);
42 var captions = new Array(~~captions~~);
43
44 dbltilda_current_size = '~~current_size~~';
45 dbltilda_theme = '~~theme~~';
46 dbltilda_stop_slideshow = '~~stop_slideshow~~';
47 dbltilda_run_slideshow = '~~run_slideshow~~';
48 dbltilda_htmlsuffix = '~~htmlsuffix~~';
49 dbltilda_pathtobase = '~~pathtobase~~';
50 </script>
51 EOF
52
53 $image_head_code.sub!('~~run_slideshow~~', defer_translation(N_('Run slideshow!')))
54 $image_head_code.sub!('~~stop_slideshow~~', defer_translation(N_('Stop slideshow')))
55
56 $body_additions = <<'EOF'
57 onload="init()" id="body"
58 EOF
59
60 $button_first = '
61     <form action="fake"><input type="button"
62                  onclick="first()"
63                  value="' + defer_translation(N_('<<- First')) + '"
64                  id="b_first"/></form>'
65
66 $button_previous = '
67     <form action="fake"><input type="button"
68                  onclick="previous()"
69                  value="' + defer_translation(N_('<- Previous')) + '"
70                  id="b_previous"/></form>'
71
72 $button_next = '
73     <form action="fake"><input type="button"
74                  onclick="next()"
75                  value="' + defer_translation(N_('Next ->')) + '"
76                  id="b_next"/></form>'
77
78 $button_last = '
79     <form action="fake"><input type="button"
80                  onclick="last()"
81                  value="' + defer_translation(N_('Last ->>')) + '"
82                  id="b_last"/></form>'
83
84 $button_slideshow = '
85     <input type="button"
86            onclick="toggle_slideshow(true)"
87            value="' + defer_translation(N_('Run slideshow!')) + '"
88            id="b_slideshow"/>'
89
90 $pause_slideshow = '
91     <font size="-2">' + defer_translation(N_('pause:')) + '<input type="text" id="secs" size="1" value="3"/>' + defer_translation(N_('secs')) + '</font>'
92
93
94 $image = <<'EOF'
95   <span id="main_img">Loading image, please wait...</span>
96 EOF
97
98 $image_counter_additions = <<'EOF'
99   id="image_counter"
100 EOF
101
102 $caption_additions = <<'EOF'
103   id="main_text"
104 EOF
105
106 $body_code = <<'EOF'
107 EOF
108
109
110 $thumbnails_head_code = '<meta name="generator" content="Booh-' + $VERSION + <<'EOF'
111  http://booh.org/"/>
112
113 <script language="JavaScript1.1" type="text/JavaScript">
114 function set_preferred_size(val) {
115     var expires = new Date(new Date().getTime() + (30 * 86400000));  // 30 days
116     document.cookie = 'booh-preferred-size-~~theme~~='
117                       + val
118                       + '; expires=' + expires.toGMTString()
119                       + '; path=/';
120 }
121 </script>
122 EOF
123
124
125 $preferred_size_reloader = <<'EOF'
126 <html>
127     <head>
128         <script language="JavaScript1.1" type="text/JavaScript">
129
130 var sizes = new Array(~~all_sizes~~);
131
132 function getPreferredSize() {
133     if (document.cookie) {
134         var index = document.cookie.indexOf('booh-preferred-size-~~theme~~');
135         if (index != -1) {
136             var oleft = document.cookie.indexOf('=', index) + 1;
137             var oright = document.cookie.indexOf(';', index);
138             if (oright == -1) {
139                 oright = document.cookie.length;
140             }
141             size = document.cookie.substring(oleft, oright);
142             for (i = 0; i < sizes.length; i++) {
143                 if (sizes[i] == size) {
144                     return 'thumbnails-' + size + '-0~~htmlsuffix~~';
145                 }
146             }
147         }
148     }
149     w = document.body.offsetWidth;
150     ~~size_auto_chooser~~
151     return 'thumbnails-~~default_size~~-0~~htmlsuffix~~';
152 }
153
154         </script>
155
156         <meta http-equiv="refresh" content="0.1;url=thumbnails-~~default_size~~-nojs-0~~htmlsuffix~~" />
157     </head>
158     <body onload="window.location.href = getPreferredSize()">
159     </body>
160 </html>
161 EOF
162
163
164 $index_head_code = '<meta name="generator" content="Booh-' + $VERSION + ' http://booh.org/"/>
165 <script language="JavaScript1.1" type="text/JavaScript">
166 function init() {
167     if (!document.cookie || document.cookie.indexOf("booh-not-a-newbie") == -1) {
168         document.getElementById("title").innerHTML += "<br/><br/>' + defer_translation(N_("<i>Hint: you can click on the images to open the albums!</i>")) + '";
169     }
170     var expires = new Date(new Date().getTime() + (10 * 86400000));  // 10 days
171     document.cookie = "booh-not-a-newbie=true"
172                       + "; expires=" + expires.toGMTString()
173                       + "; path=/";
174 }
175 </script>'