diff --git a/public/functions.js b/public/functions.js index 55c0296..15fdc40 100644 --- a/public/functions.js +++ b/public/functions.js @@ -250,6 +250,10 @@ function replaceRedditLinks(htmlContent) { function postbuilder(post){ returnfpost = ''; + let mode = localStorage.getItem('curmode') || "original"; +if (window.location.href.indexOf("comments.html") != -1) { + mode = "original"; +} timeagoed = timeago(post['created_utc']*1000); sticky = post['stickied'] ? " sticky" :" "; over18 = ''; @@ -257,7 +261,29 @@ if(checklc('a18','yes') != true) { over18 = post['over_18'] ? "over18" :" "; } ismod = (post['distinguished'] == "moderator") ? " moderator" :" "; -returnfpost += '
'+post["subreddit_name_prefixed"]+''+post["author"]+' • '+timeagoed+'
'+post['title']+'
'; +returnfpost += '
'; +if(mode == "comp") { +thumbnail = post['thumbnail']; +if(thumbnail != "self" && thumbnail != "spoiler" && thumbnail != "default" && thumbnail != "" && thumbnail != "nsfw") { +if(thumbnail == "image") { +thumbnail = post["preview"]['images'][0]['resolutions'][0]['url']; +} +returnfpost += '
thumbnail
'; +} else { +thumbnail = thumbnail || "•"; + const mx = post?.preview?.images?.[0]?.resolutions?.[0]?.url || "none"; +if(mx != "none") { +returnfpost += '
thumbnail
'; + +} +else { +returnfpost += '
'+thumbnail+'
'; +} +} +} +returnfpost += '
'+post['title']+'
'; + +if(mode != "comp") { if(post["selftext_html"] != null){ var replacedText = replaceRedditLinks(post["selftext_html"]); @@ -279,14 +305,19 @@ if(post['poll_data'] != null){ returnfpost += pollbuilder(post); } } - +} returnfpost += '
'; +returnfpost += '
'; +if(mode == "comp") { +returnfpost += '
'; +} + +returnfpost += '
'; return returnfpost; } function allown_sfw(){ @@ -318,10 +349,29 @@ jdiv.innerHTML += '
'; } + else if (urli.match(/.(gif|gifv)$/i)){ + const x = postjson?.preview?.images?.[0]?.variants?.mp4?.source?.url || "none"; +if(x == "none") { + returnpost += '
'; + +} +else { + vidposter = postjson["preview"]; + if(typeof vidposter == "undefined"){ + vidposter = postjson["thumbnail"]; + } + else { + + vidposter = postjson["preview"]["images"]["0"]["source"]["url"]; + } + returnpost += '
'; + +} + } else if (urli.match(/www.reddit.com\/gallery/g)) { returnpost += ''; return cret; } function runhsl(){ - const videos = document.querySelectorAll('.reddit_hls'); + const videos = document.querySelectorAll('.reddit_hls:not(.goner)'); videos.forEach(video => { const videoContainer = video.parentElement; + video.classList.add('goner'); // if (video.canPlayType('application/vnd.apple.mpegurl')) { // Browser natively supports HLS // video.src = video.src; diff --git a/public/new.html b/public/new.html index df79513..2cc3026 100644 --- a/public/new.html +++ b/public/new.html @@ -26,7 +26,9 @@
31 Jan 2023 +
  • NEW: Compact mode (smaller thumbnails, faster loading) is here, enable it from the settings page.
  • NEW: Infinite Scrolling is here. If that's your thing enable it from the settings page.
  • +
  • UPDATE: All GIFs now load faster than ever.
  • 18 Jan 2023
  • ADDED: New themes and fonts.
  • UPDATED: Click on the first image of a gallery post to open the images in gallery view.
  • diff --git a/public/settings.html b/public/settings.html index 9c171b2..20d3bf3 100644 --- a/public/settings.html +++ b/public/settings.html @@ -32,7 +32,9 @@
  • 20
  • - Enable infinite scrolling (beta): + Enable Infinite Scrolling (beta): + Enable Compact mode : + Export Subscriptions:
  • @@ -60,6 +62,20 @@ else{document.body.style.fontFamily='sans-serif'}} togglefont();toggletheme(); +var curcomp = localStorage.getItem('curmode') || "original"; +if(curcomp == "comp") { +document.getElementById("compbox").checked = true; +} +function compchng() { +if(document.getElementById("compbox").checked) { +localStorage.setItem('curmode','comp'); +} +else { +localStorage.setItem('curmode','original'); + +} +} + var curpp = localStorage.getItem('ppg') || 20; document.getElementById('outppg').innerHTML = curpp; document.getElementById('ppg').value = curpp; diff --git a/public/styles.css b/public/styles.css index c5a275c..c9a765e 100644 --- a/public/styles.css +++ b/public/styles.css @@ -19,7 +19,8 @@ padding:10px;margin-bottom:5px; word-break: break-word;position:relative;} h1 { margin: 6px 0px; padding: 0; - font-size: 1.5em; + font-size: 1.3em; + line-height: normal; } h2 { @@ -811,6 +812,47 @@ span#closegal { margin: 0 auto; backdrop-filter: blur(47px); } +.post.comp {overflow: hidden;clear: both;} + +.compthumb,.comptext { + width: 80px; + overflow: hidden; + margin-right: 10px; + display: inline-table; + text-align:center; +} + +.rop { + display: inline-block; + vertical-align: top; + width: calc(100% - 90px); +} + +.compthumb img { + max-width: 80px; + max-height: 80px; +} + + +.rop .post_author { + white-space: normal; +} + + + +.rop .post_link a { + font-size: 16px; +} + +.rop .post_link { + padding: 2px 0px 0px; +} +.comptext { + height: 20px; + text-align: center; + color: var(--greyc); + margin-top: 20px; +} @media all and (display-mode: standalone) { header#header { position: fixed; diff --git a/run.php b/run.php index bdd2cae..8769f6e 100644 --- a/run.php +++ b/run.php @@ -28,7 +28,8 @@