From 59fb0e9c19453701a241f36d334dee9d76629e69 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Mon, 10 Aug 2015 00:59:28 +0500 Subject: [PATCH 01/12] add post preview to #options's Post display section --- css/style.css | 6 ++++++ js/interface_localization.js | 39 ++++++++++++++++++++++++++++++++++++ js/options.js | 8 ++++++++ options.html | 17 +++++++++++++++- theme_calm/css/style.css | 6 ++++++ theme_nin/css/style.css | 10 +++++++++ theme_nin/sass/style.sass | 7 +++++++ 7 files changed, 92 insertions(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index 6b6a8ee..f5291b9 100644 --- a/css/style.css +++ b/css/style.css @@ -665,6 +665,12 @@ textarea.splited-post { background-color: #F0EFCC; } +#opt-form-post-preview #post-preview { + width: 76%; + margin-left: 16px; + padding: 8px; +} + .splited-post-counter { color: rgba(0, 0, 0, 0.3); font-weight: bold; diff --git a/js/interface_localization.js b/js/interface_localization.js index b8864db..06ad1a6 100644 --- a/js/interface_localization.js +++ b/js/interface_localization.js @@ -107,6 +107,9 @@ if(preferredLanguage == "en"){ "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for %{this_domain} in settings of your browser.", "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "Number of blocks in block chain: ", "Number of CPUs to use": "Number of CPUs to use ", "Only alphanumeric and underscore allowed.": "Only alphanumeric and underscore allowed.", @@ -402,6 +405,9 @@ if(preferredLanguage == "es"){ "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for %{this_domain} in settings of your browser.", "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "Número de bloques en la cadena de bloques: ", "Number of CPUs to use": "Número de CPUs para utilizar ", "Only alphanumeric and underscore allowed.": "Sólo alfanuméricos y subrayados permitido.", @@ -682,6 +688,9 @@ if(preferredLanguage == "uk"){ "notify_desktop_perm_denied": "Twister не може створити сповіщення на робочому столі: доступ обмежено.\n\nЯкщо ви бажаєте отримувати сповіщення, дозвольте їх виконання в налаштуваннях браузера для %{this_domain}.", "notify_desktop_test": "Є дещо новеньке у стрічці.", "notify_desktop_title": "Погляньте сюди!", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "Кількість блоків у ланцюгу: ", "Number of CPUs to use": "Кількість CPU до використання ", "Only alphanumeric and underscore allowed.": "Допустимі тільки латинські символи, числа та нижнє підкреслення.", @@ -959,6 +968,9 @@ if(preferredLanguage == "zh-CN"){ "notify_desktop_perm_denied": "Twister 无法发出桌面提醒:权限被拒绝。\n\n如果你想收到提醒,请在你的浏览器设置中允许 %{this_domain} 发出提醒。", "notify_desktop_test": "我们都在用 Twister。\n欢迎你的加入。", "notify_desktop_title": "注意,Twister 在这里!", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "区块链中的区块数:", "Number of CPUs to use": "使用CPU数目", "Only alphanumeric and underscore allowed.": "只允许字母和下划线。", @@ -1254,6 +1266,9 @@ if(preferredLanguage == "nl"){ "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for %{this_domain} in settings of your browser.", "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "Aantal blocks in block chain: ", "Number of CPUs to use": "Aantal CPUs om te gebruiken ", "Only alphanumeric and underscore allowed.": "Alleen alphanumeriek en underscore toegestaan.", @@ -1533,6 +1548,9 @@ if(preferredLanguage == "it"){ "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for %{this_domain} in settings of your browser.", "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "Numero di blocchi nella catena: ", "Number of CPUs to use": "Numero di processori da usare:", "Only alphanumeric and underscore allowed.": "Sono permessi solo caratteri alfanumerici e '_'", @@ -1809,6 +1827,9 @@ if(preferredLanguage == "fr"){ "notify_desktop_perm_denied": "Impossible d'afficher les notifications: autorisation refusée.\n\nSi tu souhaites afficher les notifications, autorise le %{this_domain} dans les paramêtres de ton navigateur.", "notify_desktop_test": "All the twisters gonna twist.\nBienvenue à toi!", "notify_desktop_title": "Youhou! Ça bouge sur ton twister!", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "Nombre de blocs dans la chaîne de blocs: ", "Number of CPUs to use": "Nombre de processeurs à utiliser", "Only alphanumeric and underscore allowed.": "Seuls les caractères alphanumériques et la barre de soulignement sont permis.", @@ -2090,6 +2111,9 @@ if(preferredLanguage == "ru"){ "notify_desktop_perm_denied": "Твистер не может выполнить уведомление: разрешение не получено.\n\nЧтобы получать уведомления, разрешите их для %{this_domain} в настройках вашего браузера.", "notify_desktop_test": "Одна лягушка сказала:\n'если не буду квакать — лопну'.\nВы нужны нам, берегите себя.", "notify_desktop_title": "Watch out, it's twister over here!", + "post_preview_dummy": 'это *полужирный*, ~курсивный~, -зачёркнутый- и _подчёркнутый_ текст.\n' + + 'экранированный: `*полужирный*, ~курсивный~, -зачёркнутый- и _подчёркнутый_`.\n' + + 'ссылки на [наш потрясный логотип](%{logo}) и наш великолепный сайт: %{site}.', "Number of blocks in block chain:": "Количество блоков в цепочке: ", "Number of CPUs to use": "Сколько использовать ядер процессора", "Only alphanumeric and underscore allowed.": "Разрешены только латинские буквы, цифры и подчеркивания.", @@ -2375,6 +2399,9 @@ if(preferredLanguage == "de"){ "notify_desktop_perm_denied": "Twister kann keine Desktop-Meldungen anzeigen: Keine Berechtigung.\n\nWenn Du Meldungen angezeigt haben möchtest, erlaube sie für %{this_domain} in den Einstellungen Deines Browsers.", "notify_desktop_test": "All die Twisterer werden twisten..\nDu bist nun auch willkommen!", "notify_desktop_title": "Achtung, hier ist Twister am Gange!", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "Anzahl der Blöcke in der Block-Chain: ", "Number of CPUs to use": "Anzahl der zu benutzenden CPU's ", "Only alphanumeric and underscore allowed.": "Nur Buchstaben, Zahlen und Unterstrich erlaubt.", @@ -2655,6 +2682,9 @@ if(preferredLanguage == "ja"){ "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for %{this_domain} in settings of your browser.", "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "全ブロック数: ", "Number of CPUs to use": "利用するCPUの数", "Only alphanumeric and underscore allowed.": "アルファベットとアンダースコア(_)が利用可能です", @@ -2932,6 +2962,9 @@ if(preferredLanguage == "pt-BR"){ "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for %{this_domain} in settings of your browser.", "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "Número de blocos: ", "Number of CPUs to use": "Número de CPUs a serem utilizados ", "Only alphanumeric and underscore allowed.": "Permitido apenas caracteres alfanuméricos e underscore '_'.", @@ -3213,6 +3246,9 @@ if(preferredLanguage == "tr"){ "notify_desktop_perm_denied": "Twister cannot perform desktop notification: permission denied.\n\nIf you want to get notifications, allow them for %{this_domain} in settings of your browser.", "notify_desktop_test": "All the twisters gonna twist.\nNow you are welcome too.", "notify_desktop_title": "Watch out, it's twister over here!", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "Blok zincirindeki blok sayısı: ", "Number of CPUs to use": "Kullanılacak CPU sayısı ", "Only alphanumeric and underscore allowed.": "Sadece harf ve alt çizgi kullanılabilir.", @@ -3491,6 +3527,9 @@ if(preferredLanguage == "cs"){ "notify_desktop_perm_denied": "Twisteru se nepodařilo zobrazit upozornění na ploše: přístup byl odepřen.\n\nPokud chcete používat upozornění na ploše, povolte je pro %{this_domain} v nastavení vašeho prohlížeče.", "notify_desktop_test": "Twister to umí pořádně roztočit.\nKaždý je tu vítán.", "notify_desktop_title": "Twister", + "post_preview_dummy": 'here is *bold*, ~italic~, -strike-trough- and _underlined_ text.\n' + + 'same but escaped: `*bold*, ~italic~, -strike-trough- and _underlined_`.\n' + + 'links to [our awesome logo](%{logo}) and our gorgeous site: %{site}.', "Number of blocks in block chain:": "Počet bloků v blockchainu: ", "Number of CPUs to use": "Kolik jader procesoru použít? ", "Only alphanumeric and underscore allowed.": "Povolena jsou jen písmena, čísla a podtržítko.", diff --git a/js/options.js b/js/options.js index 936c5f1..8e47fcc 100644 --- a/js/options.js +++ b/js/options.js @@ -311,6 +311,9 @@ twisterOptions.prototype.initControls = function () { $('#testDesktopNotif').on('click', function() { $.MAL.showDesktopNotif(false, polyglot.t('notify_desktop_test'), false,'twister_notification_test', false, false, function() { alert(polyglot.t('notify_desktop_perm_denied', {'this_domain': document.domain})) }) }); + + tickOptionsPostPreview(); + $('#opt-mod-posts-display').find('select').on('change', tickOptionsPostPreview); }; function twisterOption(option) { @@ -362,3 +365,8 @@ function checkForNumeric(elem) { return false; } } + +function tickOptionsPostPreview() { + $('#opt-mod-posts-display #post-preview').html(htmlFormatMsg( + polyglot.t('post_preview_dummy', {logo: '/img/twister_mini.png', site: 'http://twister.net.co'}), [])); +} diff --git a/options.html b/options.html index be7a2f6..684e504 100644 --- a/options.html +++ b/options.html @@ -16,6 +16,7 @@ + @@ -263,8 +264,13 @@ -
+

