|
|
@@ -16,6 +16,12 @@ export function initNotificationsTable() { |
|
|
|
|
|
|
|
return false; |
|
|
|
}); |
|
|
|
const notificationDiv= $('#notice-container-json'); |
|
|
|
if (!notificationDiv.length) { |
|
|
|
return; |
|
|
|
} else { |
|
|
|
getNotice() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export function initNotificationCount() { |
|
|
@@ -139,6 +145,44 @@ export function initNotificationCount() { |
|
|
|
|
|
|
|
fn(NotificationSettings.MinTimeout, notificationCount.text()); |
|
|
|
} |
|
|
|
function getNotice() { |
|
|
|
$('.notice-container .ui.dimmer').css('display','block') |
|
|
|
$.ajax({ |
|
|
|
type:"GET", |
|
|
|
url:"/dashboard/invitation", |
|
|
|
dataType:"json", |
|
|
|
data: { |
|
|
|
filename: 'notice/notice.json', |
|
|
|
}, |
|
|
|
success: function (data) { |
|
|
|
$('.notice-container .ui.dimmer').css('display','none') |
|
|
|
const isZh = document.documentElement.getAttribute('lang') == 'zh-CN'; |
|
|
|
if (!data) return; |
|
|
|
try { |
|
|
|
const noticeList = JSON.parse(data).Notices || []; |
|
|
|
const noticeEl = $('.notice-container'); |
|
|
|
for (let i = 0, iLen = noticeList.length; i < iLen; i++) { |
|
|
|
let noticeObj = noticeList[i]; |
|
|
|
noticeEl.append(`<div class="notice-row"> |
|
|
|
<div class="notice-title"> |
|
|
|
<a class="_hm-notice" href="${noticeObj.Link}"> |
|
|
|
<i class="ri-arrow-right-s-line" style="vertical-align:-2px;"></i> |
|
|
|
<span>${isZh ? noticeObj.Title : (noticeObj.Title_en || noticeObj.Title)}</span> |
|
|
|
</a> |
|
|
|
</div> |
|
|
|
<div class="notice-time">${noticeObj.Date || ''}</div> |
|
|
|
</div>`); |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
console.info(e); |
|
|
|
} |
|
|
|
}, |
|
|
|
error: function (err) { |
|
|
|
$('.notice-container .ui.dimmer').css('display','none') |
|
|
|
console.info(err); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
async function updateNotificationCountWithCallback(callback, timeout, lastCount) { |
|
|
|
const currentCount = $('.notification_count').text(); |
|
|
|