« MediaWiki:Common.js » : différence entre les versions

Page de l’interface de MediaWiki
(Support du texte marquee)
(Résolution de bugs)
 
(12 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */
"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime=function e(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(s){c=function t(e,r,n){return e[r]=n}}function u(t,e,r,o){var i,a,l,c,s=Object.create((e&&e.prototype instanceof p?e:p).prototype);return n(s,"_invoke",{value:(i=t,a=r,l=new L(o||[]),c="suspendedStart",function(t,e){if("executing"===c)throw Error("Generator is already running");if("completed"===c){if("throw"===t)throw e;return C()}for(l.method=t,l.arg=e;;){var r=l.delegate;if(r){var n=b(r,l);if(n){if(n===h)continue;return n}}if("next"===l.method)l.sent=l._sent=l.arg;else if("throw"===l.method){if("suspendedStart"===c)throw c="completed",l.arg;l.dispatchException(l.arg)}else"return"===l.method&&l.abrupt("return",l.arg);c="executing";var o=f(i,a,l);if("normal"===o.type){if(c=l.done?"completed":"suspendedYield",o.arg===h)continue;return{value:o.arg,done:l.done}}"throw"===o.type&&(c="completed",l.method="throw",l.arg=o.arg)}})}),s}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(n){return{type:"throw",arg:n}}}t.wrap=u;var h={};function p(){}function d(){}function y(){}var m={};c(m,i,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(k([])));g&&g!==e&&r.call(g,i)&&(m=g);var $=y.prototype=p.prototype=Object.create(m);function w(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function _(t,e){var o;n(this,"_invoke",{value:function n(i,a){function l(){return new e(function(n,o){!function n(o,i,a,l){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==_typeof(u)&&r.call(u,"__await")?e.resolve(u.__await).then(function(t){n("next",t,a,l)},function(t){n("throw",t,a,l)}):e.resolve(u).then(function(t){s.value=t,a(s)},function(t){return n("throw",t,a,l)})}l(c.arg)}(i,a,n,o)})}return o=o?o.then(l,l):l()}})}function b(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=TypeError("The iterator does not provide a '"+r+"' method")),h;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=TypeError("iterator result is not an object"),e.delegate=null,h)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=y,n($,"constructor",{value:y,configurable:!0}),n(y,"constructor",{value:d,configurable:!0}),d.displayName=c(y,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,c(t,l,"GeneratorFunction")),t.prototype=Object.create($),t},t.awrap=function(t){return{__await:t}},w(_.prototype),c(_.prototype,a,function(){return this}),t.AsyncIterator=_,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new _(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w($),c($,l,"Generator"),c($,i,function(){return this}),c($,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,L.prototype={constructor:L,reset:function t(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=void 0)},stop:function t(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function t(e){if(this.done)throw e;var n=this;function o(t,r){return l.type="throw",l.arg=e,n.next=t,r&&(n.method="next",n.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],l=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function t(e,n){for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=n&&n<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=n,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(l)},complete:function t(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),h},finish:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;E(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function t(e,r,n){return this.delegate={iterator:k(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var l=t[i](a),c=l.value}catch(s){r(s);return}l.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){asyncGeneratorStep(i,n,o,a,l,"next",t)}function l(t){asyncGeneratorStep(i,n,o,a,l,"throw",t)}a(void 0)})}}function UpdateCounters(t,e){return _UpdateCounters.apply(this,arguments)}function _UpdateCounters(){return(_UpdateCounters=_asyncToGenerator(_regeneratorRuntime().mark(function t(e,r){var n;return _regeneratorRuntime().wrap(function t(o){for(;;)switch(o.prev=o.next){case 0:return e=document.getElementById(e),o.next=3,new Promise(function(t){var r=setInterval(function(){var n=e.getBoundingClientRect();n.bottom<0||n.top-Math.max(document.documentElement.clientHeight,window.innerHeight)>=0||(clearInterval(r),t())},500)});case 3:n=0;case 4:if(!(n<=r)){o.next=11;break}return e.innerText=n.toLocaleString(navigator.language,{notation:"compact",compactDisplay:"short",maximumFractionDigits:1}),o.next=8,new Promise(function(t){setTimeout(t,10)});case 8:n+=Math.ceil(r/100),o.next=4;break;case 11:case"end":return o.stop()}},t)}))).apply(this,arguments)}function SwitchMainForm(t){var e=document.getElementById("main-form"),r=e.querySelector("input[type='hidden']"),n=e.querySelector("input:not([type='hidden'])"),o=e.querySelector("button");switch(t){case"search":r.value="title",r.name="Sp%C3%A9cial%3ARecherche",n.name="search",n.placeholder="Rechercher",n.removeAttribute("dir"),o.removeAttribute("name"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/></svg>';break;case"new-article":r.value="edit",r.name="action",n.name="title",n.placeholder="Cr\xe9er un article",n.dir="ltr",o.name="create",o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" fill="currentColor" class="bi bi-plus-lg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2"/></svg>'}}if(document.documentElement.classList.contains("skin-citizen-dark")&&!("/index.php/Accueil"===window.location.pathname||window.location.href.includes("?title=Accueil"))&&document.querySelectorAll("table").forEach(function(t){""===t.style.backgroundColor||"transparent"===t.style.backgroundColor?t.querySelectorAll("td").forEach(function(t){""===t.style.backgroundColor||"transparent"===t.style.backgroundColor||(t.style.backgroundColor="#212630",t.style.border="2px solid rgb(101 133 209)",t.style.margin="5px")}):t.style.backgroundColor="#212630"}),"/index.php/Accueil"===window.location.pathname||window.location.href.includes("?title=Accueil")){if(!CSS.supports("selector(:has(+ *)")){var t=document.getElementsByClassName("citizen-body-container")[0];t.style.setProperty("display","block","important"),t.style.setProperty("margin","0","important"),t.style.setProperty("padding","0","important"),document.getElementsByClassName("mw-body-header")[0].style.setProperty("display","none","important"),document.getElementsByClassName("mw-body-footer")[0].style.setProperty("display","none","important"),document.getElementById("citizen-body-header-sticky-sentinel").style.setProperty("display","none","important"),document.getElementsByClassName("citizen-footer")[0].style.setProperty("margin-top","0","important"),document.getElementsByClassName("mw-body")[0].style.setProperty("margin-top","-1rem")}fetch("https://wikithionville.fr/api.php?action=query&meta=userinfo|siteinfo&uiprop=rights|editcount|realname&siprop=statistics&format=json").then(function(t){return t.json()}).then(function(t){t.query.userinfo.rights.includes("edit")&&SwitchMainForm("new-article"),document.getElementsByClassName("counters")[0].style.display="flex",UpdateCounters("counter_articles",t.query.statistics.articles),UpdateCounters("counter_pages",t.query.statistics.pages),UpdateCounters("counter_utilisateurs",t.query.statistics.users),t.query.userinfo.editcount>0&&(document.getElementById("ccard_contribperso").style.display="flex",UpdateCounters("counter_contribperso",t.query.userinfo.editcount))}),document.addEventListener("scroll",function(){UpdateScroll()}),UpdateScroll(),addPopCarouselBtns(),initCards()}function UpdateScroll(){var t=window.scrollY+window.innerHeight/3;[].forEach.call(document.getElementsByClassName("panel"),function(e){e.offsetTop<=t&&e.offsetTop+e.clientHeight>t&&(document.getElementById("wiki-home").style.backgroundColor=e.getAttribute("bg"),[].forEach.call(document.querySelectorAll("#progress a"),function(t){t.getAttribute("href")==="#"+e.id?t.classList.add("active"):t.classList.remove("active")}))}),document.getElementById("img-beffroi").style.transform="translate3d(-".concat(Math.min(window.scrollY/document.getElementById("plusdinfo").offsetTop*30,30),"vw, 0, 0)")}function addPopCarouselBtns(){var t=document.querySelector(".home-header #popular ul"),e=document.getElementById("popular-next"),r=document.getElementById("popular-prev");if(t){var n=function n(){t.scrollWidth-t.clientWidth>0?(e.style.display="block",r.style.display="block"):(e.style.display="none",r.style.display="none")};e.addEventListener("click",function(){t.scrollTo({left:Math.min(t.scrollWidth,t.scrollLeft+.8*t.clientWidth),behavior:"smooth"})}),r.addEventListener("click",function(){t.scrollTo({left:Math.max(0,t.scrollLeft-.8*t.clientWidth),behavior:"smooth"})}),window.addEventListener("resize",n),n(),t.querySelectorAll("li").forEach(function(t){fetch("https://wikithionville.fr/api.php?action=query&format=json&redirects&generator=images&prop=imageinfo&iiprop=url|dimensions&titles=".concat(new URL(t.querySelector("a").href,"https://wikithionville.fr").searchParams.get("title"))).then(function(t){return t.json()}).then(function(e){var r,n,o,i,a,l,c=Object.values(null==e?void 0:null===(r=e.query)||void 0===r?void 0:r.pages),s=c.filter(function(t){return t.imageinfo&&t.imageinfo[0].width*t.imageinfo[0].height>122500&&t.imageinfo[0].url});n=s.length>0?null==s?void 0:null===(o=s[Math.round(Math.random()*((null==s?void 0:s.length)-1))])||void 0===o?void 0:null===(i=o.imageinfo[0])||void 0===i?void 0:i.url:null===(a=c.at(-1))||void 0===a?void 0:null===(l=a.imageinfo[0])||void 0===l?void 0:l.url;var u=t.querySelector("img");u.loading="lazy",u.src=n,u.onerror=function(t){u.src="/home/article_placeholder.svg"}}),t.addEventListener("click",function(){t.querySelector("a").click()})})}}function initCards(){[].forEach.call(document.getElementsByClassName("card-li"),function(t){var e=t.querySelectorAll(".card-container");t.addEventListener("mousemove",function(t){e.forEach(function(e){var r=e.querySelector(".blob"),n=e.querySelector(".fakeblob").getBoundingClientRect();r.animate([{transform:"translate3d(".concat(t.clientX-n.left-n.width/2,"px,").concat(t.clientY-n.top-n.height/2,"px, 0)")}],{duration:200,fill:"forwards"})})},{passive:!0})})}[].forEach.call(document.getElementsByClassName("text-marquee"),function(t){var e=t.querySelector("*"),r=t.clientWidth-e.scrollWidth,n=Math.max(Math.round(-r/15),1);r<0&&(t.style.animation=n+"s linear infinite alternate paused gardient_slide",e.style.setProperty("--ofw",r+"px"),e.style.animation=n+"s linear infinite alternate paused text_slide")});
/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */
/**
* Ajouter un bouton à la fin de la barre d'outils
*/
function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) {
  // Supprimée car non fonctionelle
  // mwCustomEditButtons[mwCustomEditButtons.length] =
  //  {"imageId": imageId,
  //    "imageFile": imageFile,
  //    "speedTip": speedTip,
  //    "tagOpen": tagOpen,
  //    "tagClose": tagClose,
  //    "sampleText": sampleText};
}
/**
* Insertion de nouveaux boutons dans la barre d'outil
*/
 
 
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/1/1f/Button_mp3.png',
                'Insérer un fichier mp3',
                '<flashmp3> NomFichier.mp3 </flashmp3>',
                '',
                '',
                'mw-editbutton-mp3');
 
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/9/92/Nuvola-Multimedia01.png',
                'Video',
                '{{',
                '}}',
                '#ev:service|code|taille',
                'mw-editbutton-video');
 
               
 
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/0/04/Button_array.png',
                'Tableau',
                '{| border=1\n|-\n|\n|\n|}',
                '',
                '',
                'mw-editbutton-array');
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/c/c9/Button_strike.png',
                'Rayer',
                '<s>',
                '</s>',
                '',
                'mw-editbutton-strike');
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/8/88/Btn_toolbar_enum.png',
                'Énumération',
                '\n# élément 1\n# élément 2\n# élément 3',
                '',
                '',
                'mw-editbutton-enum');
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/1/11/Btn_toolbar_liste.png',
                'Liste',
                '\n* élément A\n* élément B\n* élément C',
                '',
                '',
                'mw-editbutton-liste');
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/9/9e/Btn_toolbar_gallery.png',
                'Galerie d\'images',
                '\n<!--Consultez l Anti-sèche pour les options de la galerie-->\n<center>\n<gallery caption="Donner un titre à votre galerie">\nImage:Exemple.jpg|légende\nImage:Exemple1.jpg|légende\nImage:Exemple2.jpg|légende\n</gallery>\n</center>',
                '',
                '',
                'mw-editbutton-gallery');
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
                'Commentaire',
                '<!--',
                '-->',
                '',
                'mw-editbutton-comment');
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/4/47/Button_redir.png',
                'Redirection',
                '#REDIRECT [[',
                ']]',
                'nom de la destination',
                'mw-editbutton-redir');
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/b/b4/Button_category03.png',
                'Catégorie',
                '[[Catégorie:',
                ']]',
                'nom de la catégorie',
                'mw-editbutton-category');
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/3/3b/Button_template_alt.png',
                'Modèle',
                '{{',
                '}}',
                'modèle ou page à inclure',
                'mw-editbutton-template');
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/c/c4/Button_ref.png',
                'Référence',
                '<ref>',
                '</ref>',
                'référence, citation ou lien',
                'mw-editbutton-ref');
 
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/6/64/Buttonrefvs8.png',
                'Index des références',
                '== Notes et références ==\n<references />',
                '',
                '',
                'mw-editbutton-references');
 
