MediaWiki:Gadget-FandomKeybinds.js
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).
- Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
const page = mw.config.get('wgPageName');
const mt = window.Mousetrap;
function clickOrGoTo(element, page, params) {
var $element = $(element);
if ($element.length > 0) {
$element.click();
} else {
window.location.href = mw.util.getUrl(page, params);
}
}
mt.bind(['e', 'е'], () => clickOrGoTo('#ca-edit span, #ca-editsource span', page, {
action: 'edit'
}));
mt.bind(['m', 'м'], () => clickOrGoTo('#ca-move a span', 'Special:MovePage/' + page));
mt.bind(['w', 'в'], () => clickOrGoTo('#t-whatlinkshere a span', 'Special:WhatLinksHere/' + page));
mt.bind(['h', 'х'], () => clickOrGoTo('#ca-history a span', page, {
action: 'history'
}));
mt.bind(['p', 'п'], () => clickOrGoTo('#ca-protect a span', page, {
action: 'protect'
}));
mt.bind(['t', 'т'], () => clickOrGoTo('#ca-talk a span, #utw-talk-page-link span', 'Talk:' + page));
mt.bind(['n', 'н'], () => clickOrGoTo('#ca-purge a span', page, {
action: 'purge'
}));
mt.bind(['д', 'd'], () => clickOrGoTo('#ca-delete a span', page, {
action: 'delete'
}));