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, 
		pages, 
		output, 
		api = new mw.Api();
	
	pagecount = $('<div id="pagecount"><a href="/wiki/Special:AllPages?namespace=0&hideredirects=1"><span></span><span>pages</span></a></div>');
	
	$('#wikiActions').before(pagecount);
	
	api.get({action:"query",meta:"siteinfo",siprop:"statistics",formatversion:"2"}).done( function ( data ) {
		pages = data.query.statistics.articles;
		var temp = $("#-pagecount a span:nth-child(1)");
		temp[0].innerText = pages;
	});
});
This page was last modified on 22 July 2021, at 17:40. (14 months ago)