MediaWiki
Gadget-pagecount.js
From Dogcraft Wiki
No edit summary Tag: Manual revert |
m (rewrite) |
||
Line 1: | Line 1: | ||
$( function () { | $( function () { | ||
var pagecount, | var pagecount = document.createElement('div'), | ||
pages, | link = document.createElement('a'), | ||
pages = document.createElement('span'), | |||
api = new mw.Api(); | text = document.createElement('span'), | ||
actions = document.getElementById('wikiActions'), | |||
api = new mw.Api(), | |||
num = api.get( { | |||
action:"query", | |||
meta:"siteinfo", | |||
siprop:"statistics", | |||
formatversion:"2" | |||
} ); | |||
pagecount = | pagecount.id = 'pagecount'; | ||
link.href = "/wiki/Special:AllPages?namespace=0&hideredirects=1"; | |||
text.textContent = 'pages'; | |||
$( | $.when( num ).then( function ( data ) { | ||
pages.textContent = data.query.statistics.articles; | |||
link.append(pages, text); | |||
pagecount.append(link); | |||
actions.parentNode.insertBefore(pagecount, actions); | |||
}); | }); | ||
}); | }); |
Revision as of 23:12, 3 June 2022
$( function () {
var pagecount = document.createElement('div'),
link = document.createElement('a'),
pages = document.createElement('span'),
text = document.createElement('span'),
actions = document.getElementById('wikiActions'),
api = new mw.Api(),
num = api.get( {
action:"query",
meta:"siteinfo",
siprop:"statistics",
formatversion:"2"
} );
pagecount.id = 'pagecount';
link.href = "/wiki/Special:AllPages?namespace=0&hideredirects=1";
text.textContent = 'pages';
$.when( num ).then( function ( data ) {
pages.textContent = data.query.statistics.articles;
link.append(pages, text);
pagecount.append(link);
actions.parentNode.insertBefore(pagecount, actions);
});
});
This page was last modified on 3 June 2022, at 23:12. (15 months ago)