From 754cc6d332c33856ca6781169fd2bed46a1cde20 Mon Sep 17 00:00:00 2001 From: fatchan Date: Sat, 7 Dec 2019 10:58:32 +0000 Subject: [PATCH] minor style changes --- gulp/res/css/style.css | 13 +++++----- gulp/res/css/themes/chaos.css | 13 ++++++++++ gulp/res/css/themes/tomorrow2.css | 4 +-- gulp/res/js/hover.js | 41 ++++++++++++++----------------- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/gulp/res/css/style.css b/gulp/res/css/style.css index cd3745f7..bb2b19ee 100644 --- a/gulp/res/css/style.css +++ b/gulp/res/css/style.css @@ -2,7 +2,7 @@ body { font-family: arial, helvetica, sans-serif; font-size: 10pt; color: var(--font-color); - background: linear-gradient(var(--background-top) 38px, var(--background-rest) 238px); + background: linear-gradient(var(--background-top) 3em, var(--background-rest) 230px); flex: 1; display: flex; flex-direction: column; @@ -11,7 +11,7 @@ body { } main { - margin: 38px 0 0 0; + margin: 3em 0 0 0; } .row { @@ -59,6 +59,7 @@ pre { .navbar { background: var(--navbar-color); + box-shadow: 0 0 3px 1px var(--darken); border-bottom: 1px solid var(--post-outline-color); position: fixed; width: 100%; @@ -424,7 +425,7 @@ td, th { max-width: calc(100% - 10px); max-height: calc(100% - 50px); position: fixed; - top: 38px; + top: 3em; background-color: var(--post-color); z-index: 4; box-sizing: border-box; @@ -731,7 +732,7 @@ input:invalid, textarea:invalid { } .nav-item { - line-height: 38px; + line-height: 3em; text-decoration: none; float: left; padding-left: 10px; @@ -793,7 +794,7 @@ input[type="file"] { max-width: calc(100% - 10px); max-height: calc(100% - 50px); position: fixed; - top: 38px; + top: 3em; right: 5px; background-color: var(--post-color); z-index: 2; @@ -974,7 +975,7 @@ table.boardtable td:nth-child(6) { } .pages { - width:100%; + /*width:100%;*/ } .pad-anchor { diff --git a/gulp/res/css/themes/chaos.css b/gulp/res/css/themes/chaos.css index c9d9f572..87969c90 100644 --- a/gulp/res/css/themes/chaos.css +++ b/gulp/res/css/themes/chaos.css @@ -27,6 +27,8 @@ --title-color:#d70000; --greentext-color:#FF0000; } +#livetext, +#threadstats, #float .post-container, .catalog-tile, .live, @@ -63,3 +65,14 @@ a:hover { background:var(--link-hover)!important; color:black!important; } +.anchor:target + .post-container .post-info, .post-container.highlighted .post-info { + border-bottom: none; +} +@media only screen and (max-width: 600px) { + + .post-info{ + background: none; + border-bottom: none; + } + +} diff --git a/gulp/res/css/themes/tomorrow2.css b/gulp/res/css/themes/tomorrow2.css index 3d17c74a..4a8e9def 100644 --- a/gulp/res/css/themes/tomorrow2.css +++ b/gulp/res/css/themes/tomorrow2.css @@ -30,9 +30,7 @@ } .anchor:target + .post-container, -.post-container.highlighted, -.anchor:target + table tbody tr th, -.anchor:target + table { +.post-container.highlighted { border: 1px solid var(--highlighted-post-outline-color) !important; } diff --git a/gulp/res/js/hover.js b/gulp/res/js/hover.js index c4d30bb9..df7d36a9 100644 --- a/gulp/res/js/hover.js +++ b/gulp/res/js/hover.js @@ -84,20 +84,16 @@ window.addEventListener('DOMContentLoaded', (event) => { hoveredPost = anchor.nextSibling; } else { let hovercache = localStorage.getItem(`hovercache-${jsonPath}`); - let threadJson; let postJson; if (hovercache) { hovercache = JSON.parse(hovercache); - let highestId = 0; - if (hovercache.replies && hovercache.replies.length > 0) { - highestId = Math.max(hovercache.postId, hovercache.replies[hovercache.replies.length-1].postId); - } - if (highestId && highestId >= hash) { - //post already in our cache - threadJson = hovercache; + if (hovercache.postId == hash) { + postJson = hovercache; + } else if (hovercache.replies.length > 0) { + postJson = hovercache.replies.find(r => r.postId == hash); } } - if (!threadJson) { + if (!postJson) {//wasnt cached or cache outdates this.style.cursor = 'wait'; let json; try { @@ -111,8 +107,12 @@ window.addEventListener('DOMContentLoaded', (event) => { this.style.cursor = ''; } if (json) { - threadJson = json; - setLocalStorage(`hovercache-${jsonPath}`, JSON.stringify(threadJson)); + setLocalStorage(`hovercache-${jsonPath}`, JSON.stringify(jsonson)); + if (json.postId == hash) { + postJson = json; + } else { + postJson = json.replies.find(r => r.postId == hash); + } } else { return localStorage.removeItem(`hovercache-${jsonPath}`); //thread deleted } @@ -120,13 +120,8 @@ window.addEventListener('DOMContentLoaded', (event) => { if (lastHover !== loading) { return; //dont show for ones not hovering } - if (threadJson.postId == hash) { - postJson = threadJson; - } else { - postJson = threadJson.replies.find(r => r.postId == hash); - } if (!postJson) { - return; //post was deleted or missing for some reason + return; //post was deleted or missing } const postHtml = post({ post: postJson }); const wrap = document.createElement('div'); @@ -134,13 +129,13 @@ window.addEventListener('DOMContentLoaded', (event) => { hoveredPost = wrap.firstChild.nextSibling; //need this event so handlers like post hiding still apply to hover introduced posts const newPostEvent = new CustomEvent('addPost', { - detail: { - post: hoveredPost, - postId: postJson.postId, + detail: { + post: hoveredPost, + postId: postJson.postId, hover: true - } - }); - window.dispatchEvent(newPostEvent); + } + }); + window.dispatchEvent(newPostEvent); } toggleDottedUnderlines(hoveredPost, thisId); hoveredPost.classList.remove('highlighted');