MediaWiki:Common.js: Difference between revisions

From Renesas.info
No edit summary
Tag: Manual revert
No edit summary
Line 15: Line 15:
}
}


function code_box(text) {
function command_box(text) {
   document.write("<pre>");
   document.write("<table border=0 width=100%><tr><td>");
   document.write(text);
  document.write("<pre>" + text + "</pre>");
   document.write("</pre>");
   document.write("</td><td width=1>");
   document.write("<br/>");
   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>");
}