Note : après avoir publié vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

  • Firefox / Safari : maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou appuyez sur Ctrl + F5 ou Ctrl + R (⌘ + R sur un Mac).
  • Google Chrome : appuyez sur Ctrl + Maj + R (⌘ + Shift + R sur un Mac).
  •  Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
function liste_region_en_fr() {   var textbox = $('#wpTextbox1');   var alltext = textbox.val();   var selstart = textbox[0].selectionStart;   var selend = textbox[0].selectionEnd;   var before = alltext.substr(0, selstart);   var selected = alltext.substr(selstart, selend - selstart);   var after = alltext.substr(selend);   var text = selected;   var expr = /region([0-9]+)([^=]+)/m;   var newtext = '';   for (; ; ) {     var res = expr.exec(text);     if (res === null) {       newtext += text;       break;     }     var repl = res[2];     if (repl == 'name') {       repl = 'nom';     } else if (repl == 'color') {       repl = 'couleur';     } else if (repl == 'items') {       repl = 'elements';     }     newtext = newtext + text.substr(0, res.index) + repl + 'region' + res[1];     text = text.substr(res.index + res[0].length);   }   textbox.val(before+newtext+after); }   $(document).ready(function () { 	var myhtml = "<div style='overflow: hidden; height: 33px;clear: both;float: left;width: 100%' id='my-tbl-links'>"; 	myhtml += '<style>#my-tbl-links a{margin-left: 1em;margin-rigth: 1em}</style>'; 	myhtml += '<a href="#">Horaire</a><a href="#">Heure</a><a href="#">Minutes</a><a href="#">€</a>'; 	myhtml += '<a href="#">Lang=</a><a href="#">Regionlist_enfr</a><a href="#">Unité</a>'; 	myhtml += '<a href="#">Marqueur</a><a href="#">Bienvenue</a>'; 	myhtml += '<a href="#">coordPrecision</a>'; 	myhtml += "</div>"; 	 	$(myhtml).insertAfter($(".sections")); 	$("#my-tbl-links a").click(function(event){ 	  event.preventDefault(); 	  var sel = $(this).text(); 	  var text = null; 	  // test type of action 	  if (sel=="Regionlist_enfr") { 	  	liste_region_en_fr(); 	  	return; 	  }  else if (sel=="coordPrecision") { 	  	coordPrecision(); 	  } else if (sel=="Horaire") { 	    text = ["{{Horaire|", "|||||||}}"]; 	  } else if (sel=="Heure") { 	    text = ["{{Heure|", "}}"]; 	  } else if (sel=="Minutes") { 	    text = ["{{Heure||", "}}"]; 	  } else if (sel=="€") { 	    text = ["{{Prix|", "|€}}"]; 	  } else if (sel=="Lang=") { 	    text = ["{{Lang||", "}}"]; 	  } else if (sel=="Unité") { 	    text = ["{{Unité|", "|}}"]; 	  } else if (sel=="Marqueur") { 	    text = ["{{Marqueur|nom=", "|type=|latitude=|longitude=}}"]; 	  } else if (sel=="Bienvenue") { 	    text = ["{{subst", ":Modèle:Bienvenue|}}"]; 	  } 	  if (text===null) { 	    return; 	  } 	  var textbox = $("#wpTextbox1"); 	  var alltext = textbox.val(); 	  var selstart = textbox[0].selectionStart; 	  var selend = textbox[0].selectionEnd; 	  var before = alltext.substr(0, selstart); 	  var selected = alltext.substr(selstart, selend-selstart); 	  var after = alltext.substr(selend); 	  textbox.val(before+text[0]+selected+text[1]+after); 	});          addSourceLink("Permalink", "Permalink"); });  function addSourceLink(special, label) { 	var target = $("#ResumeDeluxe"); 	target.append(" • "); 	var tmp = $("<a href='#'>"+label+" 'En'</a>").appendTo(target); 	 	tmp.click(function(event){ 	  event.preventDefault(); 	  var target = $("#wpSummary"); 	  target.val(target.val()+" Depuis Wikivoyage en anglais ([[en:Special:"+special+"/VERSION|source]])"); 	}); }  var coordPrecision = function () {   function radians(deg) {     return deg * Math.PI / 180;   }   function distance(lon1, lat1, lon2, lat2) {     var radius = 6371; // km     var dlat = radians(lat2 - lat1);     var dlon = radians(lon2 - lon1);     var a = Math.sin(dlat / 2) * Math.sin(dlat / 2) + Math.cos(radians(lat1)) * Math.cos(radians(lat2)) * Math.sin(dlon / 2) * Math.sin(dlon / 2);     var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));     var d = radius * c;     return d;   }   function distance_text(lon1, lat1, lon2, lat2) {     var d = distance(lon1, lat1, lon2, lat2);     return (d > 1) ? (d + 'km')  : (d * 1000 + 'm');   }   function distance_l(lon, lat) {     return distance(lon, lat, lon + 1, lat);   }   function distance_n(lon, lat, n) {     var threshold = Math.pow(10, - n);     return distance(lon, lat, lon + threshold, lat + threshold) * 1000;   }   function round1(num) {     if (num - Math.floor(num) === 0) {       return num;     }     var sign = Math.sign(num);     var positive = num / sign;     var nb_dec = ('' + num).split('.') [1].length;     var mult = Math.pow(10, nb_dec - 1);     return Math.round(num * mult) / mult;   }   function round1_(num) {     if (num - Math.floor(num) === 0) {       return num;     }     var nb_dec = ('' + num).split('.') [1].length;     return parseFloat(num.toFixed(nb_dec - 1));   }   function precision(lorig_lon, orig_lat, lon, lat) {     var lon1 = round1(lon);     var lat1 = round1(lat);     console.log("precision", lon, lon1, lat, lat1);     var p_lon = lon==lon1 ? null : new Point(lon1, lat, distance(lorig_lon, orig_lat, lon1, lat));     var p_lat = lat==lat1 ? null : new Point(lon, lat1, distance(lorig_lon, orig_lat, lon, lat1));     return [p_lon, p_lat];   }   function Point(lon, lat, prec) {     this.lon = lon;     this.lat = lat;     this.prec = prec;     this.label = '';   }   Point.prototype.prec_text = function () {     if (this.prec > 1) {       return this.prec.toFixed(1) + 'km';     } else if (this.prec > 0.001) {       return (this.prec * 1000).toFixed(1) + 'm';     } else {       return (this.prec * 100000).toFixed(1) + 'cm';     }   };   function process(orig_lon, orig_lat) {     var lat = orig_lat;     var lon = orig_lon;     var all_choices = [];     for (var cnt=0; cnt<30;++cnt) {       var res = precision(orig_lon, orig_lat, lon, lat);       var res1 = res[0];       var res2 = res[1];       var choice = null;       //console.log(res1, res2);       if (res1 === null) {         if (res2 !== null) {           choice = res2;         }       } else if (res2 === null) {         choice = res1;       } else {         choice = res1.prec < res2.prec ? res1 : res2;       }       if (choice === null) {         break;       }       all_choices.push(choice);       console.log('longitude=' + choice.lon + ' | latitude=' + choice.lat + ' => ' + choice.prec_text());       lon = choice.lon;       lat = choice.lat;     }     // display      var limits = [       ['shop',       0.001],       [         'city',         0.25       ],       [         'big city',         3       ]     ];     var prev = null;     for (cnt in all_choices) {       var choice2 = all_choices[cnt];       console.log(limits);       if (limits.length > 0 && choice2.prec > limits[0][1]) {         if (prev === null) {           choice2.label = limits[0][0];         } else {           prev.label = limits[0][0];         }         limits.shift();       }       prev = choice2;     }     // display result      $('#coordPrecision').remove();     $('.editOptions').before('<div id=\'coordPrecision\'><ul/></div>');     var out = $('#coordPrecision ul');     for (cnt in all_choices) {       var choice3 = all_choices[cnt];       var txt = 'latitude=' + choice3.lat + ' | longitude=' + choice3.lon + ' => ' + choice3.prec_text();       if (choice3.label !== '') {         txt += ' (' + choice3.label + ')';       }       out.append('<li>' + txt + '</li>');     }   }   function processGUI() {     var textbox = $('#wpTextbox1');     var alltext = textbox.val();     var selstart = textbox[0].selectionStart;     var selend = textbox[0].selectionEnd;     var selected = alltext.substr(selstart, selend - selstart);     var res = /latitude *= *(-?[0-9.]+)/.exec(selected);     if (res != null) {       var lat = res[1];       var res = /longitude *= *(-?[0-9.]+)/.exec(selected);       if (res != null) {         process(parseFloat(res[1]), parseFloat(lat));       }     }   }   return processGUI; }();