MediaWiki:Common.js: Difference between revisions
Wiki admin (talk | contribs) No edit summary Tag: Manual revert |
Wiki admin (talk | contribs) No edit summary |
||
Line 15: | Line 15: | ||
} | } | ||
function | function command_box(text) { | ||
document.write("<pre>"); | document.write("<table border=0 width=100%><tr><td>"); | ||
document.write( | document.write("<pre>" + text + "</pre>"); | ||
document.write("</ | document.write("</td><td width=1>"); | ||
document.write("< | document.write("<input type=button value=\"📋Copy\" onclick=\"copy_to_clipboard('" + text + "')\" />"); | ||
document.write("</td></tr></table>"); | |||
} | } |
Revision as of 19:32, 15 September 2022
/* Any JavaScript here will be loaded for all users on every page load. */ function copy_to_clipboard_2(text) { navigator.clipboard.writeText(text); alert("Copied: " + text); } function copy_to_clipboard(text) { btn = document.activeElement; navigator.clipboard.writeText(text); btn.value="📋Copied!"; //btn.style.backgroundColor = 'green'; //btn.style.color = 'white'; btn.style.color = 'blue'; } function command_box(text) { document.write("<table border=0 width=100%><tr><td>"); document.write("<pre>" + text + "</pre>"); document.write("</td><td width=1>"); document.write("<input type=button value=\"📋Copy\" onclick=\"copy_to_clipboard('" + text + "')\" />"); document.write("</td></tr></table>"); }