Add: notification filter by user (for head)

This commit is contained in:
Cutls
2019-05-22 00:00:54 +09:00
parent 990c2f796e
commit 43bac6f3e6
7 changed files with 47 additions and 24 deletions

View File

@@ -386,45 +386,33 @@ function filterUpdateInternal(json, type) {
*/
//通知フィルター
function exclude(key) {
var excludetxt = "";
var excludetxt = localStorage.getItem("exclude-" + key);
if ($('#exc-reply-' + key + ':checked').val()) {
excludetxt = "?exclude_types[]=mention"
var reply = true
} else {
var reply = false;
}
if ($('#exc-fav-' + key + ':checked').val()) {
if (reply) {
if (!excludetxt || excludetxt !="") {
excludetxt = excludetxt + "&exclude_types[]=favourite"
} else {
excludetxt = "?exclude_types[]=favourite"
}
var fav = true
} else {
var fav = false;
}
if ($('#exc-bt-' + key + ':checked').val()) {
if (reply || fav) {
if (!excludetxt || excludetxt !="") {
excludetxt = excludetxt + "&exclude_types[]=reblog"
} else {
excludetxt = "?exclude_types[]=reblog"
}
var bt = true
} else {
var bt = false;
}
if ($('#exc-follow-' + key + ':checked').val()) {
if (reply || bt || fav) {
if (!excludetxt || excludetxt !="") {
excludetxt = excludetxt + "&exclude_types[]=follow"
} else {
excludetxt = "?exclude_types[]=follow"
}
var follow = true;
} else {
var follow = false;
}
if ($('#exc-poll-' + key + ':checked').val()) {
if (reply || bt || fav || follow) {
if (!excludetxt || excludetxt !="") {
excludetxt = excludetxt + "&exclude_types[]=poll"
} else {
excludetxt = "?exclude_types[]=poll"
@@ -444,4 +432,26 @@ function excludeCk(key, target) {
} else {
return "";
}
}
function checkNotfFilter(tlid){
var excludetxt = localStorage.getItem("exclude-" + tlid);
if(!excludetxt || excludetxt != ""){
return true;
}else{
return false;
}
}
function resetNotfFilter(tlid){
localStorage.setItem("exclude-" + tlid, "")
parseColumn();
}
function notfFilter(id,tlid){
var excludetxt = localStorage.getItem("exclude-" + tlid);
if (!excludetxt || excludetxt !="") {
excludetxt = excludetxt + "&account_id="+id
} else {
excludetxt = "?account_id="+id
}
localStorage.setItem("exclude-" + tlid, excludetxt)
parseColumn();
}

View File

@@ -79,15 +79,15 @@ function notfColumn(acct_id, tlid, sys) {
}
if (obj.type != "follow") {
if (misskey) {
templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute);
templete = templete + misskeyParse([obj], 'notf', acct_id, tlid, -1, mute);
} else {
templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute);
templete = templete + parse([obj], 'notf', acct_id, tlid, -1, mute);
}
} else {
if (misskey) {
templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute);
templete = templete + misskeyUserparse([obj], 'notf', acct_id, tlid, -1, mute);
} else {
templete = templete + userparse([obj.account], 'notf', acct_id, 'notf', -1);
templete = templete + userparse([obj.account], 'notf', acct_id, tlid, -1);
}
}

View File

@@ -235,7 +235,8 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
var what = lang.lang_parse_polled;
var icon = "fa-tasks purple-text";
}
var noticetext = '<span class="cbadge cbadge-hover"title="' + date(toot.created_at,
var noticetext = '<i class="fas fa-filter pointer big-text" onclick="notfFilter(\'' + toot.account.id +
'\',\'' + tlid + '\');" title="' + lang.lang_parse_notffilter + '"></i><span class="cbadge cbadge-hover"title="' + date(toot.created_at,
'absolute') + '(' + lang.lang_parse_notftime + ')"><i class="far fa-clock"></i>' + date(toot.created_at,
datetype) +
'</span><i class="big-text fas ' + icon + '"></i><a onclick="udg(\'' + toot.account.id +