From 2a412036f3c5a2b3a80f77365766e10a2029938f Mon Sep 17 00:00:00 2001 From: Fil <fil@rezo.net> Date: Tue, 9 Jan 2007 14:06:38 +0000 Subject: [PATCH] avec ca, le core est compatible jquery 1.1 (bugs possibles) --- dist/javascript/articles_tous_edite.js | 110 ++++++++++++------------- dist/javascript/async_upload.js | 52 ++++++------ dist/javascript/layer.js | 33 ++++---- ecrire/exec/admin_plugin.php | 17 ++-- 4 files changed, 106 insertions(+), 106 deletions(-) diff --git a/dist/javascript/articles_tous_edite.js b/dist/javascript/articles_tous_edite.js index fe77f55ff8..e4b67ca7a2 100644 --- a/dist/javascript/articles_tous_edite.js +++ b/dist/javascript/articles_tous_edite.js @@ -1,73 +1,73 @@ function deplie_arbre(){ - tree = $('#articles_tous'); - $('ul:hidden',tree).siblings('img.expandImage').each(function(){$(this).bascule()}); + tree = jQuery('#articles_tous'); + jQuery('ul:hidden',tree).siblings('img.expandImage').each(function(){jQuery(this).bascule()}); } function plie_arbre(){ - tree = $('#articles_tous'); - $('#articles_tous ul').hide(); - $('img.expandImage', tree).attr('src',img_deplierhaut); + tree = jQuery('#articles_tous'); + jQuery('#articles_tous ul').hide(); + jQuery('img.expandImage', tree).attr('src',img_deplierhaut); } function annuler_deplacement(){ - liste = $("#deplacements").text(); + liste = jQuery("#deplacements").text(); tableau = liste.split("\n"); if (tableau.length>0){ action = tableau[tableau.length-1]; tab = action.split(":"); - $("#"+tab[2]).insertion(tab[0],$("#"+tab[0]).parent().id()); + jQuery("#"+tab[2]).insertion(tab[0],jQuery("#"+tab[0]).parent().attr('id')); tableau.pop(); - $("#deplacements").html(tableau.join("\n")); - if (tableau.length==0) $("#cancel").hide(); - if (tableau.length==0) $("#apply").hide(); + jQuery("#deplacements").html(tableau.join("\n")); + if (tableau.length==0) jQuery("#cancel").hide(); + if (tableau.length==0) jQuery("#apply").hide(); } } jQuery.fn.set_expandImage = function(){ - $('ul:hidden',$(this)).parent().prepend('<img src="'+img_deplierhaut+'" class="expandImage" />'); - $('ul:visible',$(this)).parent().prepend('<img src="'+img_deplierbas+'" class="expandImage" />'); - $('img.expandImage', $(this)).click(function (){$(this).bascule();}); - return $(this); + jQuery('ul:hidden',jQuery(this)).parent().prepend('<img src="'+img_deplierhaut+'" class="expandImage" />'); + jQuery('ul:visible',jQuery(this)).parent().prepend('<img src="'+img_deplierbas+'" class="expandImage" />'); + jQuery('img.expandImage', jQuery(this)).click(function (){jQuery(this).bascule();}); + return jQuery(this); } var recall; jQuery.fn.deplie = function(){ - $(this).show(); - $(this).siblings('img.expandImage').eq(0).attr('src',img_deplierbas); - $(this).children('li').children('a.ajax').each(function(){ - $(this).before("<div>"+ajax_image_searching+"</div>"); - var id = $(this).parent().parent().id(); - $(this).parent().parent().load($(this).href()+"&var_ajaxcharset=utf-8",function(){$("#"+id).set_expandImage().set_droppables();jQuery.recallDroppables();}); + jQuery(this).show(); + jQuery(this).siblings('img.expandImage').eq(0).attr('src',img_deplierbas); + jQuery(this).children('li').children('a.ajax').each(function(){ + jQuery(this).before("<div>"+ajax_image_searching+"</div>"); + var id = jQuery(this).parent().parent().attr('id'); + jQuery(this).parent().parent().load(jQuery(this).attr('href')+"&var_ajaxcharset=utf-8",function(){jQuery("#"+id).set_expandImage().set_droppables();jQuery.recallDroppables();}); }); recall = true; jQuery.recallDroppables(); - return $(this); + return jQuery(this); } jQuery.fn.bascule = function() { - subbranch = $(this).siblings('ul').eq(0); + subbranch = jQuery(this).siblings('ul').eq(0); if (subbranch.is(':hidden')) { subbranch.show(); - $(this).attr('src',img_deplierbas); + jQuery(this).attr('src',img_deplierbas); subbranch.children('li').children('a.ajax').each(function(){ - $(this).before("<div>"+ajax_image_searching+"</div>"); - var id = $(this).parent().parent().id(); - $(this).parent().parent().load($(this).href()+"&var_ajaxcharset=utf-8",function(){$("#"+id).set_expandImage().set_droppables();}); + jQuery(this).before("<div>"+ajax_image_searching+"</div>"); + var id = jQuery(this).parent().parent().attr('id'); + jQuery(this).parent().parent().load(jQuery(this).attr('href')+"&var_ajaxcharset=utf-8",function(){jQuery("#"+id).set_expandImage().set_droppables();}); }); } else { subbranch.hide(); - $(this).attr('src',img_deplierhaut); + jQuery(this).attr('src',img_deplierhaut); } - return $(this); + return jQuery(this); } jQuery.fn.insertion = function(dropped_id,origine_id){ - dropped = $('#'+dropped_id); - subbranch = $(this).children('ul').eq(0); + dropped = jQuery('#'+dropped_id); + subbranch = jQuery(this).children('ul').eq(0); if (subbranch.size() == 0) { - $(this).prepend('<img src="'+img_deplierbas+'" width="16" height="16" class="expandImage" />'); - id = $(this).id(); + jQuery(this).prepend('<img src="'+img_deplierbas+'" width="16" height="16" class="expandImage" />'); + id = jQuery(this).attr('id'); id = id.split("-"); id=id[1] - $(this).append("<ul id='ul"+id+"' ></ul>"); - $(this).children('img.expandImage').click(function (){$(this).bascule();}); - subbranch = $(this).children('ul').eq(0); + jQuery(this).append("<ul id='ul"+id+"' ></ul>"); + jQuery(this).children('img.expandImage').click(function (){jQuery(this).bascule();}); + subbranch = jQuery(this).children('ul').eq(0); } if((dropped.is('li.art')) && (subbranch.children('li.rub').length>0)){ subbranch.end().children('li.rub').eq(0).before(dropped); @@ -79,8 +79,8 @@ jQuery.fn.insertion = function(dropped_id,origine_id){ subbranch.deplie(); } - oldParent = $('#'+origine_id); - oldBranches = $('li', oldParent); + oldParent = jQuery('#'+origine_id); + oldBranches = jQuery('li', oldParent); if (oldBranches.size() == 0) { oldParent.siblings('img.expandImage').remove(); oldParent.end().remove(); @@ -88,7 +88,7 @@ jQuery.fn.insertion = function(dropped_id,origine_id){ } jQuery.fn.set_droppables = function(){ - $('span.holder',$(this)).Droppable( + jQuery('span.holder',jQuery(this)).Droppable( { accept : 'treeItem', hoverclass : 'none', @@ -96,9 +96,9 @@ jQuery.fn.set_droppables = function(){ tollerance : 'intersect', onhover : function(dragged) { - $(this).parent().addClass('selected'); + jQuery(this).parent().addClass('selected'); if (!this.expanded) { - subbranch = $(this).siblings('ul').eq(0); + subbranch = jQuery(this).siblings('ul').eq(0); if (subbranch.is(':hidden')){ subbranch.pause(1000).deplie(); this.expanded = true; @@ -107,9 +107,9 @@ jQuery.fn.set_droppables = function(){ }, onout : function() { - $(this).parent().removeClass('selected'); + jQuery(this).parent().removeClass('selected'); if (this.expanded){ - subbranch = $(this).siblings('ul').eq(0); + subbranch = jQuery(this).siblings('ul').eq(0); subbranch.unpause(); if (recall){ recall=false; @@ -119,23 +119,23 @@ jQuery.fn.set_droppables = function(){ }, ondrop : function(dropped) { - $(this).parent().removeClass('selected'); - subbranch = $(this).siblings('ul').eq(0); + jQuery(this).parent().removeClass('selected'); + subbranch = jQuery(this).siblings('ul').eq(0); if (this.expanded) subbranch.unpause(); - var target=$(this).parent().id(); - var quoi=$(dropped).id(); - var source=$(dropped).parent().parent().id(); // il faut stocker l'id du li car le ul peut avoir disparu au moment du cancel + var target=jQuery(this).parent().attr('id'); + var quoi=jQuery(dropped).attr('id'); + var source=jQuery(dropped).parent().parent().attr('id'); // il faut stocker l'id du li car le ul peut avoir disparu au moment du cancel action=quoi+":"+target+":"+source; - var dep = $("#deplacements"); + var dep = jQuery("#deplacements"); dep.html(dep.text()+"\n"+action); - $("#apply").show(); - $("#cancel").show(); - $(this).parent().insertion(quoi,$(dropped).parent().id()); + jQuery("#apply").show(); + jQuery("#cancel").show(); + jQuery(this).parent().insertion(quoi,jQuery(dropped).parent().attr('id')); } } ); - $('li.treeItem',$(this)).Draggable( + jQuery('li.treeItem',jQuery(this)).Draggable( { revert : true, ghosting : true, @@ -144,10 +144,10 @@ jQuery.fn.set_droppables = function(){ ); } -$(document).ready( +jQuery( function() { - $('#articles_tous').set_expandImage(); - $('#articles_tous').set_droppables(); + jQuery('#articles_tous').set_expandImage(); + jQuery('#articles_tous').set_droppables(); } ); \ No newline at end of file diff --git a/dist/javascript/async_upload.js b/dist/javascript/async_upload.js index 0e8c50fb98..3122e3a5df 100644 --- a/dist/javascript/async_upload.js +++ b/dist/javascript/async_upload.js @@ -8,9 +8,9 @@ jQuery.fn.async_upload = function(add_function) { function do_async_upload(form) { jQuery.async_upload_count++; var num = jQuery.async_upload_count; - var jForm = $(form); - var par = $(jForm).parent(); - $("div.upload_message",par) + var jForm = jQuery(form); + var par = jQuery(jForm).parent(); + jQuery("div.upload_message",par) .remove(); if(!form.async_init) { form.async_init = true @@ -22,14 +22,14 @@ jQuery.fn.async_upload = function(add_function) { } jForm.attr("target","upload_frame"+num); - var jFrame = $("<iframe id='upload_frame"+num+"' name='upload_frame"+num+"' frameborder='0' marginwidth='0' marginheight='0' scrolling='no' style='position:absolute;width:1px;height:1px;' onload='this.iframeload("+num+")'></iframe>") + var jFrame = jQuery("<iframe id='upload_frame"+num+"' name='upload_frame"+num+"' frameborder='0' marginwidth='0' marginheight='0' scrolling='no' style='position:absolute;width:1px;height:1px;' onload='this.iframeload("+num+")'></iframe>") .appendTo("body"); //IE apparently do not write anything in an iframe onload event handler jFrame[0].iframeload = function(num) { //remove the previous message - $("div.upload_message",par).remove(); - var res = $(".upload_answer",this.contentDocument || document.frames(this.name).document.body); + jQuery("div.upload_message",par).remove(); + var res = jQuery(".upload_answer",this.contentDocument || document.frames(this.name).document.body); //possible classes //upload_document_added if(res.is(".upload_document_added")) { @@ -37,14 +37,14 @@ jQuery.fn.async_upload = function(add_function) { } //upload_error if(res.is(".upload_error")) { - var msg = $("<div class='upload_message'>") + var msg = jQuery("<div class='upload_message'>") .append(res.html()) jForm.after(msg[0]); return true; } //upload_zip_list if(res.is(".upload_zip_list")) { - var zip_form = $("<div class='upload_message'>").append(res.html()); + var zip_form = jQuery("<div class='upload_message'>").append(res.html()); zip_form .find("form") .attr("target","upload_frame"+num) @@ -55,7 +55,7 @@ jQuery.fn.async_upload = function(add_function) { } }; - jForm.before($("<div class='upload_message' style='height:1%'>").append(ajax_image_searching)[0]); + jForm.before(jQuery("<div class='upload_message' style='height:1%'>").append(ajax_image_searching)[0]); return true; } } @@ -63,10 +63,10 @@ jQuery.fn.async_upload = function(add_function) { function async_upload_article_edit(res,jForm){ var cont; //verify if a new document or a customized vignette - var anchor = $(res.find(">a:first")); + var anchor = jQuery(res.find(">a:first")); res.end(); - if($("#"+anchor.id()).size()) { - cont = $("#"+anchor.id()).next().next().html(anchor.next().next().html()); + if(jQuery("#"+anchor.attr('id')).size()) { + cont = jQuery("#"+anchor.attr('id')).next().next().html(anchor.next().next().html()); } else { //add a class to new documents res. @@ -75,9 +75,9 @@ function async_upload_article_edit(res,jForm){ .css("display","none") .end(); if (jForm.find("input[@name='arg']").val().search("/0/vignette")!=-1) - cont = $("#liste_images"); + cont = jQuery("#liste_images"); else - cont = $("#liste_documents"); + cont = jQuery("#liste_documents"); cont .prepend(res.html()); //find added documents, remove label and show them nicely @@ -85,23 +85,23 @@ function async_upload_article_edit(res,jForm){ find("div.documents_added") .removeClass("documents_added") .show("slow",function(){ - var anim = $(this).css("height",""); + var anim = jQuery(this).css("height",""); //bug explorer-opera-safari - if(!jQuery.browser.mozilla) anim.width(this.orig.width-2); - $(anim).find("img[@onclick]").get(0).onclick(); + if(!jQuery.browser.mozilla) anim.css('width', this.orig.width-2); + jQuery(anim).find("img[@onclick]").get(0).onclick(); }) - .overflow(""); + .css('overflow',''); } - $("form.form_upload",cont).async_upload(async_upload_article_edit); + jQuery("form.form_upload",cont).async_upload(async_upload_article_edit); verifForm(cont); return true; } function async_upload_icon(res) { res.find(">div").each(function(){ - var cont = $("#"+this.id); - verifForm(cont.html($(this).html())); - $("form.form_upload_icon",cont).async_upload(async_upload_icon); + var cont = jQuery("#"+this.id); + verifForm(cont.html(jQuery(this).html())); + jQuery("form.form_upload_icon",cont).async_upload(async_upload_icon); cont.find("img[@onclick]").each(function(){this.onclick();}); }); return true; @@ -109,14 +109,14 @@ function async_upload_icon(res) { function async_upload_portfolio_documents(res){ res.find(">div").each(function(){ - var cont = $("#"+this.id); - var self = $(this); + var cont = jQuery("#"+this.id); + var self = jQuery(this); if(!cont.size()) { - cont = $(this.id.search(/--/)!=-1 ? "#portfolio":"#documents") + cont = jQuery(this.id.search(/--/)!=-1 ? "#portfolio":"#documents") .append(self.clone().get()); } verifForm(cont.html(self.html())); - $("form.form_upload",cont).async_upload(async_upload_portfolio_documents); + jQuery("form.form_upload",cont).async_upload(async_upload_portfolio_documents); }); return true; } diff --git a/dist/javascript/layer.js b/dist/javascript/layer.js index 8e355cebd6..6071824369 100644 --- a/dist/javascript/layer.js +++ b/dist/javascript/layer.js @@ -40,7 +40,7 @@ function findObj_forcer(n) { function hide_obj(obj) { var element; if (element = findObj(obj)){ - $(element).css("visibility","hidden"); + jQuery(element).css("visibility","hidden"); } } @@ -185,16 +185,17 @@ function lancer_recherche(champ, cible) {} // obsolete function verifForm(racine) { if(!jQuery.browser.mozilla) return; racine = racine || document; - $("input.forml,input.formo,textarea.forml,textarea.formo",racine) + jQuery("input.forml,input.formo,textarea.forml,textarea.formo",racine) .each(function(){ - var jField = $(this); - var w = jField.width(); + var jField = jQuery(this); + var w = jField.css('width'); if(!w) { - jField.width("95%"); + jField.css('width','95%'); } else { - w -= (parseInt(jField.css("borderLeftWidth"))+parseInt(jField.css("borderRightWidth"))+ - parseInt(jField.css("paddingLeft"))+parseInt(jField.css("paddingRight"))); - jField.width(w+"px"); + w = parseInt(w)- + (parseInt(jField.css("borderLeftWidth"))+parseInt(jField.css("borderRightWidth"))+ + parseInt(jField.css("paddingLeft"))+parseInt(jField.css("paddingRight"))); + jField.css('width', w+'px'); } }); } @@ -212,7 +213,7 @@ function verifForm(racine) { function AjaxSqueeze(trig, id, callback) { - var target = $('#'+id); + var target = jQuery('#'+id); // position du demandeur dans le DOM (le donner direct serait mieux) if (!target.size()) {return true;} @@ -245,13 +246,13 @@ function AjaxSqueezeNode(trig, target, f) if (typeof(trig) == 'string') { i = trig.split('?'); trig = i[0] +'?var_ajaxcharset=utf-8&' + i[1]; - return $.ajax({"url":trig,"complete":function(res,status){ + return jQuery.ajax({"url":trig,"complete":function(res,status){ if(res.aborted) return; if(status=='error') { - return $(target).html('Erreur HTTP'); + return jQuery(target).html('Erreur HTTP'); } // Inject the HTML into all the matched elements - $(target).html(res.responseText) + jQuery(target).html(res.responseText) // Execute all the scripts inside of the newly-injected HTML .evalScripts() // Execute callback @@ -260,7 +261,7 @@ function AjaxSqueezeNode(trig, target, f) }}); } - $(trig).ajaxSubmit({"target":target, + jQuery(trig).ajaxSubmit({"target":target, "after":function(res,status){ if(status=='error') return this.html('Erreur HTTP'); callback(res,status); @@ -286,7 +287,7 @@ function charger_id_url(myUrl, myField, jjscript) if (!Field) return true; if (!myUrl) { - $(Field).empty(); + jQuery(Field).empty(); retour_id_url(Field, jjscript); return true; // url vide, c'est un self complet } else { @@ -300,7 +301,7 @@ function charger_node_url(myUrl, Field, jjscript, img) { // disponible en cache ? if (url_chargee[myUrl]) { - var el = $(Field).html(url_chargee[myUrl])[0]; + var el = jQuery(Field).html(url_chargee[myUrl])[0]; retour_id_url(el, jjscript); triggerAjaxLoad(el); return false; @@ -321,7 +322,7 @@ function charger_node_url(myUrl, Field, jjscript, img) function retour_id_url(Field, jjscript) { - $(Field).css({'visibility':'visible','display':'block'}); + jQuery(Field).css({'visibility':'visible','display':'block'}); if (jjscript) jjscript(); } diff --git a/ecrire/exec/admin_plugin.php b/ecrire/exec/admin_plugin.php index 1251dec879..7f82930a1f 100644 --- a/ecrire/exec/admin_plugin.php +++ b/ecrire/exec/admin_plugin.php @@ -233,18 +233,17 @@ function affiche_arbre_plugins($liste_plugins,$liste_plugins_actifs){ $visible = @isset($deplie[$current_dir]); $maxiter=1000; echo http_script(" - $(document).ready( - function(){ - $('input.check').click(function(){\$(this).parent().toggleClass('nomplugin_on');}); + jQuery(function(){ + jQuery('input.check').click(function(){ + jQuery(this).parent().toggleClass('nomplugin_on'); }); - $(document).ready(function(){ - $('div.nomplugin a[@rel=info]').click(function() { - if (!$(this).siblings('div.info').html()) { - $(this).siblings('div.info').prepend(ajax_image_searching).load( - $(this).href().replace(/admin_plugin/, 'info_plugin') + jQuery('div.nomplugin a[@rel=info]').click(function(){ + if (!jQuery(this).siblings('div.info').html()) { + jQuery(this).siblings('div.info').prepend(ajax_image_searching).load( + jQuery(this).attr('href').replace(/admin_plugin/, 'info_plugin') ); } else { - $(this).siblings('div.info').toggle(); + jQuery(this).siblings('div.info').toggle(); } return false; }); -- GitLab