Timeline bugfixes

This commit is contained in:
daisuke 2021-03-27 12:04:26 -06:00
parent ed37590c5f
commit 5b558b6df6
5 changed files with 34 additions and 10 deletions

View File

@ -553,7 +553,7 @@ function timeline($query) {
$notes = "";
$hq = array();
$hq['limit'] = 30;
$hq['limit'] = 10;
$hq['only_media'] = ($query['text'] == "off" ? 'true' : 'false');
if ($query['next']){
$hq['max_id'] = $query['next'];
@ -858,7 +858,7 @@ function getnotif($id = false, $max = false) {
if (!isset($post["type"])){
break;
}
$user = "<a class='link ldr uname' style='font-size:12px;' href='?user=" . $post['account']['id'] . "'>" . emojify($post['account']['display_name'], $post['account']['emojis'], 10) . "</a>";
$user = "<a class='link ldr uname' style='font-size:12px;' href='?user=" . $post['account']['id'] . "'>" . (empty($post['account']['display_name']) ? $post['account']['acct'] : emojify($post['account']['display_name'], $post['account']['emojis'], 10)) . "</a>";
$preview = "";
$buttons = "";
$media = "";
@ -964,6 +964,7 @@ function getnotif($id = false, $max = false) {
function processText($elem) {
global $user_settings;
global $logedin;
require_once "vendor/simple_html_dom.php";
$content = trim(html_entity_decode($elem['content'],ENT_QUOTES));
$content = preg_replace("/<(?=[^>]*(?:<|$))/","&lt;",$content);
@ -1007,7 +1008,11 @@ function processText($elem) {
//$result = preg_replace("/(?<!=\")(\b[\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/", "<a target=\"_blank\" class='external' style='color:navy;' href=\"$1\">$1</a>", $result);
$result = emojify($result, $elem['emojis']);
$result = preg_replace("/#([A-Za-z0-9\/\.]*)/", "<a class='ldr' href=\"./?tag=$1\"><b>#$1</b></a>", $result);
if ($logedin){
$result = preg_replace("/#([A-Za-z0-9\/\.]*)/", "<a class='ldr' href=\"./?tag=$1\"><b>#$1</b></a>", $result);
} else {
$result = preg_replace("/#([A-Za-z0-9\/\.]*)/", "<b>#$1</b>", $result);
}
return $result;
}

View File

@ -462,6 +462,9 @@ $('body').on('click', '.loadmore', function() {
});
function newPosts() {
var url = window.location.href;
var thread = getUrlParameter('thread');
if (typeof thread !== 'undefined') {
return false;
@ -485,6 +488,11 @@ function newPosts() {
}
$.get("index.php?ajax=1&since=" + id + "" + pageMode, function(data) {
if (window.location.href !== url){
return false;
}
if (data) {
var scroll = $(window).scrollTop();
if (scroll > 1000) {

View File

@ -38,6 +38,10 @@ $query = http_build_query(array_filter(array(
return false;
}
$.get("action.php?a=true&notes=" + thread, function(data) {
thread = getUrlParameter('thread');
if (typeof thread == 'undefined') {
return false;
}
$( ".post_notes" ).html(data);
});
}, 15000);

View File

@ -84,7 +84,7 @@ if ($logedin) {
<div class='gotop desktop'><a href='#top'></a></div>
<div class="topbar" style='text-align:center; background-color:none;'>
<div class="topbar" style='height:45px; z-index:99;'>
<span style='float:left; line-height:45px;padding-left:10px;' class='appname'>
<span style='float:left; line-height:45px;padding-left:10px;' class='appname desktop'>
<a href="./<?php echo ($logedin ? "?mode=home" : ""); ?>" style="font-family: 'patua', serif; font-weight:bold; color:white; font-size:20px; text-decoration:none" ><?php echo $setting['appname']; ?></a>
</span>
@ -114,8 +114,13 @@ if ($logedin) {
</span>
<?php endif; ?>
<span style='float:right; margin-right:20px; height:100%;'>
<span class="fw" style='margin-right:20px; height:100%;'>
<?php if ($logedin): ?>
<span class="topbutton mobile" style='position:relative;'>
<a href="./<?php echo ($logedin ? "?mode=home" : ""); ?>"' class='fontello topicon' style='text-decoration:none; display:inline; font-size:20px;'>&#xe816;</a>
</span>
<span class="topbutton desktop" style='position:relative;'>
<div style='position:absolute; left:-200px; display:none; height: 50%; background-color:white; border-radius:10px; padding: 2px; margin-top: 8px;' class="search"><form method='get' style="margin-top:-11px;"><input type='text' name='search' style='margin-left:3px; width:150px' placeholder='Type your search here'><input type='submit' value='&#xe800;' class='fontello'></form></div>
<a href='?page=search' class='searchform fontello topicon' onClick='return false'>&#xe800;</a>

View File

@ -138,7 +138,7 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
continue;
}
$post['name'] = emojify($elem['reblog']['account']['display_name'], $elem['reblog']['account']['emojis'], 20);
$post['name'] = (empty($elem['reblog']['account']['display_name']) ? $elem['reblog']['account']['acct'] : emojify($elem['reblog']['account']['display_name'], $elem['reblog']['account']['emojis'], 20));
$post['uid'] = $elem['reblog']['account']['id'];
$post['acct'] = '';//$elem['reblog']['account']['acct'];
$post['handle'] = explode("@",$elem['reblog']['account']['acct'])[0];
@ -148,7 +148,7 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
$elem = $elem['reblog'];
}
else {
$post['name'] = emojify($elem['account']['display_name'], $elem['account']['emojis'], 20);
$post['name'] = (empty($elem['account']['display_name']) ? $elem['account']['acct'] : emojify($elem['account']['display_name'], $elem['account']['emojis'], 20));
$post['uid'] = $elem['account']['id'];
$post['acct'] = "(@".$elem['account']['acct'].")";
$post['handle'] = explode("@",$elem['account']['acct'])[0];
@ -268,7 +268,8 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
/* if the post is marked as sensitive and nsfw hiding isn't turned off, we'll blur the image */
if ($elem['sensitive'] == true && $user_settings['explicit'] != 'off') {
$post['media'] .= " <div style='overflow:hidden; float:left; margin:2px;background-color:#".(($class != "") || ($elem['sensitive'] == true && $user_settings['explicit'] != 'off') ? averageColor($file['url']) : "000")."!important; ".($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;")."' $class>
//$post['media'] .= " <div style='overflow:hidden; float:left; margin:2px;background-color:#".(($class != "") || ($elem['sensitive'] == true && $user_settings['explicit'] != 'off') ? averageColor($file['url']) : "000")."!important; ".($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;")."' $class>
$post['media'] .= " <div style='overflow:hidden; float:left; margin:2px;background-color:#".(($class != "") || ($elem['sensitive'] == true && $user_settings['explicit'] != 'off') ? "000" : "000")."!important; ".($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;")."' $class>
<div class='toggleblur' style='height:25px;'>&#xe81b; Blur</div>
<a target='_blank' href='" . $file['url'] . "' onClick='return false;' style='width:100%;' class='blur'>
<noscript><img src='" . $file['url'] . "' style='width:100%;'></noscript>
@ -282,11 +283,12 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
else {
/* If the post was sensitive and wasn't caught by the nsfw filter and
didn't got blurred, then the image will be shown normally */
$post['media'] .= "<div style='margin:0px; ".($images == 3 && $m == 3 ? "width:100% !important;" : "")."background-color:#".($class != "" ? averageColor($file['url']) : "000").";' $class><a target='_blank' href='" . $file['url'] . "' onClick='return false;' class='open-lightbox'><img " . ($e < 2 ? "src='" . $file['url'] . "'" : "data-src='" . $file['url'] . "'") . " class='lazyload' style='" . ($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;") . " vertical-align:middle;'><noscript><img src='" . $file['url'] . "' style='width:100%;'></noscript></a></div>";
$post['media'] .= "<div style='margin:0px; ".($images == 3 && $m == 3 ? "width:100% !important;" : "")."background-color:#".($class != "" ? "000" : "000").";' $class><a target='_blank' href='" . $file['url'] . "' onClick='return false;' class='open-lightbox'><img " . ($e < 2 ? "src='" . $file['url'] . "'" : "data-src='" . $file['url'] . "'") . " class='lazyload' style='" . ($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;") . " vertical-align:middle;'><noscript><img src='" . $file['url'] . "' style='width:100%;'></noscript></a></div>";
// $post['media'] .= "<div style='margin:0px; ".($images == 3 && $m == 3 ? "width:100% !important;" : "")."background-color:#".($class != "" ? averageColor($file['url']) : "000").";' $class><a target='_blank' href='" . $file['url'] . "' onClick='return false;' class='open-lightbox'><img " . ($e < 2 ? "src='" . $file['url'] . "'" : "data-src='" . $file['url'] . "'") . " class='lazyload' style='" . ($images === 1 ? "width:100%;" : "max-width:100%; max-height:100%;") . " vertical-align:middle;'><noscript><img src='" . $file['url'] . "' style='width:100%;'></noscript></a></div>";
}
} else {
$post['media'] .= "<center><table><tr><td><a href='".$file['url']."' download><img src='img/doc.png' width=40 border=0></a></td><td><a href='".$file['url']."' target='_blank'>".$file['description']."</a></td></tr></table></center>";
$post['media'] .= "<center><table><tr><td><a href='".$file['remote_url']."' download><img src='img/doc.png' width=40 border=0></a></td><td><a href='".$file['url']."' target='_blank'>".$file['description']."</a></td></tr></table></center>";
}
$m++;