200520 New reply layout and Longhorn theme
This commit is contained in:
@ -43,7 +43,7 @@ function get_urls($input) {
|
||||
shortcodes and the emoji url is defined in the same place */
|
||||
function emojify($string, $emojis, $size = 40) {
|
||||
foreach ($emojis as $emoji) {
|
||||
$string = str_replace(":" . $emoji['shortcode'] . ":", "<img alt='" . $emoji['shortcode'] . "' title='" . $emoji['shortcode'] . "' src='" . $emoji['static_url'] . "' height=$size style='vertical-align: middle;'>", $string);
|
||||
$string = str_replace(":" . $emoji['shortcode'] . ":", "<img class='emoji' alt='" . $emoji['shortcode'] . "' title='" . $emoji['shortcode'] . "' src='" . $emoji['static_url'] . "' height=$size style='vertical-align: middle;'>", $string);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
@ -321,8 +321,9 @@ function render_reply($item) {
|
||||
|
||||
$reply['id'] = $item['id'];
|
||||
$reply['uid'] = $item['account']['id'];
|
||||
$reply['name'] = emojify($item['account']['display_name'], $item['account']['emojis'], 15);
|
||||
$reply['name'] = emojify($item['account']['display_name'], $item['account']['emojis'], 20);
|
||||
$reply['acct'] = $item['account']['acct'];
|
||||
$reply['handle'] = "@".explode("@",$item['account']['acct'])[0];
|
||||
$reply['avatar'] = $item['account']['avatar'];
|
||||
|
||||
$reply['menu'] = "<ul>";
|
||||
@ -357,24 +358,25 @@ function render_reply($item) {
|
||||
$reply['replyto'] = ($item['in_reply_to_id'] ? " <a class='fontello link preview ldr' target='_blank' id='" . $item['in_reply_to_id'] . "' href='?thread=" . $item['in_reply_to_id'] . "'></a> " : "");
|
||||
$reply['text'] = processText($item);
|
||||
|
||||
$reply['date'] = "<a class='ldr postAge' id='".strtotime($item['created_at'])."' style='text-decoration:none;' target='_blank' href='?thread=" . $item['id'] . "'>" . time_elapsed_string($item['created_at']) . "</a> - <span class='fontello ".$item['visibility']."'> </span>";
|
||||
$reply['date'] = "<a class='ldr postAge' id='".strtotime($item['created_at'])."' style='text-decoration:none;' target='_blank' href='?thread=" . $item['id'] . "'>" . time_elapsed_string($item['created_at']) . "</a>";
|
||||
$reply['visibility'] = $item['visibility'];
|
||||
|
||||
$reply['media'] = "";
|
||||
if (!empty($item['media_attachments'])) {
|
||||
$reply['media'] = "<div style='width:170px; display:inline-block; float:left; margin-right:15px; '>";
|
||||
$reply['media'] = "<div style='width:170px; display:inline-block; float:left; margin:15px 0px 10px 0px;'>";
|
||||
$images = count($item['media_attachments']);
|
||||
$class = ($images > 1 ? "class='icon'" : "");
|
||||
foreach ($item['media_attachments'] as $file) {
|
||||
$ext = explode(".", $file['url']);
|
||||
$ext = end($ext);
|
||||
$ext = explode("?", $ext) [0];
|
||||
if ($ext == 'mp4' || $ext == 'webm') {
|
||||
if (in_array($ext,array('webm','mp4','ogv'))) {
|
||||
$reply['media'] .= "<div style='text-align:center; width:100%;'><video preload='metadata' width='100%' controls ".($user_settings['videoloop'] == "on" ? "loop" : "").">
|
||||
<source src='" . $file['url'] . "' type='video/$ext'>
|
||||
<source src='" . $file['url'] . "' type='video/".($ext == "ogv" ? "ogg" : $ext)."'>
|
||||
</video></div>
|
||||
";
|
||||
}
|
||||
elseif ($ext == 'mp3' || $ext == 'ogg') {
|
||||
elseif (in_array($ext,array('mp3','ogg','oga','opus'))) {
|
||||
$reply['media'] .= "<div style='text-align:center; width:100%;'><audio controls>
|
||||
<source src='" . $file['url'] . "' type='audio/$ext'>
|
||||
Your browser does not support the audio tag.
|
||||
@ -814,28 +816,36 @@ function timeline($query) {
|
||||
global $srv;
|
||||
|
||||
$notes = "";
|
||||
$media = ($query['text'] == "on" ? "" : "&only_media=true");
|
||||
$next = ($query['next'] ? "&max_id=" . $query['next'] : ($query['since'] ? "&since_id=" . $query['since'] : ""));
|
||||
|
||||
|
||||
$hq = array();
|
||||
$hq['limit'] = 30;
|
||||
$hq['only_media'] = ($query['text'] == "off" ? 'true' : 'false');
|
||||
if ($query['next']){
|
||||
$hq['max_id'] = $query['next'];
|
||||
$next = $query['next'];
|
||||
} elseif ($query['since']) {
|
||||
$hq['since_id'] = $query['since'];
|
||||
}
|
||||
|
||||
switch ($query['mode']) {
|
||||
case "home":
|
||||
$array = api_get("timelines/home?limit=30{$media}{$next}");
|
||||
$array = api_get("timelines/home?".http_build_query($hq));
|
||||
break;
|
||||
|
||||
case "federated":
|
||||
$array = api_get("timelines/public?limit=30{$media}{$next}");
|
||||
$array = api_get("timelines/public?".http_build_query($hq));
|
||||
break;
|
||||
|
||||
case "tag":
|
||||
$array = api_get("timelines/tag/" . $query['tag'] . "?limit=30{$media}{$next}");
|
||||
$array = api_get("timelines/tag/" . $query['tag'] . "?".http_build_query($hq));
|
||||
break;
|
||||
|
||||
case "local":
|
||||
$array = api_get("timelines/public?limit=30&local=true{$media}{$next}");
|
||||
$array = api_get("timelines/public?local=true&".http_build_query($hq));
|
||||
break;
|
||||
|
||||
case "user":
|
||||
$array = api_get("accounts/" . $query['user'] . "/statuses?limit=30{$media}{$next}");
|
||||
$array = api_get("accounts/" . $query['user'] . "/statuses?".http_build_query($hq));
|
||||
break;
|
||||
|
||||
case "thread":
|
||||
@ -845,19 +855,19 @@ function timeline($query) {
|
||||
break;
|
||||
|
||||
case "favourites":
|
||||
$array = api_get("favourites?limit=30{$media}{$next}");
|
||||
$array = api_get("favourites?".http_build_query($hq));
|
||||
break;
|
||||
|
||||
case "direct":
|
||||
$array = api_get("timelines/direct?limit=30{$next}");
|
||||
$array = api_get("timelines/direct?".http_build_query($hq));
|
||||
break;
|
||||
|
||||
case "list":
|
||||
$array = api_get("timelines/list/" . $query['list'] . "?limit=30{$next}");
|
||||
$array = api_get("timelines/list/" . $query['list'] . "?".http_build_query($hq));
|
||||
break;
|
||||
|
||||
case "bookmarks":
|
||||
$array = api_get("bookmarks?limit=30{$next}");
|
||||
$array = api_get("bookmarks?".http_build_query($hq));
|
||||
break;
|
||||
|
||||
case "search":
|
||||
@ -866,11 +876,11 @@ function timeline($query) {
|
||||
|
||||
case "account":
|
||||
$info = api_get("accounts/verify_credentials");
|
||||
$array = api_get("accounts/" . $info['id'] . "/statuses?limit=30{$media}{$next}");
|
||||
$array = api_get("accounts/" . $info['id'] . "/statuses?".http_build_query($hq));
|
||||
break;
|
||||
|
||||
default:
|
||||
$array = api_get("timelines/public?limit=30{$media}{$next}");
|
||||
$array = api_get("timelines/public?".http_build_query($hq));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1059,4 +1069,4 @@ function getHeaders($respHeaders) {
|
||||
}
|
||||
|
||||
return $headerText;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user