(Created page with "→Any JavaScript here will be loaded for all users on every page load.: $(document).ready(function () { $.get(mw.util.wikiScript('api'), { action: 'query', meta: 'userinfo', format: 'json' }).done(function (data) { if (data.query.userinfo.id !== 0) { var username = data.query.userinfo.name; var userLink = mw.util.getUrl('User:' + username); $('#user-info').html('<a href="' + userLink + '" cla...") |
No edit summary |
||
Line 10: | Line 10: | ||
var userLink = mw.util.getUrl('User:' + username); | var userLink = mw.util.getUrl('User:' + username); | ||
$('#user-info').html('<a href="' + userLink + '" class="text-white">' + username + '</a>'); | $('#user-info').html('<a href="' + userLink + '" class="text-white">' + username + '</a>'); | ||
} | |||
}); | |||
}); | |||
document.addEventListener('DOMContentLoaded', function () { | |||
var button = document.getElementById('offcanvas-toggler'); | |||
var offcanvas = document.getElementById('offcanvas-menu'); | |||
button.addEventListener('click', function () { | |||
offcanvas.classList.toggle('show'); | |||
}); | |||
document.body.addEventListener('click', function (event) { | |||
if (!offcanvas.contains(event.target) && !button.contains(event.target)) { | |||
offcanvas.classList.remove('show'); | |||
} | } | ||
}); | }); | ||
}); | }); |
Revision as of 17:12, 16 October 2023
/* Any JavaScript here will be loaded for all users on every page load. */
$(document).ready(function () {
$.get(mw.util.wikiScript('api'), {
action: 'query',
meta: 'userinfo',
format: 'json'
}).done(function (data) {
if (data.query.userinfo.id !== 0) {
var username = data.query.userinfo.name;
var userLink = mw.util.getUrl('User:' + username);
$('#user-info').html('<a href="' + userLink + '" class="text-white">' + username + '</a>');
}
});
});
document.addEventListener('DOMContentLoaded', function () {
var button = document.getElementById('offcanvas-toggler');
var offcanvas = document.getElementById('offcanvas-menu');
button.addEventListener('click', function () {
offcanvas.classList.toggle('show');
});
document.body.addEventListener('click', function (event) {
if (!offcanvas.contains(event.target) && !button.contains(event.target)) {
offcanvas.classList.remove('show');
}
});
});
This page was edited 146 days ago on 08/26/2024. What links here