quote to post-form

post-link+text selection quoting
minor textboard catalog style changes
This commit is contained in:
Sanpaku 2021-10-12 00:34:14 +02:00
parent ac583901d4
commit a6cf3f18f5
5 changed files with 74 additions and 12 deletions

View File

@ -25,6 +25,14 @@ html[data-stylesheet="Kareha"] a:hover {
color: red!important;
}
html[data-stylesheet="Kareha"] .catalog-threads a:hover {
color: inherit !important;
}
html[data-stylesheet="Kareha"] div.catalog-threads div.container:hover {
background: #E1E1E1;
}
html[data-stylesheet="Kareha"] div.post .post-image img {
display: none;
}

View File

@ -64,6 +64,10 @@ html[data-stylesheet="Sankarea"] div.container {
max-width: 95%;
}
html[data-stylesheet="Sankarea"] div.catalog-threads div.container:hover {
border-color: red;
}
html[data-stylesheet="Sankarea"] div.post.reply {
background: #111;
border: none;

View File

@ -48,7 +48,7 @@ if (board_type != 'txt') {
//shift-click on upload to remove file
document.addEventListener("DOMContentLoaded", function(event) {
if (document.getElementById("upload")) {
document.getElementById("upload").setAttribute("title", "Shift + Left Click to remove file.");
@ -61,4 +61,43 @@ document.addEventListener("DOMContentLoaded", function(event) {
},
false);
}
});
//post quoting
document.addEventListener("DOMContentLoaded", function(event) {
if (document.querySelector('body.thread')) { //Only allow post-quoting if thread is open.
//cite number + text if selected
function cite(id) {
const textArea = document.getElementById('body');
if (!textArea) {
return false;
}
document.getElementById('post-form').scrollIntoView();
textArea.value += `>>${id}\n`;
const selection = window.getSelection().toString();
if (selection) {
textArea.value += `>${selection.split("\n").join("\n>")}\n`;
}
textArea.focus();
}
//call a cite if # is numeric (avoids #top #bottom) that will only run on inital page load
if (location.hash.substr(1) != '') {
var hash = location.hash.substr(1); //remove # and convert to number
const regex = new RegExp('q[0-9]+');
if (regex.test(hash) == true) { //if #q123
var hash = hash.substr(1); //remove q
cite(hash);
}
}
// Get all posts
const posts = document.querySelectorAll("[num]");
for (const post of posts) {
post.addEventListener("click", (event) => {
event.preventDefault();
cite(post.getAttribute('num'));
});
}
};
});

View File

@ -30,7 +30,7 @@
<option value="warning" selected>Warning</option>
</select>
</td></tr>
<tr><th>Public:</th><td><label for="public"><input type="checkbox" id="public" name="public">Public Ban Message</label><input type="text" name="ban-message" size="25" maxlength="256" autocomplete="off" placeholder="(User was banned for this post.)"></td></tr>
<tr><th>Public:</th><td><label for="public_' . $post_number_reply . '"><input type="checkbox" id="public_' . $post_number_reply . '" name="public">Public Ban Message</label><input type="text" name="ban-message" size="25" maxlength="256" autocomplete="off" placeholder="(User was banned for this post.)"></td></tr>
<tr><th style="visibility:hidden;"></th><td><details style="float:right;"><summary style="text-align:right;">Ban</summary><input type="submit" name="create-ban" value="Create Ban"></details></td></tr>
</tbody></table></details>';
}
@ -77,7 +77,13 @@
echo '</span>';
}
?>
<span class="post-number"><a name="<?php echo $post_number_reply; ?>" href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_reply; ?>">No.</a><a href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_reply; ?>"><?php echo $post_number_reply; ?></a>&nbsp;</span>
<?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="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>';
?>
</div>
@ -129,11 +135,11 @@
$full_height = preg_replace('/^[^x]*x/', '', $reply_file[0][3]);
if ($reply_file[0][5] != "1") {
echo '<img id="'.$post_number_reply.'" class="thumb" width="'.$thmb_width.'" height="'.$thmb_height.'" src="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $reply_file[0][6] . '"/>';
echo '<img img-id="'.$post_number_reply.'" class="thumb" width="'.$thmb_width.'" height="'.$thmb_height.'" src="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $reply_file[0][6] . '"/>';
} else {
echo '<img id="'.$post_number_reply.'" class="thumb" width="'.$thumb_res_reply.'" height="'.$thumb_res_reply.'" src="' . $prefix_folder . '/' . '/assets/img/' . $thumb_spoiler . '"/>';
echo '<img img-id="'.$post_number_reply.'" class="thumb" width="'.$thumb_res_reply.'" height="'.$thumb_res_reply.'" src="' . $prefix_folder . '/' . '/assets/img/' . $thumb_spoiler . '"/>';
}
echo '<img id="'.$post_number_reply.'" class="expand" style="display:none;" width="'.$full_width.'" height="'.$full_height.'" img-src="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $reply_file[0][1] . '"/>';
echo '<img img-id="'.$post_number_reply.'" class="expand" style="display:none;" width="'.$full_width.'" height="'.$full_height.'" img-src="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $reply_file[0][1] . '"/>';
//image full
echo '</a>';

