Senior9324 (토론 | 기여) (Senior9324 (토론)의 128388판 편집을 되돌림) |
Senior9324 (토론 | 기여) 편집 요약 없음 |
||
(같은 사용자의 중간 판 3개는 보이지 않습니다) | |||
11번째 줄: | 11번째 줄: | ||
dataType: "json" | dataType: "json" | ||
}).done(function(msg) { | }).done(function(msg) { | ||
if (test) msg = {query: {notifications: {count: 1}}}; | if (test && msg.query.notifications.count == 0) msg = {query: {notifications: {count: -1}}}; | ||
if (msg.query.notifications.count | 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>'); | |||
} | } | ||
}); | }); | ||
}); | }); |
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>');
}
});
});