Add: anouncement read counter

This commit is contained in:
cutls 2020-01-29 23:22:53 +09:00
parent b821724e59
commit b24d937152
7 changed files with 22 additions and 4 deletions

View File

@ -79,7 +79,7 @@ function announParse(obj, acct_id, tlid) {
template = template =
template + template +
`<div class="announcement"> `<div class="announcement" data-id="${toot.id}">
${content} ${content}
<div class="reactionsPack"> <div class="reactionsPack">
${reactions} ${reactions}

View File

@ -406,6 +406,11 @@ function notfCanceler(acct) {
localStorage.removeItem('notf-follow_' + acct) localStorage.removeItem('notf-follow_' + acct)
$('.notf-follow_' + acct).addClass('hide') $('.notf-follow_' + acct).addClass('hide')
$('.notf-icon_' + acct).removeClass('red-text') $('.notf-icon_' + acct).removeClass('red-text')
var id = $('#announce_' + acct + ' .announcement').first().attr('data-id')
$('.notf-announ_' + acct + '_ct').text("")
if(id) {
localStorage.setItem('announ_' + acct, id)
}
} }
function allNotfRead() { function allNotfRead() {
var multi = localStorage.getItem('multi') var multi = localStorage.getItem('multi')

View File

@ -1191,7 +1191,16 @@ function announ(acct_id, tlid) {
} }
if (json.length > 0) { if (json.length > 0) {
$('.notf-announ_' + acct_id).removeClass('hide') $('.notf-announ_' + acct_id).removeClass('hide')
$('.notf-announ_' + acct_id + '_ct').text(json.length) var ct = 0
for (var i = 0; i < json.length; i++) {
if (localStorage.getItem('announ_' + acct_id) == json[i].id) {
break
}
ct++
}
if(ct > 0) {
$('.notf-announ_' + acct_id + '_ct').text(ct)
}
} else { } else {
$('.notf-announ_' + acct_id).addClass('hide') $('.notf-announ_' + acct_id).addClass('hide')
} }

View File

@ -368,9 +368,10 @@ function parseColumn(target, dontclose) {
title="${unique_notf}" ${icnsert}> title="${unique_notf}" ${icnsert}>
<i class="material-icons waves-effect nex notf-icon_${acct.domain}">notifications</i> <i class="material-icons waves-effect nex notf-icon_${acct.domain}">notifications</i>
</a> </a>
<span class="cbadge hide notf-announ_${acct.domain}" style="margin-right:0" onclick="notfToggle('${acct.domain}','${key}')"> <span class="cbadge hide notf-announ_${acct.domain}" style="margin-right:0"
onclick="notfToggle('${acct.domain}','${key}')" title="${lang.lang_layout_announ}">
<i class="fas fa-bullhorn"></i> <i class="fas fa-bullhorn"></i>
<span class="notf-announ_${acct.domain}_ct">0</span> <span class="notf-announ_${acct.domain}_ct"></span>
</span> </span>
${if_tag_btn} ${if_tag_btn}
</div> </div>

View File

@ -139,6 +139,7 @@
"lang_layout_deleteColumnDesc": "Delete this column", "lang_layout_deleteColumnDesc": "Delete this column",
"lang_layout_unread": "Unread", "lang_layout_unread": "Unread",
"lang_layout_tagManager": "Tag timeline manager", "lang_layout_tagManager": "Tag timeline manager",
"lang_layout_announ": "Announcement: the counter is the number of your unread announcements. If not shown, it means announcements are all marked as read.",
"lang_sort_gothis": "Go to this column", "lang_sort_gothis": "Go to this column",
"lang_sort_remthis": "Delete this column", "lang_sort_remthis": "Delete this column",
"lang_spotify_img": "Attach an album artwork", "lang_spotify_img": "Attach an album artwork",

View File

@ -138,6 +138,7 @@
"lang_layout_deleteColumnDesc": "カラムを削除してええ?", "lang_layout_deleteColumnDesc": "カラムを削除してええ?",
"lang_layout_unread": "未読", "lang_layout_unread": "未読",
"lang_layout_tagManager": "タグタイムラインをいじる", "lang_layout_tagManager": "タグタイムラインをいじる",
"lang_layout_announ": "お知らせ: 数字は未読数や。表示されてんときはもう読んでしもたいうことやな。",
"lang_sort_gothis": "このカラムへ", "lang_sort_gothis": "このカラムへ",
"lang_sort_remthis": "このカラムを消す", "lang_sort_remthis": "このカラムを消す",
"lang_spotify_img": "アルバムアートワークを付けるで。", "lang_spotify_img": "アルバムアートワークを付けるで。",

View File

@ -139,6 +139,7 @@
"lang_layout_deleteColumnDesc": "カラムを削除しますか?", "lang_layout_deleteColumnDesc": "カラムを削除しますか?",
"lang_layout_unread": "未読", "lang_layout_unread": "未読",
"lang_layout_tagManager": "タグタイムラインの編集", "lang_layout_tagManager": "タグタイムラインの編集",
"lang_layout_announ": "お知らせ: 数字は未読数を表します。表示されていない場合は全て既読です。",
"lang_sort_gothis": "このカラムへ", "lang_sort_gothis": "このカラムへ",
"lang_sort_remthis": "このカラムを削除", "lang_sort_remthis": "このカラムを削除",
"lang_spotify_img": "アルバムアートワークを添付します。", "lang_spotify_img": "アルバムアートワークを添付します。",