View File

@ -1,6 +1,6 @@
<div class="thread <?php echo $post_number_op ?>">
<div class="post op <?php echo $post_number_op ?>" data-postid="<?php echo $post_number_op; ?>">
<div class="post op" data-postid="<?php echo $post_number_op; ?>">
<?php
if ($op_file[0][0] == "deleted") {
echo '<div class="post-file"><div class="file-info deleted">File Deleted</div><div class="post-image"><img class="file-deleted" width="'.$thumb_res_reply.'" height="'.$thumb_res_reply.'" src="' . $prefix_folder . '/assets/img/' . $thumb_deleted . '"/></div></div>';
@ -48,11 +48,11 @@
$full_height = preg_replace('/^[^x]*x/', '', $op_file[0][3]);
if ($op_file[0][5] != "1") {
echo '<img id="'.$post_number_op.'" class="thumb" width="'.$thmb_width.'" height="'.$thmb_height.'" src="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $op_file[0][6] . '"/>';
echo '<img img-id="'.$post_number_op.'" class="thumb" width="'.$thmb_width.'" height="'.$thmb_height.'" src="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $op_file[0][6] . '"/>';
} else {
echo '<img id="'.$post_number_op.'" class="thumb" width="'.$thumb_res_reply.'" height="'.$thumb_res_reply.'" src="' . $prefix_folder . '/' . '/assets/img/' . $thumb_spoiler . '"/>';
echo '<img img-id="'.$post_number_op.'" class="thumb" width="'.$thumb_res_reply.'" height="'.$thumb_res_reply.'" src="' . $prefix_folder . '/' . '/assets/img/' . $thumb_spoiler . '"/>';
}
echo '<img id="'.$post_number_op.'" class="expand" style="display:none;" width="'.$full_width.'" height="'.$full_height.'" img-src="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $op_file[0][1] . '"/>';
echo '<img img-id="'.$post_number_op.'" class="expand" style="display:none;" width="'.$full_width.'" height="'.$full_height.'" img-src="' . $prefix_folder . '/' . $uploads_folder . '/' . $current_board . '/' . $op_file[0][1] . '"/>';
//image full
echo '</a>';
@ -145,7 +145,7 @@
<option value="warning" selected>Warning</option>
</select>
</td></tr>
<tr><th>Public:</th><td><label for="public"><input type="checkbox" id="public" name="public">Public Ban Message</label><input type="text" name="ban-message" size="25" maxlength="256" autocomplete="off" placeholder="(User was banned for this post.)"></td></tr>
<tr><th>Public:</th><td><label for="public_' . $post_number_op . '"><input type="checkbox" id="public_' . $post_number_op . '" name="public">Public Ban Message</label><input type="text" name="ban-message" size="25" maxlength="256" autocomplete="off" placeholder="(User was banned for this post.)"></td></tr>
<tr><th style="visibility:hidden;"></th><td><details style="float:right;"><summary style="text-align:right;">Ban</summary><input type="submit" name="create-ban" value="Create Ban"></details></td></tr>
</tbody></table></details>';
}
@ -193,7 +193,12 @@
}
?>
<span class="post-number"><a name="<?php echo $post_number_op; ?>" href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op; ?>">No.</a><a href="<?php echo $prefix_folder . '/' . $main_file . '?board=' . $current_board . '&thread=' . $post_number_op . '#' . $post_number_op; ?>"><?php echo $post_number_op; ?></a></span>
<?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="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>';
?>
<?php
if ($info_sticky == 1) {