MediaWiki:Common.js : Différence entre versions
Ligne 8 : | Ligne 8 : | ||
(function () { | (function () { | ||
− | var myElement = document.getElementById('mw- | + | var myElement = document.getElementById('mw-rendu-maths'); |
− | myElement.insertAdjacentHTML('afterend', '<input></input>'); | + | myElement.insertAdjacentHTML('afterend', ' |
+ | <form name="a" action="#"> | ||
+ | <tr> | ||
+ | <td>test</td> | ||
+ | <td><input name="c" id="c" type="text" size="2" value="2" /></td> | ||
+ | <td><input name="d" type="text" size="5" value="5" /></td> | ||
+ | <td><input name="b" type="text" size="5" /></td> | ||
+ | <tr> | ||
+ | <form> | ||
+ | '); | ||
})(); | })(); | ||
(function Calculer() { | (function Calculer() { | ||
− | var | + | var element1 = document.getElementById('a'); |
− | document. | + | var element2 = document.getElementById('b'); |
− | + | var element3 = document.getElementById('c'); | |
− | + | var element4 = document.getElementById('d'); | |
− | + | element4.value = element1.value+element2.value; | |
− | + | })(); | |
− | |||
− | |||
− | |||
Version du 22 septembre 2021 à 10:25
/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */
/*Favicon*/
$('link[rel="shortcut icon"]').attr('href', 'https://gf1.geo.gfsrv.net/cdn98/191b803adbf82f4b8febe3a2c38c2c.ico');
/*test*/
(function () {
var myElement = document.getElementById('mw-rendu-maths');
myElement.insertAdjacentHTML('afterend', '
<form name="a" action="#">
<tr>
<td>test</td>
<td><input name="c" id="c" type="text" size="2" value="2" /></td>
<td><input name="d" type="text" size="5" value="5" /></td>
<td><input name="b" type="text" size="5" /></td>
<tr>
<form>
');
})();
(function Calculer() {
var element1 = document.getElementById('a');
var element2 = document.getElementById('b');
var element3 = document.getElementById('c');
var element4 = document.getElementById('d');
element4.value = element1.value+element2.value;
})();
/* Pour les cookies */
(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();
})();