User:Noël Tchallagassou/common.js: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
Created page with "mw.loader.using('jquery', function () { // Check if jQuery is loaded if (typeof jQuery === "undefined") { console.error("jQuery is not loaded, the script will not work."); return; } // Function to create a button function createButton(text, color, bottom, onClick) { return $('<button>') .text(text) .css({ position: 'fixed', right: '10px', bott..." Tags: Mobile edit Mobile web edit |
Installing User:SaoMikoto/js/Usergroup.js (script-installer) Tags: Mobile edit Mobile web edit |
||
| Line 51: | Line 51: | ||
}); |
}); |
||
}); |
}); |
||
importScript('User:SaoMikoto/js/Usergroup.js'); // Backlink: [[User:SaoMikoto/js/Usergroup.js]] |
|||
Revision as of 13:46, 2 October 2025
mw.loader.using('jquery', function () {
// Check if jQuery is loaded
if (typeof jQuery === "undefined") {
console.error("jQuery is not loaded, the script will not work.");
return;
}
// Function to create a button
function createButton(text, color, bottom, onClick) {
return $('<button>')
.text(text)
.css({
position: 'fixed',
right: '10px',
bottom: bottom + 'px',
padding: '8px 12px',
fontSize: '14px',
color: 'white',
backgroundColor: color,
border: '2px solid ' + color,
borderRadius: '6px',
zIndex: 9999,
cursor: 'pointer'
})
.click(onClick)
.appendTo('body');
}
createButton('↓ Bottom', '#e74c3c', 10, function () {
$('html, body').animate({ scrollTop: $(document).height() }, 'slow');
});
createButton('↑ Top', '#2ecc71', 60, function () {
$('html, body').animate({ scrollTop: 0 }, 'slow');
});
createButton('Recent changes', '#3498db', 110, function () {
window.location.href = '/wiki/Special:RecentChanges';
});
createButton('Desktop version', '#f39c12', 160, function () {
const url = new URL(window.location.href);
url.searchParams.set('useskin', 'vector');
window.location.href = url.toString();
});
createButton('Mobile version', '#9b59b6', 210, function () {
const url = new URL(window.location.href);
url.searchParams.set('useskin', 'minerva');
window.location.href = url.toString();
});
});
importScript('User:SaoMikoto/js/Usergroup.js'); // Backlink: [[User:SaoMikoto/js/Usergroup.js]]