diff options
-rw-r--r-- | data/style.css | 2 | ||||
-rw-r--r-- | elm/sethash.js | 10 | ||||
-rw-r--r-- | lib/VNWeb/Discussions/Thread.pm | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/data/style.css b/data/style.css index 44284234..9691a17e 100644 --- a/data/style.css +++ b/data/style.css @@ -393,7 +393,7 @@ div.thread tr:not(:last-child) td { border-bottom: 1px solid $border$; } div.thread td.tc1 { width: 170px; padding: 5px 10px; border-right: 1px solid $border$; } div.thread td.tc2 { padding: 10px 20px 10px 10px; } div.thread tr.deleted td { padding: 1px 10px; } -div.thread tr:target { outline: 1px dotted $standout$ } +div.thread tr:target, div.thread tr.target { outline: 1px dotted $standout$ } div.thread i.deleted { font-style: normal; color: $grayedout$; } div.thread i.lastmod { float: right; font-size: 11px; color: $grayedout$; margin: 0 -10px -5px 0; } div.thread i.edit { float: right; color: $grayedout$; font-style: normal; margin: -10px -10px 0 0; visibility: hidden } diff --git a/elm/sethash.js b/elm/sethash.js index 3441a650..7b054d0b 100644 --- a/elm/sethash.js +++ b/elm/sethash.js @@ -1,2 +1,8 @@ -if(pageVars.sethash && location.hash.length <= 1) - location.hash = pageVars.sethash; +// Emulate setting a location.hash if none has been set. +if(pageVars.sethash && location.hash.length <= 1) { + var e = document.getElementById(pageVars.sethash); + if(e) { + e.scrollIntoView(); + e.classList.add('target'); + } +} diff --git a/lib/VNWeb/Discussions/Thread.pm b/lib/VNWeb/Discussions/Thread.pm index 2b3df320..9928592f 100644 --- a/lib/VNWeb/Discussions/Thread.pm +++ b/lib/VNWeb/Discussions/Thread.pm @@ -196,7 +196,7 @@ TUWF::get qr{/$RE{tid}(?:(?<sep>[\./])$RE{num})?}, sub { 'UPDATE notifications SET read = NOW() WHERE uid =', \auth->uid, 'AND ltype = \'t\' AND iid = vndbid_num(', \$id, ') AND read IS NULL' ) if auth && $t->{count} <= $page*25; - framework_ title => $t->{title}, $num ? (js => 1, pagevars => {sethash=>"#$num"}) : (), sub { + framework_ title => $t->{title}, $num ? (js => 1, pagevars => {sethash=>$num}) : (), sub { metabox_ $t; elm_ 'Discussions.Poll' => $POLL_OUT, { question => $t->{poll_question}, |