var voirAussi = '<!-- Suggestion de présentation des annexes. Aide : http://fr.wikipedia.org/wiki/Aide:Note -->\n'
+ '== Annexes ==\n'
+ '=== Notes et références ===\n'
+ '<references/>\n'
+ '=== Articles connexes ===\n'
+ '* [[À remplacer]]\n'
+ '*\n'
+ '=== Liens et documents externes ===\n'
+ '*\n';
addCustomButton('http://upload.wikimedia.org/wikipedia/commons/b/bb/Seealso.png',
                'Section Voir aussi',
                voirAussi,
                '',
                '',
                'mw-editbutton-voiraussi');
 
// ######## NEW CODE ########
// Change table card to dark if it's has a color if isn't, apply this modification to the td (for buttons)
if (document.documentElement.classList.contains("skin-citizen-dark")&&!(window.location.pathname==='/index.php/Accueil'||window.location.href.includes("?title=Accueil"))) {
  document.querySelectorAll("table").forEach(function(table){
    if (!(table.style.backgroundColor===""||table.style.backgroundColor==="transparent")) {
      table.style.backgroundColor="#212630"
    }else{
      table.querySelectorAll("td").forEach(function(td){
        if (!(td.style.backgroundColor===""||td.style.backgroundColor==="transparent")) {
          td.style.backgroundColor="#212630"
          td.style.border="2px solid rgb(101 133 209)"
          td.style.margin="5px"
        }
      })
    }
  })  
}
 
