Browse Source

Add post type hint to reflinks

Resolves #226.
sqlitefix
Trevor Slocum 3 months ago
parent
commit
4c2ec96e6b
  1. 6
      css/burichan.css
  2. 1
      imgboard.php
  3. 3
      inc/functions.php
  4. 2
      inc/html.php
  5. 22
      js/tinyib.js

6
css/burichan.css

@ -190,9 +190,9 @@ hr {
}
.reply {
background: #D6DAF0;
color: #000000;
font-family: serif;
background: #D6DAF0 !important;
color: #000000 !important;
font-family: serif !important;
}
.replyhl {

1
imgboard.php

@ -572,6 +572,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
if (isset($_GET['res'])) {
$html = fixLinksInRes($html);
}
echo $html;
die();
// Check if the request is to auto-refresh a thread

3
inc/functions.php

@ -176,7 +176,8 @@ function fixLinksInRes($html) {
function _postLink($matches) {
$post = postByID($matches[1]);
if ($post) {
return '<a href="res/' . ($post['parent'] == TINYIB_NEWTHREAD ? $post['id'] : $post['parent']) . '.html#' . $matches[1] . '">' . $matches[0] . '</a>';
$is_op = $post['parent'] == TINYIB_NEWTHREAD;
return '<a href="res/' . ($is_op ? $post['id'] : $post['parent']) . '.html#' . $matches[1] . '" class="' . ($is_op ? 'refop' : 'refreply') . '">' . $matches[0] . '</a>';
}
return $matches[0];
}

2
inc/html.php

@ -441,7 +441,7 @@ function backlinks($post) {
if ($return != '') {
$return = '&nbsp;' . $return;
}
return ' <small><span id="reflinks' . $post['id'] . '" class="reflink">' . $return . '</span></small>';
return ' <small><span id="backlinks' . $post['id'] . '" class="backlinks">' . $return . '</span></small>';
}
function buildPost($post, $res, $compact=false) {

22
js/tinyib.js

@ -240,15 +240,15 @@ function setPostAttributes(element, autorefresh) {
}
if (enablebacklinks && autorefresh) {
reflinks = $('#reflinks' + m[1]);
if (reflinks) {
if (reflinks.html() == '') {
reflinks.append('&nbsp;');
backlinks = $('#backlinks' + m[1]);
if (backlinks) {
if (backlinks.html() == '') {
backlinks.append('&nbsp;');
} else {
reflinks.append(', ');
backlinks.append(', ');
}
reflinks.append('<a href="' + $(element).attr('postLink') + '">&gt;&gt;' + $(element).attr('postID') + '<a>');
setPostAttributes(reflinks, false);
backlinks.append('<a href="' + $(element).attr('postLink') + '">&gt;&gt;' + $(element).attr('postID') + '<a>');
setPostAttributes(backlinks, false);
}
}
@ -275,11 +275,15 @@ function setPostAttributes(element, autorefresh) {
} else if (refpost.html() && refpost.html() != undefined) {
preview.className = 'hoverpost';
$(preview).html(refpost.html());
if (refpost.hasClass('reply')) {
if (refpost.prop("tagName").toLowerCase() == 'td') {
$(preview).addClass('reply');
}
} else {
$(preview).html('<div class="hoverpost" style="padding: 14px;">Loading...</div>');
extraclasses = '';
if ($(this).hasClass('refreply')) {
extraclasses = ' reply';
}
$(preview).html('<div class="hoverpost' + extraclasses + '" style="padding: 14px;">Loading...</div>');
$(preview).fadeIn(125);
$.ajax({
url: base_url + $(this).attr('refID'),

Loading…
Cancel
Save