X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=www%2Fprive%2Fjavascript%2FajaxCallback.js;h=3df5c8847ef17b9937fa9618f9704fd005e8533e;hb=cc641eb476987612f6d6df1a5417c1c5582a8ab8;hp=8d5d7a0752a1df8c4c17eed83c85ded1bd66dc4d;hpb=a33c2ba9d919664b3bb0f565f8e9a8b9d8530cdb;p=lhc%2Fweb%2Fclavette_www.git diff --git a/www/prive/javascript/ajaxCallback.js b/www/prive/javascript/ajaxCallback.js index 8d5d7a0..3df5c88 100644 --- a/www/prive/javascript/ajaxCallback.js +++ b/www/prive/javascript/ajaxCallback.js @@ -136,7 +136,7 @@ jQuery.fn.positionner = function(force, setfocus) { jQuery.spip.virtualbuffer_id='spip_virtualbufferupdate'; jQuery.spip.initReaderBuffer = function(){ if (jQuery('#'+jQuery.spip.virtualbuffer_id).length) return; - jQuery('body').append('

'); + jQuery('body').append('

'); } jQuery.spip.updateReaderBuffer = function(){ var i = jQuery('#'+jQuery.spip.virtualbuffer_id); @@ -151,7 +151,9 @@ jQuery.fn.formulaire_setARIA = function(){ // eviter une double execution du js au moment de sa reinsertion dans le DOM par wrap() // cf http://bugs.jquery.com/ticket/7447 this.find('script').remove(); - this.wrap('
'); + this.wrap('
'); + // dans un formulaire, le screen reader relit tout a chaque saisie d'un caractere si on est en aria-live + jQuery('form',this).not('[aria-live]').attr('aria-live','off'); } return this; } @@ -647,7 +649,12 @@ jQuery.fn.ajaxbloc = function() { if (jQuery.spip.ajaxReload(blocfrag,options)) // don't trig reload of parent blocks event.stopPropagation(); - }).addClass('bind-ajaxReload'); + }).addClass('bind-ajaxReload') + .attr('aria-live','polite').attr('aria-atomic','true'); + + // dans un formulaire, le screen reader relit tout a chaque saisie d'un caractere si on est en aria-live + // mettre un aria-live="off" sur les forms inclus dans ce bloc aria-live="polite" + jQuery('form',this).not('[aria-live]').attr('aria-live','off'); jQuery(ajaxbloc_selecteur,this).not('.noajax,.bind-ajax') .click(function(){return jQuery.spip.ajaxClick(blocfrag,this.href,{force:jQuery(this).is('.nocache'),history:!(jQuery(this).is('.nohistory')||jQuery(this).closest('.box_modalbox').length)});}) @@ -863,12 +870,13 @@ function parametre_url(url,c,v,sep,force_vide){ if (p>0) a=url.substring(0,p); args = url.substring(p+1).split('&'); } - else - a=url; + else + a=url; var regexp = new RegExp('^(' + c.replace('[]','\\[\\]') + '\\[?\\]?)(=.*)?$'); var ajouts = []; var u = (typeof(v)!=='object')?encodeURIComponent(v):v; var na = []; + var v_read = null; // lire les variables et agir for(var n=0;n2 && typeof r[2]!=='undefined')?r[2].substring(1):''; + // c'est un tableau, on memorise les valeurs + if (r[1].substr(-2) == '[]') { + if (!v_read) v_read = []; + v_read.push((r.length>2 && typeof r[2]!=='undefined')?r[2].substring(1):''); + } + // c'est un scalaire, on retourne direct + else { + return (r.length>2 && typeof r[2]!=='undefined')?r[2].substring(1):''; + } } // suppression else if (!v.length) { } // Ajout. Pour une variable, remplacer au meme endroit, // pour un tableau ce sera fait dans la prochaine boucle - else if (r[1].substring(-2) != '[]') { + else if (r[1].substr(-2) != '[]') { na.push(r[1]+'='+u); ajouts.push(r[1]); } - else na.push(args[n]); + /* Pour les tableaux ont laisse tomber les valeurs de départ, on + remplira à l'étape suivante */ + // else na.push(args[n]); } else na.push(args[n]); } - if (v==null) return v; // rien de trouve + if (v==null) return v_read; // rien de trouve ou un tableau // traiter les parametres pas encore trouves if (v || v.length || force_vide) { ajouts = "="+ajouts.join("=")+"=";