3 function ThickBox1_insert_head_css($flux){
7 $flux .= ThickBox_call_css();
12 function ThickBox1_insert_head($flux){
13 $flux = ThickBox1_insert_head_css($flux);
15 // on ajoute la class thickbox aux liens de type="image/xxx"
17 // TODO: ne charger thickbox.js et thickbox.css que si
18 // jQuery("a.thickbox,a[type='image/jpeg'],...").size() > 0)
19 if(!$GLOBALS["spip_pipeline"]["insert_js"])
20 $flux .= ThickBox_call_js();
25 function ThickBox1_header_prive($flux) {
26 include_spip("inc/filtres");
28 $flux .= ThickBox_call_css();
29 $flux .= ThickBox_call_js();
35 function ThickBox1_insert_js($flux){
36 include_spip("inc/filtres");
38 // on ajoute la class thickbox aux liens de type="image/xxx"
40 // TODO: ne charger thickbox.js et thickbox.css que si
41 // jQuery("a.thickbox,a[type='image/jpeg'],...").size() > 0)
43 if($flux['type']=='inline')
44 $flux["data"]["ThickBox1"] =
46 <script type="text/javascript"><!--
47 // Inside the function "this" will be "document" when called by ready()
48 // and "the ajaxed element" when called because of onAjaxLoad
49 var init_f = function() {
51 if (jQuery("a.thickbox,a[type=\'image/jpeg\'],a[type=\'image/png\'],a[type=\'image/gif\']",me).addClass("thickbox").size()) {
53 var TB_initload = function(){
54 TB_chemin_animation = "'.url_absolue(find_in_path('circle_animation.gif')).'";
55 TB_chemin_close = "'.url_absolue(find_in_path('close.gif')).'";
56 TB_chemin_css = "'.url_absolue(find_in_path('thickbox.css')).'";
60 if (typeof TB_init == "function") {
64 .prepend("<link rel=\'stylesheet\'type=\'text/css\' href=\''.url_absolue(find_in_path('thickbox.css')).'\' />");
66 .url_absolue(find_in_path('javascript/thickbox.js'))
71 //onAjaxLoad is defined in private area only
72 if(typeof onAjaxLoad == "function") onAjaxLoad(init_f);
74 // Demarrage : on charge et execute les scripts de thickbox en asynchrone
75 // ce qui permet a la page de s\'afficher plus tot
76 jQuery(document).ready(function(){setTimeout(init_f.apply(document),200)});
82 function ThickBox1_verifie_js_necessaire($flux) {
84 //var_dump($flux["page"]);
85 $page = $flux["page"]["texte"];
86 //cherche <a> avec un type image ou une class thickbox
87 $necessaire = preg_match(",<a[^>]+(?:(type)|class)\s*=\s*['\"](?(1)image/(?:jpeg|png|gif)|[^>'\"]*\bthickbox\b[^>'\"]*)['\"],iUs",$page);
88 $flux["data"]["ThickBox1"] = $necessaire;
94 function ThickBox_call_js() {
95 $flux = '<script src=\''.url_absolue(find_in_path('javascript/thickbox.js')).'\' type=\'text/javascript\'></script>';
96 $flux .= '<script type="text/javascript"><!--
97 // Inside the function "this" will be "document" when called by ready()
98 // and "the ajaxed element" when called because of onAjaxLoad
99 var init_f = function() {
100 if (jQuery("a.thickbox,a[type=\'image/jpeg\'],a[type=\'image/png\'],a[type=\'image/gif\']",this).addClass("thickbox").size()) {
101 TB_chemin_animation = "'.url_absolue(find_in_path('circle_animation.gif')).'";
102 TB_chemin_close = "'.url_absolue(find_in_path('close.gif')).'";
103 TB_chemin_css = "'.url_absolue(find_in_path('thickbox.css')).'";
107 //onAjaxLoad is defined in private area only
108 if(typeof onAjaxLoad == "function") onAjaxLoad(init_f);
109 if (window.jQuery) jQuery(document).ready(init_f);
114 function ThickBox_call_css() {
115 $flux = '<link rel="stylesheet" href="'.url_absolue(find_in_path('thickbox.css')).'" type="text/css" media="all" />';