From 38fb270c01d26f1287387de1814f9ae1e240567f Mon Sep 17 00:00:00 2001 From: chylex Date: Fri, 30 Jun 2017 13:03:57 +0200 Subject: [PATCH] Update website with script copy button and guide on using DHT in the app --- build.py | 22 +++++++++++++++------- web/index.php | 19 +++++++++++++++++-- web/style.css | 24 ++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/build.py b/build.py index 2d3c3c7..711cdaa 100644 --- a/build.py +++ b/build.py @@ -46,7 +46,8 @@ def combine_files(input_pattern, output_file): def build_tracker(): output_file_raw = "bld/track.js" - output_file_bookmark = "bld/track.html" + output_file_bookmark = "bld/track_bookmark.html" + output_file_copyable = "bld/track_copyable.html" output_file_tmp = "bld/track.tmp.js" input_pattern = "src/tracker/*.js" @@ -73,13 +74,18 @@ def build_tracker(): os.remove(output_file_tmp) + with open(output_file_raw, "r") as raw: + script_contents = raw.read().replace("&", "&").replace('"', """).replace("'", "'").replace("<", "<").replace(">", ">") + with open(output_file_bookmark, "w") as out: out.write("", ">")) - + out.write(script_contents) out.write("'>Add Bookmark") + + with open(output_file_copyable, "w") as out: + out.write("Copy to Clipboard") def build_renderer(): @@ -136,14 +142,16 @@ def build_renderer(): def build_website(): - tracker_file = "bld/track.html" + tracker_file_bookmark = "bld/track_bookmark.html" + tracker_file_copyable = "bld/track_copyable.html" viewer_file = "bld/viewer.html" web_style_file = "bld/web/style.css" distutils.dir_util.copy_tree("web", "bld/web") os.makedirs("bld/web/build", exist_ok = True) - shutil.copyfile(tracker_file, "bld/web/build/track.html") + shutil.copyfile(tracker_file_bookmark, "bld/web/build/track_bookmark.html") + shutil.copyfile(tracker_file_copyable, "bld/web/build/track_copyable.html") shutil.copyfile(viewer_file, "bld/web/build/viewer.html") if USE_JAVA: diff --git a/web/index.php b/web/index.php index 45bfe76..c5680c4 100644 --- a/web/index.php +++ b/web/index.php @@ -20,8 +20,15 @@

How to Save History

-

Add the following script as a bookmark, or run it in your browser console:

-

Open your Discord Friends list in a new tab (do not use an already opened one), click the bookmark, and read the additional instructions that explain the limitations and recommendations.

+

...in your browser

+

Add the script as a browser bookmark by clicking . Then open your Discord Friends list in a new tab (do not use an already opened one), and click the bookmark.

+ +

...in Discord app

+

Click to copy the script. Then press Ctrl+Shift+I in the Discord app, select Console, paste the script into the text box on the bottom and press Enter to run it.

+

The script may ask you to reload Discord, simply paste and run the script again after the reload (the console stays open).

+ +

What next?

+

When running for the first time, you will see a Settings dialog with additional instructions that explain the limitations and recommendations. Please, read them carefully.

Upload your previously saved file if you have any. By default, Discord History Tracker is set to pause tracking after it reaches a previously saved message to avoid unnecessary history loading. You may also set it to load all channels in the server or your friends list by checking Switch to Next Channel.

Once you have configured everything, click Start Tracking, let it run in the background, and download the file when done.

@@ -53,6 +60,14 @@ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 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(); + document.execCommand("copy"); + ele.style.display = "none"; + }); \ No newline at end of file diff --git a/web/style.css b/web/style.css index c3a8d34..2a51390 100644 --- a/web/style.css +++ b/web/style.css @@ -49,6 +49,17 @@ h2 { text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7); } +h3 { + margin: 30px 0 0; + font-size: 22px; + color: rgba(255, 255, 255, 0.62); + text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); +} + +h2 + h3 { + margin-top: 12px; +} + ul { margin-top: 12px; } @@ -67,3 +78,16 @@ ul { overflow: hidden; text-overflow: ellipsis; } + +#tracker-copy-contents { + position: fixed; + top: 0; + left: 0; + width: 20px; + height: 20px; + padding: 0; + background: transparent; + display: none; + border: none; + resize: none; +}