(새 문서: →이 자바스크립트 설정은 모든 문서, 모든 사용자에게 적용됩니다.: $('#mw-content-block').append('최근 바뀜'); $.ajax({ url: '/api.php?action=query&format=json&list=recentchanges&utf8=1&formatversion=2&rcshow=!bot&rclimit=10&rctoponly&ns=0', type: 'GET', dataType: 'json', success: function (response) { //console.log('response', response); //console.log('response.batchcomplete', response.batchcomplete); if(response.batchcom...) |
편집 요약 없음 |
||
1번째 줄: | 1번째 줄: | ||
$('#mw-content-block').append('<div id="side-recent"><div class="side-recent-title"><a href="/index.php?title=특수:최근바뀜">최근 바뀜</a></div></div>'); | |||
$('#mw-content-block').append('최근 바뀜'); | |||
$.ajax({ | $.ajax({ | ||
url: '/api.php?action=query&format=json&list=recentchanges&utf8=1&formatversion=2&rcshow=!bot&rclimit=10&rctoponly&ns=0', | url: '/api.php?action=query&format=json&list=recentchanges&utf8=1&formatversion=2&rcshow=!bot&rclimit=10&rctoponly&ns=0', | ||
15번째 줄: | 14번째 줄: | ||
for (var index = 0; index < response.query.recentchanges.length; index++) { | for (var index = 0; index < response.query.recentchanges.length; index++) { | ||
if(response.query.recentchanges[index].ns === 0) { | if(response.query.recentchanges[index].ns === 0) { | ||
$('#side-recent').append(''+response.query.recentchanges[index].title+''); | $('#side-recent').append('<div class="side-recent-item"><a href="/index.php?title='+response.query.recentchanges[index].title+'">'+response.query.recentchanges[index].title+'</a></div>'); | ||
} | } | ||
} | } |
2023년 3월 23일 (목) 16:11 기준 최신판
$('#mw-content-block').append('<div id="side-recent"><div class="side-recent-title"><a href="/index.php?title=특수:최근바뀜">최근 바뀜</a></div></div>');
$.ajax({
url: '/api.php?action=query&format=json&list=recentchanges&utf8=1&formatversion=2&rcshow=!bot&rclimit=10&rctoponly&ns=0',
type: 'GET',
dataType: 'json',
success: function (response) {
//console.log('response', response);
//console.log('response.batchcomplete', response.batchcomplete);
if(response.batchcomplete === true) {
//console.log('response.query', response.query);
if(response.query !== undefined) {
if(response.query.recentchanges !== undefined) {
if(response.query.recentchanges.length > 0) {
for (var index = 0; index < response.query.recentchanges.length; index++) {
if(response.query.recentchanges[index].ns === 0) {
$('#side-recent').append('<div class="side-recent-item"><a href="/index.php?title='+response.query.recentchanges[index].title+'">'+response.query.recentchanges[index].title+'</a></div>');
}
}
}
}
}
}
},
error: function (xhr, status, error) {
console.log(error);
}
});