Jump to content

MediaWiki:Common.js

From EthernalRO Wiki
Revision as of 14:52, 26 January 2026 by Slicer (talk | contribs)

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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// Copiar /navi mapa,x,y pro clipboard
function naviCopy(map, x, y) {
    const text = "/navi " + map + "," + x + "," + y;

    // tenta API Clipboard
    if (navigator.clipboard && window.isSecureContext) {
        navigator.clipboard.writeText(text).then(function() {
            mw.notify("Copiado: " + text);
        });
    } else {
        // fallback
        const ta = document.createElement("textarea");
        ta.value = text;
        document.body.appendChild(ta);
        ta.select();
        document.execCommand("copy");
        document.body.removeChild(ta);
        mw.notify("Copiado: " + text);
    }
}