MediaWiki
Gadget-pagecount.js
From Dogcraft Wiki
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (โ-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (โ-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
$( 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. (16 months ago)