post-highlighting

This commit is contained in:
Sanpaku 2021-10-12 02:29:29 +02:00
parent a6cf3f18f5
commit 4c93efa4ff
11 changed files with 122 additions and 12 deletions

View File

@ -96,6 +96,16 @@ html[data-stylesheet="Cyanide"] .post.reply {
border-color: #264048;
}
html[data-stylesheet="Cyanide"] div.post.reply.highlighted, html[data-stylesheet="Cyanide"] div.post.reply.mouse-highlight {
background: #0f3f4f;
border-color: #26606e;
}
html[data-stylesheet="Cyanide"] div.post.reply.highlighted.mouse-highlight {
background: #17596f;
}
html[data-stylesheet="Cyanide"] div.post-arrows {
color: #1f4048;
}

View File

@ -72,6 +72,14 @@ html[data-stylesheet="Futaba"] .post.reply {
border: none;
}
html[data-stylesheet="Futaba"] div.post.reply.highlighted, html[data-stylesheet="Futaba"] div.post.reply.mouse-highlight {
background: #f0c0b0;
}
html[data-stylesheet="Futaba"] div.post.reply.highlighted.mouse-highlight {
background: #e8a690;
}
html[data-stylesheet="Futaba"] div.post-arrows, html[data-stylesheet="Futaba"] div.omitted, html[data-stylesheet="Futaba"] div.page-info {
color: #800;
}

View File

@ -53,6 +53,14 @@ html[data-stylesheet="Kareha"] div.post.reply {
border: none;
}
html[data-stylesheet="Kareha"] div.post.reply.highlighted, html[data-stylesheet="Kareha"] div.post.reply.mouse-highlight {
background: #CCC;
}
html[data-stylesheet="Kareha"] div.post.reply.highlighted.mouse-highlight {
background: #BBB;
}
html[data-stylesheet="Kareha"] div.file-info.deleted {
display: block;
}

View File

@ -73,6 +73,14 @@ html[data-stylesheet="Sankarea"] div.post.reply {
border: none;
}
html[data-stylesheet="Sankarea"] div.post.reply.highlighted, html[data-stylesheet="Sankarea"] div.post.reply.mouse-highlight {
background: #333;
}
html[data-stylesheet="Sankarea"] div.post.reply.highlighted.mouse-highlight {
background: #444;
}
html[data-stylesheet="Sankarea"] .post-arrows {
display:none;
}

View File

@ -101,6 +101,15 @@ html[data-stylesheet="Tomorrow"] .post.reply {
border-color: #282a2e;
}
html[data-stylesheet="Tomorrow"] div.post.reply.highlighted, html[data-stylesheet="Tomorrow"] div.post.reply.mouse-highlight {
background: #1d1d21;
border-color: #111;
}
html[data-stylesheet="Tomorrow"] div.post.reply.highlighted.mouse-highlight {
background: #111;
}
html[data-stylesheet="Tomorrow"] div.post-arrows {
color: #c5c8c6;
}
@ -128,7 +137,7 @@ html[data-stylesheet="Tomorrow"] .catalog .container {
}
html[data-stylesheet="Tomorrow"] .catalog .container:hover {
background: #2c2e33;
background: #2c2e33;
}
html[data-stylesheet="Tomorrow"] .box.left, html[data-stylesheet="Tomorrow"] .box.right {

View File

@ -20,10 +20,6 @@ body {
text-decoration: underline;
}
.modlevel {
/*font-weight: normal;*/
}
.modlevel.admin {
color: red;
}
@ -129,9 +125,6 @@ div.post-image img {
min-height: 16px;
}
div.post.reply .post-image img {
}
p {
margin: 0;
padding: 0;
@ -200,6 +193,15 @@ div.post.reply.banned {
margin-left: 10px;
}
div.post.reply.highlighted, div.post.reply.mouse-highlight {
background: #d6bad0;
border-color: #ba9dbf;
}
div.post.reply.highlighted.mouse-highlight {
background: #bfa6ba;
}
.main h2 {
background: #98e;
padding-left: 4px;

View File

@ -76,6 +76,15 @@ html[data-stylesheet="Yotsuba"] .post.reply {
border-color: #d9bfb7;
}
html[data-stylesheet="Yotsuba"] div.post.reply.highlighted, html[data-stylesheet="Yotsuba"] div.post.reply.mouse-highlight {
background: #f0c0b0;
border-color: #d99f91;
}
html[data-stylesheet="Yotsuba"] div.post.reply.highlighted.mouse-highlight {
background: #e8a690;
}
html[data-stylesheet="Yotsuba"] div.post-arrows {
color: #e0bfb7;
}

View File

@ -100,4 +100,60 @@ document.addEventListener("DOMContentLoaded", function(event) {
});
}
};
});
});
document.addEventListener("DOMContentLoaded", function(event) {
// Highlight
function hl(element) {
let current = document.getElementsByClassName('highlighted');
for (let i = 0; i<current.length; i++) {
current[i].classList.remove('highlighted');
}
console.log(element);
let hlthis = document.querySelectorAll(`[data-postid="${element}"]`);
for (let i = 0; i<hlthis.length; i++) {
hlthis[i].classList.toggle('highlighted');
}
}
if (location.hash.substr(1) != '') {
const hash = location.hash.substr(1); //remove #
let regex = new RegExp('[0-9]+');
if (regex.test(hash) == true) { //if #123
hl(hash);
}
}
// Get all anchor posts
const highlights = document.querySelectorAll(".post-number a.anchor");
for (const highlight of highlights) {
highlight.addEventListener("click", (event) => {
hl(highlight.getAttribute('name'));
});
}
// Get all quotelink posts
const hlquotelinks = document.querySelectorAll(".quotelink");
for (const hlquotelink of hlquotelinks) {
let number = hlquotelink.textContent.substr(2);
console.log(number);
hlquotelink.addEventListener("click", (event) => {
hl(number);
});
hlquotelink.addEventListener("mouseover", (event) => {
//highlight type 2 (to not mess with click highlights)
let hlthis = document.querySelectorAll(`[data-postid="`+number+`"]`);
for (let i = 0; i<hlthis.length; i++) {
hlthis[i].classList.add('mouse-highlight');
}
});
hlquotelink.addEventListener("mouseout", (event) => {
let hlthis = document.querySelectorAll(`[data-postid="`+number+`"]`);
for (let i = 0; i<hlthis.length; i++) {
hlthis[i].classList.remove('mouse-highlight');
}
});
}
});

View File

@ -80,7 +80,7 @@
<?php
echo '<span class="post-number">';
echo '<a name="' . $post_number_reply . '" href="' . $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_reply . '">No.</a>';
echo '<a class="anchor" name="' . $post_number_reply . '" href="' . $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_reply . '">No.</a>';
echo '<a class="click" num="' . $post_number_reply . '" id="cite_' . $post_number_reply . '" href="' . $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#q' . $post_number_reply . '">' . $post_number_reply . '</a>';
echo '&nbsp;</span>';
?>

View File

@ -195,7 +195,7 @@
<?php
echo '<span class="post-number">';
echo '<a name="' . $post_number_op . '" href="' . $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op . '">No.</a>';
echo '<a class="anchor" name="' . $post_number_op . '" href="' . $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op . '">No.</a>';
echo '<a class="click" num="' . $post_number_op . '" id="cite_' . $post_number_op . '" href="' . $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#q' . $post_number_op . '">' . $post_number_op . '</a>';
echo '&nbsp;</span>';
?>

View File

@ -1 +1 @@
0.92
0.93