diff --git a/app/templates/index.html b/app/templates/index.html
index 52a31db..e6dfa13 100755
--- a/app/templates/index.html
+++ b/app/templates/index.html
@@ -199,7 +199,7 @@
{% endif %}
-
+
@@ -285,10 +285,28 @@
}
}
- function comments(permalink){
- window.open("https://reddit.com" + permalink, '_blank');
+ commentTimer = null;
+
+ function commentsDown(button, permalink) {
+ commentTimer = setTimeout(() => {
+ navigator.clipboard.writeText("https://reddit.com" + permalink);
+ commentTimer = null;
+ button.textContent = "Copied!"
+ }, 500);
}
+ function commentsUp(button, permalink) {
+ if (commentTimer != null) {
+ clearTimeout(commentTimer);
+ commentTimer = null;
+ pauseVideo(button);
+ window.open("https://reddit.com" + permalink, '_blank');
+ } else {
+ setTimeout(() => {
+ button.textContent = "Comments";
+ }, 500);
+ }
+ }
// text expand code
function checkHeight(){
@@ -316,9 +334,17 @@
});
// audio/video sync code
+ function pauseVideo(element){
+ div = element.closest('.post');
+ video = div.querySelector('video:first-of-type');
+ if (video) {
+ video.pause();
+ pauseAudio(video);
+ }
+ }
function findAudio(video){
- const div = video.closest('.post');
+ div = video.closest('.post');
return div.querySelector('audio:first-of-type');
}