diff --git a/public/style.css b/public/style.css index 3e81cc9..793ad0e 100644 --- a/public/style.css +++ b/public/style.css @@ -58,7 +58,7 @@ summary { font-size: 14px; margin-top: 17px; text-align: right; - min-width: 32px; + min-width: 21px; } .dark .post .rank { color: #646464; @@ -499,9 +499,12 @@ form.nsfw div { font-size: 14px; overflow: auto; } -.expand .md img { +.expando .md img { max-width: 100%; } +.expando.open.showimage .md { + display: none; +} .dark .expando .md { background-color: #262626; color: #ddd; @@ -804,7 +807,6 @@ nav .tabs { } nav ul { - white-space: nowrap; list-style: none; margin: 5px 2.5px 0px 2.5px; padding: 0; @@ -813,9 +815,11 @@ nav ul { } nav li { + white-space: nowrap; margin: 0px 1px; padding: 0px; - display: inline; + display: inline-block; + margin-top: 5px; font-size: 12px; font-weight: 700; } @@ -836,11 +840,13 @@ nav ul a { } nav .selected a { + color: orangered; background-color: white; border: 1px solid #00a846; border-bottom: 1px solid white; } .dark nav .selected a { + color: #d25a32; border-bottom: 1px solid #262626; } diff --git a/public/utils.js b/public/utils.js index d5d419c..6f8f0a4 100644 --- a/public/utils.js +++ b/public/utils.js @@ -103,6 +103,11 @@ function loadMore(e) { request(window.location.origin+window.location.pathname+"?"+urlParams.toString(), "", function(res){ if (res.trim()) { e.target.outerHTML = res + '' + if (showimages = document.getElementById("showimages")) { + if (showimages.className == "selected") { + toggle_images(true) + } + } } else { e.target.outerHTML = '' @@ -160,6 +165,40 @@ function youtube_iframe(id) { return '' } +function show_images(e) { + e = e || window.event; + e.preventDefault() + var targ = e.currentTarget || e.srcElement || e; + console.log(targ) + var parent = targ.parentNode + if (parent.className == "") { + parent.className = "selected" + toggle_images(true) + } else { + parent.className = "" + toggle_images(false) + } + return false +} + +function toggle_images(open) { + var posts = document.getElementsByClassName("post") + for (var i = 0; i < posts.length; i++) { + var btn = posts[i].getElementsByClassName("expando-button")[0] + if (btn.className.indexOf("hidden") != -1) { continue } + var img = posts[i].getElementsByClassName("image") + if (!img.length) { continue } + var bdy = posts[i].getElementsByClassName("expando")[0] + if (open) { + bdy.className = 'expando open showimage'; + btn.className = "expando-button open" + } else { + bdy.className = 'expando'; + btn.className = "expando-button" + } + } +} + var posts = document.getElementsByClassName("post") for (var i = 0; i < posts.length; i++) { var url = posts[i].getElementsByClassName("url")[0].href diff --git a/templates/frontpage.html b/templates/frontpage.html index 3dedab1..9f2b11d 100644 --- a/templates/frontpage.html +++ b/templates/frontpage.html @@ -2,7 +2,7 @@