MediaWiki:Common.js
De Documentation
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).
- Internet Explorer / Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
- Opera : appuyez sur Ctrl + F5.
/* Tout JavaScript présent ici sera exécuté par tous les utilisateurs à chaque chargement de page. */ // input search $('#searchInput').attr('placeholder','Rechercher ...'); $('#searchInput').addClass('showText'); $('meta').attr('name', 'viewport'); $('meta').attr('content', 'initial-scale=1, maximum-scale=1, user-scalable=no'); // user login if ($('#personal #pt-login').length == 0) { $('html').addClass('login-ok'); } $("#mw-wrapper").prepend('<div id="tinyNavbar">' + '<i class="fa fa-list-ul fa-solid"></i>' + '<a href="/wiki/test1/test/doc/index.php/Accueil" title="Accueil">' + '<i class="fa fa-home fa-solid" style="margin-left:20px" title="Sommaire"></i></a></div>'); $("body").after('<div id="btnIndex"><i class="fa fa-list-ul fa-solid" title="Sommaire"></i></div>'); function visibleOnScroll() { var posToc = $toc.offset().top + $toc.outerHeight() - 30; if (posToc < $(window).scrollTop()) { $itemstoShow.show(); } else if (posToc - 40 > $(window).scrollTop()) { $itemstoShow.hide(); } } $("#toc a").each(function() { var tocId = $(this).attr('href').slice(1); var refId = document.getElementById(tocId); var refNum = $(this).find('.tocnumber').text(); $(refId).prepend('<span class="numToc">'+refNum+')</span>'); }); $(document).ready(function() { $("#btnModalSoft").after('<div id="modalSoft" class="lgModal"><div class="modal-content">' + '<b>Liste des logiciels installés</b><span class="btnClose">×</span>' + '<iframe src="/searchSoftFrame"></iframe>' + '</div></div>'); var modal = document.getElementById("modalSoft"); if (!modal) return; var btnModal = document.getElementById("btnModalSoft"); var btnClose = modal.getElementsByClassName("btnClose")[0]; btnModal.onclick = function() { modal.style.display = "block"; } btnClose.onclick = function() { modal.style.display = "none"; } window.addEventListener("click", function(e) { if (e.target == modal) { modal.style.display = "none"; } }); }); $(document).ready(function() { lastScrollTop = 0; $toc = $('#toc'); $itemstoShow = $('#tinyNavbar, #btnIndex'); visibleOnScroll(); $(window).scroll(visibleOnScroll); $(window).resize (visibleOnScroll); $("#tinyNavbar .fa-list-ul, #btnIndex .fa-list-ul").click(function() { $('html').animate({ scrollTop: $('#mw-toc-heading').offset().top -40}, 50); }); });