Senior9324 (토론 | 기여) 편집 요약 없음 |
Senior9324 (토론 | 기여) 편집 요약 없음 |
||
13번째 줄: | 13번째 줄: | ||
if (test && msg.query.notifications.count == 0) msg = {query: {notifications: {count: -1}}}; | if (test && msg.query.notifications.count == 0) msg = {query: {notifications: {count: -1}}}; | ||
if (msg.query.notifications.count != 0) { | if (msg.query.notifications.count != 0) { | ||
$(document.body).addClass("has-notification"); | $(document.body).addClass("has-notification"); | ||
$(".mw-echo-notifications-badge").append('<span class="notify-count">' + msg.query.notifications.count + '</span>'); | $(".mw-echo-notifications-badge").append('<span class="notify-count">' + msg.query.notifications.count + '</span>'); |
2015년 7월 26일 (일) 16:22 기준 최신판
$(document).ready(function() {
$.ajax({
url: (mw) ? mw.util.wikiScript("api") : "//librewiki.net/api.php",
method: "get",
data: {
"action": "query",
"meta": "notifications",
"format": "json",
"notprop": "count"
},
dataType: "json"
}).done(function(msg) {
if (test && msg.query.notifications.count == 0) msg = {query: {notifications: {count: -1}}};
if (msg.query.notifications.count != 0) {
$(document.body).addClass("has-notification");
$(".mw-echo-notifications-badge").append('<span class="notify-count">' + msg.query.notifications.count + '</span>');
}
});
});