1 | <?php |
---|
2 | |
---|
3 | // inc/barrac_pipeline_insert_head.php |
---|
4 | |
---|
5 | // $LastChangedRevision: 30253 $ |
---|
6 | // $LastChangedBy: gilles.vincent@gmail.com $ |
---|
7 | // $LastChangedDate: 2009-07-27 03:26:42 +0000 (Mon, 27 Jul 2009) $ |
---|
8 | |
---|
9 | /***************************************************** |
---|
10 | Copyright (C) 2008 Christian PAULUS |
---|
11 | cpaulus@quesaco.org - http://www.quesaco.org/ |
---|
12 | /***************************************************** |
---|
13 | |
---|
14 | This file is part of BarrAc. |
---|
15 | |
---|
16 | BarrAc is free software; you can redistribute it and/or modify |
---|
17 | it under the terms of the GNU General Public License as published by |
---|
18 | the Free Software Foundation; either version 2 of the License, or |
---|
19 | (at your option) any later version. |
---|
20 | |
---|
21 | BarrAc is distributed in the hope that it will be useful, |
---|
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
24 | GNU General Public License for more details. |
---|
25 | |
---|
26 | You should have received a copy of the GNU General Public License |
---|
27 | along with BarrAc; if not, write to the Free Software |
---|
28 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
29 | |
---|
30 | /***************************************************** |
---|
31 | |
---|
32 | Ce fichier est un des composants de BarrAc. |
---|
33 | |
---|
34 | BarrAc est un programme libre, vous pouvez le redistribuer et/ou le modifier |
---|
35 | selon les termes de la Licence Publique Generale GNU publiee par |
---|
36 | la Free Software Foundation (version 2 ou bien toute autre version ulterieure |
---|
37 | choisie par vous). |
---|
38 | |
---|
39 | BarrAc est distribue car potentiellement utile, mais SANS AUCUNE GARANTIE, |
---|
40 | ni explicite ni implicite, y compris les garanties de commercialisation ou |
---|
41 | d'adaptation dans un but specifique. Reportez-vous a la Licence Publique Generale GNU |
---|
42 | pour plus de details. |
---|
43 | |
---|
44 | Vous devez avoir recu une copie de la Licence Publique Generale GNU |
---|
45 | en meme temps que ce programme ; si ce n'est pas le cas, ecrivez a la |
---|
46 | Free Software Foundation, Inc., |
---|
47 | 59 Temple Place, Suite 330, Boston, MA 02111-1307, Etats-Unis. |
---|
48 | |
---|
49 | *****************************************************/ |
---|
50 | |
---|
51 | if (!defined("_ECRIRE_INC_VERSION")) return; |
---|
52 | |
---|
53 | include_spip('inc/utils'); |
---|
54 | include_spip('inc/plugin_globales_lib'); |
---|
55 | include_spip('inc/barrac_api_icones'); |
---|
56 | |
---|
57 | // pipeline (plugin.xml) |
---|
58 | // Insere les css de la barre d'accessibilite dans l'espace public |
---|
59 | function barrac_insert_head ($flux) { |
---|
60 | |
---|
61 | $barrac_js_declarations = $barrac_js_var_init = $barrac_js_events_manager = |
---|
62 | $barrac_js_cookie_init_case = $barrac_js_bouton_switch = |
---|
63 | $barrac_js_code_result = $barrac_flux_complements = ""; |
---|
64 | |
---|
65 | $config_default = unserialize(_BARRAC_DEFAULT_VALUES_ARRAY); |
---|
66 | |
---|
67 | // charger la config barrac |
---|
68 | $config = __plugin_lire_key_in_serialized_meta('config', _BARRAC_META_PREFERENCES); |
---|
69 | |
---|
70 | // corrige les manques eventuels |
---|
71 | foreach($config_default as $key=>$value) { |
---|
72 | if(!isset($config[$key])) $config[$key] = $config_default[$key]; |
---|
73 | } |
---|
74 | foreach($config as $key=>$value) { |
---|
75 | $$key = $value; |
---|
76 | } |
---|
77 | |
---|
78 | // Combien de boutons actifs ? |
---|
79 | $boutons_actifs_count = barrac_boutons_actifs_count($config); |
---|
80 | |
---|
81 | // pas de boutons ? |
---|
82 | if(!$boutons_actifs_count) return($flux); |
---|
83 | |
---|
84 | // valider la position |
---|
85 | $config['barrac_position_barre'] = barrac_confirmer_valeur_var( |
---|
86 | $config['barrac_position_barre'] |
---|
87 | , unserialize(_BARRAC_POSITIONS_ARRAY) |
---|
88 | , _BARRAC_POSITION_DEFAULT |
---|
89 | ); |
---|
90 | list($ii, $jj) = explode("_", $config['barrac_position_barre']); |
---|
91 | $style_barre = "$ii:0px;$jj:0px;"; |
---|
92 | |
---|
93 | if($config['barrac_position_fixed'] == 'oui') { |
---|
94 | // sera corrige en dynamique par affichage_final pour IE qui ne comprend pas fixed |
---|
95 | $style_barre .= " position:fixed;"; |
---|
96 | } |
---|
97 | |
---|
98 | // valider la marge |
---|
99 | $config['barrac_marge_entre_boutons'] = intval($config['barrac_marge_entre_boutons']); |
---|
100 | $config['barrac_marge_entre_boutons'] = |
---|
101 | (($config['barrac_marge_entre_boutons'] >= 0) && ($config['barrac_marge_entre_boutons'] <= _BARRAC_ICONE_MARGE_MAX)) |
---|
102 | ? $config['barrac_marge_entre_boutons'] |
---|
103 | : _BARRAC_ICONE_MARGE_DEFAULT |
---|
104 | ; |
---|
105 | |
---|
106 | // valider la taille |
---|
107 | $config['barrac_taille_bouton'] = intval($config['barrac_taille_bouton']); |
---|
108 | $config['barrac_taille_bouton'] = |
---|
109 | (($config['barrac_taille_bouton'] >= 0) && ($config['barrac_taille_bouton'] <= _BARRAC_ICONE_TAILLE_MAX)) |
---|
110 | ? $config['barrac_taille_bouton'] |
---|
111 | : _BARRAC_ICONE_TAILLE_DEFAULT |
---|
112 | ; |
---|
113 | |
---|
114 | // valider la presentation |
---|
115 | $config['barrac_presentation_barre'] = barrac_confirmer_valeur_var($config['barrac_presentation_barre'] |
---|
116 | , array(_BARRAC_PRESENTATION_HORIZONTAL, _BARRAC_PRESENTATION_VERTICAL) |
---|
117 | , _BARRAC_PRESENTATION_DEFAULT); |
---|
118 | |
---|
119 | // definir taille de la barre |
---|
120 | $ii = barrac_barre_largest_side_size($config, $boutons_actifs_count); |
---|
121 | |
---|
122 | switch($config['barrac_presentation_barre']) { |
---|
123 | case _BARRAC_PRESENTATION_HORIZONTAL: |
---|
124 | $width = $ii; |
---|
125 | $height = $config['barrac_taille_bouton']; |
---|
126 | $padding = "margin-left:".$config['barrac_marge_entre_boutons']."px;"; |
---|
127 | $style_item = " float:left; margin-right:".$config['barrac_marge_entre_boutons']."px;"; |
---|
128 | break; |
---|
129 | case _BARRAC_PRESENTATION_VERTICAL: |
---|
130 | $width = $config['barrac_taille_bouton']; |
---|
131 | $height = $ii; |
---|
132 | $padding = "margin-top:".$config['barrac_marge_entre_boutons']."px;"; |
---|
133 | $style_item = " margin-bottom:".$config['barrac_marge_entre_boutons']."px;"; |
---|
134 | break; |
---|
135 | } |
---|
136 | $style_barre .= "width:".$width."px;height:".$height."px;".$padding; |
---|
137 | |
---|
138 | // bouton action grossir taille caracteres |
---|
139 | if($config[_BARRAC_ACTION_GROSSIR]=='oui') { |
---|
140 | if(($config['barrac_grossir_global'] == "non") |
---|
141 | && ($ii = barac_compacte_css_link ('barrac_grossir_css', $config['barrac_grossir_cssfile'], 'nav_caracteres_grossir')) |
---|
142 | ) { |
---|
143 | $barrac_flux_complements .= $ii; |
---|
144 | $reaction_evenement_parent = " $('#barrac_grossir_css').attr('disabled',false);"; |
---|
145 | $reaction_evenement_frere = " $('#barrac_grossir_css').attr('disabled',true);"; |
---|
146 | } |
---|
147 | else { |
---|
148 | $barrac_js_declarations .= "" |
---|
149 | . " var barrac_grossir = {'fontSize': 0};" |
---|
150 | ; |
---|
151 | $barrac_js_var_init .= "" |
---|
152 | . " barrac_grossir['fontSize'] = barrac_init_string($('body').css('fontSize'));" |
---|
153 | ; |
---|
154 | $reaction_evenement_parent = "" |
---|
155 | . " $('body').css('fontSize','".$config['barrac_grossir_taille']."%');"; |
---|
156 | $reaction_evenement_frere = "" |
---|
157 | . " $.each( barrac_grossir, function(i, n){ $('body').css(i, n); });"; |
---|
158 | } |
---|
159 | $reaction_evenement_parent .= barrac_javascript_cookie(_BARRAC_ACTION_GROSSIR, 'oui'); |
---|
160 | $reaction_evenement_frere .= barrac_javascript_cookie(_BARRAC_ACTION_GROSSIR, 'non'); |
---|
161 | $barrac_js_events_manager .= |
---|
162 | barrac_js_events_manager (_BARRAC_ACTION_GROSSIR, _BARRAC_ACTION_REDUIRE, $reaction_evenement_parent, $reaction_evenement_frere); |
---|
163 | $barrac_js_cookie_init_case .= barrac_js_cookie_init_case(_BARRAC_ACTION_GROSSIR); |
---|
164 | $barrac_js_bouton_switch .= barrac_js_bouton_switch (_BARRAC_ACTION_GROSSIR, _BARRAC_ACTION_REDUIRE); |
---|
165 | } |
---|
166 | |
---|
167 | // bouton action espacement des liens |
---|
168 | if($config[_BARRAC_ACTION_ESPACER]=='oui') { |
---|
169 | if(($barrac_espacer_global == "non") |
---|
170 | && ($ii = barac_compacte_css_link ('barrac_espacer_css', $config['barrac_espacer_cssfile'], 'nav_espacer_liens')) |
---|
171 | ){ |
---|
172 | $barrac_flux_complements .= $ii; |
---|
173 | $reaction_evenement_parent = " $('#barrac_espacer_css').attr('disabled',false);"; |
---|
174 | $reaction_evenement_frere = " $('#barrac_espacer_css').attr('disabled',true);"; |
---|
175 | } |
---|
176 | else { |
---|
177 | $barrac_js_declarations .= "" |
---|
178 | . " var barrac_espacer = {'paddingLeft': 0, 'paddingRight': 0};" |
---|
179 | ; |
---|
180 | $barrac_js_var_init .= "" |
---|
181 | . " barrac_espacer['paddingLeft'] = barrac_init_string($('//p/a').css('paddingLeft'));" |
---|
182 | . " barrac_espacer['paddingRight'] = barrac_init_string($('//p/a').css('paddingRight'));" |
---|
183 | ; |
---|
184 | $reaction_evenement_parent = "" |
---|
185 | . " $('//p/a').css({ paddingLeft: '".$config['barrac_espacer_taille']."', paddingRight: '".$config['barrac_espacer_taille']."' });"; |
---|
186 | $reaction_evenement_frere = "" |
---|
187 | . " $.each( barrac_espacer, function(i, n){ $('//p/a').css(i, n); });"; |
---|
188 | } |
---|
189 | $reaction_evenement_parent .= barrac_javascript_cookie(_BARRAC_ACTION_ESPACER, 'oui'); |
---|
190 | $reaction_evenement_frere .= barrac_javascript_cookie(_BARRAC_ACTION_ESPACER, 'non'); |
---|
191 | $barrac_js_events_manager .= |
---|
192 | barrac_js_events_manager (_BARRAC_ACTION_ESPACER, _BARRAC_ACTION_RAPPROCHER, $reaction_evenement_parent, $reaction_evenement_frere); |
---|
193 | $barrac_js_cookie_init_case .= barrac_js_cookie_init_case(_BARRAC_ACTION_ESPACER); |
---|
194 | $barrac_js_bouton_switch .= barrac_js_bouton_switch (_BARRAC_ACTION_ESPACER, _BARRAC_ACTION_ESPACER); |
---|
195 | } |
---|
196 | |
---|
197 | // bouton action encadrement des paragraphes |
---|
198 | if($config[_BARRAC_ACTION_ENCADRER]=='oui') { |
---|
199 | if(($config['barrac_encadrer_global'] == "non") |
---|
200 | && ($ii = barac_compacte_css_link ('barrac_encadrer_css', $config['barrac_encadrer_cssfile'], 'nav_encadrer_liens')) |
---|
201 | ) { |
---|
202 | $barrac_flux_complements .= $ii; |
---|
203 | $reaction_evenement_parent = " $('#barrac_encadrer_css').attr('disabled',false);"; |
---|
204 | $reaction_evenement_frere = " $('#barrac_encadrer_css').attr('disabled',true);"; |
---|
205 | } |
---|
206 | else { |
---|
207 | $barrac_js_declarations .= "" |
---|
208 | . " var barrac_encadrer = {'titre': {'padding':'', 'border':''}, 'texte': {'padding':'', 'border':''}};" |
---|
209 | ; |
---|
210 | $barrac_js_var_init .= "" |
---|
211 | . " barrac_encadrer['titre']['padding'] = barrac_init_string($('.titre').css('padding'));" |
---|
212 | . " barrac_encadrer['titre']['border'] = barrac_init_string($('.titre').css('border'));" |
---|
213 | . " barrac_encadrer['texte']['padding'] = barrac_init_string($('.texte').css('padding'));" |
---|
214 | . " barrac_encadrer['texte']['border'] = barrac_init_string($('.texte').css('border'));" |
---|
215 | ; |
---|
216 | $reaction_evenement_parent = "" |
---|
217 | . " $('.titre, .texte').css({padding: '".$config['barrac_encadrer_padding']."', border: '".$config['barrac_encadrer_taille']." solid ".$config['barrac_encadrer_couleur']."'});"; |
---|
218 | $reaction_evenement_frere = "" |
---|
219 | . " $.each( barrac_encadrer['titre'], function(i, n){ $('.titre').css(i, n); });" |
---|
220 | . " $.each( barrac_encadrer['texte'], function(i, n){ $('.texte').css(i, n); });"; |
---|
221 | } |
---|
222 | $reaction_evenement_parent .= barrac_javascript_cookie(_BARRAC_ACTION_ENCADRER, 'oui'); |
---|
223 | $reaction_evenement_frere .= barrac_javascript_cookie(_BARRAC_ACTION_ENCADRER, 'non'); |
---|
224 | $barrac_js_events_manager .= |
---|
225 | barrac_js_events_manager (_BARRAC_ACTION_ENCADRER, _BARRAC_ACTION_DECADRER, $reaction_evenement_parent, $reaction_evenement_frere); |
---|
226 | $barrac_js_cookie_init_case .= barrac_js_cookie_init_case(_BARRAC_ACTION_ENCADRER); |
---|
227 | $barrac_js_bouton_switch .= barrac_js_bouton_switch (_BARRAC_ACTION_ENCADRER, _BARRAC_ACTION_DECADRER); |
---|
228 | } |
---|
229 | |
---|
230 | // bouton action inversion des couleurs |
---|
231 | if($config[_BARRAC_ACTION_INVERSER]=='oui') { |
---|
232 | if(($config['barrac_inverser_global'] == "non") |
---|
233 | && ($ii = barac_compacte_css_link ('barrac_inverser_css', $config['barrac_inverser_cssfile'], 'nav_inverser_liens')) |
---|
234 | ) { |
---|
235 | $barrac_flux_complements .= $ii; |
---|
236 | $reaction_evenement_parent = " $('#barrac_inverser_css').attr('disabled',false);"; |
---|
237 | $reaction_evenement_frere = " $('#barrac_inverser_css').attr('disabled',true);"; |
---|
238 | } |
---|
239 | else { |
---|
240 | // les filtres ne fonctionnent que pour MSIE (html si >= 6) |
---|
241 | $reaction_evenement_parent = " |
---|
242 | $('body').css('filter', 'Invert()');"; |
---|
243 | $reaction_evenement_frere = " |
---|
244 | $('body').css('filter', '');"; |
---|
245 | } |
---|
246 | if(!empty($reaction_evenement_parent)) { |
---|
247 | $reaction_evenement_parent .= barrac_javascript_cookie(_BARRAC_ACTION_INVERSER, 'oui'); |
---|
248 | $reaction_evenement_frere .= barrac_javascript_cookie(_BARRAC_ACTION_INVERSER, 'non'); |
---|
249 | $barrac_js_events_manager .= |
---|
250 | barrac_js_events_manager (_BARRAC_ACTION_INVERSER, _BARRAC_ACTION_REPLACER, $reaction_evenement_parent, $reaction_evenement_frere); |
---|
251 | $barrac_js_cookie_init_case .= barrac_js_cookie_init_case(_BARRAC_ACTION_INVERSER); |
---|
252 | $barrac_js_bouton_switch .= barrac_js_bouton_switch (_BARRAC_ACTION_INVERSER, _BARRAC_ACTION_REPLACER); |
---|
253 | } |
---|
254 | } |
---|
255 | |
---|
256 | if(!empty($barrac_js_events_manager)) { |
---|
257 | $barrac_js_code_result = " |
---|
258 | " |
---|
259 | . $barrac_js_declarations |
---|
260 | . " |
---|
261 | function barrac_init_intval(v) { return(!v ? 0 : v); } |
---|
262 | function barrac_init_string(s) { return(!s ? '' : s); } |
---|
263 | function barrac_cookieCreate (name, value, days) { |
---|
264 | var expires = ''; |
---|
265 | if (days) { |
---|
266 | var date = new Date(); |
---|
267 | date.setTime(date.getTime() + (days*24*60*60*1000)); |
---|
268 | expires = '; expires=' + date.toGMTString(); |
---|
269 | } |
---|
270 | document.cookie = name + '=' + value + expires + '; path=/'; |
---|
271 | return (true); |
---|
272 | } |
---|
273 | |
---|
274 | $(document).ready(function() { |
---|
275 | |
---|
276 | var barrac_montre_toi = true; |
---|
277 | |
---|
278 | if('" . $barrac_mobile_no_display . "'=='oui') { |
---|
279 | /* alert(jQuery.fn.jquery); */ |
---|
280 | if(navigator.userAgent.match(/webkit/i)) { |
---|
281 | barrac_montre_toi = false; |
---|
282 | } |
---|
283 | } |
---|
284 | |
---|
285 | if(barrac_montre_toi) { |
---|
286 | $('#barrac_boutons').css('display','block'); |
---|
287 | |
---|
288 | " |
---|
289 | . $barrac_js_var_init |
---|
290 | . " |
---|
291 | if($.browser.msie) { |
---|
292 | $.extend ({ |
---|
293 | key_reset: function(ctrlKey, keyCode) { return (ctrlKey && ( keyCode == 106)); } |
---|
294 | }); |
---|
295 | } |
---|
296 | else if($.browser.mozilla) { |
---|
297 | $.extend ({ |
---|
298 | key_reset: function(ctrlKey, keyCode) { return (ctrlKey && ( keyCode == 96)); } |
---|
299 | }); |
---|
300 | } |
---|
301 | else if($.browser.opera) { |
---|
302 | $.extend ({ |
---|
303 | key_reset: function(ctrlKey, keyCode) { return (keyCode == 42); } |
---|
304 | }); |
---|
305 | } |
---|
306 | |
---|
307 | $(document).keyup( function(evenement) { |
---|
308 | var keyCode = window.event ? evenement.keyCode : evenement.which; |
---|
309 | var ctrlKey = evenement.ctrlKey; |
---|
310 | if($.key_reset(ctrlKey, keyCode)) { |
---|
311 | " |
---|
312 | . $barrac_js_bouton_switch |
---|
313 | . " |
---|
314 | } |
---|
315 | return (false); |
---|
316 | }); |
---|
317 | |
---|
318 | " |
---|
319 | . $barrac_js_events_manager |
---|
320 | . " |
---|
321 | if(document.cookie!=''){ |
---|
322 | cookies = document.cookie.split('; '); |
---|
323 | var cc; |
---|
324 | for(var ii = 0; ii < cookies.length; ii++) { |
---|
325 | cc = cookies[ii].split('='); |
---|
326 | statut = cc[1]; |
---|
327 | switch(cc[0]) { |
---|
328 | " |
---|
329 | . $barrac_js_cookie_init_case |
---|
330 | . " |
---|
331 | } |
---|
332 | } |
---|
333 | } |
---|
334 | } /* fin if(barrac_montre_toi) */ |
---|
335 | else { |
---|
336 | $('#barrac_boutons').css('display','none'); |
---|
337 | } |
---|
338 | }); /* fin ready() */ |
---|
339 | "; |
---|
340 | |
---|
341 | // corriger la transparence des fonds en png pour IE > 5.5 < 7.0 |
---|
342 | // pour IE 5.5, le filtre ne fonctionne pas ! Laisser sales icones ! |
---|
343 | $barrac_js_ie_complements = " |
---|
344 | <!--[if (gte IE 6)&(lt IE 7)]> |
---|
345 | <script type='text/javascript'> |
---|
346 | $.fn.extend({ |
---|
347 | barrac_png_image_swap: function() { |
---|
348 | var png_src = ''; |
---|
349 | png_src = $(this).css('backgroundImage'); |
---|
350 | $(this).css('backgroundImage', 'none'); |
---|
351 | png_src = png_src.substr(4); |
---|
352 | png_src = png_src.substr(0, png_src.length - 1); |
---|
353 | var filtre = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + png_src + ')'; |
---|
354 | $(this).css('filter', filtre); |
---|
355 | } |
---|
356 | }); |
---|
357 | $(document).ready(function() { |
---|
358 | $('#barrac_boutons').children('.item').each(function(){ |
---|
359 | $(this).barrac_png_image_swap(); |
---|
360 | }); |
---|
361 | $('#barrac_boutons a').each(function() { |
---|
362 | $(this).barrac_png_image_swap(); |
---|
363 | }); |
---|
364 | }); |
---|
365 | </script> |
---|
366 | <![endif]--> |
---|
367 | "; |
---|
368 | } |
---|
369 | |
---|
370 | // les feuilles CSS de barrac |
---|
371 | $barrac_flux_styles = " |
---|
372 | <!-- barrac CSS --> |
---|
373 | <style type='text/css' media='screen'> |
---|
374 | #barrac_boutons, #barrac_boutons * |
---|
375 | , #barrac_boutons .item a:link, #barrac_boutons .item a:visited, #barrac_boutons .item a:hover, #barrac_boutons .item a:active { |
---|
376 | display:block; |
---|
377 | margin:0; padding:0; border:0; |
---|
378 | } |
---|
379 | #barrac_boutons { |
---|
380 | position: absolute; |
---|
381 | width:42px; /* calcule par insert_head */ |
---|
382 | height:42px; /* calcule par insert_head */ |
---|
383 | z-index: 32000; |
---|
384 | list-style: none; |
---|
385 | } |
---|
386 | #barrac_boutons .item, #barrac_boutons .item a { |
---|
387 | display:block; |
---|
388 | width:24px; |
---|
389 | height:24px; |
---|
390 | background: url(none) no-repeat center center; |
---|
391 | overflow: hidden; |
---|
392 | } |
---|
393 | #barrac_boutons .item div { } |
---|
394 | |
---|
395 | #barrac_boutons a:link, #barrac_boutons a:visited, #barrac_boutons a:hover, #barrac_boutons a:active { |
---|
396 | text-decoration: none; |
---|
397 | } |
---|
398 | </style> |
---|
399 | <!--[if IE]> |
---|
400 | <style type='text/css' media='screen'> |
---|
401 | #barrac_boutons { |
---|
402 | width: auto !important;/**/ |
---|
403 | } |
---|
404 | #barrac_boutons .item { |
---|
405 | cursor: hand; |
---|
406 | margin:0; padding:0; border:0; font-size:1pt; line-height:1pt; |
---|
407 | } |
---|
408 | </style> |
---|
409 | <![endif]--> |
---|
410 | ";/**/ |
---|
411 | |
---|
412 | // place la barre des boutons |
---|
413 | $barrac_flux_styles .= " |
---|
414 | <style type='text/css'> |
---|
415 | #barrac_boutons {" . $style_barre . "} |
---|
416 | #barrac_boutons .item { background-image: url(" . barrac_icone_fond() . ");width:" . $config['barrac_taille_bouton'] . "px;height:" . $config['barrac_taille_bouton'] . "px;$style_item } |
---|
417 | #barrac_boutons .item a { width:" . $config['barrac_taille_bouton'] . "px;height:" . $config['barrac_taille_bouton'] . "px; } |
---|
418 | </style> |
---|
419 | "; |
---|
420 | |
---|
421 | /* */ |
---|
422 | $barrac_js_code_result = " |
---|
423 | <!-- barrac JS --> |
---|
424 | <script type='text/javascript'> |
---|
425 | //<![CDATA[ |
---|
426 | " |
---|
427 | . preg_replace('=[[:space:]]+=', ' ', compacte_js($barrac_js_code_result)) |
---|
428 | //. $barrac_js_code_result |
---|
429 | . " |
---|
430 | //]]> |
---|
431 | </script> |
---|
432 | "; |
---|
433 | |
---|
434 | // assembler le tout |
---|
435 | $barrac_flux_complements .= $barrac_js_code_result . $barrac_js_ie_complements; |
---|
436 | |
---|
437 | // compresser |
---|
438 | $barrac_flux_styles = compacte_css($barrac_flux_styles); |
---|
439 | |
---|
440 | $flux .= $barrac_flux_styles . $barrac_flux_complements; |
---|
441 | |
---|
442 | return ($flux); |
---|
443 | } |
---|
444 | |
---|
445 | |
---|
446 | /******************************************************************************/ |
---|
447 | |
---|
448 | function barac_compacte_css_link ($id, $href, $title) { |
---|
449 | if(!empty($href) && ($href = find_in_path($href)) && ($href = compacte($href, 'css'))) { |
---|
450 | return("<link id='$id' href='".$href."' rel='alternate stylesheet'" . " title='"._T(_BARRAC_LANG.$title)."' type='text/css' />\n"); |
---|
451 | } |
---|
452 | return(false); |
---|
453 | } |
---|
454 | |
---|
455 | function barrac_js_events_manager ($action_parent, $action_frere, $reaction_parent, $reaction_frere) { |
---|
456 | return( |
---|
457 | " |
---|
458 | $('#"._BARRAC_PREFIX."_item_".$action_parent."').click( function() { |
---|
459 | $('#"._BARRAC_PREFIX."_item_".$action_frere."').show(); |
---|
460 | $('#"._BARRAC_PREFIX."_item_".$action_parent."').hide();" . $reaction_parent |
---|
461 | . " |
---|
462 | }); |
---|
463 | $('#"._BARRAC_PREFIX."_item_".$action_frere."').click( function() { |
---|
464 | $('#"._BARRAC_PREFIX."_item_".$action_parent."').show(); |
---|
465 | $('#"._BARRAC_PREFIX."_item_".$action_frere."').hide();" . $reaction_frere |
---|
466 | . " |
---|
467 | }); |
---|
468 | "); |
---|
469 | } |
---|
470 | |
---|
471 | function barrac_js_bouton_switch ($action_parent, $action_frere) { |
---|
472 | return(" |
---|
473 | if($('#"._BARRAC_PREFIX."_item_".$action_parent."').css('display') == 'none') { |
---|
474 | $('#"._BARRAC_PREFIX."_item_".$action_frere."').click(); |
---|
475 | } |
---|
476 | "); |
---|
477 | } |
---|
478 | |
---|
479 | function barrac_js_cookie_init_case ($action_parent) { |
---|
480 | return( " |
---|
481 | case '" . _BARRAC_PREFIX . "_" . $action_parent . "': |
---|
482 | if(statut == 'oui') { $('#" . _BARRAC_PREFIX . "_item_" . $action_parent . "').click(); } |
---|
483 | break; |
---|
484 | " |
---|
485 | ); |
---|
486 | } |
---|
487 | |
---|
488 | function barrac_javascript_cookie ($action_parent, $value) { |
---|
489 | return( " |
---|
490 | barrac_cookieCreate('" . _BARRAC_PREFIX . "_" . $action_parent . "', '".$value."', 365);" |
---|
491 | ); |
---|
492 | } |
---|
493 | |
---|
494 | /** barrac_confirmer_valeur_var () |
---|
495 | Verifier si la variable contient une valeur acceptable. |
---|
496 | Renvoyer si ok, sinon renvoyer valeur par defaut. |
---|
497 | */ |
---|
498 | function barrac_confirmer_valeur_var ($var, $acceptables, $defaut) { |
---|
499 | return ((!empty($var) && in_array($var, $acceptables)) ? $var : $defaut); |
---|
500 | } |
---|
501 | |
---|
502 | ?> |
---|