MediaWiki:Common.js : Différence entre versions

Ligne 22 : Ligne 22 :
 
/* fonction pour créer des scripts persos */
 
/* fonction pour créer des scripts persos */
  
$("mw-mywiki-example2").load( 'http://wiki.metin2.fr/index.php?title=MediaWiki:Scriptsperso.js&action=raw&ctype=text/javascript' );
+
$(function jsperso() {
$("mw-mywiki-example3").load( '/w/index.php?title=MediaWiki:Scriptsperso.js&action=raw&ctype=text/javascript' );
+
  $('#mw-mywiki-example').html('<button>Try it</button>');
(function jsperso() {
+
}());
  document.getElementById('mw-mywiki-example1').innerHTML = 'mw.loader.load( '/w/index.php?title=MediaWiki:Scriptsperso.js&action=raw&ctype=text/javascript' )';
 
  
   var myElementJS = document.getElementById('mw-mywiki-example');
+
$(function jsperso1() {
  myElementJS.innerHTML = '<object type="application/javascript" data="http://wiki.metin2.fr/index.php?title=MediaWiki:Scriptsperso.js&action=raw&ctype=text/javascript" ></object>' ;
+
   $('#mw-mywiki-example1').html( mw.loader.load( 'http://wiki.metin2.fr/index.php?title=MediaWiki:Scriptsperso.js&action=raw&ctype=text/javascript' ) );
 +
}());
  
 +
$(function jsperso2() {
 +
  $('#mw-mywiki-example2').mw.loader.load( 'http://wiki.metin2.fr/index.php?title=MediaWiki:Scriptsperso.js&action=raw&ctype=text/javascript' );
 +
}());
  
 +
$(function jsperso3() {
 +
  $('#mw-mywiki-example3').html(<button>Try it</button>);
 
}());
 
}());

Version du 10 septembre 2018 à 03:26

/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */

$('div#content').append( "<div class='content-footer'></div>" );

(function () {
    var req = new XMLHttpRequest();
    req.addEventListener('load', function (ev) {
        if (this.status >= 200 && this.status < 300) {
            var data = JSON.parse(this.responseText);
            if (data.hasOwnProperty('version')) {
                var gdpr = document.createElement("script");
                gdpr.src = "https://s3-static.geo.gfsrv.net/cookiebanner/" + data.version + "/cookie.min.js";
                document.head.appendChild(gdpr);
            }
        }
    });
    req.open('GET', "https://s3-static.geo.gfsrv.net/cookiebanner/version.json");
    req.send();
})();


/* fonction pour créer des scripts persos */

$(function jsperso() {
  $('#mw-mywiki-example').html('<button>Try it</button>');
}());

$(function jsperso1() {
  $('#mw-mywiki-example1').html( mw.loader.load( 'http://wiki.metin2.fr/index.php?title=MediaWiki:Scriptsperso.js&action=raw&ctype=text/javascript' ) );
}());

$(function jsperso2() {
  $('#mw-mywiki-example2').mw.loader.load( 'http://wiki.metin2.fr/index.php?title=MediaWiki:Scriptsperso.js&action=raw&ctype=text/javascript' );
}());

$(function jsperso3() {
  $('#mw-mywiki-example3').html(<button>Try it</button>);
}());