From 125b9443859f780480cdf04da3f4afe470ceb9b3 Mon Sep 17 00:00:00 2001 From: Daisuke Date: Wed, 13 May 2020 15:26:38 -0500 Subject: [PATCH] 130520 User search and wetcat theme --- action.php | 12 +- css/mobile.css | 40 +++- css/style.css | 21 +- include/functions.php | 57 +++-- js/scripts.js | 70 +++--- layout/header.php | 11 +- modules/timeline.php | 13 +- templates/post.txt | 2 +- templates/reply.txt | 4 +- templates/replyform.txt | 4 + templates/textpost.txt | 2 +- themes/1994/css/color.css | 9 +- themes/chicago/css/color.css | 90 +++++-- themes/chicago/css/mobile.css | 8 +- themes/chicago/css/style.css | 7 + themes/wetcat/bg.jpg | Bin 0 -> 72598 bytes themes/wetcat/css/color.css | 425 ++++++++++++++++++++++++++++++++++ themes/wetcat/css/mobile.css | 13 ++ themes/wetcat/css/style.css | 6 + themes/wetcat/loadingb.gif | Bin 0 -> 18353 bytes themes/whistler/css/color.css | 18 +- 21 files changed, 689 insertions(+), 123 deletions(-) create mode 100644 themes/chicago/css/style.css create mode 100644 themes/wetcat/bg.jpg create mode 100644 themes/wetcat/css/color.css create mode 100644 themes/wetcat/css/mobile.css create mode 100644 themes/wetcat/css/style.css create mode 100644 themes/wetcat/loadingb.gif diff --git a/action.php b/action.php index 8306dec..1dee695 100644 --- a/action.php +++ b/action.php @@ -276,12 +276,8 @@ foreach($_GET as $key => $value){ case "userinfo": $info = api_get("accounts/".htmlentities($value)); $rel = api_get("accounts/relationships?id=".htmlentities($value)); - $image=imagecreatefromstring(file_get_contents($info['avatar'])); - $thumb=imagecreatetruecolor(1,1); - imagecopyresampled($thumb,$image,0,0,0,0,1,1,imagesx($image),imagesy($image)); - $mainColor=strtoupper(dechex(imagecolorat($thumb,0,0))); - echo "
+ echo "
".$info['acct']." @@ -326,9 +322,13 @@ foreach($_GET as $key => $value){ case "emoji": echo emoji_list(sanitize($value)); - //die(); + break; + + case "contact": + echo contact_search(sanitize($value)); break; } + } diff --git a/css/mobile.css b/css/mobile.css index 62b7d61..69e41c0 100644 --- a/css/mobile.css +++ b/css/mobile.css @@ -34,6 +34,10 @@ select{ font-weight:bold; font-family:fontello, sans-serif; } + +.postform select,.reply select{ + width: 45px; +} option{ font-family:fontello, sans-serif; @@ -263,7 +267,7 @@ aside { font-weight:bold; margin-top:5px; } - + .formbtn { background-color:transparent; border: 0px; @@ -307,7 +311,6 @@ aside { #usermenu .menu { display: none; width: 150px; - height: 100px; position: absolute; top: -322px; left: -80px; @@ -366,10 +369,21 @@ aside { } .felem { - margin-left: 10px; + margin-left: 7px; float: left; } +.contact{ + background-color:white; + cursor: pointer; + border-top:1px dotted #aaa; +} + +.contact:hover{ + background-color:#0000a0; + color:white; +} + .avatar { width: 80px; background-size: 80px; @@ -413,6 +427,14 @@ aside { text-align: left; } +.postHeader div { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + + + .postHeader *,.post_footer *{ font-size:small; } @@ -468,9 +490,9 @@ aside { } .blur { - -webkit-filter: blur(25px) brightness(70%) grayscale(100%); + -webkit-filter: blur(25px) brightness(70%) grayscale(80%); /* Safari 6.0 - 9.0 */ - filter: blur(25px) brightness(70%) grayscale(100%); + filter: blur(25px) brightness(70%) grayscale(80%); opacity: 0.5; transition: 0.4s; } @@ -483,8 +505,8 @@ aside { .small { width: 48% !important; - height: 321px; - line-height: 321px; + height: 221px; + line-height: 221px; background-color: black; float:left; margin:2px !important; @@ -492,8 +514,8 @@ aside { .smaller { width: 31% !important; - height: 212px; - line-height: 212px; + height: 112px; + line-height: 112px; background-color: black; float:left; margin:2px !important; diff --git a/css/style.css b/css/style.css index 92ab83b..d816861 100644 --- a/css/style.css +++ b/css/style.css @@ -262,7 +262,7 @@ aside { margin-top:5px; float:left; } - + .formbtn { background-color:transparent; border: 0px; @@ -363,6 +363,17 @@ aside { float: left; } +.contact{ + background-color:white; + cursor: pointer; + border-top:1px dotted #aaa; +} + +.contact:hover{ + background-color:#0000a0; + color:white; +} + .avatar { width: 80px; height: 80px; @@ -454,9 +465,9 @@ aside { } .blur { - -webkit-filter: blur(25px) brightness(70%) grayscale(100%); + -webkit-filter: blur(25px) brightness(70%) grayscale(80%); /* Safari 6.0 - 9.0 */ - filter: blur(25px) brightness(70%) grayscale(100%); + filter: blur(25px) brightness(70%) grayscale(80%); opacity: 0.5; transition: 0.4s; } @@ -468,7 +479,7 @@ aside { } .small { - width: 321px !important; + width: 321px; height: 321px; line-height: 321px; /* background-color: black; */ @@ -477,7 +488,7 @@ aside { } .smaller { - width: 212px !important; + width: 212px; height: 212px; line-height: 212px; /* background-color: black; */ diff --git a/include/functions.php b/include/functions.php index 688eaf4..ec9a5c4 100644 --- a/include/functions.php +++ b/include/functions.php @@ -39,23 +39,6 @@ function get_urls($input) { return false; } -/* this function replaces the emoji codes in a text with the correspondent emojis - of the specified instance, returns the html code with the emojis in the specified size*/ - /* -function emoji($text, $size = 30, $srv) { - $data = json_decode(file_get_contents("https://$srv/api/v1/custom_emojis") , true) [0]['url']; - $u = explode("/", $data); - array_pop($u); - $url = implode("/", $u); - $text = str_replace("http:", "http;", $text); - $text = str_replace("https:", "https;", $text); - $text = preg_replace('~:([a-z0-9_]+):~', "", $text); - $text = str_replace("http;", "http:", $text); - $text = str_replace("https;", "https:", $text); - return $text; -} -*/ - /* this is the same as above but is used on other places, like user bios and places where the shortcodes and the emoji url is defined in the same place */ function emojify($string, $emojis, $size = 40) { @@ -89,6 +72,22 @@ function emoji_list($val){ return $return; } +function contact_search($val){ + global $user_settings; + $return = ""; + $list = api_get("/accounts/search?q=".$val); + foreach ($list as $contact){ + $return .= "
+
+
+ ".emojify($contact['display_name'], $contact['emojis'], 15)."
+ ".$contact['acct']." +
+
"; + } + return $return; +} + /* general function to check if one strings starts with a given search */ function starts_with($string,$search){ @@ -921,10 +920,13 @@ function processText($elem) { global $user_settings; require_once "vendor/simple_html_dom.php"; $content = trim(html_entity_decode($elem['content'],ENT_QUOTES)); + $content = preg_replace("/<(?=[^>]*(?:<|$))/","<",$content); if (!empty($content)) { $html = str_get_html($content); foreach ($html->find('a') as $lnk) { + + //remove text links to media attachments foreach ($elem['media_attachments'] as $f) { if (is_numeric(strpos($f['description'],explode("…",$lnk->innertext)[0]))) { $content = str_replace($lnk->outertext . "
", null, $content); @@ -933,6 +935,7 @@ function processText($elem) { } } + //modify links for hashtags and external urls if (is_numeric(strpos($lnk->href, $user_settings['instance'])) || in_array($lnk->class, array( "u-url mention", "hashtag" @@ -947,7 +950,7 @@ function processText($elem) { } } } - + $result = strip_tags($content, '

'); $result = str_replace('
', '
', $result); //$result = str_replace(''', "'", $result); @@ -1038,4 +1041,22 @@ function time_elapsed_string($datetime, $full = false) { if (!$full) $string = array_slice($string, 0, 1); return $string ? implode(', ', $string) . ' ago' : 'just now'; +} + +function getHeaders($respHeaders) { + $headers = array(); + + $headerText = substr($respHeaders, 0, strpos($respHeaders, "\r\n\r\n")); + + foreach (explode("\r\n", $headerText) as $i => $line) { + if ($i === 0) { + $headers['http_code'] = $line; + } else { + list ($key, $value) = explode(': ', $line); + + $headers[$key] = $value; + } + } + + return $headerText; } \ No newline at end of file diff --git a/js/scripts.js b/js/scripts.js index 9f1a173..3d41ce6 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -22,6 +22,11 @@ $('body').on('click', '#emoji', function(e) { $(this).closest(".element").find('.picker').css("display","block"); }); +$('body').on('click', '#contact', function(e) { + $(this).closest(".element").find('.contactpicker').css("display","none"); + $(this).closest(".element").find('.contactpicker').css("display","block"); +}); + $('body').on('click', '.emoji', function(e) { var code = $(this).attr("title"); console.log(code); @@ -29,9 +34,16 @@ $('body').on('click', '.emoji', function(e) { $(this).closest(".element").find("#status").val(boxtxt + ":"+code+":"); }); +$('body').on('click', '.contact', function(e) { + var code = $(this).attr("title"); + console.log(code); + boxtxt = $(this).closest(".element").find("#status").val(); + $(this).closest(".element").find("#status").val(boxtxt + " "+code); +}); + $('body').on('click', '.close', function(e) { - $(this).closest('.element').find('.emojilist').html(""); - $(this).closest(".element").find('.picker').css("display","none"); + $(this).next().html(""); + $(this).parent('div').css("display","none"); }); $(document).on("change paste keyup","#emojisearch",function () { @@ -43,6 +55,15 @@ $(document).on("change paste keyup","#emojisearch",function () { }); }); +$(document).on("change paste keyup","#contactsearch",function () { + var val = $(this).val(); + var list = $(this).closest('.element').find('.contactlist'); + console.log(val); + $.get("action.php?a=true&contact=" + val, function(data) { + list.html(data); + }); +}); + // Open Lightbox $('body').on('click', '.open-lightbox', function(e) { e.preventDefault(); @@ -186,8 +207,6 @@ $('body').on('click', '.unblock', function() { }); }); - - $('body').on('click', '.autl', function() { var id = $(this).attr('id'); var list = $(this).attr('list'); @@ -307,15 +326,6 @@ $('.container').on('mouseleave', '.preview', function(event) { $('.container').find('.previewpost').fadeOut(300, function() { $(this).remove(); }); }); -/* -$('body').on('mouseleave', '.userinfo', function() { - var id = $(this).attr('id'); - $.when($('#' + id + '.userinfo').fadeOut()).then(function() { - $('#' + id + '.userinfo').remove(); - }); -}); -* */ - var getUrlParameter = function getUrlParameter(sParam) { var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split('&'), @@ -392,7 +402,6 @@ $('body').on('click', '.loadmore', function() { loadmore(); }); - function newPosts() { var thread = getUrlParameter('thread'); if (typeof thread !== 'undefined') { @@ -442,35 +451,6 @@ window.setInterval(function() { newPosts(); }, 25000); -/* -$('body').on('click', '#settings #send', function() { - $('#settings #send').after(''); - var params = { - attach: $('#settings input[name=attach]:checked').val(), - explicit: $('#settings input[name=explicit]:checked').val(), - replies: $('#settings select[name=replies]').val(), - reblog: $('#settings input[name=reblog]:checked').val(), - mtwords: $('#settings textarea[name=mtwords]').val(), - videoloop: $('#settings input[name=videoloop]:checked').val(), - text: $('#settings input[name=text]:checked').val(), - theme: $('#settings').find('select[name=theme]').val(), - fg: $('#settings').find('input[name=fg]').val(), - bg: $('#settings').find('input[name=bg]').val(), - tx: $('#settings').find('input[name=tx]').val(), - lc: $('#settings').find('input[name=lc]').val(), - bc: $('#settings').find('input[name=bc]').val(), - bw: $('#settings').find('input[name=bw]').val(), - br: $('#settings').find('input[name=br]').val() - }; - $.get("?action=settings&ajax=1&" + $.param(params), function(data) { - $('#settings #loading').remove(); - $('#settings #send').after('Settings Saved'); - $('#settings #saved').delay(1000).fadeOut("slow"); - window.location.reload(true); - }); -}); -*/ - function themecheck(name){ if(name.value == "custom"){ $('#customtheme').css("display","block"); @@ -510,5 +490,9 @@ function timeSince(date) { if (interval >= 1) { return interval + " minute"+(interval > 1 ? "s" : ""); } + + if (interval < 0) { + return " just now"; + } return Math.floor(seconds) + " seconds"; } \ No newline at end of file diff --git a/layout/header.php b/layout/header.php index f93aaeb..1b23aa0 100644 --- a/layout/header.php +++ b/layout/header.php @@ -153,17 +153,16 @@ if ($logedin) {

- + - + - + @@ -215,6 +214,7 @@ endif; ?>
+
@@ -231,6 +231,9 @@ endif; ?>
😜
+
+  +
diff --git a/modules/timeline.php b/modules/timeline.php index 13f777c..2202dde 100644 --- a/modules/timeline.php +++ b/modules/timeline.php @@ -194,7 +194,6 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) { } $post['json'] = json_encode($json); - /* the options menu of the post */ $post['menu'] = "