User:Unnilennium/common.js

From SME Server
< User:Unnilennium
Revision as of 15:13, 7 November 2021 by Unnilennium (talk | contribs) (no mobile view)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Note: After saving, 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: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
(function () {
     // Find the link used to switch to the desktop view.
     var desktopLink = document.getElementById("mw-mf-display-toggle");

     if (desktopLink === null) {
          return;
     }

     var href = desktopLink.getAttribute('href')

     // Make sure we're not already in the desktop view, which could lead to
     // an infinite loop.
     if (href.indexOf('.m.') > -1) {
          return;
     }

     // Navigate to the new URL, replacing the history element, as if we were
     // never on the mobile site! You can use .assign() instead, if you want to
     // keep the URL of the mobile site in your history.
     window.location.replace(href);
})()