No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
} | } | ||
function | function copyToClip(str) { | ||
function listener(e) { | |||
e.clipboardData.setData("text/html", str); | |||
e.clipboardData.setData("text/plain", str); | |||
e.preventDefault(); | |||
} | |||
document.addEventListener("copy", listener); | |||
document.execCommand("copy"); | document.execCommand("copy"); | ||
document.removeEventListener("copy", listener); | |||
} | }; |
Revision as of 13:47, 20 April 2023
/* Any JavaScript here will be loaded for all users on every page load. */
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Watchlist' ) {
document.body.classList.add( 'mw-rcfilters-ui-initialized' );
}
function copyToClip(str) {
function listener(e) {
e.clipboardData.setData("text/html", str);
e.clipboardData.setData("text/plain", str);
e.preventDefault();
}
document.addEventListener("copy", listener);
document.execCommand("copy");
document.removeEventListener("copy", listener);
};