MediaWiki:Gadget-EditShortcut.js

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Revision as of 23:34, 1 June 2024 by Vish (talk | contribs) (Created page with "(function() { document.addEventListener('keydown', function(event) { // Check if the pressed key is 'e' and no modifier keys are pressed if (event.key === 'e' && !event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey) { // Prevent the default action to avoid any unwanted behavior event.preventDefault(); // Redirect to the "edit source" URL window.location.href = mw.util.getUrl(mw.config.get...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
(function() {
    document.addEventListener('keydown', function(event) {
        // Check if the pressed key is 'e' and no modifier keys are pressed
        if (event.key === 'e' && !event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey) {
            // Prevent the default action to avoid any unwanted behavior
            event.preventDefault();
            // Redirect to the "edit source" URL
            window.location.href = mw.util.getUrl(mw.config.get('wgPageName'), { action: 'edit' });
        }
    });
})();