diff --git a/QvitterPlugin.php b/QvitterPlugin.php index e11b8f8..c3c9bf8 100644 --- a/QvitterPlugin.php +++ b/QvitterPlugin.php @@ -528,16 +528,16 @@ class QvitterPlugin extends Plugin { $oembed = File_oembed::getKV('file_id',$attachment->id); if($oembed instanceof File_oembed) { $oembed_html = str_replace('<!--//-->','',$oembed->html); // trash left of wordpress' javascript after htmLawed removed the tags - if($oembed->provider == 'Twitter' && strstr($oembed_html, '>— '.$oembed->author_name)) { - $oembed_html = substr($oembed_html,0,strpos($oembed_html, '>— '.$oembed->author_name)+1); // remove user data from twitter oembed html (we have it in ) - $twitter_username = substr($oembed->html,strpos($oembed->html, '>— '.$oembed->author_name)+strlen('>— '.$oembed->author_name)); + if($oembed->provider == 'Twitter' && strstr($oembed_html, '>— '.$oembed->author_name)) { + $oembed_html = substr($oembed_html,0,strpos($oembed_html, '>— '.$oembed->author_name)+1); // remove user data from twitter oembed html (we have it in ) + $twitter_username = substr($oembed->html,strpos($oembed->html, '>— '.$oembed->author_name)+strlen('>— '.$oembed->author_name)); $twitter_username = substr($twitter_username, strpos($twitter_username,'(@')+1); $twitter_username = substr($twitter_username, 0,strpos($twitter_username,')')); $oembed->title = $twitter_username; } $oembed_html = str_replace('…','...',$oembed_html); // ellipsis is sometimes stored as html in db, for some reason - $oembed_html = mb_substr(trim(strip_tags(html_entity_decode($oembed_html,ENT_QUOTES))),0,250); // sometimes we have html charachters that we want to decode and then strip - $oembed_title = trim(strip_tags(html_entity_decode($oembed->title,ENT_QUOTES))); + $oembed_html = mb_substr(trim(strip_tags($oembed_html)),0,250); + $oembed_title = trim(strip_tags(html_entity_decode($oembed->title,ENT_QUOTES))); // sometimes we have html charachters that we want to decode and then strip $oembed_provider = trim(strip_tags(html_entity_decode($oembed->provider,ENT_QUOTES))); $oembed_author_name = trim(strip_tags(html_entity_decode($oembed->author_name,ENT_QUOTES))); $attachment_url_to_id[$enclosure_o->url]['oembed'] = array( @@ -703,11 +703,33 @@ class QvitterPlugin extends Plugin { // reply-to profile url try { $reply = $notice->getParent(); - $twitter_status['in_reply_to_profileurl'] = $reply->getProfile()->getUrl(); + $reply_profile = $reply->getProfile(); + $twitter_status['in_reply_to_profileurl'] = $reply_profile->getUrl(); + $twitter_status['in_reply_to_ostatus_uri'] = $reply_profile->getUri(); } catch (ServerException $e) { $twitter_status['in_reply_to_profileurl'] = null; + $twitter_status['in_reply_to_ostatus_uri'] = null; } + // attentions + try { + $attentions = $notice->getAttentionProfiles(); + $attentions_array = array(); + foreach ($attentions as $attn) { + if(!$attn->isGroup()) { + $attentions_array[] = array( + 'id' => $attn->getID(), + 'screen_name' => $attn->getNickname(), + 'fullname' => $attn->getStreamName(), + 'profileurl' => $attn->getUrl(), + 'ostatus_uri' => $attn->getUri(), + ); + } + } + $twitter_status['attentions'] = $attentions_array; + } catch (Exception $e) { + // + } // fave number $faves = Fave::byNotice($notice); diff --git a/actions/apiqvitterblocks.php b/actions/apiqvitterblocks.php index ebeed52..f6d7bb2 100644 --- a/actions/apiqvitterblocks.php +++ b/actions/apiqvitterblocks.php @@ -109,14 +109,18 @@ class ApiQvitterBlocksAction extends ApiPrivateAuthAction $blocks = QvitterBlocked::getBlocked($this->target->id, $offset, $limit); - $profiles = array(); + if($blocks) { + $profiles = array(); - while ($blocks->fetch()) { - $this_profile_block = clone($blocks); - $profiles[] = $this->getTargetProfile($this_profile_block->blocked); + while ($blocks->fetch()) { + $this_profile_block = clone($blocks); + $profiles[] = $this->getTargetProfile($this_profile_block->blocked); + } + return $profiles; + } else { + return false; } - return $profiles; } /** diff --git a/actions/qvitter.php b/actions/qvitter.php index 19d131d..672a655 100644 --- a/actions/qvitter.php +++ b/actions/qvitter.php @@ -158,6 +158,17 @@ class QvitterAction extends ApiAction print ' '."\n"; print ' '."\n"; + // rel="me" for the IndieWeb audience + $relMes = array( + ['href' => $user->getProfile()->getHomepage(), + 'text' => _('Homepage'), + 'image' => null], + ); + Event::handle('OtherAccountProfiles', array($user->getProfile(), &$relMes)); + foreach ($relMes as $relMe) { + print ' '."\n"; + } + // maybe openid if (array_key_exists('OpenID', StatusNet::getActivePlugins())) { print ' '."\n"; diff --git a/classes/QvitterBlocked.php b/classes/QvitterBlocked.php index a3cbc58..39f8b51 100644 --- a/classes/QvitterBlocked.php +++ b/classes/QvitterBlocked.php @@ -49,7 +49,12 @@ class QvitterBlocked extends Profile_block public static function getBlocked($profile_id, $offset = 0, $limit = PROFILES_PER_PAGE) { $ids = self::getBlockedIDs($profile_id, $offset, $limit); - return Profile_block::listFind('blocked', $ids); + try { + $blocked = Profile_block::listFind('blocked', $ids); + return $blocked; + } catch(NoResultException $e) { + return false; + } } diff --git a/css/qvitter.css b/css/qvitter.css index 481f634..f05eca6 100644 --- a/css/qvitter.css +++ b/css/qvitter.css @@ -3218,7 +3218,8 @@ ul.stats .avatar-row .avatar { .permalink-link { color: #999999 !important; } -.permalink-link:hover { +.permalink-link:hover, +.longdate a:hover { text-decoration:underline; } diff --git a/js/dom-functions.js b/js/dom-functions.js index 4aab788..d0edece 100644 --- a/js/dom-functions.js +++ b/js/dom-functions.js @@ -1224,8 +1224,6 @@ function expand_queet(q,doScrolling) { if($.inArray(attachment_mimetype, ['video/mp4', 'video/ogg', 'video/quicktime', 'video/webm']) >=0) { if(q.children('.queet').find('.expanded-content').children('.media').children('video').children('source[href="' + attachment_title + '"]').length < 1) { // not if already showed - console.log('video!'); - // local attachment with a thumbnail var attachment_poster = ''; if(typeof this.thumb_url != 'undefined') { @@ -1337,32 +1335,40 @@ function replyFormHtml(streamItem,qid) { var cachedText = encodeURIComponent(data); } + // object with ostatus-uri as key to avoid duplicates var screenNamesToAdd = {}; - // add the screen name to the one we're replying to (if it's not me) - if(!thisIsALinkToMyProfile(q.find('.account-group').attr('href'))) { - var replyToScreenName = q.find('.account-group span.screen-name').html().replace('@',''); - screenNamesToAdd[q.find('.account-group').attr('href')] = replyToScreenName; + // add the screen name to the one we're replying to first (if it's not me) + if(!thisIsALinkToMyProfile(streamItem.attr('data-user-profile-url')) && typeof streamItem.attr('data-user-ostatus-uri') != 'undefined') { + screenNamesToAdd[streamItem.attr('data-user-ostatus-uri')] = streamItem.attr('data-user-screen-name'); } - // add the screen name to the one who the one we're replying to is replying to (if it's not me) - if(q.find('i.addressees > span.reply-to').length > 0 - && !thisIsALinkToMyProfile(q.find('i.addressees > span.reply-to > a').attr('href'))) { - var replyToScreenName = q.find('i.addressees > span.reply-to > a').html().replace('@',''); - if(typeof screenNamesToAdd[q.find('i.addressees > span.reply-to > a').attr('href')] == 'undefined') { - screenNamesToAdd[q.find('i.addressees > span.reply-to > a').attr('href')] = replyToScreenName; - } + // old style notice (probably cached, this can be removed later) + else if (typeof streamItem.attr('data-user-ostatus-uri') == 'undefined') { + screenNamesToAdd[q.find('.account-group').attr('href')] = q.find('.screen-name').text().replace('@',''); } - // get all other mentions (if it's not me) - $.each(q.find('.queet-text').find('.mention'),function(key,obj){ - if(!thisIsALinkToMyProfile($(obj).attr('href'))) { - if(typeof screenNamesToAdd[$(obj).attr('href')] == 'undefined') { - var thisMention = $(obj).html().replace('@',''); - screenNamesToAdd[$(obj).attr('href')] = thisMention; - } + // add the rest of the attentions (not me) + if(q.children('script.attentions-json').length > 0 + && q.children('script.attentions-json').text() != 'undefined') { + try { + var attentionsParsed = JSON.parse(q.children('script.attentions-json').text()); } - }); + catch(e) { + var attentionsParsed = false; + console.log('could not parse attentions json: ' + e); + console.log("attentions-json: " + q.children('script.attentions-json').text()); + } + + if(attentionsParsed !== false) { + $.each(attentionsParsed, function() { + if(!thisIsALinkToMyProfile(this.profileurl) + && typeof screenNamesToAdd[this.ostatus_uri] == 'undefined') { + screenNamesToAdd[this.ostatus_uri] = this.screen_name; + } + }); + } + } // build reply/rant strings var repliesText = ''; @@ -2035,8 +2041,19 @@ function buildQueetHtml(obj, idInStream, extraClasses, requeeted_by, isConversat // reply-to html var reply_to_html = ''; - if(obj.in_reply_to_screen_name !== null && obj.in_reply_to_profileurl !== null && obj.in_reply_to_screen_name != obj.user.screen_name) { - reply_to_html = '@' + obj.in_reply_to_screen_name + ' '; + if(obj.in_reply_to_screen_name !== null + && obj.in_reply_to_profileurl !== null + && obj.in_reply_to_profileurl != obj.user.statusnet_profile_url) { + var replyToProfileurl = obj.in_reply_to_profileurl; + var replyToScreenName = obj.in_reply_to_screen_name; + } + // if we don't have a reply-to, we might have attentions, in that case use the first one as reply + else if(typeof obj.attentions != 'undefined' && typeof obj.attentions[0] != 'undefined') { + var replyToProfileurl = obj.attentions[0].profileurl; + var replyToScreenName = obj.attentions[0].screen_name; + } + if(typeof replyToProfileurl != 'undefined' && typeof replyToScreenName != 'undefined') { + reply_to_html = '@' + replyToScreenName + ' '; } // in-groups html @@ -2092,26 +2109,37 @@ function buildQueetHtml(obj, idInStream, extraClasses, requeeted_by, isConversat statusnetHTML = statusnetHTML.slice(0,-4); } + // external var ostatusHtml = ''; - if(obj.is_local === false) { + if(obj.user.is_local === false) { ostatusHtml = ''; + var qSource = '' + getHost(obj.external_url) + ''; + } + else { + var qSource = obj.source; } var queetTime = parseTwitterDate(obj.created_at); var queetHtml = '
\
\ \ + \ ' + requeetHtml + '\ ' + ostatusHtml + '\
\ diff --git a/js/misc-functions.js b/js/misc-functions.js index 256da91..64b11fa 100644 --- a/js/misc-functions.js +++ b/js/misc-functions.js @@ -570,12 +570,12 @@ function cacheSyntaxHighlighting() { window.syntaxHighlightingRegexps = Object(); var allDomains = '(abb|abbott|abogado|ac|academy|accenture|accountant|accountants|active|actor|ad|ads|adult|ae|aero|af|afl|ag|agency|ai|aig|airforce|al|allfinanz|alsace|am|amsterdam|an|android|ao|apartments|aq|aquarelle|ar|archi|army|arpa|as|asia|associates|at|attorney|au|auction|audio|auto|autos|aw|ax|axa|az|ba|band|bank|bar|barclaycard|barclays|bargains|bauhaus|bayern|bb|bbc|bbva|bd|be|beer|berlin|best|bf|bg|bh|bi|bible|bid|bike|bingo|bio|biz|bj|bl|black|blackfriday|bloomberg|blue|bm|bmw|bn|bnpparibas|bo|boats|bond|boo|boutique|bq|br|bridgestone|broker|brother|brussels|bs|bt|budapest|build|builders|business|buzz|bv|bw|by|bz|bzh|ca|cab|cafe|cal|camera|camp|cancerresearch|canon|capetown|capital|caravan|cards|care|career|careers|cars|cartier|casa|cash|casino|cat|catering|cbn|cc|cd|center|ceo|cern|cf|cfa|cfd|cg|ch|channel|chat|cheap|chloe|christmas|chrome|church|ci|cisco|citic|city|ck|cl|claims|cleaning|click|clinic|clothing|club|cm|cn|co|coach|codes|coffee|college|cologne|com|community|company|computer|condos|construction|consulting|contractors|cooking|cool|coop|corsica|country|coupons|courses|cr|credit|creditcard|cricket|crs|cruises|cu|cuisinella|cv|cw|cx|cy|cymru|cyou|cz|dabur|dad|dance|date|dating|datsun|day|dclk|de|deals|degree|delivery|democrat|dental|dentist|desi|design|dev|diamonds|diet|digital|direct|directory|discount|dj|dk|dm|dnp|do|docs|dog|doha|domains|doosan|download|durban|dvag|dz|earth|eat|ec|edu|education|ee|eg|eh|email|emerck|energy|engineer|engineering|enterprises|epson|equipment|er|erni|es|esq|estate|et|eu|eurovision|eus|events|everbank|exchange|expert|exposed|express|fail|faith|fan|fans|farm|fashion|feedback|fi|film|finance|financial|firmdale|fish|fishing|fit|fitness|fj|fk|flights|florist|flowers|flsmidth|fly|fm|fo|foo|football|forex|forsale|foundation|fr|frl|frogans|fund|furniture|futbol|fyi|ga|gal|gallery|garden|gb|gbiz|gd|gdn|ge|gent|gf|gg|ggee|gh|gi|gift|gifts|gives|gl|glass|gle|global|globo|gm|gmail|gmo|gmx|gn|gold|goldpoint|golf|goo|goog|google|gop|gov|gp|gq|gr|graphics|gratis|green|gripe|gs|gt|gu|guge|guide|guitars|guru|gw|gy|hamburg|hangout|haus|healthcare|help|here|hermes|hiphop|hitachi|hiv|hk|hm|hn|hockey|holdings|holiday|homedepot|homes|honda|horse|host|hosting|house|how|hr|ht|hu|ibm|icbc|icu|id|ie|ifm|il|im|immo|immobilien|in|industries|infiniti|info|ing|ink|institute|insure|int|international|investments|io|iq|ir|irish|is|it|iwc|java|jcb|je|jetzt|jewelry|jll|jm|jo|jobs|joburg|jp|juegos|kaufen|kddi|ke|kg|kh|ki|kim|kitchen|kiwi|km|kn|koeln|komatsu|kp|kr|krd|kred|kw|ky|kyoto|kz|la|lacaixa|land|lat|latrobe|lawyer|lb|lc|lds|lease|leclerc|legal|lgbt|li|liaison|lidl|life|lighting|limited|limo|link|lk|loan|loans|lol|london|lotte|lotto|love|lr|ls|lt|ltda|lu|lupin|luxe|luxury|lv|ly|ma|madrid|maif|maison|management|mango|market|marketing|markets|marriott|mba|mc|md|me|media|meet|melbourne|meme|memorial|men|menu|mf|mg|mh|miami|mil|mini|mk|ml|mm|mma|mn|mo|mobi|moda|moe|monash|money|montblanc|mormon|mortgage|moscow|motorcycles|mov|movie|mp|mq|mr|ms|mt|mtn|mtpc|mu|museum|mv|mw|mx|my|mz|na|nadex|nagoya|name|navy|nc|ne|nec|net|network|neustar|new|news|nexus|nf|ng|ngo|nhk|ni|nico|ninja|nissan|nl|no|np|nr|nra|nrw|ntt|nu|nyc|nz|okinawa|om|one|ong|onl|online|ooo|org|organic|osaka|otsuka|ovh|pa|page|panerai|paris|partners|parts|party|pe|pf|pg|ph|pharmacy|philips|photo|photography|photos|physio|piaget|pics|pictet|pictures|pink|pizza|pk|pl|place|plumbing|plus|pm|pn|pohl|poker|porn|post|pr|praxi|press|pro|prod|productions|prof|properties|property|ps|pt|pub|pw|py|qa|qpon|quebec|racing|re|realtor|recipes|red|redstone|rehab|reise|reisen|reit|ren|rent|rentals|repair|report|republican|rest|restaurant|review|reviews|rich|rio|rip|ro|rocks|rodeo|rs|rsvp|ru|ruhr|run|rw|ryukyu|sa|saarland|sale|samsung|sandvik|sandvikcoromant|sap|sarl|saxo|sb|sc|sca|scb|schmidt|scholarships|school|schule|schwarz|science|scot|sd|se|seat|sener|services|sew|sex|sexy|sg|sh|shiksha|shoes|show|shriram|si|singles|site|sj|sk|ski|sky|sl|sm|sn|sncf|so|soccer|social|software|sohu|solar|solutions|sony|soy|space|spiegel|spreadbetting|sr|ss|st|study|style|su|sucks|supplies|supply|support|surf|surgery|suzuki|sv|swiss|sx|sy|sydney|systems|sz|taipei|tatar|tattoo|tax|taxi|tc|td|team|tech|technology|tel|temasek|tennis|tf|tg|th|thd|theater|tickets|tienda|tips|tires|tirol|tj|tk|tl|tm|tn|to|today|tokyo|tools|top|toray|toshiba|tours|town|toys|tp|tr|trade|trading|training|travel|trust|tt|tui|tv|tw|tz|ua|ug|uk|um|university|uno|uol|us|uy|uz|va|vacations|vc|ve|vegas|ventures|versicherung|vet|vg|vi|viajes|video|villas|vision|vlaanderen|vn|vodka|vote|voting|voto|voyage|vu|wales|walter|wang|watch|webcam|website|wed|wedding|weir|wf|whoswho|wien|wiki|williamhill|win|wme|work|works|world|ws|wtc|wtf|xbox|xerox|xin|测试|परीक्षा|佛山|慈善|集团|在线|한국|ভারত|八卦|موقع|বাংলা|公益|公司|移动|我爱你|москва|испытание|қаз|онлайн|сайт|срб|бел|时尚|테스트|淡马锡|орг|삼성|சிங்கப்பூர்|商标|商店|商城|дети|мкд|טעסט|工行|中文网|中信|中国|中國|娱乐|谷歌|భారత్|ලංකා|測試|ભારત|भारत|آزمایشی|பரிட்சை|网店|संगठन|餐厅|网络|укр|香港|δοκιμή|飞利浦|إختبار|台湾|台灣|手机|мон|الجزائر|عمان|ایران|امارات|بازار|پاکستان|الاردن|بھارت|المغرب|السعودية|سودان|عراق|مليسيا|澳門|政府|شبكة|გე|机构|组织机构|健康|ไทย|سورية|рус|рф|تونس|みんな|グーグル|ελ|世界|ਭਾਰਤ|网址|游戏|vermögensberater|vermögensberatung|企业|信息|مصر|قطر|广东|இலங்கை|இந்தியா|հայ|新加坡|فلسطين|テスト|政务|xxx|xyz|yachts|yandex|ye|yodobashi|yoga|yokohama|youtube|yt|za|zip|zm|zone|zuerich|zw|oracle|xn--1qqw23a|xn--30rr7y|xn--3bst00m|xn--3ds443g|xn--3e0b707e|xn--45brj9c|xn--45q11c|xn--4gbrim|xn--55qw42g|xn--55qx5d|xn--6frz82g|xn--6qq986b3xl|xn--80adxhks|xn--80ao21a|xn--80asehdb|xn--80aswg|xn--90a3ac|xn--90ais|xn--9et52u|xn--b4w605ferd|xn--c1avg|xn--cg4bki|xn--clchc0ea0b2g2a9gcd|xn--czr694b|xn--czrs0t|xn--czru2d|xn--d1acj3b|xn--d1alf|xn--estv75g|xn--fiq228c5hs|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--fjq720a|xn--flw351e|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--gecrj9c|xn--h2brj9c|xn--hxt814e|xn--i1b6b1a6a2e|xn--imr513n|xn--io0a7i|xn--j1amh|xn--j6w193g|xn--kcrx77d1x4a|xn--kprw13d|xn--kpry57d|xn--kput3i|xn--l1acc|xn--lgbbat1ad8j|xn--mgb9awbf|xn--mgba3a4f16a|xn--mgbaam7a8h|xn--mgbab2bd|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbc0a9azcg|xn--mgberp4a5d4ar|xn--mgbpl2fh|xn--mgbx4cd0ab|xn--mxtq1m|xn--ngbc5azd|xn--node|xn--nqv7f|xn--nqv7fs00ema|xn--nyqy26a|xn--o3cw4h|xn--ogbpf8fl|xn--p1acf|xn--p1ai|xn--pgbs0dh|xn--q9jyb4c|xn--qcka1pmc|xn--rhqv96g|xn--s9brj9c|xn--ses554g|xn--unup4y|xn--vermgensberater-ctb|xn--vermgensberatung-pwb|xn--vhquv|xn--vuq861b|xn--wgbh1c|xn--wgbl6a|xn--xhq521b|xn--xkc2al3hye2a|xn--xkc2dl3a5ee0h|xn--y9a3aq|xn--yfro4i67o|xn--ygbi2ammx|xn--zfr164b)'; - window.syntaxHighlightingRegexps.externalMention = XRegExp.cache('(^|\\s|\\.|
| |\\()(@)[a-zA-Z0-9]+(@)[\\p{L}\\p{N}\\-\\.]+(\\.)(' + allDomains + ')($|\\s|\\.|\\,|\\:|\\-|\\<|\\!|\\?|\\&|\\))'); - window.syntaxHighlightingRegexps.mention = /(^|\s|\.|
| |\()(@)[a-zA-Z0-9]+($|\s|\.|\,|\:|\-|\<|\!|\?|\&|\))/; - window.syntaxHighlightingRegexps.tag = XRegExp.cache('(^|\\s|\\.|
| |\\()(\\#)[\\p{L}\\p{N}\\-\\.]+($|\\s|\\.|\\,|\\:|\\-|\\<|\\!|\\?|\\&|\\))'); - window.syntaxHighlightingRegexps.url = XRegExp.cache('(^|\\s|\\.|
| |\\()(http\\:\\/\\/|https\:\\/\\/)([\\p{L}\\p{N}\\-\\.]+)?(\\.)(' + allDomains + ')(\\/[\\p{L}\\p{N}\\%\\!\\*\\\'\\(\\)\\;\\:\\@\\&\\=\\+\\$\\,\\/\\?\\#\\[\\]\\-\\_\\.\\~]+)?(\\/)?($|\\s|\\,|\\:|\\-|\\<|\\!|\\?|\\&|\\))'); - window.syntaxHighlightingRegexps.urlWithoutProtocol = XRegExp.cache('(^|\\s|\\.|
| |\\()[\\p{L}\\p{N}\\-\\.]+(\\.)(' + allDomains + ')(\\/[\\p{L}\\p{N}\\%\\!\\*\\\'\\(\\)\\;\\:\\@\\&\\=\\+\\$\\,\\/\\?\\#\\[\\]\\-\\_\\.\\~]+)?(\\/)?($|\\s|\\.|\\,|\\:|\\-|\\<|\\!|\\?|\\&|\\))'); - window.syntaxHighlightingRegexps.email = XRegExp.cache('(^|\\s|\\.|
| |\\()([a-zA-Z0-9\\!\\#\\$\\%\\&\\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\.]+)?(@)[\\p{L}\\p{N}\\-\\.]+(\\.)(' + allDomains + ')($|\\s|\\.|\\,|\\:|\\-|\\<|\\!|\\?|\\&|\\))'); + window.syntaxHighlightingRegexps.externalMention = XRegExp.cache('(^|\\s|\\.|
| |\\()(@)[a-zA-Z0-9]+(@)[\\p{L}\\p{N}\\-\\.]+(\\.)(' + allDomains + ')($|\\s|\\.|\\,|\\:|\\-|\\<|\\!|\\?|\\&|\\)|\\\')'); + window.syntaxHighlightingRegexps.mention = /(^|\s|\.|
| |\()(@)[a-zA-Z0-9]+($|\s|\.|\,|\:|\-|\<|\!|\?|\&|\)|\')/; + window.syntaxHighlightingRegexps.tag = XRegExp.cache('(^|\\s|\\.|
| |\\()(\\#)[\\p{L}\\p{N}\\-\\.]+($|\\s|\\,|\\:|\\<|\\!|\\?|\\&|\\)|\\\')'); + window.syntaxHighlightingRegexps.url = XRegExp.cache('(^|\\s|\\.|
| |\\()(http\\:\\/\\/|https\:\\/\\/)([\\p{L}\\p{N}\\-\\.]+)?(\\.)(' + allDomains + ')(\\/[\\p{L}\\p{N}\\%\\!\\*\\\'\\(\\)\\;\\:\\@\\&\\=\\+\\$\\,\\/\\?\\#\\[\\]\\-\\_\\.\\~]+)?(\\/)?($|\\s|\\,|\\:|\\-|\\<|\\!|\\?|\\&|\\)|\\\')'); + window.syntaxHighlightingRegexps.urlWithoutProtocol = XRegExp.cache('(^|\\s|\\.|
| |\\()[\\p{L}\\p{N}\\-\\.]+(\\.)(' + allDomains + ')(\\/[\\p{L}\\p{N}\\%\\!\\*\\\'\\(\\)\\;\\:\\@\\&\\=\\+\\$\\,\\/\\?\\#\\[\\]\\-\\_\\.\\~]+)?(\\/)?($|\\s|\\.|\\,|\\:|\\-|\\<|\\!|\\?|\\&|\\)|\\\')'); + window.syntaxHighlightingRegexps.email = XRegExp.cache('(^|\\s|\\.|
| |\\()([a-zA-Z0-9\\!\\#\\$\\%\\&\\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\.]+)?(@)[\\p{L}\\p{N}\\-\\.]+(\\.)(' + allDomains + ')($|\\s|\\.|\\,|\\:|\\-|\\<|\\!|\\?|\\&|\\)|\\\')'); cacheSyntaxHighlightingGroups(); } @@ -588,7 +588,7 @@ function cacheSyntaxHighlighting() { function cacheSyntaxHighlightingGroups() { if(window.groupNicknamesAndLocalAliases.length > 0) { var allGroupNicknamesAndLocalAliases = '(' + window.groupNicknamesAndLocalAliases.join('|') + ')'; - window.syntaxHighlightingRegexps.group = XRegExp.cache('(^|\\s|\\.|
| |\\()(\\!)' + allGroupNicknamesAndLocalAliases + '($|\\s|\\.|\\,|\\:|\\-|\\<|\\!|\\?|\\&|\\))'); + window.syntaxHighlightingRegexps.group = XRegExp.cache('(^|\\s|\\.|
| |\\()(\\!)' + allGroupNicknamesAndLocalAliases + '($|\\s|\\.|\\,|\\:|\\-|\\<|\\!|\\?|\\&|\\)|\\\')'); } } @@ -819,6 +819,18 @@ function removeProtocolFromUrl(url) { return url.substring(url.indexOf('://')+3); } +/* · + · + · Get host from URL + · + · · · · · · · · · */ + +function getHost(url) { + var a = document.createElement('a'); + a.href = url; + return a.hostname; + } + /* · · @@ -1044,6 +1056,16 @@ function searchForUpdatedNoticeData(obj) { streamItemsUpdated = true; } + // attentions might have been added to a notice + if(queetFoundInFeed.children('script.attentions-json').text() != JSON.stringify(obj.attentions)) { + if(queetFoundInFeed.children('script.attentions-json').length == 0) { + queetFoundInFeed.prepend(''); + } + else { + queetFoundInFeed.children('script.attentions-json').text(JSON.stringify(obj.attentions)); + } + } + // set favorite data queetFoundInFeed.find('.action-fav-num').attr('data-fav-num',obj.fave_num); queetFoundInFeed.find('.action-fav-num').html(obj.fave_num); @@ -1285,7 +1307,7 @@ function displayOrHideUnreadNotifications(notifications) { if(totNotif>0) { $('#unseen-notifications').html(totNotif); - document.title = window.siteTitle + ' (' + totNotif + ')'; // update html page title + document.title = '(' + totNotif + ') ' + window.siteTitle; // update html page title $('#unseen-notifications').show(); } else { diff --git a/js/qvitter.js b/js/qvitter.js index f70782e..5d49d81 100644 --- a/js/qvitter.js +++ b/js/qvitter.js @@ -2952,17 +2952,18 @@ $('body').on('keyup paste input', 'div.queet-box-syntax', function() { } // long enough match, create a mention span else { - // don't include ending char, if any of these + // don't include ending char, if any of these (but tags can contain and end with . and -) if(currentMatch[0].slice(-1) == '<' || currentMatch[0].slice(-1) == '&' || currentMatch[0].slice(-1) == '?' || currentMatch[0].slice(-1) == '!' || currentMatch[0].slice(-1) == ' ' - || currentMatch[0].slice(-1) == '-' + || (currentMatch[0].slice(-1) == '-' && k != 'tag') || currentMatch[0].slice(-1) == ':' - || currentMatch[0].slice(-1) == '.' + || (currentMatch[0].slice(-1) == '.' && k != 'tag') || currentMatch[0].slice(-1) == ',' - || currentMatch[0].slice(-1) == ')') { + || currentMatch[0].slice(-1) == ')' + || currentMatch[0].slice(-1) == '\'') { currentMatch[0] = currentMatch[0].slice(0,-1); } diff --git a/locale/en.json b/locale/en.json index 9d546fe..d11c471 100644 --- a/locale/en.json +++ b/locale/en.json @@ -6,13 +6,13 @@ "loginSignIn": "Sign in", "loginRememberMe": "Remember me", "loginForgotPassword": "Forgot password?", - "notices": "Notices", + "notices": "Quips", "followers": "Followers", "following": "Following", "groups": "Groups", - "compose": "Compose a new notice...", + "compose": "What's quipping?", "queetVerb": "Send", - "queetsNounPlural": "Notices", + "queetsNounPlural": "Quips", "logout": "Sign out", "languageSelected": "Language:", "viewMyProfilePage": "View my profile page", @@ -21,18 +21,18 @@ "details": "Details", "expandFullConversation": "Expand full conversation", "replyVerb": "Reply", - "requeetVerb": "Repeat", + "requeetVerb": "Requip", "favoriteVerb": "Favorite", - "requeetedVerb": "Repeated", + "requeetedVerb": "Requipped", "favoritedVerb": "Favorited", "replyTo": "Reply to", - "requeetedBy": "Repeated by {requeeted-by}", + "requeetedBy": "Requipped by {requeeted-by}", "favoriteNoun": "Favorite", "favoritesNoun": "Favorites", - "requeetNoun": "Repeat", - "requeetsNoun": "Repeats", - "newQueet": "{new-notice-count} new notice", - "newQueets": "{new-notice-count} new notices", + "requeetNoun": "Requip", + "requeetsNoun": "Requips", + "newQueet": "{new-notice-count} new quip", + "newQueets": "{new-notice-count} new quips", "longmonthsJanuary": "January", "longmonthsFebruary": "February", "longmonthsMars": "March", @@ -76,7 +76,7 @@ "searchVerb": "Search", "deleteVerb": "Delete", "cancelVerb": "Cancel", - "deleteConfirmation": "Are you sure you want to delete this notice?", + "deleteConfirmation": "Are you sure you want to delete this quip?", "userExternalFollow": "Remote follow", "userExternalFollowHelp": "Your account ID (e.g. user@rainbowdash.net).", "userFollow": "Follow", @@ -108,8 +108,8 @@ "otherServers": "Alternatively you can create an account on another server of the GNU social network. Comparison", "editMyProfile": "Edit profile", "notifications": "Notifications", - "xFavedYourQueet": "favorited your Queet", - "xRepeatedYourQueet": "requeeted you", + "xFavedYourQueet": "favorited your quip", + "xRepeatedYourQueet": "requipped you", "xStartedFollowingYou": "followed you", "followsYou": "follows you", "FAQ": "FAQ", @@ -119,7 +119,7 @@ "showTerms": "Read our Terms of Use", "ellipsisMore": "More", "blockUser": "Block {username}", - "goToOriginalNotice": "Go to original notice", + "goToOriginalNotice": "Go to the original quip", "goToTheUsersRemoteProfile": "Go to the user's remote profile", "clickToDrag":"Click to drag", "keyboardShortcuts":"Keyboard shortcuts", @@ -128,7 +128,7 @@ "tooltipBookmarkStream":"Add this stream to your bookmarks", "tooltipTopMenu":"Menu and settings", "tooltipAttachImage":"Attach an image", - "tooltipShortenUrls":"Shorten all URLs in the Queet", + "tooltipShortenUrls":"Shorten all URLs in the quip", "tooltipReloadStream":"Refresh this stream", "tooltipRemoveBookmark":"Remove this bookmark", "clearHistory":"Clear browsing history", @@ -137,21 +137,21 @@ "ERRORcouldNotFindUserWithNickname":"Could not find a user with nickname \"{nickname}\" on this server", "ERRORcouldNotFindGroupWithNickname":"Could not find a group with nickname \"{nickname}\" on this server", "ERRORcouldNotFindPage":"Could not find that page.", - "ERRORnoticeRemoved": "This notice has been removed.", + "ERRORnoticeRemoved": "This quip has been removed.", "ERRORnoContactWithServer": "Can not establish a connection to the server. The server could be overloaded, or there might be a problem with your internet connection. Please try again later!", "ERRORattachmentUploadFailed": "The upload failed. The format might be unsupported or the size too large.", "hideRepliesToPeopleIDoNotFollow":"Hide replies to people I don't follow", "markAllNotificationsAsSeen":"Mark all notifications as seen", "notifyRepliesAndMentions":"Mentions and replies", "notifyFavs":"Favorites", - "notifyRepeats":"Requeets", + "notifyRepeats":"Requips", "notifyFollows":"New followers", "timelineOptions":"Timeline options", "ERRORfailedSavingYourSetting":"Failed saving your setting", "ERRORfailedMarkingAllNotificationsAsRead":"Failed marking all notifications as seen.", "newNotification": "{new-notice-count} new notification", "newNotifications": "{new-notice-count} new notifications", - "thisIsANoticeFromABlockedUser":"Warning: This is a notice from a user you have blocked. Click to show it.", + "thisIsANoticeFromABlockedUser":"Warning: This is a quip from a user you have blocked. Click to show it.", "nicknamesListWithListName":"{nickname}’s list: {list-name}", "myListWithListName":"My list: {list-name}", "listMembers":"Members",