From 3d806c729c226f0ef1c15b4b7232d632923f6ec6 Mon Sep 17 00:00:00 2001 From: John Stephani Date: Thu, 25 Dec 2025 22:54:36 -0600 Subject: [PATCH] Add copy comment link on hold button, pause video if visiting comments --- app/templates/index.html | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) 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'); }