Changeset 74758 in spip-zone


Ignore:
Timestamp:
Aug 14, 2013, 8:45:53 PM (6 years ago)
Author:
cedric@…
Message:

dispatcher le js inline : une partie va dans blocs.js pour l'init, et l'autre partie reste inline, mais poussee avant les CSS
(chargement non bloquant : js inline, css, js externe)

Location:
_plugins_/blocsdepliables
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/blocsdepliables/blocsdepliables_pipelines.php

    r73523 r74758  
    1010
    1111function blocsdepliables_insert_head($flux){
     12        $flux .= "<script type='text/javascript' src='".find_in_path("js/blocs.js")."'></script>";
     13        return $flux;
     14}
     15
     16function blocsdepliables_insert_head_css($flux){
    1217        include_spip("inc/config");
    1318        $slide = lire_config('blocsdepliables/animation','aucun');
     
    1621        if (lire_config('blocsdepliables/cookie',0)){
    1722                $js_cookie = find_in_path("javascript/jquery.cookie.js");
    18                 $js_cookie = "if(jQuery('div.cs_blocs').length) jQuery.getScript('$js_cookie', cs_blocs_cookie);";
    1923        }
    2024
     
    2327var blocs_title_sep = /".preg_quote(_BLOC_TITLE_SEP)."/g;
    2428var blocs_title_def = "._q(_T('couteau:bloc_deplier')._BLOC_TITLE_SEP._T('couteau:bloc_replier')).";
    25 jQuery.fn.cs_todo=function(){return this.not('.cs_done').addClass('cs_done');};
    26 var cs_sel_jQuery='';
    27 jQuery(function(){
    28 blocs_init.apply(document);
    29 if(typeof onAjaxLoad=='function') onAjaxLoad(blocs_init);
    30 $js_cookie });";
     29var blocs_js_cookie = '$js_cookie';
     30";
     31        $flux =
     32                "<script type='text/javascript'>/*<![CDATA[*/\n$js\n/*]]>*/</script>"
     33                . $flux
     34                . '<link rel="stylesheet" type="text/css" href="'.find_in_path("css/blocs.css").'" />';
    3135
    32         $flux .= "<script type='text/javascript' src='".find_in_path("js/blocs.js")."'></script>
    33 <script type='text/javascript'>/*<![CDATA[*/\n$js\n/*]]>*/</script>";
    34         return $flux;
    35 }
    36 
    37 function blocsdepliables_insert_head_css($flux){
    38         $flux .= '<link rel="stylesheet" type="text/css" href="'.find_in_path("css/blocs.css").'" />';
    3936        return $flux;
    4037}
  • _plugins_/blocsdepliables/js/blocs.js

    r73523 r74758  
    217217});
    218218*/
     219
     220/* Init */
     221jQuery.fn.cs_todo=function(){return this.not('.cs_done').addClass('cs_done');};
     222var cs_sel_jQuery='';
     223jQuery(function(){
     224blocs_init.apply(document);
     225if(typeof onAjaxLoad=='function') onAjaxLoad(blocs_init);
     226if(blocs_js_cookie && jQuery('div.cs_blocs').length) jQuery.getScript(blocs_js_cookie, cs_blocs_cookie);
     227});
  • _plugins_/blocsdepliables/paquet.xml

    r73523 r74758  
    22        prefix="blocsdepliables"
    33        categorie="edition"
    4         version="1.0.1"
    5         etat="test"
     4        version="1.1.0"
     5        etat="stable"
    66        compatibilite="[3.0.0;3.0.*]"
    77        logo="prive/themes/spip/images/blocsdepliables-64.png"
Note: See TracChangeset for help on using the changeset viewer.