"use strict";
 
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function UpdateCounters(_x, _x2) {
  return _UpdateCounters.apply(this, arguments);
}
function _UpdateCounters() {
  _UpdateCounters = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(elm, value) {
    var count;
    return _regeneratorRuntime().wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          elm = document.getElementById(elm);
          _context.next = 3;
          return new Promise(function (r) {
            var interval = setInterval(function () {
              var rect = elm.getBoundingClientRect();
              if (!(rect.bottom < 0 || rect.top - Math.max(document.documentElement.clientHeight, window.innerHeight) >= 0)) {
                clearInterval(interval);
                r();
              }
            }, 500);
          });
        case 3:
          count = 0;
        case 4:
          if (!(count <= value)) {
            _context.next = 11;
            break;
          }
          elm.innerText = count.toLocaleString(navigator.language, {
            notation: "compact",
            compactDisplay: "short",
            maximumFractionDigits: 1
          });
          _context.next = 8;
          return new Promise(function (r) {
            setTimeout(r, 10);
          });
        case 8:
          count += Math.ceil(value / 100);
          _context.next = 4;
          break;
        case 11:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
  return _UpdateCounters.apply(this, arguments);
}
if (window.location.pathname === '/index.php/Accueil' || window.location.href.includes("?title=Accueil")) {
  fetch("https://wikithionville.fr/api.php?action=query&meta=userinfo|siteinfo&uiprop=rights|editcount|realname&siprop=statistics&format=json").then(function (res) {
    return res.json();
  }).then(function (res) {
    if (res.query.userinfo.rights.includes("edit")) {
      document.getElementById("search_form").style.display = "none";
      document.getElementById("new_article_form").style.display = "flex";
    }
    document.getElementsByClassName("counters")[0].style.display = "flex";
    UpdateCounters("counter_articles", res.query.statistics.articles);
    UpdateCounters("counter_pages", res.query.statistics.pages);
    UpdateCounters("counter_utilisateurs", res.query.statistics.users);
    if (res.query.userinfo.editcount > 0) {
      document.getElementById("ccard_contribperso").style.display = "flex";
      UpdateCounters("counter_contribperso", res.query.userinfo.editcount);
    }
  });
}
 
[].forEach.call(document.getElementsByClassName("text-marquee"), function (marquee) {
let text_elm = marquee.querySelector("*")
let ofw=marquee.clientWidth-text_elm.scrollWidth
    let duration = Math.max(Math.round(-ofw/15),1)
    if(ofw<0){
      marquee.style.animation=duration+"s linear infinite alternate paused gardient_slide"
        text_elm.style.setProperty("--ofw",ofw+'px')
        text_elm.style.animation=duration+"s linear infinite alternate paused text_slide"
    }
});

Dernière version du 16 octobre 2024 à 09:55

"use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime=function e(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(s){c=function t(e,r,n){return e[r]=n}}function u(t,e,r,o){var i,a,l,c,s=Object.create((e&&e.prototype instanceof p?e:p).prototype);return n(s,"_invoke",{value:(i=t,a=r,l=new L(o||[]),c="suspendedStart",function(t,e){if("executing"===c)throw Error("Generator is already running");if("completed"===c){if("throw"===t)throw e;return C()}for(l.method=t,l.arg=e;;){var r=l.delegate;if(r){var n=b(r,l);if(n){if(n===h)continue;return n}}if("next"===l.method)l.sent=l._sent=l.arg;else if("throw"===l.method){if("suspendedStart"===c)throw c="completed",l.arg;l.dispatchException(l.arg)}else"return"===l.method&&l.abrupt("return",l.arg);c="executing";var o=f(i,a,l);if("normal"===o.type){if(c=l.done?"completed":"suspendedYield",o.arg===h)continue;return{value:o.arg,done:l.done}}"throw"===o.type&&(c="completed",l.method="throw",l.arg=o.arg)}})}),s}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(n){return{type:"throw",arg:n}}}t.wrap=u;var h={};function p(){}function d(){}function y(){}var m={};c(m,i,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(k([])));g&&g!==e&&r.call(g,i)&&(m=g);var $=y.prototype=p.prototype=Object.create(m);function w(t){["next","throw","return"].forEach(function(e){c(t,e,function(t){return this._invoke(e,t)})})}function _(t,e){var o;n(this,"_invoke",{value:function n(i,a){function l(){return new e(function(n,o){!function n(o,i,a,l){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,u=s.value;return u&&"object"==_typeof(u)&&r.call(u,"__await")?e.resolve(u.__await).then(function(t){n("next",t,a,l)},function(t){n("throw",t,a,l)}):e.resolve(u).then(function(t){s.value=t,a(s)},function(t){return n("throw",t,a,l)})}l(c.arg)}(i,a,n,o)})}return o=o?o.then(l,l):l()}})}function b(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=TypeError("The iterator does not provide a '"+r+"' method")),h;var o=f(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=TypeError("iterator result is not an object"),e.delegate=null,h)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=y,n($,"constructor",{value:y,configurable:!0}),n(y,"constructor",{value:d,configurable:!0}),d.displayName=c(y,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,c(t,l,"GeneratorFunction")),t.prototype=Object.create($),t},t.awrap=function(t){return{__await:t}},w(_.prototype),c(_.prototype,a,function(){return this}),t.AsyncIterator=_,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new _(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},w($),c($,l,"Generator"),c($,i,function(){return this}),c($,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,L.prototype={constructor:L,reset:function t(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=void 0)},stop:function t(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function t(e){if(this.done)throw e;var n=this;function o(t,r){return l.type="throw",l.arg=e,n.next=t,r&&(n.method="next",n.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],l=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function t(e,n){for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=n&&n<=a.finallyLoc&&(a=null);var l=a?a.completion:{};return l.type=e,l.arg=n,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(l)},complete:function t(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),h},finish:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function t(e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;E(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function t(e,r,n){return this.delegate={iterator:k(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var l=t[i](a),c=l.value}catch(s){r(s);return}l.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){asyncGeneratorStep(i,n,o,a,l,"next",t)}function l(t){asyncGeneratorStep(i,n,o,a,l,"throw",t)}a(void 0)})}}function UpdateCounters(t,e){return _UpdateCounters.apply(this,arguments)}function _UpdateCounters(){return(_UpdateCounters=_asyncToGenerator(_regeneratorRuntime().mark(function t(e,r){var n;return _regeneratorRuntime().wrap(function t(o){for(;;)switch(o.prev=o.next){case 0:return e=document.getElementById(e),o.next=3,new Promise(function(t){var r=setInterval(function(){var n=e.getBoundingClientRect();n.bottom<0||n.top-Math.max(document.documentElement.clientHeight,window.innerHeight)>=0||(clearInterval(r),t())},500)});case 3:n=0;case 4:if(!(n<=r)){o.next=11;break}return e.innerText=n.toLocaleString(navigator.language,{notation:"compact",compactDisplay:"short",maximumFractionDigits:1}),o.next=8,new Promise(function(t){setTimeout(t,10)});case 8:n+=Math.ceil(r/100),o.next=4;break;case 11:case"end":return o.stop()}},t)}))).apply(this,arguments)}function SwitchMainForm(t){var e=document.getElementById("main-form"),r=e.querySelector("input[type='hidden']"),n=e.querySelector("input:not([type='hidden'])"),o=e.querySelector("button");switch(t){case"search":r.value="title",r.name="Sp%C3%A9cial%3ARecherche",n.name="search",n.placeholder="Rechercher",n.removeAttribute("dir"),o.removeAttribute("name"),o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001q.044.06.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0"/></svg>';break;case"new-article":r.value="edit",r.name="action",n.name="title",n.placeholder="Cr\xe9er un article",n.dir="ltr",o.name="create",o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" fill="currentColor" class="bi bi-plus-lg" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2"/></svg>'}}if(document.documentElement.classList.contains("skin-citizen-dark")&&!("/index.php/Accueil"===window.location.pathname||window.location.href.includes("?title=Accueil"))&&document.querySelectorAll("table").forEach(function(t){""===t.style.backgroundColor||"transparent"===t.style.backgroundColor?t.querySelectorAll("td").forEach(function(t){""===t.style.backgroundColor||"transparent"===t.style.backgroundColor||(t.style.backgroundColor="#212630",t.style.border="2px solid rgb(101 133 209)",t.style.margin="5px")}):t.style.backgroundColor="#212630"}),"/index.php/Accueil"===window.location.pathname||window.location.href.includes("?title=Accueil")){if(!CSS.supports("selector(:has(+ *)")){var t=document.getElementsByClassName("citizen-body-container")[0];t.style.setProperty("display","block","important"),t.style.setProperty("margin","0","important"),t.style.setProperty("padding","0","important"),document.getElementsByClassName("mw-body-header")[0].style.setProperty("display","none","important"),document.getElementsByClassName("mw-body-footer")[0].style.setProperty("display","none","important"),document.getElementById("citizen-body-header-sticky-sentinel").style.setProperty("display","none","important"),document.getElementsByClassName("citizen-footer")[0].style.setProperty("margin-top","0","important"),document.getElementsByClassName("mw-body")[0].style.setProperty("margin-top","-1rem")}fetch("https://wikithionville.fr/api.php?action=query&meta=userinfo|siteinfo&uiprop=rights|editcount|realname&siprop=statistics&format=json").then(function(t){return t.json()}).then(function(t){t.query.userinfo.rights.includes("edit")&&SwitchMainForm("new-article"),document.getElementsByClassName("counters")[0].style.display="flex",UpdateCounters("counter_articles",t.query.statistics.articles),UpdateCounters("counter_pages",t.query.statistics.pages),UpdateCounters("counter_utilisateurs",t.query.statistics.users),t.query.userinfo.editcount>0&&(document.getElementById("ccard_contribperso").style.display="flex",UpdateCounters("counter_contribperso",t.query.userinfo.editcount))}),document.addEventListener("scroll",function(){UpdateScroll()}),UpdateScroll(),addPopCarouselBtns(),initCards()}function UpdateScroll(){var t=window.scrollY+window.innerHeight/3;[].forEach.call(document.getElementsByClassName("panel"),function(e){e.offsetTop<=t&&e.offsetTop+e.clientHeight>t&&(document.getElementById("wiki-home").style.backgroundColor=e.getAttribute("bg"),[].forEach.call(document.querySelectorAll("#progress a"),function(t){t.getAttribute("href")==="#"+e.id?t.classList.add("active"):t.classList.remove("active")}))}),document.getElementById("img-beffroi").style.transform="translate3d(-".concat(Math.min(window.scrollY/document.getElementById("plusdinfo").offsetTop*30,30),"vw, 0, 0)")}function addPopCarouselBtns(){var t=document.querySelector(".home-header #popular ul"),e=document.getElementById("popular-next"),r=document.getElementById("popular-prev");if(t){var n=function n(){t.scrollWidth-t.clientWidth>0?(e.style.display="block",r.style.display="block"):(e.style.display="none",r.style.display="none")};e.addEventListener("click",function(){t.scrollTo({left:Math.min(t.scrollWidth,t.scrollLeft+.8*t.clientWidth),behavior:"smooth"})}),r.addEventListener("click",function(){t.scrollTo({left:Math.max(0,t.scrollLeft-.8*t.clientWidth),behavior:"smooth"})}),window.addEventListener("resize",n),n(),t.querySelectorAll("li").forEach(function(t){fetch("https://wikithionville.fr/api.php?action=query&format=json&redirects&generator=images&prop=imageinfo&iiprop=url|dimensions&titles=".concat(new URL(t.querySelector("a").href,"https://wikithionville.fr").searchParams.get("title"))).then(function(t){return t.json()}).then(function(e){var r,n,o,i,a,l,c=Object.values(null==e?void 0:null===(r=e.query)||void 0===r?void 0:r.pages),s=c.filter(function(t){return t.imageinfo&&t.imageinfo[0].width*t.imageinfo[0].height>122500&&t.imageinfo[0].url});n=s.length>0?null==s?void 0:null===(o=s[Math.round(Math.random()*((null==s?void 0:s.length)-1))])||void 0===o?void 0:null===(i=o.imageinfo[0])||void 0===i?void 0:i.url:null===(a=c.at(-1))||void 0===a?void 0:null===(l=a.imageinfo[0])||void 0===l?void 0:l.url;var u=t.querySelector("img");u.loading="lazy",u.src=n,u.onerror=function(t){u.src="/home/article_placeholder.svg"}}),t.addEventListener("click",function(){t.querySelector("a").click()})})}}function initCards(){[].forEach.call(document.getElementsByClassName("card-li"),function(t){var e=t.querySelectorAll(".card-container");t.addEventListener("mousemove",function(t){e.forEach(function(e){var r=e.querySelector(".blob"),n=e.querySelector(".fakeblob").getBoundingClientRect();r.animate([{transform:"translate3d(".concat(t.clientX-n.left-n.width/2,"px,").concat(t.clientY-n.top-n.height/2,"px, 0)")}],{duration:200,fill:"forwards"})})},{passive:!0})})}[].forEach.call(document.getElementsByClassName("text-marquee"),function(t){var e=t.querySelector("*"),r=t.clientWidth-e.scrollWidth,n=Math.max(Math.round(-r/15),1);r<0&&(t.style.animation=n+"s linear infinite alternate paused gardient_slide",e.style.setProperty("--ofw",r+"px"),e.style.animation=n+"s linear infinite alternate paused text_slide")});