From 91a2fdec186cf5bc5b8b0430a3933dbde5ad8aed Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Sat, 28 Mar 2015 10:22:56 +0500 Subject: [PATCH] fix for showing of promoted posts, zh localizaion of notifications, replacement of couldnt_find_any_posts string by common slider --- css/style.css | 2 +- home.html | 4 +++- js/interface_localization.js | 14 +++++++------- js/twister_actions.js | 8 +++----- js/twister_timeline.js | 6 +++++- theme_calm/css/style.css | 2 +- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/css/style.css b/css/style.css index 1fa1444..6fd0162 100644 --- a/css/style.css +++ b/css/style.css @@ -1741,7 +1741,7 @@ ol.toptrends-list { .postboard-loading { - text-align: right; + text-align: center; } .postboard-loading div { diff --git a/home.html b/home.html index ae4b799..9d86413 100644 --- a/home.html +++ b/home.html @@ -496,10 +496,12 @@ -
+ diff --git a/js/interface_localization.js b/js/interface_localization.js index c17c4ed..16620fe 100644 --- a/js/interface_localization.js +++ b/js/interface_localization.js @@ -896,19 +896,19 @@ if(preferredLanguage == "zh"){ "Network status": "网络状态", "New direct message...": "新的即时信息...", "New Post...": "新推文...", - "You got": "You got", + "You got": "你收到", "in postboard": "在时间线里", "in search result": "在搜索结果里", "in top trends": "在热词趋势里", "new_posts": "%{smart_count} 新推文", - "new_mentions": "%{smart_count} new mention |||| %{smart_count} new mentions", - "new_direct_messages": "%{smart_count} new direct message |||| %{smart_count} new direct messages", + "new_mentions": "%{smart_count} 新的提及 |||| %{smart_count} 新的提及", + "new_direct_messages": "%{smart_count} 新私信 |||| %{smart_count} 新私信", "nobody": "nobody", // used to promote a post without attaching the user "Not available": "用户名不可用", // username is not available - "notify_desktop_error": "Twister cannot perform desktop notification: unknown error occured.", - "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!", + "notify_desktop_error": "Twister 无法发出桌面提醒: 发生未知错误.", + "notify_desktop_perm_denied": "Twister 无法发出桌面提醒: 权限被拒绝.\n\n如果你想收到提醒, 在你的浏览器设置中允许 %{this_domain} 发出提醒.", + "notify_desktop_test": "我们都用 Twister.\n欢迎你加入.", + "notify_desktop_title": "注意, twister 在这!", "Number of blocks in block chain:": "块链中的块数:", "Number of CPUs to use": "使用CPU数目 ", "Only alphanumeric and underscore allowed.": "只允许字母和下划线", diff --git a/js/twister_actions.js b/js/twister_actions.js index 488e40c..ac3e8bb 100644 --- a/js/twister_actions.js +++ b/js/twister_actions.js @@ -291,7 +291,7 @@ function updateProfileData(profileModalContent, username) { profileModalContent.find(".following-count").parent().attr("href", $.MAL.followingUrl(username)); var postsView = profileModalContent.find(".postboard-posts"); - + // try using getposts first. fallback to dht. twisterRpc("getposts", [1,[{username: username}]], function(args, posts) { @@ -326,6 +326,7 @@ function clearHashtagProcessed() { } function requestHashtag(postboard,hashtag,resource, timeoutArgs) { + postboard.closest("div").find(".postboard-loading").show(); dhtget( hashtag, resource, "m", function(args, data) { processHashtag(args.postboard, args.hashtag, data); @@ -360,9 +361,6 @@ function processHashtag(postboard, hashtag, data) { _hashtagPendingPostsUpdated++; } } - - if(!postboard.children().length && !_hashtagPendingPosts.length && hashtag != defaultScreenName) - postboard.closest("div").find(".no-posts-found-message").show(); if( _hashtagPendingPosts.length ) { if( !postboard.children().length || autoUpdateHashtag ) { @@ -371,8 +369,8 @@ function processHashtag(postboard, hashtag, data) { var newTweetsBar = postboard.closest("div").find(".postboard-news"); newTweetsBar.text(polyglot.t("new_posts", _hashtagPendingPosts.length)); newTweetsBar.fadeIn("slow"); + postboard.closest("div").find(".postboard-loading").hide(); } - postboard.closest("div").find(".no-posts-found-message").hide(); } } } diff --git a/js/twister_timeline.js b/js/twister_timeline.js index 7e18b78..fa928c5 100644 --- a/js/twister_timeline.js +++ b/js/twister_timeline.js @@ -189,7 +189,7 @@ function showPosts(req, posts) var streamItemsParent = $.MAL.getStreamPostsParent(); for( var i = 0; i < posts.length; i++ ) { - if ( req.users.indexOf(posts[i]['userpost']['n']) > -1 ) { + if (req.users.indexOf(posts[i]['userpost']['n']) > -1 || req.getspam) { // FIXME maybe it's unecessary check but currently we got unwanted adverting posts which are coming with requested ones from 'getposts' sometimes var post = posts[i]; //console.log(post); var streamPost = postToElem(post, "original", req.getspam); @@ -349,6 +349,10 @@ function willBeHidden(post){ if (post['userpost']['n'] === defaultScreenName) return false; + // currently we don't need to filter promoted posts anyhow + if (typeof(post['userpost']['lastk']) === 'undefined' ) + return false; + if (typeof(post['userpost']['rt']) !== 'undefined') { // hope it is not too egocentric to overcome HideCloseRTsOpt this way if (post['userpost']['rt']['n'] === defaultScreenName) diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index f6c625b..9cf3225 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -2159,7 +2159,7 @@ textarea.splited-post { .postboard-loading { - text-align: right; + text-align: center; } .postboard-loading div {