Posts display

+
+

Post preview

+
+
+

Line feeds

@@ -448,6 +454,15 @@
+ + diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index 6e3933b..cab2c80 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -790,6 +790,12 @@ textarea.splited-post { background-color: #EEE; } +#opt-form-post-preview #post-preview { + width: 76%; + margin-left: 16px; + padding: 8px; +} + .splited-post-counter { color: rgba(0, 0, 0, 0.3); font-weight: bold; diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css index e0d724f..9839db7 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -2291,6 +2291,16 @@ textarea.splited-post { background-color: #EEE; } +#opt-form-post-preview { + width: 100%; +} + +#opt-form-post-preview #post-preview { + width: 76%; + margin-left: 16px; + padding: 8px; +} + /* line 384, ../sass/style.sass */ .splited-post-counter { color: rgba(0, 0, 0, 0.3); diff --git a/theme_nin/sass/style.sass b/theme_nin/sass/style.sass index 8e29cc2..14d69d8 100755 --- a/theme_nin/sass/style.sass +++ b/theme_nin/sass/style.sass @@ -368,6 +368,13 @@ ul.userMenu-search-profiles samp background-color: #EEE +#opt-form-post-preview + width: 100% + #post-preview + width: 76% + margin-left: 16px + padding: 8px + #postboard-top clear: both position: relative From fe8b59f356498fcc0d389103755fdb982cae10b1 Mon Sep 17 00:00:00 2001 From: erqan Date: Mon, 3 Aug 2015 13:03:53 +0300 Subject: [PATCH 02/12] show sent info for RTs, not for original posts use always `userpost` values. --- js/twister_formatpost.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 66141e0..605543c 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -145,7 +145,7 @@ function postToElem( post, kind, promoted ) { postData.attr('data-promoted', 1); postData.attr('data-screen-name', '!' + n); } else { - setPostInfoSent(n,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') { From e64edb9809280f19e2a496d6962f3f36db5be739 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Mon, 10 Aug 2015 02:19:08 +0500 Subject: [PATCH 03/12] add 2px left-right margin for samp --- css/style.css | 2 ++ theme_calm/css/style.css | 2 ++ theme_nin/css/style.css | 2 ++ theme_nin/sass/_postboard.sass | 2 ++ 4 files changed, 8 insertions(+) diff --git a/css/style.css b/css/style.css index f5291b9..93d9b36 100644 --- a/css/style.css +++ b/css/style.css @@ -1057,6 +1057,8 @@ ol.toptrends-list { .post-text samp { background-color: #F0EFCC; + padding-left: 2px; + padding-right: 2px; } .post-context diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index cab2c80..05107f4 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -1259,6 +1259,8 @@ textarea.splited-post { .post-text samp { background: #EEE; + padding-left: 2px; + padding-right: 2px; } .post-context diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css index 9839db7..a0895fd 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -880,6 +880,8 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, .post-text samp { background-color: #EEE; + padding-left: 2px; + padding-right: 2px; } /* line 138, ../sass/_postboard.sass */ diff --git a/theme_nin/sass/_postboard.sass b/theme_nin/sass/_postboard.sass index 8b599da..a027644 100755 --- a/theme_nin/sass/_postboard.sass +++ b/theme_nin/sass/_postboard.sass @@ -136,6 +136,8 @@ padding: 0 samp background-color: #EEE + padding-left: 2px + padding-right: 2px .post-context font-size: 11px From 252c3476000df97f03e658419970c454684f8690 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Mon, 10 Aug 2015 02:33:54 +0500 Subject: [PATCH 04/12] add .post-text class to #post-preview, cleanup it's custom CSS --- css/style.css | 8 -------- following.html | 2 +- home.html | 2 +- options.html | 2 +- theme_calm/css/style.css | 24 ++++++++---------------- theme_nin/css/style.css | 12 ------------ theme_nin/sass/style.sass | 6 ------ 7 files changed, 11 insertions(+), 45 deletions(-) diff --git a/css/style.css b/css/style.css index 93d9b36..437156f 100644 --- a/css/style.css +++ b/css/style.css @@ -657,14 +657,6 @@ textarea.splited-post { word-wrap: break-word; } -#post-preview a { - color: #E34F42; -} - -#post-preview samp { - background-color: #F0EFCC; -} - #opt-form-post-preview #post-preview { width: 76%; margin-left: 16px; diff --git a/following.html b/following.html index ab4f61e..1a5a81d 100644 --- a/following.html +++ b/following.html @@ -207,7 +207,7 @@
-
+
diff --git a/home.html b/home.html index c06955c..848137f 100644 --- a/home.html +++ b/home.html @@ -299,7 +299,7 @@
-
+
diff --git a/options.html b/options.html index 684e504..61bcb39 100644 --- a/options.html +++ b/options.html @@ -268,7 +268,7 @@

Posts display

Post preview

-
+
diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index 05107f4..3126fde 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -786,10 +786,6 @@ textarea.splited-post { word-wrap: break-word; } -#post-preview samp { - background-color: #EEE; -} - #opt-form-post-preview #post-preview { width: 76%; margin-left: 16px; @@ -1276,7 +1272,7 @@ textarea.splited-post { } /* external http links */ -.post-text a[href^="http"], #post-preview a[href^="http"] { +.post-text a[href^="http"] { font: italic 13px "Open Sans", sans-serif; text-decoration: none; color: #b46e67; @@ -1287,12 +1283,12 @@ textarea.splited-post { transition: all 200ms; } -.post-text a[href^="http"]:hover, #post-preview a[href^="http"]:hover { +.post-text a[href^="http"]:hover { color: #e18881; opacity: .8; } -.post-text a[href^="http"]:after, #post-preview a[href^="http"]:after { +.post-text a[href^="http"]:after { content: ''; display: inline-block; position: relative; @@ -1310,12 +1306,11 @@ textarea.splited-post { transition: all 200ms; } -.post-text a[href^="http"]:hover:after, #post-preview a[href^="http"]:hover:after { +.post-text a[href^="http"]:hover:after { opacity: .8; } -.post-text a[href^="#profile"], .follow-suggestions a[href^="#profile"], -#post-preview a[href^="#profile"] { +.post-text a[href^="#profile"], .follow-suggestions a[href^="#profile"] { color: #5e8da4; text-decoration: none; -webkit-transition: all 200ms; @@ -1325,8 +1320,7 @@ textarea.splited-post { transition: all 200ms; } -.post-text a[href^="#profile"]:hover, .follow-suggestions a[href^="#profile"]:hover, -#post-preview a[href^="#profile"]:hover { +.post-text a[href^="#profile"]:hover, .follow-suggestions a[href^="#profile"]:hover { color: #76b2ce; } @@ -1334,8 +1328,7 @@ textarea.splited-post { font-size: 11px; } -.toptrends-list a[href^="#hashtag"], .post-text a[href^="#hashtag"], -#post-preview a[href^="#hashtag"] { +.toptrends-list a[href^="#hashtag"], .post-text a[href^="#hashtag"] { color: #5e72a4; text-decoration: none; -webkit-transition: all 200ms; @@ -1345,8 +1338,7 @@ textarea.splited-post { transition: all 200ms; } -.toptrends-list a[href^="#hashtag"]:hover, .post-text a[href^="#hashtag"]:hover, -#post-preview a[href^="#hashtag"]:hover { +.toptrends-list a[href^="#hashtag"]:hover, .post-text a[href^="#hashtag"]:hover { color: #768fce; } diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css index a0895fd..421f199 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -2281,18 +2281,6 @@ textarea.splited-post { word-wrap: break-word; } -#post-preview a { - color: #AAA; -} - -#post-preview a:hover { - color: #B4C669; -} - -#post-preview samp { - background-color: #EEE; -} - #opt-form-post-preview { width: 100%; } diff --git a/theme_nin/sass/style.sass b/theme_nin/sass/style.sass index 14d69d8..879295e 100755 --- a/theme_nin/sass/style.sass +++ b/theme_nin/sass/style.sass @@ -361,12 +361,6 @@ ul.userMenu-search-profiles margin: 4px 0 padding: 4px word-wrap: break-word - a - color: #AAA - a:hover - color: $color-green - samp - background-color: #EEE #opt-form-post-preview width: 100% From 3f20e2094501588149fb51a09876bcc97c3a7368 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Mon, 10 Aug 2015 02:38:07 +0500 Subject: [PATCH 05/12] fix #CSS for links in ~calm~ theme --- theme_calm/css/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index 3126fde..c8298b8 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -1272,7 +1272,7 @@ textarea.splited-post { } /* external http links */ -.post-text a[href^="http"] { +.post-text a { font: italic 13px "Open Sans", sans-serif; text-decoration: none; color: #b46e67; @@ -1283,7 +1283,7 @@ textarea.splited-post { transition: all 200ms; } -.post-text a[href^="http"]:hover { +.post-text a:hover { color: #e18881; opacity: .8; } From ea144e63f93cbd8d3f97ccd978eb628b2f01b826 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Mon, 10 Aug 2015 03:02:15 +0500 Subject: [PATCH 06/12] move image preview setup to ~setPostImagePreview()~ in twister_formatpost.js and fix it slightly --- js/interface_common.js | 16 ++-------------- js/twister_formatpost.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/js/interface_common.js b/js/interface_common.js index e2ec064..c25f340 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -486,22 +486,10 @@ function postExpandFunction(e, postLi) { var originalLi = $('
  • ', {class: 'module post original'}).appendTo(itemOl) .append(originalPost); + setPostImagePreview(postExpandedContent, originalPost.find('a[rel="nofollow"]')); + postExpandedContent.slideDown('fast'); - if ($.Options.displayPreview.val === 'enable') { - var previewContainer = postExpandedContent.find('.preview-container')[0]; - /* was the preview added before... */ - if ($(previewContainer).children().length === 0) { - var link = originalPost.find('a[rel="nofollow"]'); - /*is there any link in the post?*/ - for (var i = 0; i < link.length; i++) { - if (/^[^?]+\.(?:jpe?g|gif|png)$/i.test(link[i].href)) { - var url = proxyURL(link[i].href); - $(previewContainer).append($('')); - } - } - } - } // insert 'reply_to' before requestRepliedBefore(originalLi); // insert replies to this post after diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 605543c..57dde30 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -695,3 +695,19 @@ function reverseHtmlEntities(str) { .replace(/'/g, "'") .replace(/&/g, '&'); } + +function setPostImagePreview(elem, links) { + if ($.Options.displayPreview.val === 'enable') { + var previewContainer = elem.find('.preview-container'); + // was the preview added before... + if (!previewContainer.children().length) { + // is there any links to images in the post? + for (var i = 0; i < links.length; i++) { + if (/^[^?]+\.(?:jpe?g|gif|png)$/i.test(links[i].href)) { + var url = proxyURL(links[i].href); + previewContainer.append($('')); + } + } + } + } +} From f902055293006ca982bca942a957d4c77a24b19e Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Mon, 10 Aug 2015 03:41:41 +0500 Subject: [PATCH 07/12] add image preview to #options's post preview --- js/options.js | 22 ++++++++++++++++++++-- options.html | 2 ++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/js/options.js b/js/options.js index 8e47fcc..b047087 100644 --- a/js/options.js +++ b/js/options.js @@ -288,9 +288,11 @@ twisterOptions.prototype.add = function (option) { }; twisterOptions.prototype.initControls = function () { + var elem; + for (var option in this) { if (typeof this[option] === 'object') { - var elem = $(this[option].option.selector); + elem = $(this[option].option.selector); if (elem.length) { if (elem.attr('type') && elem.attr('type').toLowerCase() === 'checkbox') elem.prop('checked', /^\s*1|true\s*$/i.test(this[option].val)) @@ -367,6 +369,22 @@ function checkForNumeric(elem) { } function tickOptionsPostPreview() { - $('#opt-mod-posts-display #post-preview').html(htmlFormatMsg( + var elem = $('#opt-mod-posts-display #post-preview'); + 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'}), [])); + + if ($.Options.displayPreview.val === 'enable') { + imgPreviewCont.empty(); + var links = elem.children().first().find('a[rel="nofollow"]'); + if (links.length) { + setPostImagePreview(elem, links); + imgPreviewCont.show(); + } else { + imgPreviewCont.hide(); + } + } else { + imgPreviewCont.hide(); + } } diff --git a/options.html b/options.html index 61bcb39..f895350 100644 --- a/options.html +++ b/options.html @@ -269,6 +269,8 @@

    Post preview

    +
    +
    From 2ae0996c2eb08f4f7438f4a1c6be28adcbd586b3 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Mon, 10 Aug 2015 03:42:34 +0500 Subject: [PATCH 08/12] fix proxy() to not proxy local URLs --- js/twister_formatpost.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 57dde30..5662cd3 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -665,7 +665,8 @@ function htmlFormatMsg(msg, mentions) { function proxyURL(url) { var proxyOpt = $.Options.useProxy.val; - if (proxyOpt !== 'disable' && !$.Options.useProxyForImgOnly.val) { + if (proxyOpt !== 'disable' && !$.Options.useProxyForImgOnly.val + && url[0] !== '/' && url.indexOf(location.origin) !== 0) { // proxy alternatives may be added to options page FIXME currently not; and we need more fresh proxies if (proxyOpt === 'ssl-proxy-my-addr') { url = 'https://ssl-proxy.my-addr.org/myaddrproxy.php/' + From 2d050681594ff41c1cda8b37aec8f7a9af66e4d6 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Mon, 10 Aug 2015 04:29:41 +0500 Subject: [PATCH 09/12] tune #CSS of image preview of #options's post preview --- css/style.css | 5 +++++ theme_calm/css/style.css | 5 +++++ theme_nin/css/style.css | 10 ++++++++++ theme_nin/sass/style.sass | 6 ++++++ 4 files changed, 26 insertions(+) diff --git a/css/style.css b/css/style.css index 437156f..a020344 100644 --- a/css/style.css +++ b/css/style.css @@ -663,6 +663,11 @@ textarea.splited-post { padding: 8px; } +#opt-form-post-preview #post-preview .preview-container { + margin-top: 8px; + margin-bottom: -10px; /* to neutralize .image-preview */ +} + .splited-post-counter { color: rgba(0, 0, 0, 0.3); font-weight: bold; diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index c8298b8..be7b82c 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -792,6 +792,11 @@ textarea.splited-post { padding: 8px; } +#opt-form-post-preview #post-preview .preview-container { + height: auto; + margin-top: 8px; +} + .splited-post-counter { color: rgba(0, 0, 0, 0.3); font-weight: bold; diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css index 421f199..3bc5cdf 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -2291,6 +2291,16 @@ textarea.splited-post { padding: 8px; } +#opt-form-post-preview #post-preview .preview-container { + background-color: rgba(0, 0, 0, 0.43); + width: 97%; + margin-top: 8px; +} + +#opt-form-post-preview #post-preview .image-preview { + width: auto; +} + /* line 384, ../sass/style.sass */ .splited-post-counter { color: rgba(0, 0, 0, 0.3); diff --git a/theme_nin/sass/style.sass b/theme_nin/sass/style.sass index 879295e..19c6d27 100755 --- a/theme_nin/sass/style.sass +++ b/theme_nin/sass/style.sass @@ -368,6 +368,12 @@ ul.userMenu-search-profiles width: 76% margin-left: 16px padding: 8px + .preview-container + background-color: rgba(0, 0, 0, 0.43) + width: 97% + margin-top: 8px + .image-preview + width: auto #postboard-top clear: both From 4d11c5f5c6701c658327203b971916c8759b0939 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Mon, 10 Aug 2015 04:31:15 +0500 Subject: [PATCH 10/12] fix image preview in ~calm~ theme --- theme_calm/css/style.css | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index be7b82c..7505ef0 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -1362,27 +1362,23 @@ textarea.splited-post { } /* Inpost previw */ -.preview-container -{ - height: 100px; +.preview-container { width: 95%; - margin: 0 auto; - overflow: hidden; - display: none; - -webkit-border-radius: 10px; - -moz-border-radius: 10px; - border-radius: 10px; - /*line-height: 0;*/ + text-align: center; + overflow-y: auto; margin-bottom: 3px; - position: relative; } -.image-preview -{ + +.image-preview { max-height: 500px; max-width: 100%; margin: 0 auto; display: block; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; } + /* video preview */ .vimeo #imgOverlay { From 5e93f5263b9fd07872e8186a429c1546d88d78f8 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Mon, 10 Aug 2015 06:39:51 +0500 Subject: [PATCH 11/12] fix of #markdown chars position data collecting --- js/twister_formatpost.js | 88 ++++++++++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 26 deletions(-) diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 5662cd3..eafef64 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -273,6 +273,66 @@ function htmlFormatMsg(msg, mentions) { return false; } + function kindOfL(i) { + if (stopCharsMarkout.indexOf(msg.str[i]) > -1) { + for (var j = i - 1; j > -1; j--) { + if (msg.str[j] === chr) { + return -1; + } else if (stopCharsMarkout.indexOf(msg.str[j]) === -1) { + return whiteSpaces.indexOf(msg.str[j]); + } + } + } else if (msg.str[i] === '<') { + for (var j = i - 1; j > -1; j--) { + if (msg.str[j] === '>') { + if (j === 0) { + return -1; + } else { + if (msg.str[j - 1] === chr) { + return -1; + } else { + return kindOfL(j - 1); + } + } + } + } + } else { + return whiteSpaces.indexOf(msg.str[i]); + } + + return 0; + } + + function kindOfR(i) { + if (stopCharsMarkout.indexOf(msg.str[i]) > -1) { + for (var j = i + 1; j < msg.str.length; j++) { + if (msg.str[j] === chr) { + return -1; + } else if (stopCharsMarkout.indexOf(msg.str[j]) === -1) { + return whiteSpaces.indexOf(msg.str[j]); + } + } + } else if (msg.str[i] === '>') { + for (var j = i + 1; j < msg.str.length; j++) { + if (msg.str[j] === '<') { + if (j === msg.str.length - 1) { + return -1; + } else { + if (msg.str[j + 1] === chr) { + return -1; + } else { + return kindOfR(j + 1); + } + } + } + } + } else { + return whiteSpaces.indexOf(msg.str[i]); + } + + return 0; + } + var i, j, t, l, r, htmlEntityEncoded; var w = false; var p = []; @@ -291,32 +351,8 @@ function htmlFormatMsg(msg, mentions) { p.push({i: i, k: j - i, t: 1, w: w, a: -1, p: -1}); w = false; } else { - if (stopCharsMarkout.indexOf(msg.str[i - 1]) > -1) { - l = 1; - for (t = i - 2; t > -1; t--) { - if (msg.str[t] === chr) { - l = -1; - break; - } else if (stopCharsMarkout.indexOf(msg.str[t]) === -1) { - l = whiteSpaces.indexOf(msg.str[t]); - break; - } - } - } else - l = whiteSpaces.indexOf(msg.str[i - 1]); - if (stopCharsMarkout.indexOf(msg.str[j]) > -1) { - r = 1; - for (t = j + 1; t < msg.str.length; t++) { - if (msg.str[t] === chr) { - r = -1; - break; - } else if (stopCharsMarkout.indexOf(msg.str[t]) === -1) { - r = whiteSpaces.indexOf(msg.str[t]); - break; - } - } - } else - r = whiteSpaces.indexOf(msg.str[j]); + l = kindOfL(i - 1); + r = kindOfR(j); if (l > -1) { if (r > -1) { if (j - i > 2) { From dbd49d41830075ee56fbb858a73273c2107166d8 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Mon, 10 Aug 2015 07:03:25 +0500 Subject: [PATCH 12/12] yet another fix of #markdown chars position data collecting --- js/twister_formatpost.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index eafef64..52adcad 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -286,7 +286,7 @@ function htmlFormatMsg(msg, mentions) { for (var j = i - 1; j > -1; j--) { if (msg.str[j] === '>') { if (j === 0) { - return -1; + return -10; } else { if (msg.str[j - 1] === chr) { return -1; @@ -316,7 +316,7 @@ function htmlFormatMsg(msg, mentions) { for (var j = i + 1; j < msg.str.length; j++) { if (msg.str[j] === '<') { if (j === msg.str.length - 1) { - return -1; + return -10; } else { if (msg.str[j + 1] === chr) { return -1; @@ -344,15 +344,20 @@ function htmlFormatMsg(msg, mentions) { if (msg.str[j] !== chr) break; } - if (i === 0) { + + if (i !== 0) { + l = kindOfL(i - 1); + } + if (j !== msg.str.length) { + r = kindOfR(j); + } + if (i === 0 || l === -10) { p.push({i: i, k: j - i, t: -1, w: w, a: -1, p: -1}); w = false; - } else if (j === msg.str.length) { + } else if (j === msg.str.length || r === -10) { p.push({i: i, k: j - i, t: 1, w: w, a: -1, p: -1}); w = false; } else { - l = kindOfL(i - 1); - r = kindOfR(j); if (l > -1) { if (r > -1) { if (j - i > 2) {