diff --git a/js/interface_localization.js b/js/interface_localization.js index f379811..3c9ee55 100644 --- a/js/interface_localization.js +++ b/js/interface_localization.js @@ -216,7 +216,11 @@ if(preferredLanguage == "en"){ "Show all": "Show all", "Show only if I am in": "Show only if I am in", "Show if it's between users I follow": "Show if it's between users I follow", - "Postboard displays": "Postboard displays" + "Postboard displays": "Postboard displays", + "RTs those are close to original twist": "RTs those are close to original twist", + "Show if the original is older than": "Show if the original is older than", + "hour(s)": "hour(s)", + "only numbers are allowed!": "only numbers are allowed!" }; } if(preferredLanguage == "es"){ @@ -1832,7 +1836,11 @@ if(preferredLanguage == "tr"){ "Show all": "Hepsini göster", "Show only if I am in": "Sadece ben içindeysem göster", "Show if it's between users I follow": "Takip ettiğim kullanıcılar arasında ise göster", - "Postboard displays": "Zaman çizelgesinde" + "Postboard displays": "Zaman çizelgesinde", + "RTs those are close to original twist": "Orjinal twist'e yakın olan RTler", + "Show if the original is older than": "Orjinali yandaki süreden daha eskiyse göster", + "hour(s)": "saat", + "only numbers are allowed!": "sadece rakam girilebilir!" }; } diff --git a/js/options.js b/js/options.js index 1410d17..72aa037 100644 --- a/js/options.js +++ b/js/options.js @@ -277,6 +277,49 @@ var TwisterOptions = function() }); } + this.getHideCloseRTsOpt = function () { + return $.Options.getOption('hideCloseRTs', 'disable'); + }; + + this.setHideCloseRTsOpt = function () { + $('#hideCloseRTs')[0].value = this.getHideCloseRTsOpt(); + + if (this.getHideCloseRTsOpt() === 'disable') { + $('#hideCloseRTsDesc')[0].style.display = 'none'; + } else { + $('#hideCloseRTsDesc')[0].style.display = 'inline'; + } + + $('#hideCloseRTs').on('change', function () { + $.Options.setOption(this.id, this.value); + + if (this.value === 'disable') { + $('#hideCloseRTsDesc')[0].style.display = 'none'; + } else { + $('#hideCloseRTsDesc')[0].style.display = 'inline'; + } + }); + }; + + this.getHideCloseRTsHourOpt = function () { + return parseInt($.Options.getOption('hideCloseRtsHour', '1')); + }; + + this.setHideCloseRTsHourOpt = function () { + $('#hideCloseRtsHour')[0].value = this.getHideCloseRTsHourOpt().toString(); + + $('#hideCloseRtsHour').on('keyup', function () { + if (/^\d+$/.test(this.value)) { + this.style.backgroundColor = ''; + $.Options.setOption(this.id, this.value); + $(this).next('span').text(polyglot.t('hour(s)')); + } else { + this.style.backgroundColor = '#f00'; + $(this).next('span').text(polyglot.t('only numbers are allowed!')); + } + }); + }; + this.InitOptions = function() { this.soundNotifOptions(); this.volumeControl(); @@ -294,6 +337,8 @@ var TwisterOptions = function() this.setUseProxyForImgOnlyOpt(); this.setSplitPostsOpt(); this.setHideRepliesOpt(); + this.setHideCloseRTsHourOpt(); + this.setHideCloseRTsOpt(); } } diff --git a/js/twister_timeline.js b/js/twister_timeline.js index 6b8f710..67db343 100644 --- a/js/twister_timeline.js +++ b/js/twister_timeline.js @@ -319,8 +319,17 @@ function willBeHiden(post){ ($.Options.getHideRepliesOpt() === 'following' && followingUsers.indexOf(msg.substring(1, msg.search(/ |,|;|\.|:|\/|\?|\!|\\|'|"|\n/))) === -1 )) { - return true + return true; } } + + if (typeof(post['userpost']['rt']) !== 'undefined' && + $.Options.getHideCloseRTsOpt() != 'disable' && + followingUsers.indexOf(post['userpost']['rt']['n']) > -1 && + parseInt(post['userpost']['time']) - parseInt(post['userpost']['rt']['time']) < $.Options.getHideCloseRTsHourOpt() * 3600) + { + return true; + } + return false; } \ No newline at end of file diff --git a/options.html b/options.html index 8da9846..c354289 100644 --- a/options.html +++ b/options.html @@ -150,6 +150,19 @@ +
+
+
+

RTs those are close to original twist

+ +
+ hour(s) +
+
+