From f59049c3c2b8eacb0a3e9b49c8c1468e101b22d8 Mon Sep 17 00:00:00 2001 From: Daisuke Date: Tue, 21 Apr 2020 17:42:31 -0500 Subject: [PATCH] More work on polls and themes --- action.php | 2 +- css/color.css | 34 +++++++------- include/functions.php | 78 +++++++++++++++++++++++++------- js/scripts.js | 4 +- layout/header.php | 14 +++--- modules/settings.php | 14 +++--- modules/timeline.php | 12 +++-- settings.php | 2 +- templates/replyform.txt | 8 ++-- themes/1994/css/color.css | 37 +++++++++++---- themes/amplifier/css/color.css | 22 ++++----- themes/ancientbird/css/color.css | 24 +++++++++- themes/bythebook/css/color.css | 22 ++++++++- themes/chicago/css/color.css | 30 ++++++++---- themes/cuatro/css/color.css | 27 ++++++++--- themes/custom/css/color.php | 17 ++++++- themes/monad/css/color.css | 16 ++++++- themes/phubbub/css/color.css | 21 ++++++--- 18 files changed, 281 insertions(+), 103 deletions(-) diff --git a/action.php b/action.php index f5e8f77..476fec5 100644 --- a/action.php +++ b/action.php @@ -41,7 +41,7 @@ if (isset($_GET['action']) && $_GET['action'] == "settings"){ $user_settings['replies'] = ($value == "on" ? "on" : "off"); break; - case "setreblog": + case "reblog": $user_settings['reblog'] = ($value == "on" ? "on" : "off"); break; diff --git a/css/color.css b/css/color.css index 5fe34f7..e1cbb5a 100644 --- a/css/color.css +++ b/css/color.css @@ -18,21 +18,7 @@ label { textarea,input[type="text"]{ box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px rgba(255, 255, 255, 0.1); border-radius: 5px; -} - -.polloption{ - box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px rgba(255, 255, 255, 0.1); - border-radius: 5px; - display:block; - margin:5px; - padding:5px; - background-color: #ddd; -} - -.polloption:hover{ - background-color: #305792; - box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); - color: white; + border:0px; } input[type="radio"]:checked+label,select { @@ -124,7 +110,7 @@ input[type="checkbox"]:checked+label { background-color:white; } -#send { +input[type="submit"] { background-color:#305792; border: 1px solid #305792; color:white; @@ -243,6 +229,22 @@ input[type="checkbox"]:checked+label { color:white; } +.polloption{ + box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px rgba(255, 255, 255, 0.1); + border-radius: 5px; + display:block; + margin:5px; + padding:5px; + background-color: #ddd; +} + +.polloption:hover{ + background-color: #305792; + box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); + color: white; + cursor: pointer; +} + .post_footer { background-color: #eee; } diff --git a/include/functions.php b/include/functions.php index 987a4e4..b326fd9 100644 --- a/include/functions.php +++ b/include/functions.php @@ -67,6 +67,7 @@ function emojify($string, $emojis, $size = 40) { function emoji_list($val){ $emojilist = api_get("/custom_emojis"); $c = 0; + $return = ""; foreach ($emojilist as $emoji){ if (starts_with($emoji['shortcode'],$val) && $c < 50){ $return .= ""; @@ -283,7 +284,7 @@ function render_reply($item) { $unlisted = ""; $direct = ""; - $reply['date'] = " - " . date("d/m/y H:i", strtotime($item['created_at'])) . " - " . $$item['visibility'] . ""; + $reply['date'] = "" . time_elapsed_string($item['created_at']) . " - " . $$item['visibility'] . ""; $reply['media'] = ""; if (!empty($item['media_attachments'])) { @@ -720,23 +721,23 @@ function timeline($query) { switch ($query['mode']) { case "home": - $array = api_get("timelines/home?limit=25{$media}{$next}"); + $array = api_get("timelines/home?limit=30{$media}{$next}"); break; case "federated": - $array = api_get("timelines/public?limit=25{$media}{$next}"); + $array = api_get("timelines/public?limit=30{$media}{$next}"); break; case "tag": - $array = api_get("timelines/tag/" . $query['tag'] . "?limit=25{$media}{$next}"); + $array = api_get("timelines/tag/" . $query['tag'] . "?limit=30{$media}{$next}"); break; case "local": - $array = api_get("timelines/public?limit=25&local=true{$media}{$next}"); + $array = api_get("timelines/public?limit=30&local=true{$media}{$next}"); break; case "user": - $array = api_get("accounts/" . $query['user'] . "/statuses?limit=25{$media}{$next}"); + $array = api_get("accounts/" . $query['user'] . "/statuses?limit=30{$media}{$next}"); break; case "thread": @@ -746,19 +747,19 @@ function timeline($query) { break; case "favourites": - $array = api_get("favourites?limit=25{$media}{$next}"); + $array = api_get("favourites?limit=30{$media}{$next}"); break; case "direct": - $array = api_get("timelines/direct?limit=25{$next}"); + $array = api_get("timelines/direct?limit=30{$next}"); break; case "list": - $array = api_get("timelines/list/" . $query['list'] . "?limit=25{$next}"); + $array = api_get("timelines/list/" . $query['list'] . "?limit=30{$next}"); break; case "bookmarks": - $array = api_get("bookmarks?limit=25{$next}"); + $array = api_get("bookmarks?limit=30{$next}"); break; case "search": @@ -767,11 +768,11 @@ function timeline($query) { case "account": $info = api_get("accounts/verify_credentials"); - $array = api_get("accounts/" . $info['id'] . "/statuses?limit=25{$media}{$next}"); + $array = api_get("accounts/" . $info['id'] . "/statuses?limit=30{$media}{$next}"); break; default: - $array = api_get("timelines/public?limit=25{$media}{$next}"); + $array = api_get("timelines/public?limit=30{$media}{$next}"); break; } @@ -781,7 +782,7 @@ function timeline($query) { $next = end($array) ['id']; $thread = array(); - + /* foreach ($array as $elem) { if ($query['replies'] == "on" || $query['mode'] == "thread") { $thread[] = $elem; @@ -792,12 +793,26 @@ function timeline($query) { } } + }*/ + + foreach ($array as $elem) { + if ($query['replies'] == "on" || $query['mode'] == "thread") { + $thread[] = $elem; + } + else { + if ($elem['in_reply_to_id'] == null) { + $thread[] = $elem; + } else { + $rel = api_get("accounts/relationships?id=" . $elem['in_reply_to_account_id']); + if ($rel[0]['following']){ + $thread[] = $elem; + } + } + } + } - return array( - $thread, - $next - ); + return $thread; } /* this function takes in a whole post entity and spits out the HTMLfied text of the post @@ -896,3 +911,32 @@ function themes($mode,$name = false){ } } } + +function time_elapsed_string($datetime, $full = false) { + $now = new DateTime; + $ago = new DateTime($datetime); + $diff = $now->diff($ago); + + $diff->w = floor($diff->d / 7); + $diff->d -= $diff->w * 7; + + $string = array( + 'y' => 'year', + 'm' => 'month', + 'w' => 'week', + 'd' => 'day', + 'h' => 'hour', + 'i' => 'minute', + 's' => 'second', + ); + foreach ($string as $k => &$v) { + if ($diff->$k) { + $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : ''); + } else { + unset($string[$k]); + } + } + + if (!$full) $string = array_slice($string, 0, 1); + return $string ? implode(', ', $string) . ' ago' : 'just now'; +} \ No newline at end of file diff --git a/js/scripts.js b/js/scripts.js index 04d6fc9..6748738 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -431,7 +431,7 @@ $('body').on('click', '#settings #send', function() { $('#settings #send').after(''); var attach = $('#settings input[name=attach]:checked').val(); var explicit = $('#settings input[name=explicit]:checked').val(); - var replies = $('#settings input[name=replies]:checked').val(); + var replies = $('#settings input[name=replies]').val(); var reblog = $('#settings input[name=reblog]:checked').val(); var text = $('#settings input[name=text]:checked').val(); var videoloop = $('#settings input[name=videoloop]:checked').val(); @@ -464,7 +464,7 @@ $('body').on('click', '#settings #send', function() { $('#settings #loading').remove(); $('#settings #send').after('Settings Saved'); $('#settings #saved').delay(1000).fadeOut("slow"); - window.location.reload(true); + window.location.reload(true); }); }); diff --git a/layout/header.php b/layout/header.php index efdfe28..d61f767 100644 --- a/layout/header.php +++ b/layout/header.php @@ -2,11 +2,11 @@ <?php echo $setting['appname']; ?> - - - ?id=' /> - - + + + ?id=' /> + +