(function () { "use strict"; function each(selector, root, fn) { Array.prototype.forEach.call((root || document).querySelectorAll(selector), fn); } if (navigator.clipboard && window.isSecureContext) { each("button[data-copy]", null, function (button) { var source = document.getElementById(button.getAttribute("data-copy")); if (!source) { return; } button.hidden = false; button.addEventListener("click", function () { navigator.clipboard.writeText(source.textContent.trim()).then(function () { button.setAttribute("data-copied", ""); }, function () { button.removeAttribute("data-copied"); }); }); }); } each("form", null, function (form) { form.addEventListener("submit", function () { each("button[data-disable-on-submit]", form, function (button) { button.disabled = true; }); }); }); window.addEventListener("pageshow", function () { each("button[data-disable-on-submit]", null, function (button) { button.disabled = false; }); }); })();