From d61a07f810565aa54327ca24c8330bb280c00397 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Wed, 12 Aug 2015 00:36:26 +0500 Subject: [PATCH 01/14] restyle postToElem() --- js/twister_formatpost.js | 98 ++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 43 deletions(-) diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 52adcad..5f8cf02 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -28,7 +28,7 @@ $(document).ready(function() { // format "userpost" to html element // kind = "original"/"ancestor"/"descendant" -function postToElem( post, kind, promoted ) { +function postToElem(post, kind, promoted) { /* "userpost" : { @@ -49,27 +49,26 @@ function postToElem( post, kind, promoted ) { } "sig_userpost" : signature by userpost.n */ + var username, k, t, msg, rt, content_to_rt, content_to_sigrt, retweeted_by; // Obtain data from userpost - var postJson = $.toJSON(post); - var userpost = post["userpost"]; - if( "rt" in userpost ) { - var rt = userpost["rt"]; - var n = rt["n"]; - var k = rt["k"]; - var t = rt["time"]; - var msg = rt["msg"]; - var content_to_rt = $.toJSON(rt); - var content_to_sigrt = userpost["sig_rt"]; - var retweeted_by = userpost["n"]; + var userpost = post.userpost; + if (userpost.rt) { + rt = userpost.rt; + username = rt.n; + k = rt.k; + t = rt.time; + msg = rt.msg; + content_to_rt = $.toJSON(rt); + content_to_sigrt = userpost.sig_rt; + retweeted_by = userpost.n; } else { - var n = userpost["n"]; - var k = userpost["k"]; - var t = userpost["time"]; - var msg = userpost["msg"] - var content_to_rt = $.toJSON(userpost); - var content_to_sigrt = post["sig_userpost"]; - var retweeted_by = undefined; + username = userpost.n; + k = userpost.k; + t = userpost.time; + msg = userpost.msg; + content_to_rt = $.toJSON(userpost); + content_to_sigrt = post.sig_userpost; } // Now create the html elements @@ -79,36 +78,36 @@ function postToElem( post, kind, promoted ) { .attr('data-time', t) ; - if( post['isNew'] ) + if (post.isNew) elem.addClass('new'); var postData = elem.find('.post-data'); postData.addClass(kind) - .attr('data-userpost', postJson) + .attr('data-userpost', $.toJSON(post)) .attr('data-content_to_rt', content_to_rt) .attr('data-content_to_sigrt', content_to_sigrt) - .attr('data-screen-name', n) + .attr('data-screen-name', username) .attr('data-id', k) .attr('data-lastk', userpost["lastk"]) .attr('data-text', msg) ; - if( 'reply' in userpost ) { + if (userpost.reply) { postData.attr('data-replied-to-screen-name', userpost.reply.n) .attr('data-replied-to-id', userpost.reply.k) .find('.post-expand').text(polyglot.t('Show conversation')) ; - } else if ( 'rt' in userpost && 'reply' in userpost.rt ) { + } else if (userpost.rt && userpost.rt.reply) { postData.attr('data-replied-to-screen-name', userpost.rt.reply.n) .attr('data-replied-to-id', userpost.rt.reply.k) .find('.post-expand').text(polyglot.t('Show conversation')) ; } - var postInfoName = elem.find('.post-info-name'); - postInfoName.text(n).attr('href', $.MAL.userUrl(n)); - getFullname( n, postInfoName ); - //elem.find('.post-info-tag').text("@" + n); - getAvatar( n, elem.find('.avatar') ); + var postInfoName = elem.find('.post-info-name') + .text(username).attr('href', $.MAL.userUrl(username)); + getFullname(username, postInfoName); + //elem.find('.post-info-tag').text("@" + username); + getAvatar(username, elem.find('.avatar')); elem.find('.post-info-time').text(timeGmtToText(t)).attr('title', timeSincePost(t)); var mentions = []; @@ -116,10 +115,10 @@ function postToElem( post, kind, promoted ) { postData.attr('data-text-mentions', mentions); var replyTo = ''; - if( n !== defaultScreenName ) - replyTo += '@' + n + ' '; + if (username !== defaultScreenName) + replyTo += '@' + username + ' '; for (var i = 0; i < mentions.length; i++) { - if (mentions[i] !== n && mentions[i] !== defaultScreenName) + if (mentions[i] !== username && mentions[i] !== defaultScreenName) replyTo += '@' + mentions[i] + ' '; } @@ -128,11 +127,11 @@ function postToElem( post, kind, promoted ) { if (!defaultScreenName) postTextArea.attr('placeholder', polyglot.t('You have to log in to post replies.')); else - postTextArea.attr('placeholder', polyglot.t('reply_to', { fullname: replyTo })+ '...'); + postTextArea.attr('placeholder', polyglot.t('reply_to', {fullname: replyTo})+ '...'); postData.attr('data-reply-to', replyTo); - if( retweeted_by != undefined ) { + if (typeof retweeted_by !== 'undefined') { elem.find('.post-context').show(); elem.find('.post-retransmited-by') .attr('href', $.MAL.userUrl(retweeted_by)) @@ -140,25 +139,38 @@ function postToElem( post, kind, promoted ) { ; } - if (typeof(promoted) !== 'undefined' && promoted) { + if (typeof promoted !== 'undefined' && promoted) { elem.find('.post-propagate').remove(); postData.attr('data-promoted', 1); - postData.attr('data-screen-name', '!' + n); + postData.attr('data-screen-name', '!' + username); } else { - setPostInfoSent(userpost["n"], userpost["k"], elem.find('.post-info-sent')); + setPostInfoSent(userpost.n, userpost.k, elem.find('.post-info-sent')); if ($.Options.filterLang.val !== 'disable' && $.Options.filterLangSimulate.val) { // FIXME it's must be stuff from template actually - if (typeof(post['langFilter']) !== 'undefined') { - if (typeof(post['langFilter']['prob'][0]) !== 'undefined') - var mlm = ' // '+polyglot.t('Most possible language: this', {'this': ''+post['langFilter']['prob'][0].toString()+''}); + if (typeof post.langFilter !== 'undefined') { + if (typeof post.langFilter.prob[0] !== 'undefined') + var mlm = ' // ' + polyglot.t('Most possible language: this', + {'this': '' + post.langFilter.prob[0].toString() + ''}); else var mlm = ''; - elem.append('
'+polyglot.t('This post is treated by language filter', {'treated': ''+((post['langFilter']['pass']) ? polyglot.t('passed') : polyglot.t('blocked'))+''})+'
') - .append('
'+polyglot.t('Reason: this', {'this': ''+post['langFilter']['reason']+''})+mlm+'
') + elem.append('
' + + polyglot.t('This post is treated by language filter', + {'treated': '' + (post.langFilter.pass ? polyglot.t('passed') : polyglot.t('blocked')) + ''}) + + '
' + ) + .append('
' + + polyglot.t('Reason: this', {'this': '' + post.langFilter.reason + ''}) + + mlm +'
' + ) ; } else { - elem.append('
'+polyglot.t('This post is treated by language filter', {'treated': ''+polyglot.t('not analyzed')+''})+'
'); + elem.append('
' + + polyglot.t('This post is treated by language filter', + {'treated': '' + polyglot.t('not analyzed') + ''}) + + '
' + ) + ; } } } From 29e4130e721e9910dec1e6942fd6348a24b69022 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Wed, 12 Aug 2015 01:49:30 +0500 Subject: [PATCH 02/14] fix mentions thing in htmlFormatMsg() --- js/interface_common.js | 4 ++-- js/options.js | 2 +- js/twister_formatpost.js | 38 ++++++++++++++++++++++---------------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/js/interface_common.js b/js/interface_common.js index c25f340..ec03d7e 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -587,7 +587,7 @@ function posPostPreview(event) { - postPreview.css('padding-left') - postPreview.css('padding-right')); } if (textArea[0].value.length) - postPreview.html(htmlFormatMsg(textArea[0].value, [])).show(); + postPreview.html(htmlFormatMsg(textArea[0].value).html).show(); else postPreview.hide(); textArea.before(postPreview); @@ -698,7 +698,7 @@ function replyTextInput(event) { if ($.Options.postPreview.val) { if (textArea[0].value.length) - textAreaForm.find('#post-preview').html(htmlFormatMsg(textArea[0].value, [])).show(); + textAreaForm.find('#post-preview').html(htmlFormatMsg(textArea[0].value).html).show(); else textAreaForm.find('#post-preview').html('').hide(); } diff --git a/js/options.js b/js/options.js index b047087..6941387 100644 --- a/js/options.js +++ b/js/options.js @@ -373,7 +373,7 @@ function tickOptionsPostPreview() { var imgPreviewCont = elem.find('.preview-container'); elem.children().first().html(htmlFormatMsg( - polyglot.t('post_preview_dummy', {logo: '/img/twister_mini.png', site: 'http://twister.net.co'}), [])); + polyglot.t('post_preview_dummy', {logo: '/img/twister_mini.png', site: 'http://twister.net.co'})).html); if ($.Options.displayPreview.val === 'enable') { imgPreviewCont.empty(); diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 5f8cf02..5699170 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -110,20 +110,26 @@ function postToElem(post, kind, promoted) { getAvatar(username, elem.find('.avatar')); elem.find('.post-info-time').text(timeGmtToText(t)).attr('title', timeSincePost(t)); - var mentions = []; - elem.find('.post-text').html(htmlFormatMsg(msg, mentions)); - postData.attr('data-text-mentions', mentions); - - var replyTo = ''; - if (username !== defaultScreenName) - replyTo += '@' + username + ' '; - for (var i = 0; i < mentions.length; i++) { - if (mentions[i] !== username && mentions[i] !== defaultScreenName) - replyTo += '@' + mentions[i] + ' '; + msg = htmlFormatMsg(msg); + elem.find('.post-text').html(msg.html); + postData.attr('data-text-mentions', msg.mentions.join()); // FIXME no idea why do we need this attribute since we don't use it but use data-reply-to instead + + if (username !== defaultScreenName) { + if (msg.mentions.indexOf(username) === -1) + msg.mentions.splice(0, 0, username); + } else { + var i = msg.mentions.indexOf(defaultScreenName); + if (i !== -1) + msg.mentions.splice(i, 1); } + if (msg.mentions.length) + var replyTo = '@' + msg.mentions.join(' @') + ' '; + else + var replyTo = ''; var postTextArea = elem.find('.post-area-new textarea'); postTextArea.attr('data-reply-to', replyTo); + if (!defaultScreenName) postTextArea.attr('placeholder', polyglot.t('You have to log in to post replies.')); else @@ -208,7 +214,7 @@ function dmDataToSnippetItem(dmData, remoteUser) { getGroupChatName( remoteUser, dmItem.find("a.post-info-name") ); else getFullname( remoteUser, dmItem.find("a.post-info-name") ); - dmItem.find(".post-text").html(htmlFormatMsg(dmData.text, [])); + dmItem.find(".post-text").html(htmlFormatMsg(dmData.text).html); dmItem.find(".post-info-time").text(timeGmtToText(dmData.time)).attr("title",timeSincePost(dmData.time)); return dmItem; @@ -226,14 +232,13 @@ function dmDataToConversationItem(dmData, localUser, remoteUser) { getAvatar(from, dmItem.find(".post-photo").find("img") ); dmItem.find(".post-info-time").text(timeGmtToText(dmData.time)).attr("title",timeSincePost(dmData.time)); setPostInfoSent(from,dmData.k,dmItem.find('.post-info-sent')); - var mentions = []; - dmItem.find('.post-text').html(htmlFormatMsg(dmData.text, mentions)); + dmItem.find('.post-text').html(htmlFormatMsg(dmData.text).html); return dmItem; } // convert message text to html, featuring @users and links formating. -function htmlFormatMsg(msg, mentions) { +function htmlFormatMsg(msg) { // TODO: add options for emotions; msg = $.emotions(msg); // TODO make markup optionally mutable ? @@ -534,6 +539,7 @@ function htmlFormatMsg(msg, mentions) { + whiteSpaces; var stopCharsMarkout = '/\\*~_-`.,:;?!%+=&\'"[](){}^|«»…\u201C\u201D\u2026\u2014\u4E00\u3002\uFF0C\uFF1A\uFF1F\uFF01\u3010\u3011\u2047\u2048\u2049'; var i, j, k, str; + var mentions = []; msg = {str: escapeHtmlEntities(msg), htmlEntities: []}; @@ -663,7 +669,7 @@ function htmlFormatMsg(msg, mentions) { break; } str = msg.str.slice(i + 1, j).toLowerCase(); - mentions.push(str); // FIXME + mentions.push(str); msg = msgAddHtmlEntity(msg, i, i + str.length + 1, newHtmlEntityLink(_htmlFormatMsgLinkTemplateUser, $.MAL.userUrl(str), '@' + str) @@ -713,7 +719,7 @@ function htmlFormatMsg(msg, mentions) { if ($.Options.displayLineFeeds.val === 'enable') msg = msg.replace(/\n/g, '
'); - return msg; + return {html: msg, mentions: mentions}; } function proxyURL(url) { From 6537515dac21f33924e58b175d5b836149ec8f2c Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Wed, 12 Aug 2015 05:10:56 +0500 Subject: [PATCH 03/14] show post retwists with comment as posts with citation --- css/style.css | 35 +++++++++++++++++ following.html | 25 +++++++++--- home.html | 25 +++++++++--- js/twister_formatpost.js | 69 ++++++++++++++++++++++++---------- theme_calm/css/style.css | 35 +++++++++++++++++ theme_nin/css/style.css | 34 +++++++++++++++++ theme_nin/sass/_postboard.sass | 20 ++++++++++ tmobile.html | 67 ++++++++++++++++++++++++++++----- 8 files changed, 270 insertions(+), 40 deletions(-) diff --git a/css/style.css b/css/style.css index a020344..905fe34 100644 --- a/css/style.css +++ b/css/style.css @@ -1253,6 +1253,41 @@ ol.toptrends-list { border-left: solid 3px #E34F42; margin-left: 2px; } + +.post-rt-reference { + background-color: #FAFAFA; + border: 1px solid #ccc; +} + +.post-rt-reference:hover { + background-color: #FFF; + cursor: pointer; +} + +.post-rt-reference .post-photo { + width: 24px; + height: 24px; +} + +.post-rt-reference .post-photo img { + width: 24px; + height: auto; +} + +.post-rt-reference .post-info-name { + font-size: 10px; +} + +.post-rt-reference .post-text { + font-size: 10px; + margin: 2px 10px 4px 10px; +} + +.post-rt-reference .post-info-time { + font-size: 9px; + color: #000; +} + /*********************************** ******** LOGIN AND NETWORK PAGES *** ***********************************/ diff --git a/following.html b/following.html index 1a5a81d..12f5462 100644 --- a/following.html +++ b/following.html @@ -222,11 +222,7 @@

- + Expand
@@ -261,6 +257,25 @@
+
+
+
user-photo
+ +

+
+
+ +
+ + twisted again by + +
+ diff --git a/home.html b/home.html index 848137f..6f3ad15 100644 --- a/home.html +++ b/home.html @@ -314,11 +314,7 @@

- + Expand
@@ -353,6 +349,25 @@
+
+
+
user-photo
+ +

+
+
+ +
+ + twisted again by + +
+ diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 5699170..4f6c7d4 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -3,12 +3,16 @@ // // Format JSON posts and DMs to HTML. +var _templatePostRtReference +var _templatePostRtBy var _htmlFormatMsgLinkTemplateExternal; var _htmlFormatMsgLinkTemplateUser; var _htmlFormatMsgLinkTemplateHashtag; $(document).ready(function() { // we're setting it here for perfomance improvement purpose // to not search and prepare it for for every post every time + _templatePostRtReference = $('#post-rt-reference-template').children().clone(true); + _templatePostRtBy = $('#post-retransmited-by-template').children().clone(true); _htmlFormatMsgLinkTemplateExternal = $('#external-page-link-template') if (_htmlFormatMsgLinkTemplateExternal.length) { _htmlFormatMsgLinkTemplateExternal = _htmlFormatMsgLinkTemplateExternal[0].cloneNode(); @@ -29,6 +33,18 @@ $(document).ready(function() { // format "userpost" to html element // kind = "original"/"ancestor"/"descendant" function postToElem(post, kind, promoted) { + + function setPostCommon(elem, username, time) { + var postInfoName = elem.find('.post-info-name') + .text(username).attr('href', $.MAL.userUrl(username)); + + getFullname(username, postInfoName); + //elem.find('.post-info-tag').text("@" + username); // FIXME + getAvatar(username, elem.find('.avatar')); + + elem.find('.post-info-time').text(timeGmtToText(time)).attr('title', timeSincePost(time)); + } + /* "userpost" : { @@ -49,23 +65,33 @@ function postToElem(post, kind, promoted) { } "sig_userpost" : signature by userpost.n */ - var username, k, t, msg, rt, content_to_rt, content_to_sigrt, retweeted_by; + + var username, k, time, msg, rt, content_to_rt, content_to_sigrt, retweeted_by; // Obtain data from userpost var userpost = post.userpost; if (userpost.rt) { rt = userpost.rt; - username = rt.n; - k = rt.k; - t = rt.time; - msg = rt.msg; - content_to_rt = $.toJSON(rt); - content_to_sigrt = userpost.sig_rt; + if (userpost.msg) { + username = userpost.n; + k = userpost.k; + time = userpost.time; + msg = userpost.msg; + content_to_rt = $.toJSON(userpost); + content_to_sigrt = post.sig_userpost; + } else { + username = rt.n; + k = rt.k; + time = rt.time; + msg = rt.msg; + content_to_rt = $.toJSON(rt); + content_to_sigrt = userpost.sig_rt; + } retweeted_by = userpost.n; } else { username = userpost.n; k = userpost.k; - t = userpost.time; + time = userpost.time; msg = userpost.msg; content_to_rt = $.toJSON(userpost); content_to_sigrt = post.sig_userpost; @@ -75,7 +101,7 @@ function postToElem(post, kind, promoted) { var elem = $.MAL.getPostTemplate().clone(true); elem.removeAttr('id') .addClass(kind) - .attr('data-time', t) + .attr('data-time', time) ; if (post.isNew) @@ -103,12 +129,7 @@ function postToElem(post, kind, promoted) { ; } - var postInfoName = elem.find('.post-info-name') - .text(username).attr('href', $.MAL.userUrl(username)); - getFullname(username, postInfoName); - //elem.find('.post-info-tag').text("@" + username); - getAvatar(username, elem.find('.avatar')); - elem.find('.post-info-time').text(timeGmtToText(t)).attr('title', timeSincePost(t)); + setPostCommon(elem, username, time); msg = htmlFormatMsg(msg); elem.find('.post-text').html(msg.html); @@ -138,11 +159,19 @@ function postToElem(post, kind, promoted) { postData.attr('data-reply-to', replyTo); if (typeof retweeted_by !== 'undefined') { - elem.find('.post-context').show(); - elem.find('.post-retransmited-by') - .attr('href', $.MAL.userUrl(retweeted_by)) - .text('@' + retweeted_by) - ; + var postContext = elem.find('.post-context'); + if (userpost.msg) { + postContext.append(_templatePostRtReference.clone(true)) + .find('.post-text').html(htmlFormatMsg(rt.msg).html); + ; + setPostCommon(postContext, rt.n, rt.time) + } else { + postContext.append(_templatePostRtBy.clone(true)) + .find('.post-retransmited-by') + .attr('href', $.MAL.userUrl(retweeted_by)).text('@' + retweeted_by) + ; + } + postContext.show(); } if (typeof promoted !== 'undefined' && promoted) { diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index 7505ef0..90b2ca4 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -1616,6 +1616,41 @@ textarea.splited-post { border-left: solid 3px #43464d; margin-left: 2px; } + +.post-rt-reference { + background-color: #FAFAFA; + border: 1px solid #ccc; +} + +.post-rt-reference:hover { + background-color: #FFF; + cursor: pointer; +} + +.post-rt-reference .post-photo { + width: 24px; + height: 24px; +} + +.post-rt-reference .post-photo img { + width: 24px; + height: auto; +} + +.post-rt-reference .post-info-name { + font-size: 10px; +} + +.post-rt-reference .post-text { + font-size: 10px; + margin: 2px 10px 4px 10px; +} + +.post-rt-reference .post-info-time { + font-size: 9px; + color: #000; +} + /*********************************** ******** LOGIN AND NETWORK PAGES *** ***********************************/ diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css index 3bc5cdf..49643fd 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -1101,6 +1101,40 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, margin-left: 1px; } +.post-rt-reference { + background-color: #FAFAFA; + border: 1px solid #ccc; +} + +.post-rt-reference:hover { + background-color: #FFF; + cursor: pointer; +} + +.post-rt-reference .post-photo { + width: 24px; + height: 24px; +} + +.post-rt-reference .post-photo img { + width: 24px; + height: auto; +} + +.post-rt-reference .post-info-name { + font-size: 10px; +} + +.post-rt-reference .post-text { + font-size: 10px; + margin: 2px 10px 4px 10px; +} + +.post-rt-reference .post-info-time { + font-size: 9px; + color: #000; +} + /* MODAL */ /* line 316, ../sass/_postboard.sass */ .modal-content .postboard { diff --git a/theme_nin/sass/_postboard.sass b/theme_nin/sass/_postboard.sass index a027644..9f0f7a9 100755 --- a/theme_nin/sass/_postboard.sass +++ b/theme_nin/sass/_postboard.sass @@ -311,6 +311,26 @@ border-left: solid 3px $main-color-color margin-left: 1px +.post-rt-reference + background-color: #FAFAFA + border: 1px solid #ccc + &:hover + background-color: #FFF + cursor: pointer + .post-photo + width: 24px + height: 24px + img + width: 24px + height: auto + .post-info-name + font-size: 10px + .post-text + font-size: 10px + margin: 2px 10px 4px 10px + .post-info-time + font-size: 9px + color: #000 diff --git a/tmobile.html b/tmobile.html index 6a7699b..45f9e7f 100644 --- a/tmobile.html +++ b/tmobile.html @@ -75,8 +75,45 @@ .header {position:fixed;z-index:10;top:0;width:100%} .content {padding:15px 20px 20px 20px;} .footer {position:fixed;z-index:10;bottom:0;width:100%} + +.post-rt-reference { + background-color: #FAFAFA; + border: 1px solid #ccc; + padding: 4px; +} + +.post-rt-reference:hover { + background-color: #FFF; + cursor: pointer; +} + +.post-rt-reference .post-photo { + float: left; + width: 24px; + height: 24px; + margin-right: 4px; +} + +.post-rt-reference .post-photo img { + width: 24px; + height: auto; +} + +.post-rt-reference .post-info-name { + font-size: 10px; +} + +.post-rt-reference .post-text { + font-size: 10px; + margin: 2px 10px 4px 10px; } +.post-rt-reference .post-info-time { + font-size: 9px; + font-weight: lighter; + color: #000 !important; + float: right; +}
@@ -710,11 +747,7 @@

- +
@@ -733,11 +766,7 @@

- +
@@ -761,6 +790,24 @@
+
+
+
user-photo
+ +

+
+
+ +
+ + twisted again by + +
From 3efe7bccc28079af331e88ba6bfefb54e1b702f3 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Wed, 12 Aug 2015 05:54:16 +0500 Subject: [PATCH 04/14] tune CSS for post retwists, disable ~nin~'s post context hack --- css/style.css | 10 ++++++---- theme_calm/css/style.css | 14 ++++++++++---- theme_nin/css/style.css | 23 ++++++++++------------- theme_nin/js/theme_option.js | 6 +++--- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/css/style.css b/css/style.css index 905fe34..587d5f0 100644 --- a/css/style.css +++ b/css/style.css @@ -1074,14 +1074,16 @@ ol.toptrends-list { font-size: 13px; top: 40px; } -.post-retransmited-icon -{ + +.post-retransmited-icon { display: inline-block; width: 16px; height: 16px; background: url(../img/repost.png) no-repeat left center; vertical-align: middle; + margin: 2px; } + .post-interactions { margin: 2px 10px 10px 60px; @@ -1275,11 +1277,11 @@ ol.toptrends-list { } .post-rt-reference .post-info-name { - font-size: 10px; + font-size: 11px; } .post-rt-reference .post-text { - font-size: 10px; + font-size: 11px; margin: 2px 10px 4px 10px; } diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index 90b2ca4..3964294 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -1436,14 +1436,16 @@ textarea.splited-post { font-size: 13px; top: 40px; } -.post-retransmited-icon -{ + +.post-retransmited-icon { display: inline-block; width: 25px; height: 25px; background: url(../img/repost.png) no-repeat left center; vertical-align: middle; + margin: 2px; } + .post-interactions { margin: -5px 10px 5px 60px; @@ -1638,14 +1640,18 @@ textarea.splited-post { } .post-rt-reference .post-info-name { - font-size: 10px; + font-size: 11px; } .post-rt-reference .post-text { - font-size: 10px; + font-size: 11px; margin: 2px 10px 4px 10px; } +.post-rt-reference .post-text a { + font-size: 11px; +} + .post-rt-reference .post-info-time { font-size: 9px; color: #000; diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css index 49643fd..a44696d 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -56,7 +56,7 @@ font-style: normal; } /* line 64, ../sass/_fonts.sass */ -[class^="icon-"]:before, [class*=" icon-"]:before, .extend-icon:before, .userMenu li.userMenu-config > a:before, .post-context span:before, .post-reply:before, .post-propagate:before, .post-favorite:before, .post .show-more:before, .mini-profile-actions span:before, ul.userMenu-search-profiles button:before, .mini-profile-indicators .userMenu-connections a:before, .mini-profile-indicators .userMenu-messages a:before, .mini-profile-indicators .userMenu-user a:before, .twister-user-remove:before, .refresh-toptrends:before, .twistday-reminder .refresh:before, .refresh-users:before, .modal-close:before, .mark-all-as-read:before, .modal-back:before, .icon-down-after:after { +[class^="icon-"]:before, [class*=" icon-"]:before, .extend-icon:before, .userMenu li.userMenu-config > a:before, .post-retransmited-icon:before, .post-reply:before, .post-propagate:before, .post-favorite:before, .post .show-more:before, .mini-profile-actions span:before, ul.userMenu-search-profiles button:before, .mini-profile-indicators .userMenu-connections a:before, .mini-profile-indicators .userMenu-messages a:before, .mini-profile-indicators .userMenu-user a:before, .twister-user-remove:before, .refresh-toptrends:before, .twistday-reminder .refresh:before, .refresh-users:before, .modal-close:before, .mark-all-as-read:before, .modal-back:before, .icon-down-after:after { font-family: "fontello"; font-style: normal; font-weight: normal; @@ -204,7 +204,7 @@ /* '' */ /* line 188, ../sass/_fonts.sass */ -.icon-twistagain:before, .post-context span:before, .post-propagate:before { +.icon-twistagain:before, .post-retransmited-icon:before, .post-propagate:before { content: ""; } @@ -888,11 +888,11 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, .post-context { font-size: 11px; line-height: 11px; - margin: 0 0 1em 0; + margin: 2px 10px 4px 60px; color: #b3b5b7; } /* line 146, ../sass/_postboard.sass */ -.post-context span:before { +.post-retransmited-icon:before { display: block; float: left; background: #B4C669; @@ -913,11 +913,6 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, color: #66686B; } -/* line 163, ../sass/_postboard.sass */ -.post-retransmited-icon { - display: none; -} - /* line 166, ../sass/_postboard.sass */ .post-interactions { margin: 10px 0 3px 0; @@ -1104,6 +1099,7 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, .post-rt-reference { background-color: #FAFAFA; border: 1px solid #ccc; + padding: 2px; } .post-rt-reference:hover { @@ -1122,17 +1118,18 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, } .post-rt-reference .post-info-name { - font-size: 10px; + font-size: 11px; + padding-left: 0px; } .post-rt-reference .post-text { - font-size: 10px; - margin: 2px 10px 4px 10px; + font-size: 11px; + margin: 4px 4px 4px 28px; } .post-rt-reference .post-info-time { font-size: 9px; - color: #000; + color: #B3B5B7; } /* MODAL */ diff --git a/theme_nin/js/theme_option.js b/theme_nin/js/theme_option.js index bb82e60..d080831 100644 --- a/theme_nin/js/theme_option.js +++ b/theme_nin/js/theme_option.js @@ -8,9 +8,9 @@ $(function(){ $('.userMenu-search-profiles button').html('').attr('title',polyglot.t('Follow')); $('.mini-profile-actions span').html(''); - $('.post-context').each(function(){ - $(this).prependTo($(this).parent()); - }); + //$('.post-context').each(function(){ + // $(this).prependTo($(this).parent()); + //}); $( '.userMenu-home.current a' ).on( 'click', function() { From adced65c55eba655ee9835f266628bbf976f9614 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Wed, 12 Aug 2015 06:34:08 +0500 Subject: [PATCH 05/14] update ~nin~'s SASS --- theme_nin/sass/_postboard.sass | 38 ++++++++++++++++------------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/theme_nin/sass/_postboard.sass b/theme_nin/sass/_postboard.sass index 9f0f7a9..bad16ce 100755 --- a/theme_nin/sass/_postboard.sass +++ b/theme_nin/sass/_postboard.sass @@ -142,22 +142,8 @@ .post-context font-size: 11px line-height: 11px - margin: 0 0 1em 0 + margin: 2px 10px 4px 60px color: lighten($dark-grey,30%) - span - @extend .icon-twistagain - @extend .extend-icon - &:before - display: block - float: left - background: $main-color-color - text-align: center - padding: 1px 2px 2px 2px - line-height: 9px - font-size: 9px - +border-radius(3px) - color: white - margin-right: .4em .mini-screen-name font-size: 13px @@ -165,7 +151,18 @@ .post-retransmited-icon - display: none + @extend .icon-twistagain + @extend .extend-icon + display: block + float: left + background: $main-color-color + text-align: center + padding: 1px 2px 2px 2px + line-height: 9px + font-size: 9px + +border-radius(3px) + color: white + margin-right: .4em .post-interactions margin: 10px 0 3px 0 @@ -314,6 +311,7 @@ .post-rt-reference background-color: #FAFAFA border: 1px solid #ccc + padding: 2px &:hover background-color: #FFF cursor: pointer @@ -324,13 +322,13 @@ width: 24px height: auto .post-info-name - font-size: 10px + font-size: 11px .post-text - font-size: 10px - margin: 2px 10px 4px 10px + font-size: 11px + margin: 4px 4px 4px 28px .post-info-time font-size: 9px - color: #000 + color: #B3B5B7 From 7069b01eebd6e421b58e7b95afd22b8db2aec290 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Wed, 12 Aug 2015 08:07:43 +0500 Subject: [PATCH 06/14] revive ~nin~'s post context #hack --- theme_nin/css/style.css | 4 ++++ theme_nin/js/theme_option.js | 5 ++--- theme_nin/sass/_postboard.sass | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css index a44696d..730a624 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -907,6 +907,10 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, margin-right: 0.4em; } +.post-context.post-retransmited-by-container { + margin: 0 0 1em; +} + /* line 158, ../sass/_postboard.sass */ .mini-screen-name { font-size: 13px; diff --git a/theme_nin/js/theme_option.js b/theme_nin/js/theme_option.js index d080831..b0678ee 100644 --- a/theme_nin/js/theme_option.js +++ b/theme_nin/js/theme_option.js @@ -8,9 +8,8 @@ $(function(){ $('.userMenu-search-profiles button').html('').attr('title',polyglot.t('Follow')); $('.mini-profile-actions span').html(''); - //$('.post-context').each(function(){ - // $(this).prependTo($(this).parent()); - //}); + $.globalEval(postToElem.toString().replace(/postContext.append\(_templatePostRtBy/, + 'postContext.addClass(\'post-retransmited-by-container\').prependTo(postContext.parent()).append(_templatePostRtBy')); $( '.userMenu-home.current a' ).on( 'click', function() { diff --git a/theme_nin/sass/_postboard.sass b/theme_nin/sass/_postboard.sass index bad16ce..336069f 100755 --- a/theme_nin/sass/_postboard.sass +++ b/theme_nin/sass/_postboard.sass @@ -144,6 +144,8 @@ line-height: 11px margin: 2px 10px 4px 60px color: lighten($dark-grey,30%) + &.post-retransmited-by-container + margin: 0 0 1em .mini-screen-name font-size: 13px From 48a5292249090edef2209156a0854c596769504c Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Wed, 12 Aug 2015 16:24:09 +0500 Subject: [PATCH 07/14] fix of deleting user mention from mentions to reply --- js/twister_formatpost.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 4f6c7d4..bfb79df 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -138,11 +138,10 @@ function postToElem(post, kind, promoted) { if (username !== defaultScreenName) { if (msg.mentions.indexOf(username) === -1) msg.mentions.splice(0, 0, username); - } else { - var i = msg.mentions.indexOf(defaultScreenName); - if (i !== -1) - msg.mentions.splice(i, 1); } + for (var i = msg.mentions.indexOf(defaultScreenName); i !== -1; i = msg.mentions.indexOf(defaultScreenName)) + msg.mentions.splice(i, 1); + if (msg.mentions.length) var replyTo = '@' + msg.mentions.join(' @') + ' '; else From 66431127e6bf580c811ccced7139daa2b76fcaf2 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Wed, 12 Aug 2015 22:10:42 +0500 Subject: [PATCH 08/14] introduce sending posts with citation (retwists with comments) --- css/style.css | 4 ++ js/interface_common.js | 123 +++++++++++++++++++++++---------------- js/twister_actions.js | 50 +++++++++++----- js/twister_network.js | 16 ++--- theme_calm/css/style.css | 4 ++ 5 files changed, 126 insertions(+), 71 deletions(-) diff --git a/css/style.css b/css/style.css index 587d5f0..6e4a80b 100644 --- a/css/style.css +++ b/css/style.css @@ -1787,6 +1787,10 @@ ol.toptrends-list { min-height: 68px; } +.reTwist .post-area-extras { + margin-right: 10px; +} + /************************************* ********* REPLY POSTS PROMPT ********* **************************************/ diff --git a/js/interface_common.js b/js/interface_common.js index ec03d7e..61b9bdc 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -379,13 +379,25 @@ function reTwistPopup(e) { return; } - openModal({ + var modal = openModal({ classBase: '.prompt-wrapper', classAdd: 'reTwist', title: polyglot.t('retransmit_this') - }) - .content - .append(postToElem($.evalJSON($(this).parents('.post-data').attr('data-userpost')), '')); + }); + + modal.content + .append(postToElem($.evalJSON($(this).parents('.post-data').attr('data-userpost')), '')) + .append($('#reply-modal-template').children().clone(true)) // FIXME retwist-reply-modal-template + ; + + var replyArea = modal.content.find('.post-area .post-area-new'); + var textArea = replyArea.find('textarea'); + var textAreaPostInline = modal.content.find('.post .post-area-new textarea'); + $.each(['placeholder', 'data-reply-to'], function(i, attribute) { + textArea.attr(attribute, textAreaPostInline.attr(attribute)); + }); + + replyArea.find('.post-submit').addClass('with-reference'); } // Expande Área do Novo post @@ -399,16 +411,16 @@ function replyInitPopup(e, post) { getFullname(post.userpost.n, modal.self.find('h3 .fullname')); modal.content - .append($('#reply-modal-template').children().clone(true)) .append(postToElem(post, '')) + .append($('#reply-modal-template').children().clone(true)) ; // FIXME passing data through attributes may result in a mess like following var replyArea = modal.content.find('.post-area .post-area-new').addClass('open'); - var replyText = replyArea.find('textarea'); - var postInlineReplyText = modal.content.find('.post .post-area-new textarea'); + var textArea = replyArea.find('textarea'); + var textAreaPostInline = modal.content.find('.post .post-area-new textarea'); $.each(['placeholder', 'data-reply-to'], function(i, attribute) { - replyText.attr(attribute, postInlineReplyText.attr(attribute)); + textArea.attr(attribute, textAreaPostInline.attr(attribute)); }); composeNewPost(e, replyArea); @@ -1202,82 +1214,95 @@ function undoLastUnicode(e) { } function postSubmit(e, oldLastPostId) { + var btnPostSubmit; + if (e instanceof $) { - var $this = e; + btnPostSubmit = e; //check if previous part was sent... if (oldLastPostId === lastPostId) { - setTimeout(postSubmit, 1000, $this, oldLastPostId); + setTimeout(postSubmit, 1000, btnPostSubmit, oldLastPostId); return; } } else { e.stopPropagation(); e.preventDefault(); - var $this = $(this); + btnPostSubmit = $(this); } - $.MAL.disableButton($this); + $.MAL.disableButton(btnPostSubmit); - var $replyText = $this.closest('.post-area-new').find('textarea'); + var textArea = btnPostSubmit.closest('.post-area-new').find('textarea'); - $replyText.siblings('#post-preview').hide(); + textArea.siblings('#post-preview').hide(); - var $postOrig = $this.closest('.post-data'); - if (!$postOrig.length) { - $postOrig = $this.closest('.modal-content').find('.post-data'); + var postData = btnPostSubmit.closest('.post-data'); + if (!postData.length) { + postData = btnPostSubmit.closest('.modal-content').find('.post-data'); } - if (splitedPostsCount > 1) { - if ($replyText.length < splitedPostsCount) { - //current part will be sent as reply to the previous part... - $postOrig = $('
'); + if (btnPostSubmit.hasClass('with-reference')) { + function doSubmitPost(postText, postData) { + newRtMsg(postData, postText); + } + } else { + if (splitedPostsCount > 1) { + if (textArea.length < splitedPostsCount) { + //current part will be sent as reply to the previous part... + postData = $('
'); + } + } + + function doSubmitPost(postText, postData) { + newPostMsg(postText, postData); } } - if ($replyText.length <= 1) { + if (textArea.length <= 1) { if (splitedPostsCount > 1) { - var postxt = ''; - var reply_to = $replyText.attr('data-reply-to'); - var val = $replyText.val(); + var postText = ''; + var reply_to = textArea.attr('data-reply-to'); + var val = textArea.val(); if (typeof reply_to === 'undefined' || checkPostForMentions(val, reply_to, 140)) - postxt = val + ' (' + splitedPostsCount.toString() + '/' + splitedPostsCount.toString() + ')'; + postText = val + ' (' + splitedPostsCount.toString() + '/' + splitedPostsCount.toString() + ')'; else - postxt = reply_to + val + ' (' + splitedPostsCount.toString() + '/' + splitedPostsCount.toString() + ')'; + postText = reply_to + val + ' (' + splitedPostsCount.toString() + '/' + splitedPostsCount.toString() + ')'; - newPostMsg(postxt, $postOrig); + doSubmitPost(postText, postData); } else - newPostMsg($replyText.val(), $postOrig); + doSubmitPost(textArea.val(), postData); splitedPostsCount = 1; } else { - var postxt = ''; - var reply_to = $replyText.attr('data-reply-to'); - var val = $replyText[0].value; + var postText = ''; + var reply_to = textArea.attr('data-reply-to'); + var val = textArea[0].value; if (typeof reply_to === 'undefined' || checkPostForMentions(val, reply_to, 140)) - postxt = val + ' (' + (splitedPostsCount - $replyText.length + 1).toString() + '/' + splitedPostsCount.toString() + ')'; + postText = val + ' (' + (splitedPostsCount - textArea.length + 1).toString() + '/' + splitedPostsCount.toString() + ')'; else - postxt = reply_to + val + ' (' + (splitedPostsCount - $replyText.length + 1).toString() + '/' + splitedPostsCount.toString() + ')'; + postText = reply_to + val + ' (' + (splitedPostsCount - textArea.length + 1).toString() + '/' + splitedPostsCount.toString() + ')'; - $($replyText[0]).remove(); + $(textArea[0]).remove(); oldLastPostId = lastPostId; - newPostMsg(postxt, $postOrig); - setTimeout(postSubmit, 1000, $this, oldLastPostId); + doSubmitPost(postText, postData); + setTimeout(postSubmit, 1000, btnPostSubmit, oldLastPostId); return; } - $replyText.val('').attr('placeholder', polyglot.t('Your message was sent!')); - var tweetForm = $this.parents('form'); - var remainingCount = tweetForm.find('.post-area-remaining'); - remainingCount.text(140); - - if ($this.parents('.prompt-wrapper').length) + if (btnPostSubmit.parents('.prompt-wrapper').length) closeModalHandler('.prompt-wrapper'); - - if ($this.closest('.post-area,.post-reply-content')) { - $('.post-area-new').removeClass('open').find('textarea').blur(); - }; - $replyText.data('unicodeConversionStack', []); - $replyText.data('disabledUnicodeRules', []); + else { + textArea.val('').attr('placeholder', polyglot.t('Your message was sent!')); + var tweetForm = btnPostSubmit.parents('form'); + var remainingCount = tweetForm.find('.post-area-remaining'); + remainingCount.text(140); + + if (btnPostSubmit.closest('.post-area,.post-reply-content')) { + $('.post-area-new').removeClass('open').find('textarea').blur(); + }; + textArea.data('unicodeConversionStack', []); + textArea.data('disabledUnicodeRules', []); + } } function retweetSubmit(e) { diff --git a/js/twister_actions.js b/js/twister_actions.js index e5ea597..82db067 100644 --- a/js/twister_actions.js +++ b/js/twister_actions.js @@ -263,30 +263,50 @@ function newPostMsg(msg, $postOrig) { } } -function newRtMsg($postOrig) { - var content_to_rt = $postOrig.attr('data-content_to_rt'); - var content_to_sigrt = $postOrig.attr('data-content_to_sigrt'); +function newRtMsg(postData, msg) { + var userpost = $.evalJSON(postData.attr('data-content_to_rt')); + var sig_userpost; + + if (userpost.rt) { + if (parseInt(twisterVersion) <= 93000) { + alert(polyglot.t('error', + {error: 'can\'t handle retwisting of commented retwisted twists with daemon version ' + + twisterDisplayVersion + ' and below of that. please upgrade it.'} + )); + + return; + } else { + // dropping of rt to avoid overquoting + sig_userpost = userpost.sig_wort; + userpost.rt = undefined; + userpost.sig_rt = undefined; + } + } else { + sig_userpost = postData.attr('data-content_to_sigrt'); + } - var sig_userpost = String(content_to_sigrt); - var userpost = $.evalJSON(String(content_to_rt)); - var rtObj = { sig_userpost :sig_userpost, userpost : userpost }; + var rtObj = {sig_userpost: sig_userpost, userpost: userpost}; - if( lastPostId != undefined ) { - if ( typeof _sendedPostIDs !== 'undefined' ) + if (typeof lastPostId !== 'undefined') { + if (typeof _sendedPostIDs !== 'undefined') _sendedPostIDs.push(lastPostId + 1); - var params = [defaultScreenName, lastPostId+1, rtObj] + var params = [defaultScreenName, lastPostId + 1, rtObj]; - twisterRpc("newrtmsg", params, - function(arg, ret) { incLastPostId(); }, null, - function(arg, ret) { var msg = ("message" in ret) ? ret.message : ret; - alert(polyglot.t("ajax_error", { error: msg })); }, null); + if (typeof msg !== 'undefined') + params.push(msg); + + twisterRpc('newrtmsg', params, + function(arg, ret) {incLastPostId();}, null, + function(arg, ret) {var msg = ('message' in ret) ? ret.message : ret; + alert(polyglot.t('ajax_error', {error: msg})); + }, null + ); } else { - alert(polyglot.t("Internal error: lastPostId unknown (following yourself may fix!)")); + alert(polyglot.t('Internal error: lastPostId unknown (following yourself may fix!)')); } } - function updateProfileData(profileModalContent, username) { //profileModalContent.find("a").attr("href",$.MAL.userUrl(username)); diff --git a/js/twister_network.js b/js/twister_network.js index ef8cabf..41b1aa0 100644 --- a/js/twister_network.js +++ b/js/twister_network.js @@ -4,6 +4,8 @@ // Provides functions for periodic network status check // Interface to network.html page. +var twisterVersion; +var twisterDisplayVersion; var twisterdConnections = 0; var twisterdAddrman = 0; var twisterDhtNodes = 0; @@ -39,9 +41,9 @@ function requestNetInfo(cbFunc, cbArg) { twisterdBlocks = ret.blocks; twisterDhtNodes = ret.dht_nodes; twisterVersion = ("0000000" + ret.version).slice(-8); - twisterDisplayVersion = twisterVersion.slice(0,2) + '.' + - twisterVersion.slice(2,4) + '.' + - twisterVersion.slice(4,6) + '.' + + twisterDisplayVersion = twisterVersion.slice(0,2) + '.' + + twisterVersion.slice(2,4) + '.' + + twisterVersion.slice(4,6) + '.' + twisterVersion.slice(6,8); $(".connection-count").text(twisterdConnections); @@ -301,10 +303,10 @@ function initInterfaceNetwork() { }); } else - { - $(".userMenu-profile > a").text(polyglot.t("Login")); - $(".userMenu-profile > a").attr("href","login.html"); - } + { + $(".userMenu-profile > a").text(polyglot.t("Login")); + $(".userMenu-profile > a").attr("href","login.html"); + } }); networkUpdate(); setInterval("networkUpdate()", 2000); diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index 3964294..c4cdd0b 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -2183,6 +2183,10 @@ textarea.splited-post { min-height: 68px; } +.reTwist .post-area-extras { + margin-right: 10px; +} + /************************************* ********* REPLY POSTS PROMPT ********* **************************************/ From 24cb89ba3bb9e4ebdf84b1b603c22d0eee7928d2 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Wed, 12 Aug 2015 22:47:54 +0500 Subject: [PATCH 09/14] rearrange commented retwists #CSS --- css/style.css | 71 +++++++++++++++--------------- theme_calm/css/style.css | 79 +++++++++++++++++----------------- theme_nin/css/style.css | 76 ++++++++++++++++---------------- theme_nin/sass/_postboard.sass | 38 ++++++++-------- theme_nin/sass/style.sass | 2 +- 5 files changed, 135 insertions(+), 131 deletions(-) diff --git a/css/style.css b/css/style.css index 6e4a80b..3243cd3 100644 --- a/css/style.css +++ b/css/style.css @@ -1256,40 +1256,6 @@ ol.toptrends-list { margin-left: 2px; } -.post-rt-reference { - background-color: #FAFAFA; - border: 1px solid #ccc; -} - -.post-rt-reference:hover { - background-color: #FFF; - cursor: pointer; -} - -.post-rt-reference .post-photo { - width: 24px; - height: 24px; -} - -.post-rt-reference .post-photo img { - width: 24px; - height: auto; -} - -.post-rt-reference .post-info-name { - font-size: 11px; -} - -.post-rt-reference .post-text { - font-size: 11px; - margin: 2px 10px 4px 10px; -} - -.post-rt-reference .post-info-time { - font-size: 9px; - color: #000; -} - /*********************************** ******** LOGIN AND NETWORK PAGES *** ***********************************/ @@ -1773,7 +1739,7 @@ ol.toptrends-list { **************************************/ .reTwist.prompt-wrapper { - margin-top: -100px; + margin-top: -140px; } .reTwist .post-expand, @@ -2126,3 +2092,38 @@ ul.dropdown-menu .active, ul.dropdown-menu .active a { text-decoration: none; cursor: pointer; } + + +.post-rt-reference { + background-color: #FAFAFA; + border: 1px solid #ccc; +} + +.post-rt-reference:hover { + background-color: #FFF; + cursor: pointer; +} + +.post-rt-reference .post-photo { + width: 24px; + height: 24px; +} + +.post-rt-reference .post-photo img { + width: 24px; + height: auto; +} + +.post-rt-reference .post-info-name { + font-size: 11px; +} + +.post-rt-reference .post-text { + font-size: 11px; + margin: 2px 10px 4px 10px; +} + +.post-rt-reference .post-info-time { + font-size: 9px; + color: #000; +} diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index c4cdd0b..a46f86b 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -1619,44 +1619,6 @@ textarea.splited-post { margin-left: 2px; } -.post-rt-reference { - background-color: #FAFAFA; - border: 1px solid #ccc; -} - -.post-rt-reference:hover { - background-color: #FFF; - cursor: pointer; -} - -.post-rt-reference .post-photo { - width: 24px; - height: 24px; -} - -.post-rt-reference .post-photo img { - width: 24px; - height: auto; -} - -.post-rt-reference .post-info-name { - font-size: 11px; -} - -.post-rt-reference .post-text { - font-size: 11px; - margin: 2px 10px 4px 10px; -} - -.post-rt-reference .post-text a { - font-size: 11px; -} - -.post-rt-reference .post-info-time { - font-size: 9px; - color: #000; -} - /*********************************** ******** LOGIN AND NETWORK PAGES *** ***********************************/ @@ -2169,7 +2131,7 @@ textarea.splited-post { **************************************/ .reTwist.prompt-wrapper { - margin-top: -100px; + margin-top: -140px; } .reTwist .post-expand, @@ -2562,3 +2524,42 @@ p.post-text img { .reply textarea{ margin-top: 20px; } + + +.post-rt-reference { + background-color: #FAFAFA; + border: 1px solid #ccc; +} + +.post-rt-reference:hover { + background-color: #FFF; + cursor: pointer; +} + +.post-rt-reference .post-photo { + width: 24px; + height: 24px; +} + +.post-rt-reference .post-photo img { + width: 24px; + height: auto; +} + +.post-rt-reference .post-info-name { + font-size: 11px; +} + +.post-rt-reference .post-text { + font-size: 11px; + margin: 2px 10px 4px 10px; +} + +.post-rt-reference .post-text a { + font-size: 11px; +} + +.post-rt-reference .post-info-time { + font-size: 9px; + color: #000; +} diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css index 730a624..9db49ee 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -1100,42 +1100,6 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, margin-left: 1px; } -.post-rt-reference { - background-color: #FAFAFA; - border: 1px solid #ccc; - padding: 2px; -} - -.post-rt-reference:hover { - background-color: #FFF; - cursor: pointer; -} - -.post-rt-reference .post-photo { - width: 24px; - height: 24px; -} - -.post-rt-reference .post-photo img { - width: 24px; - height: auto; -} - -.post-rt-reference .post-info-name { - font-size: 11px; - padding-left: 0px; -} - -.post-rt-reference .post-text { - font-size: 11px; - margin: 4px 4px 4px 28px; -} - -.post-rt-reference .post-info-time { - font-size: 9px; - color: #B3B5B7; -} - /* MODAL */ /* line 316, ../sass/_postboard.sass */ .modal-content .postboard { @@ -2825,7 +2789,7 @@ ol.toptrends-list a:hover { /* line 705, ../sass/style.sass */ .reTwist.prompt-wrapper { - margin-top: -110px; + margin-top: -150px; } .reTwist .modal-content { @@ -3354,3 +3318,41 @@ ul.dropdown-menu .active, ul.dropdown-menu .active a { margin: 2% 1%; } } + + +.post-rt-reference { + background-color: #FAFAFA; + border: 1px solid #ccc; + padding: 2px; +} + +.post-rt-reference:hover { + background-color: #FFF; + cursor: pointer; +} + +.post-rt-reference .post-photo { + width: 24px; + height: 24px; + margin-right: 4px; +} + +.post-rt-reference .post-photo img { + width: 24px; + height: auto; +} + +.post-rt-reference .post-info-name { + font-size: 11px; + padding-left: 0px; +} + +.post-rt-reference .post-text { + font-size: 11px; + margin: 4px 4px 4px 28px; +} + +.post-rt-reference .post-info-time { + font-size: 9px; + color: #B3B5B7; +} diff --git a/theme_nin/sass/_postboard.sass b/theme_nin/sass/_postboard.sass index 336069f..ddb9dc7 100755 --- a/theme_nin/sass/_postboard.sass +++ b/theme_nin/sass/_postboard.sass @@ -310,6 +310,24 @@ border-left: solid 3px $main-color-color margin-left: 1px + +/* MODAL */ +.modal-content + .postboard + width: auto!important + padding: 0 + clear: none!important + position: relative + .post-text + margin: 0 0 0 40px + .post-photo + width: 30px + height: 30px + img + width: 100% + height: 100% + + .post-rt-reference background-color: #FAFAFA border: 1px solid #ccc @@ -320,6 +338,7 @@ .post-photo width: 24px height: 24px + margin-right: 4px img width: 24px height: auto @@ -331,22 +350,3 @@ .post-info-time font-size: 9px color: #B3B5B7 - - - - -/* MODAL */ -.modal-content - .postboard - width: auto!important - padding: 0 - clear: none!important - position: relative - .post-text - margin: 0 0 0 40px - .post-photo - width: 30px - height: 30px - img - width: 100% - height: 100% diff --git a/theme_nin/sass/style.sass b/theme_nin/sass/style.sass index 19c6d27..6c0653d 100755 --- a/theme_nin/sass/style.sass +++ b/theme_nin/sass/style.sass @@ -778,7 +778,7 @@ ol.toptrends-list .prompt-wrapper.reTwist &.prompt-wrapper - margin-top: -110px + margin-top: -150px .modal-content padding: 20px 15px .modal-buttons From 5da5cde79ad1300aad1b6f98a2c29a7d0547c80c Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Thu, 13 Aug 2015 00:32:51 +0500 Subject: [PATCH 10/14] add check to newRtMsg() to avoid undefined sig_userpost --- js/twister_actions.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/twister_actions.js b/js/twister_actions.js index 82db067..3502729 100644 --- a/js/twister_actions.js +++ b/js/twister_actions.js @@ -285,6 +285,14 @@ function newRtMsg(postData, msg) { sig_userpost = postData.attr('data-content_to_sigrt'); } + if (typeof sig_userpost === 'undefined') { + alert(polyglot.t('error', + {error: 'can\'t sig_userpost is not deifned'} + )); + + return; + } + var rtObj = {sig_userpost: sig_userpost, userpost: userpost}; if (typeof lastPostId !== 'undefined') { From f251cf09494b1a9f8525d00bfcb7755ae065ac39 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Thu, 13 Aug 2015 01:07:13 +0500 Subject: [PATCH 11/14] add handling of new userpost property `sig_wort` finally --- js/twister_actions.js | 2 ++ js/twister_formatpost.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/js/twister_actions.js b/js/twister_actions.js index 3502729..e6b6061 100644 --- a/js/twister_actions.js +++ b/js/twister_actions.js @@ -293,6 +293,8 @@ function newRtMsg(postData, msg) { return; } + userpost.sig_wort = undefined; + var rtObj = {sig_userpost: sig_userpost, userpost: userpost}; if (typeof lastPostId !== 'undefined') { diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index bfb79df..bafbf2c 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -70,6 +70,10 @@ function postToElem(post, kind, promoted) { // Obtain data from userpost var userpost = post.userpost; + + if (post.sig_wort) + userpost.sig_wort = post.sig_wort; + if (userpost.rt) { rt = userpost.rt; if (userpost.msg) { From 21e9db5ea356133bf2940993912e8c294bfbfad3 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Thu, 13 Aug 2015 19:05:15 +0500 Subject: [PATCH 12/14] fix doSubmitPost() dynamic declaration --- js/interface_common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/interface_common.js b/js/interface_common.js index 61b9bdc..12b3a75 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -1240,7 +1240,7 @@ function postSubmit(e, oldLastPostId) { } if (btnPostSubmit.hasClass('with-reference')) { - function doSubmitPost(postText, postData) { + var doSubmitPost = function (postText, postData) { newRtMsg(postData, postText); } } else { @@ -1251,7 +1251,7 @@ function postSubmit(e, oldLastPostId) { } } - function doSubmitPost(postText, postData) { + var doSubmitPost = function (postText, postData) { newPostMsg(postText, postData); } } From 7a6669d926c0ad67c8722544543b1a39b3320fd6 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Sat, 15 Aug 2015 02:17:17 +0500 Subject: [PATCH 13/14] add `click to post citation to open related conversation` --- js/interface_common.js | 5 +++-- js/twister_formatpost.js | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/js/interface_common.js b/js/interface_common.js index 12b3a75..5e26403 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -293,7 +293,7 @@ function openConversationClick(e) { e.stopPropagation(); e.preventDefault(); - var postData = $(this).parents('.module.post.original.open .module.post.original .post-data'); + var postData = $(this).closest(e.data.feeder); window.location.hash = '#conversation?post=' + postData.attr('data-screen-name') + ':post' + postData.attr('data-id'); @@ -1427,7 +1427,8 @@ function initInterfaceCommon() { ; $('.post-submit').on('click', postSubmit); $('.modal-propagate').on('click', retweetSubmit); - $('.expanded-content .show-more').on('click', openConversationClick); + $('.expanded-content .show-more').on('click', + {feeder: '.module.post.original.open .module.post.original .post-data'}, openConversationClick); if ($.Options.unicodeConversion.val === 'disable') $('.undo-unicode').on('click', undoLastUnicode).css('display', 'none'); diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index bafbf2c..9c2db86 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -12,6 +12,8 @@ var _htmlFormatMsgLinkTemplateHashtag; $(document).ready(function() { // we're setting it here for perfomance improvement purpose // to not search and prepare it for for every post every time _templatePostRtReference = $('#post-rt-reference-template').children().clone(true); + _templatePostRtReference.find('.post-text') + .on('click', {feeder: '.post-rt-reference'}, openConversationClick); _templatePostRtBy = $('#post-retransmited-by-template').children().clone(true); _htmlFormatMsgLinkTemplateExternal = $('#external-page-link-template') if (_htmlFormatMsgLinkTemplateExternal.length) { @@ -165,9 +167,12 @@ function postToElem(post, kind, promoted) { var postContext = elem.find('.post-context'); if (userpost.msg) { postContext.append(_templatePostRtReference.clone(true)) - .find('.post-text').html(htmlFormatMsg(rt.msg).html); + .find('.post-rt-reference') + .attr('data-screen-name', rt.n) + .attr('data-id', rt.k) + .find('.post-text').html(htmlFormatMsg(rt.msg).html) ; - setPostCommon(postContext, rt.n, rt.time) + setPostCommon(postContext, rt.n, rt.time); } else { postContext.append(_templatePostRtBy.clone(true)) .find('.post-retransmited-by') From 80be52b2d9be925b86bfb676cb55b6e3b51670df Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Sun, 16 Aug 2015 00:25:17 +0500 Subject: [PATCH 14/14] add `click to post citation to open post in tmobile` --- js/tmobile.js | 9 +++++++++ js/twister_formatpost.js | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/js/tmobile.js b/js/tmobile.js index 32603a6..24a0b00 100644 --- a/js/tmobile.js +++ b/js/tmobile.js @@ -488,6 +488,15 @@ function handleAvatarFileSelectMobile(evt) { } } +function openConversationClick(event) { + event.stopPropagation(); + event.preventDefault(); + + var userpost = $(event.target).closest(event.data.feeder).attr('data-userpost'); + + $.mobile.showPageLoadingMsg(); + $.mobile.navigate('#post?userpost=' + encodeURIComponent(userpost)); +} function clearProfilePage() { diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 9c2db86..c09a9f5 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -120,7 +120,7 @@ function postToElem(post, kind, promoted) { .attr('data-content_to_sigrt', content_to_sigrt) .attr('data-screen-name', username) .attr('data-id', k) - .attr('data-lastk', userpost["lastk"]) + .attr('data-lastk', userpost.lastk) .attr('data-text', msg) ; if (userpost.reply) { @@ -170,6 +170,7 @@ function postToElem(post, kind, promoted) { .find('.post-rt-reference') .attr('data-screen-name', rt.n) .attr('data-id', rt.k) + .attr('data-userpost', $.toJSON({userpost: rt, sig_userpost: userpost.sig_rt})) .find('.post-text').html(htmlFormatMsg(rt.msg).html) ; setPostCommon(postContext, rt.n, rt.time);