mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-03-12 05:21:18 +00:00
hiding options for the posts those begin with a mention
This commit is contained in:
parent
415572ac5f
commit
3c6b307ede
@ -211,7 +211,12 @@ if(preferredLanguage == "en"){
|
|||||||
"Split only new post": "Split only new post",
|
"Split only new post": "Split only new post",
|
||||||
"Split all": "Split all",
|
"Split all": "Split all",
|
||||||
"Don't split": "Don't split",
|
"Don't split": "Don't split",
|
||||||
"Split long posts": "Split long posts"
|
"Split long posts": "Split long posts",
|
||||||
|
"Posts that begin with mention": "Posts that begin with mention",
|
||||||
|
"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"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if(preferredLanguage == "es"){
|
if(preferredLanguage == "es"){
|
||||||
@ -1822,7 +1827,12 @@ if(preferredLanguage == "tr"){
|
|||||||
"Split only new post": "Sadece yeni postaları böl",
|
"Split only new post": "Sadece yeni postaları böl",
|
||||||
"Split all": "Hepsini böl",
|
"Split all": "Hepsini böl",
|
||||||
"Don't split": "Bölme",
|
"Don't split": "Bölme",
|
||||||
"Split long posts": "Uzun gönderileri böl"
|
"Split long posts": "Uzun gönderileri böl",
|
||||||
|
"Posts that begin with mention": "Bahsettiği kullanıcının adıyla başlayan gönderiler",
|
||||||
|
"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"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ var TwisterOptions = function()
|
|||||||
return $.Options.getOption('splitPosts', 'disable');
|
return $.Options.getOption('splitPosts', 'disable');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setSplitPostsOpt = function (){
|
this.setSplitPostsOpt = function () {
|
||||||
$('#splitPosts')[0].value = this.getSplitPostsOpt();
|
$('#splitPosts')[0].value = this.getSplitPostsOpt();
|
||||||
|
|
||||||
if (this.getSplitPostsOpt() === 'enable')
|
if (this.getSplitPostsOpt() === 'enable')
|
||||||
@ -255,7 +255,7 @@ var TwisterOptions = function()
|
|||||||
else
|
else
|
||||||
$("#splitPostWarning")[0].style.display = "none";
|
$("#splitPostWarning")[0].style.display = "none";
|
||||||
|
|
||||||
$('#splitPosts').on('change', function (){
|
$('#splitPosts').on('change', function () {
|
||||||
$.Options.setOption(this.id, this.value);
|
$.Options.setOption(this.id, this.value);
|
||||||
|
|
||||||
if (this.value === 'enable')
|
if (this.value === 'enable')
|
||||||
@ -265,6 +265,18 @@ var TwisterOptions = function()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.getHideRepliesOpt = function () {
|
||||||
|
return $.Options.getOption('hideReplies', 'following');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setHideRepliesOpt = function () {
|
||||||
|
$('#hideReplies')[0].value = this.getHideRepliesOpt();
|
||||||
|
|
||||||
|
$('#hideReplies').on('change', function () {
|
||||||
|
$.Options.setOption(this.id, this.value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.InitOptions = function() {
|
this.InitOptions = function() {
|
||||||
this.soundNotifOptions();
|
this.soundNotifOptions();
|
||||||
this.volumeControl();
|
this.volumeControl();
|
||||||
@ -281,6 +293,7 @@ var TwisterOptions = function()
|
|||||||
this.setUseProxyOpt();
|
this.setUseProxyOpt();
|
||||||
this.setUseProxyForImgOnlyOpt();
|
this.setUseProxyForImgOnlyOpt();
|
||||||
this.setSplitPostsOpt();
|
this.setSplitPostsOpt();
|
||||||
|
this.setHideRepliesOpt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,8 +140,15 @@ function requestGetposts(req)
|
|||||||
// request if needed
|
// request if needed
|
||||||
function processReceivedPosts(req, posts)
|
function processReceivedPosts(req, posts)
|
||||||
{
|
{
|
||||||
|
//hiding posts can cause empty postboard, so we have to track the count...
|
||||||
|
var p2a = posts.length;
|
||||||
for( var i = 0; i < posts.length; i++ ) {
|
for( var i = 0; i < posts.length; i++ ) {
|
||||||
var post = posts[i];
|
var post = posts[i];
|
||||||
|
if (willBeHiden(post)) {
|
||||||
|
p2a--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var streamPost = postToElem(post, "original");
|
var streamPost = postToElem(post, "original");
|
||||||
var timePost = post["userpost"]["time"];
|
var timePost = post["userpost"]["time"];
|
||||||
streamPost.attr("data-time",timePost);
|
streamPost.attr("data-time",timePost);
|
||||||
@ -192,11 +199,15 @@ function processReceivedPosts(req, posts)
|
|||||||
}
|
}
|
||||||
req.doneReportProcessing(posts.length);
|
req.doneReportProcessing(posts.length);
|
||||||
|
|
||||||
if( req.mode == "done" ) {
|
//if the count of posts less then 5....
|
||||||
|
if( req.mode == "done" && p2a > 5) {
|
||||||
timelineLoaded = true;
|
timelineLoaded = true;
|
||||||
$.MAL.postboardLoaded();
|
$.MAL.postboardLoaded();
|
||||||
_refreshInProgress = false;
|
_refreshInProgress = false;
|
||||||
} else {
|
} else {
|
||||||
|
//we will request more older post...
|
||||||
|
req.count += postsPerRefresh;
|
||||||
|
req.mode = 'older';
|
||||||
requestGetposts(req);
|
requestGetposts(req);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,7 +277,15 @@ function processLastHave(userHaves)
|
|||||||
// callback for getposts to update the number of new pending posts not shown in timeline
|
// callback for getposts to update the number of new pending posts not shown in timeline
|
||||||
function processNewPostsConfirmation(expected, posts)
|
function processNewPostsConfirmation(expected, posts)
|
||||||
{
|
{
|
||||||
_newPostsPending += posts.length;
|
//we don't want to produce alert for the posts that won't be displayed
|
||||||
|
var p2h = 0;
|
||||||
|
for( var i = posts.length-1; i >= 0; i-- ) {
|
||||||
|
if (willBeHiden(posts[i])) {
|
||||||
|
//posts.splice(i, 1);
|
||||||
|
p2h++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_newPostsPending += posts.length - p2h;
|
||||||
if( _newPostsPending ) {
|
if( _newPostsPending ) {
|
||||||
$.MAL.reportNewPosts(_newPostsPending);
|
$.MAL.reportNewPosts(_newPostsPending);
|
||||||
}
|
}
|
||||||
@ -288,3 +307,20 @@ function timelineChangedUser()
|
|||||||
_newPostsPending = 0;
|
_newPostsPending = 0;
|
||||||
timelineLoaded = false;
|
timelineLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function willBeHiden(post){
|
||||||
|
var msg = post['userpost']['msg'];
|
||||||
|
if (post['userpost']['n'] !== defaultScreenName &&
|
||||||
|
$.Options.getHideRepliesOpt() !== 'disable' &&
|
||||||
|
/^\@/.test(msg) &&
|
||||||
|
!(new RegExp('@' + defaultScreenName + '( |,|;|\\.|:|\\/|\\?|\\!|\\\\|\'|"|\\n|$)').test(msg)))
|
||||||
|
{
|
||||||
|
if ($.Options.getHideRepliesOpt() === 'only-me' ||
|
||||||
|
($.Options.getHideRepliesOpt() === 'following' &&
|
||||||
|
followingUsers.indexOf(msg.substring(1, msg.search(/ |,|;|\.|:|\/|\?|\!|\\|'|"|\n/))) === -1 ))
|
||||||
|
{
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
17
options.html
17
options.html
@ -136,6 +136,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="postboard-display">
|
||||||
|
<div class="module">
|
||||||
|
<p class="label"> Postboard displays </p>
|
||||||
|
<br/>
|
||||||
|
<div>
|
||||||
|
<form action="" id="hideRepliesOpt">
|
||||||
|
<p class="label">Posts that begin with mention</p>
|
||||||
|
<select name="" id="hideReplies">
|
||||||
|
<option value="disable">Show all</option>
|
||||||
|
<option value="only-me">Show only if I am in</option>
|
||||||
|
<option value="following">Show if it's between users I follow</option>
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="posts-display">
|
<div class="posts-display">
|
||||||
<div class="module">
|
<div class="module">
|
||||||
<p class="label"> Posts display </p>
|
<p class="label"> Posts display </p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user