LLWiki正在建设中,欢迎加入我们!
“User:Bhsd/tool.js”的版本间差异
跳转到导航
跳转到搜索
小 |
小 |
||
第1行: | 第1行: | ||
mw.loader.using('mediawiki.api').then(function() { |
mw.loader.using('mediawiki.api').then(function() { |
||
var api = new mw.Api(), |
var api = new mw.Api(), |
||
⚫ | |||
table = $('table').first(), |
table = $('table').first(), |
||
list = table.find('td:first-child a'); |
list = table.find('td:first-child a'); |
||
⚫ | |||
list.each(function() |
list.each(function(){ |
||
⚫ | |||
⚫ | |||
}); |
|||
⚫ | |||
api.get({ action:'query', formatversion:2, prop:'info', titles: |
api.get({ action:'query', formatversion:2, prop:'info', titles:title }).then(function(data) { |
||
⚫ | |||
data.query.pages. |
var length = data.query.pages[0].length; |
||
ele.parent().after('<td>' + length + '</td>'); |
|||
}); |
}); |
||
}); |
}); |
2020年8月29日 (六) 10:19的版本
mw.loader.using('mediawiki.api').then(function() { var api = new mw.Api(), table = $('table').first(), list = table.find('td:first-child a'); table.find('th').first().after( '<th>大小</th>' ); list.each(function(){ var ele = $(this), title = ele.attr('href').sustring(4); api.get({ action:'query', formatversion:2, prop:'info', titles:title }).then(function(data) { var length = data.query.pages[0].length; ele.parent().after('<td>' + length + '</td>'); }); }); });