Note : après avoir enregistré la page, vous devrez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

Mozilla / Firefox / Konqueror / Safari : maintenez la touche Majuscule (Shift) en cliquant sur le bouton Actualiser (Reload) ou pressez Maj-Ctrl-R (Cmd-R sur Apple Mac) ;

Chrome / Internet Explorer / Opera : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5.
/**
 * to benefit of this script 
 * you need to load this javascript into your monobook.js
 * by putting in it 
 *
 * importScript('User:Esby/link-helper.js');
 *
 * 
 * Implements various displaying of wiki and non wiki links for copy/pasting.
 * 
 * 
 * author esby 
 */
 
/* Configuration: */
 
// in your monobook.js, set this variable to true to disable this script.

var nsl_disable = false;
 
var nsl_base;
var nsl_sec_base;

nsl_base = "http://commons.wikimedia.org/wiki/";
nsl_sec_base = "https://secure.wikimedia.org/wikipedia/commons/wiki/";

if ( wgNoticeProject == 'wikipedia')
{
  nsl_base = "http://" +  mw.config.get('wgContentLanguage') + ".wikipedia.org/wiki/";
  nsl_sec_base = "https://secure.wikimedia.org/wikipedia/" + mw.config.get('wgContentLanguage') + "/wiki/";
}
 
// define some meta-variables
var nsl_first = true; // the first iteration?

var nsl_g_form = false;

var nsl_wikified_url;
var nsl_wikified_url_prefix;
var nsl_normal_url;
var nsl_secure_url

var use_prefixed;
var use_secure;

use_prefixed = true;
use_secure = false;

function nsl_calc_strings()
{
  nsl_wikified_url = '[[' + mw.config.get('wgPageName') + '|' + mw.config.get('wgFormattedNamespaces')[mw.config.get('wgNamespaceNumber')] + ':' + mw.config.get('wgTitle') + ']]';
  if (mw.config.get('wgNamespaceNumber') == 0 ) // no name space
    nsl_wikified_url = '[[' + mw.config.get('wgPageName') + '|' + mw.config.get('wgTitle') + ']]';
  if (mw.config.get('wgNamespaceNumber') == 14 ) // categories
    nsl_wikified_url = '[[' + mw.config.get('wgPageName') + '|' + mw.config.get('wgCanonicalNamespace') + ':' + mw.config.get('wgTitle') + ']]';
  if (mw.config.get('wgNamespaceNumber') == 6 ) // files
    nsl_wikified_url = '[[' + mw.config.get('wgPageName') + '|' + 'thumb|left|'  + mw.config.get('wgCanonicalNamespace') + ':' + mw.config.get('wgTitle') + ']]';
  if (mw.config.get('wgNamespaceNumber') == 10 ) // templates
    nsl_wikified_url = '{{' + mw.config.get('wgTitle') + '|'+ '}}';

  nsl_wikified_url_prefix = '[[:' + mw.config.get('wgPageName') + '|' + mw.config.get('wgFormattedNamespaces')[mw.config.get('wgNamespaceNumber')] + ':' + mw.config.get('wgTitle') + ']]';
  if (mw.config.get('wgNamespaceNumber') == 0 )
    nsl_wikified_url_prefix = '[[:' + mw.config.get('wgPageName') + '|' + mw.config.get('wgTitle') + ']]';
  if (mw.config.get('wgNamespaceNumber') == 10 )
    nsl_wikified_url_prefix = '<nowiki>{{</nowiki>[[:' + mw.config.get('wgPageName') + '|'+ ']]<nowiki>}}</nowiki>';


  nsl_normal_url = nsl_base + mw.config.get('wgPageName');   

  nsl_secure_url = nsl_sec_base + mw.config.get('wgPageName');
}

function nsl_get_wikitext()
{
  use_prefixed = !(use_prefixed);
  if (!use_prefixed)
    return nsl_wikified_url;
  else
   return nsl_wikified_url_prefix;
}

function nsl_get_url()
{
  use_secure = !(use_secure);
  if (!use_secure)
    return nsl_secure_url;
  else
    return nsl_normal_url;
}

// build widget 
function nsl_buildWidget() {

    // preventing multiple widget to be build per page
    if (nsl_g_form) return;

    // set up the floating form
    var form = document.createElement('form');

    form.appendSpace = function()   
    {
      this.appendChild(document.createTextNode(' '));
    }

    form.appendBR = function()   
    {
      this.appendChild(document.createElement('br'));
    }

    form.className = 'nsl_info';

    form.onsubmit = function() {
        return false; // don't perform action
    };


    // determining the urls
    nsl_calc_strings();

    // button to swap wiki url fields.
    var submit = document.createElement('input');
    submit.setAttribute('type', 'submit');
    submit.value = '!';
    submit.className = 'nsl_swap_wikitext';
    submit.onclick = function() {
       nsl_box1.value = nsl_get_wikitext();
       exit;
    };
    form.appendChild(submit);
    form.appendSpace()

    // wikisyntax
    // input box for the nsl info
    var input = document.createElement('input');
    input.setAttribute('type', 'text');
    input.setAttribute('size', '80');
    input.setAttribute('maxlength', '250');
    input.onclick = function() { this.select(); };
    input.className = 'nsl_output_wikiname';
    input.value = nsl_get_wikitext();
    nsl_box1 = input;    
    form.appendChild(input);
    form.appendSpace();

    form.appendBR();

    // button to swap url fields
    var submit = document.createElement('input');
    submit.setAttribute('type', 'submit');
    submit.value = '!';
    submit.className = 'nsl_swap_url';
    submit.onclick = function() {
       nsl_box2.value = nsl_get_url();
       exit;
    };

    form.appendChild(submit);
    form.appendSpace()  
  
    // non secure information
    // input box for the nsl info
    var input = document.createElement('input');
    input.setAttribute('type', 'text');
    input.setAttribute('size', '80');
    input.setAttribute('maxlength', '250');
    input.onclick = function() { this.select(); };
    input.className = 'nsl_output';
    input.value = nsl_get_url();
    nsl_box2 = input;
    form.appendChild(input);
    form.appendSpace()

    nsl_g_form = form;
    var bodyContent = document.getElementById('bodyContent');
    bodyContent.insertBefore(nsl_g_form, bodyContent.firstChild);
}

function nsl_init()
{
 // possible site for cookie checking to disable language select
  if (nsl_disable) 
    return;

  // if it's the first iteration...
  if (nsl_first) 
  {
     nsl_buildWidget();
  } 
  nsl_first = false;
}

function nsl_register() {
    nsl_init();
}

// register as onload function (there must be a better way)
if (window.addEventListener) {
    window.addEventListener("load", nsl_register, true);
} else if (window.attachEvent) {
    window.attachEvent("onload", nsl_register);
}