From c6d6bc1a9c2bdb6f42d70ee027bf97ccda1976a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 7 Aug 2020 18:44:03 -0500 Subject: Created a mod message button to copy mod message to clipboard --- main.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'main.js') diff --git a/main.js b/main.js index 12b6140..d3a3250 100644 --- a/main.js +++ b/main.js @@ -41,13 +41,15 @@ function compute() { let modMessage = `Mod Message: Time starts at ${parseFloat(startFrame).toFixed(3)} and ends at ${parseFloat(endFrame).toFixed(3)} at ${frameRate} fps to get a final time of ${finalTime}.`; let credits = `Retimed using [yt-frame-timer](https://mattbraddock.com/yt-frame-timer)`; document.getElementById('time').value = finalTime; - document.getElementById('postModMessage').innerHTML = "The mod message has been copied to clipboard! Please paste the it into the comment of the run you are verifying."; document.getElementById('modMessage').innerHTML = modMessage + ' ' + credits; - // Copy mod message to clipboard - navigator.clipboard.writeText(modMessage) - .then(() => { alert(`Copied to clipboard!`) }) - .catch((error) => { alert(`Copy failed! ${error}`) }) + // Allow user to copy mod message to clipboard + document.getElementById("modMessageButton").disabled = false; + $("#modMessageButton").click(function () { + navigator.clipboard.writeText(modMessage + ' ' + credits) + .then(() => { alert(`The mod message has been copied to clipboard! Please paste it into the comment of the run you are verifying.`) }) + .catch((error) => { alert(`Failed to copy to clipboard! ${error}`) }) + }); } const validateFPS = (event) => { -- cgit v1.2.3