User:Lady Furude/common.js

$(function {   "use strict";    var copyButton = $(" ", { id: "dev-copy-code", text: "Copy" }).css({ float: "right", padding: "7px", border: "1px solid black", "border-radius": "5px", color: "#4C566A", cursor: "pointer" });   $("div.mw-geshi.mw-content-ltr.pi-data-value").prepend(copyButton);    $("#dev-copy-code").hover(function { $("#dev-copy-code").css({color: "white"}); setTimeout(function {           $("#dev-copy-code").css({color: "#4C566A"});        }, 500); });   document.querySelector("#dev-copy-code").addEventListener("click", function { $("#dev-copy-code").click; var range = document.createRange; range.selectNode(document.querySelector("div.javascript.source-javascript")); window.getSelection.addRange(range); try { document.execCommand("copy"); } catch(err) { console.log("Whoops, unable to copy"); }       window.getSelection.removeAllRanges; }); });