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

@ -195,6 +195,7 @@ var lang = {
"lang_parse_thread": "Show thread",
"lang_parse_unknown": "Attached file",
"lang_parse_nsfw": "NSFW media",
"lang_parse_notffilter":"Show this user's notifications",
//misskey
"lang_misskeyparse_renote": "Repost",
"lang_misskeyparse_renoteqt": "Renote",

View File

@ -197,6 +197,7 @@ var lang = {
"lang_parse_thread": "会話を表示",
"lang_parse_unknown": "添付ファイル",
"lang_parse_nsfw": "閲覧注意",
"lang_parse_notffilter":"このユーザーの通知のみを表示",
//misskey
"lang_misskeyparse_renote": "再投稿",
"lang_misskeyparse_renoteqt": "引用",

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 +

View File

@ -169,7 +169,11 @@ function parseColumn(dontclose) {
'<input type="checkbox" class="filled-in" id="exc-bt-' + key + '" ' + excludeCk(key, "reblog") + ' /><label for="exc-bt-' + key + '" class="exc-chb" ><i class="fas fa-retweet exc-icons"></i></label> ' +
'<input type="checkbox" class="filled-in" id="exc-follow-' + key + '" ' + excludeCk(key, "follow") + ' /><label for="exc-follow-' + key + '" class="exc-chb" ><i class="fas fa-users exc-icons"></i></label> ' +
'<input type="checkbox" class="filled-in" id="exc-poll-' + key + '" ' + excludeCk(key, "poll") + ' /><label for="exc-poll-' + key + '" class="exc-chb" ><i class="fas fa-tasks exc-icons"></i></label> ' +
'<button class="btn waves-effect" style="width:60px; padding:0;" onclick="exclude(' + key + ')">Filter</button><br>';
'<button class="btn waves-effect" style="width:60px; padding:0;" onclick="exclude(' + key + ')">Filter</button>';
if(checkNotfFilter(key)){
exclude=exclude+'<button class="btn red waves-effect" style="width:60px; padding:0;" onclick="resetNotfFilter(' + key + ')">Clear all</button>'
}
exclude=exclude+"<br>";
} else if (acct.type == "home") {
var exclude = '<a onclick="ebtToggle(' + key +
')" class="setting nex"><i class="fas fa-retweet waves-effect nex" title="' + lang.lang_layout_excludingbt + '" style="font-size:24px"></i><span id="sta-bt-' +

View File

@ -681,7 +681,13 @@
Pixiv Fanboxでは支援者様限定で様々なTheDeskに関する記事をご覧いただけます。最低月一更新。<br>
困ったときは、<a href="https://docs.thedesk.top">TheDesk Docs</a>をご覧ください。
<h5>Release Note Usamin (18.4.1)</h5>
<br>
・macOSでのアップデータについて修正。<br>
・本来不要なところにフォロリク許可画面が出るようになっていたのを修正。<br>
・不明なメディアに対するリンクを表示します。<br>
・PleromaでのVideoの挙動について修正しました。<br>
・Patreonでの支援を開始しました<br>
・アスタルテの新しいBBCodeに対応しました<br>
・Electron 5.0.1になりました<br>
<br>
<h5>ThinkingDeskラベル</h5>
<img src="../../img/thinkingdesk.png" style="width:100px;" draggable="false"><br>