Changeset 39716 in spip-zone for _plugins_/thickbox2


Ignore:
Timestamp:
Aug 8, 2010, 7:48:25 PM (8 years ago)
Author:
prigent.yohann@…
Message:

insert_head_css ici aussi

Location:
_plugins_/thickbox2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/thickbox2/head.php

    r31249 r39716  
    11<?php
    22
     3function ThickBox1_insert_head_css($flux){
     4        static $done = false;
     5        if (!$done) {
     6                $done = true;
     7                $flux .= ThickBox_call_css();
     8        }
     9        return $flux;
     10}
    311
    412function ThickBox1_insert_head($flux){
    5 
     13        $flux = ThickBox1_insert_head_css($flux);
     14       
    615        // on ajoute la class thickbox aux liens de type="image/xxx"
    716
     
    918        // jQuery("a.thickbox,a[type='image/jpeg'],...").size() > 0)
    1019        if(!$GLOBALS["spip_pipeline"]["insert_js"])
    11                 $flux = ThickBox1_header_prive($flux);
     20                $flux .= ThickBox_call_js();
    1221
    1322        return $flux;
     
    1726include_spip("inc/filtres");
    1827
    19 $flux .=
    20 
    21 '
    22 <script src=\''.url_absolue(find_in_path('javascript/thickbox.js')).'\' type=\'text/javascript\'></script>
    23 <link rel="stylesheet" href="'.url_absolue(find_in_path('thickbox.css')).'" type="text/css" media="all" />
    24 <script type="text/javascript"><!--
    25 // Inside the function "this" will be "document" when called by ready()
    26 // and "the ajaxed element" when called because of onAjaxLoad
    27 var init_f = function() {
    28         if (jQuery("a.thickbox,a[type=\'image/jpeg\'],a[type=\'image/png\'],a[type=\'image/gif\']",this).addClass("thickbox").size()) {
    29                 TB_chemin_animation = "'.url_absolue(find_in_path('circle_animation.gif')).'";
    30                 TB_chemin_close = "'.url_absolue(find_in_path('close.gif')).'";
    31                 TB_chemin_css = "'.url_absolue(find_in_path('thickbox.css')).'";
    32                 TB_init(this);
    33         };
    34 }
    35 //onAjaxLoad is defined in private area only
    36 if(typeof onAjaxLoad == "function") onAjaxLoad(init_f);
    37 if (window.jQuery) jQuery(document).ready(init_f);
    38 // --></script>';
     28$flux .= ThickBox_call_css();
     29$flux .= ThickBox_call_js();
    3930
    4031return $flux;
     
    10192}
    10293
     94function 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
     99var 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')).'";
     104                TB_init(this);
     105        };
     106}
     107//onAjaxLoad is defined in private area only
     108if(typeof onAjaxLoad == "function") onAjaxLoad(init_f);
     109if (window.jQuery) jQuery(document).ready(init_f);
     110// --></script>';
     111        return $flux;
     112}
     113
     114function ThickBox_call_css() {
     115        $flux = '<link rel="stylesheet" href="'.url_absolue(find_in_path('thickbox.css')).'" type="text/css" media="all" />';
     116        return $flux;
     117}
    103118?>
  • _plugins_/thickbox2/plugin.xml

    r34504 r39716  
    2525        </prefix>
    2626        <pipeline>
     27                <nom>insert_head_css</nom>
     28                <inclure>head.php</inclure>
     29        </pipeline>
     30        <pipeline>
    2731                <nom>insert_head</nom>
    2832                <inclure>head.php</inclure>
Note: See TracChangeset for help on using the changeset viewer.