diff --git a/web/index.php b/web/index.php index c4e0b45..52ba811 100644 --- a/web/index.php +++ b/web/index.php @@ -22,12 +22,14 @@

How to Save History

Running the Script

    -
  1. Click Copy to Clipboard to copy the script
  2. +
  3. Click Copy to Clipboard to copy the script
  4. Open the JavaScript console in your browser or the Discord app by pressing Ctrl+Shift+I, and selecting the Console tab
  5. Paste the script into the console, and press Enter to run it
  6. Press Ctrl+Shift+I again to close the console
+

Your browser may not support copying to clipboard, please try copying the script manually:

+

Please note that it's no longer possible to use DHT as a bookmark. Discord updated their CSP rules which improve website security, but as a result, browsers will no longer execute bookmark scripts on the website.

@@ -57,21 +59,30 @@ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create','UA-48632978-5','auto');ga('send','pageview'); - document.getElementById("tracker-copy").addEventListener("click", function(){ - var ele = document.getElementById("tracker-copy-contents"); - ele.style.display = "block"; - ele.select(); + var contents = document.getElementById("tracker-copy-contents"); + var issue = document.getElementById("tracker-copy-issue"); + var button = document.getElementById("tracker-copy-button"); + + if (document.queryCommandSupported("copy")){ + contents.style.display = "none"; + issue.style.display = "none"; + } + + button.addEventListener("click", function(){ + contents.style.display = "block"; + issue.style.display = "block"; - try{ - if (!document.execCommand("copy")){ - throw null; - } - }catch(e){ - prompt("Press CTRL+C to copy the script:", ele.value); - } + contents.select(); + document.execCommand("copy"); - ele.style.display = "none"; + button.innerHTML = "Copied to Clipboard"; + contents.style.display = "none"; + issue.style.display = "none"; }); + + contents.addEventListener("click", function(){ + contents.select(); + }) diff --git a/web/style.css b/web/style.css index 421e164..ea7f9ce 100644 --- a/web/style.css +++ b/web/style.css @@ -97,14 +97,12 @@ li { } #tracker-copy-contents { - position: fixed; - top: 0; - left: 0; - width: 20px; - height: 20px; - padding: 0; - background: transparent; - display: none; + width: 100%; + height: 82px; + padding: 4px; + color: rgba(255, 255, 255, 0.8); + background: rgba(255, 255, 255, 0.2); border: none; resize: none; + box-sizing: border-box; }