Valider 251552ff rédigé par placido@roxing.net's avatar placido@roxing.net
Parcourir les fichiers

executer les éventuels scripts inline contenus dans les z_apl

parent 85393d98
Chargement en cours
Chargement en cours
Chargement en cours
Chargement en cours
+58 −51
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -10,41 +10,48 @@ var getAjax = function(url, success) {
};
// peupler le zbloc et dire qu'il est prêt
function getZapl(bloc) {
    var zapl = document.querySelector("#zapl-" + bloc);
    if (zapl) {
        var myurl = window.location + "";
        myurl = myurl.split('#');
        myurl = myurl[0] + ((myurl[0].indexOf("?") > 0) ? "&" : "?") + "var_zajax=" + bloc;
        getAjax(myurl, function(data) {
				var el = document.querySelector("#zapl-" + bloc);
            var newEl = document.createElement('div');
            newEl.innerHTML = data;
				el.parentNode.replaceChild(newEl, el);
            zapl.parentNode.replaceChild(newEl, zapl);
            // un array qui liste les zblocs traités
				if (!window.zapl_list) {
						window.zapl_list = [];
				}
            window.zapl_list.push(bloc);
        });
    }
};

// attendre jQuery et les zblocs pour renclencher AjaxLoad
window.zapl_loop_index = 0;
zapl_loop_index = 0;
zapl_list = [];
zapl_loop = setInterval(function() {
    //console.log("loop index : " +  window.zapl_loop_index + " - jQuery chargé ? : " + (typeof jQuery.spip.triggerAjaxLoad !== 'undefined') + " - Nb zapl traités:" + window.zapl_list.length );
	if (	(typeof jQuery.spip === 'object') &&
				(typeof jQuery.spip.triggerAjaxLoad === 'function') &&
				(typeof window.zapl_list !== 'undefined') &&
				!(document.querySelectorAll("[id^='zapl-']").length) ) {
			clearInterval(zapl_loop);
			var h = window.location.hash;
			if (h) {
					// $b correspond à la selection jQuery des zblocs
					var $b = $();
    if (
        typeof jQuery.spip === 'object' &&
        typeof jQuery.spip.triggerAjaxLoad === 'function' &&
        window.zapl_list.length &&
        !document.querySelectorAll("[id^='zapl-']").length
    ) {
        clearInterval(window.zapl_loop);
        // $b = collection jQuery des zblocs
        var $b = jQuery();
        window.zapl_list.forEach(function(e) {
							$b = $b.add(e);
            $b = $b.add("#" + e);
        });
        //executer les scripts inline inclus
        var $s = $b.find("script");
        if ($s.length) {
            $s.each(function(i, e) {
                jQuery.globalEval($(e).html());
            });
					if ($b.find(h)[0]) {
							jQuery(h).positionner(true);
        }
        // positionner ancre
        var h = window.location.hash;
        if (h && $b.find(h)[0]) {
            jQuery(h).positionner(true);
        }
        jQuery.spip.triggerAjaxLoad(document);
        return;
+1 −1
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
<paquet
	prefix="Zcore"
	categorie="outil"
	version="2.6.6"
	version="2.6.7"
	etat="stable"
	compatibilite="[3.0.0;3.2.*]"
	logo="prive/themes/spip/images/z-core-32.png"