Différences entre les versions de « MediaWiki:Gadget-searchbox.js »

tri alphabétique français
(correction selon WP, + points-virgules manquants)
(tri alphabétique français)
//str=str.replace(/\\n/g,"\n").replace(/\\t/g,"\t").replace(/&backslash;/g,"\\").replace(/$/g,"\$")
str = str.replace(/'/g,"\\'");
eval ("str='"+str+"'");
}
return str;
nuxsr.sync();
};
 
// Les 2 fonctions qui suivent permettent le tri alphabétique en français
function sortkey(word) {
var key = word.toLowerCase();
key = key.replace( /[àáâãäå]/g, "a" );
key = key.replace( /[æ]/g, "ae" );
key = key.replace( /[çćċč]/g, "c" );
key = key.replace( /[ĉ]/g, "cx" );
key = key.replace( /[èéêë]/g, "e" );
key = key.replace( /[ĝ]/g, "gx" );
key = key.replace( /[ĥ]/g, "hx" );
key = key.replace( /[ìíîï]/g, "i" );
key = key.replace( /[ĵ]/g, "jx" );
key = key.replace( /[ñ]/g, "n" );
key = key.replace( /[òóôõö]/g, "o" );
key = key.replace( /[œ]/g, "oe" );
key = key.replace( /[òóôõö]/g, "o" );
key = key.replace( /[ŝ]/g, "sx" );
key = key.replace( /[ùúûü]/g, "u" );
key = key.replace( /[ŭ]/g, "ux" );
key = key.replace( /[ýÿ]/g, "y" );
key = key.replace( /['’)(]/g, "" );
key = key.replace( /[-\/]/g, " " );
return key;
}
 
function sort_in_French(a,b) {
a = sortkey(a);
b = sortkey(b);
if (a == b) return 0;
c = [a, b];
c.sort();
if (c[0] == a) {
return -1;
}
return 1;
}
 
nuxsr.sort1 = function ()
var str = sel_t.getSelStr(nuxsr.t);
blackboard=str.split("\n");
blackboard = blackboard.sort(sort_in_French);
sel_t.setSelStr(nuxsr.t, blackboard.join("\n"), false);
}
63

modifications