jQuery.spip.virtualbuffer_id='spip_virtualbufferupdate';
jQuery.spip.initReaderBuffer = function(){
if (jQuery('#'+jQuery.spip.virtualbuffer_id).length) return;
- jQuery('body').append('<p style="float:left;width:0;height:0;position:absolute;left:-5000;top:-5000;"><input type="hidden" name="'+jQuery.spip.virtualbuffer_id+'" id="'+jQuery.spip.virtualbuffer_id+'" value="0" /></p>');
+ jQuery('body').append('<p style="float:left;width:0;height:0;position:absolute;left:-5000px;top:-5000px;"><input type="hidden" name="'+jQuery.spip.virtualbuffer_id+'" id="'+jQuery.spip.virtualbuffer_id+'" value="0" /></p>');
}
jQuery.spip.updateReaderBuffer = function(){
var i = jQuery('#'+jQuery.spip.virtualbuffer_id);
// 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('<div class="ariaformprop" aria-live="assertive" aria-atomic="true"></div>');
+ this.wrap('<div class="ariaformprop" aria-live="polite" aria-atomic="true" aria-relevant="additions"></div>');
+ // 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;
}
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)});})
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;n<args.length;n++){
var val = args[n];
var r=val.match(regexp);
if (r && r.length){
if (v==null){
- return (r.length>2 && 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("=")+"=";