MediaWiki

Gadget-pagecount.js

From Dogcraft Wiki

No edit summary
No edit summary
Line 12: Line 12:
console.log( pages );
console.log( pages );
var temp = $("#top-bar-pagecount a span:nth-child(1)");
var temp = $("#top-bar-pagecount a span:nth-child(1)");
temp[0].innerText = "page";
temp[0].innerText = pages;
});
});
});
});

Revision as of 14:19, 7 April 2021

$( function () {
	var topbar, pagecount, pages, output, 
		api = new mw.Api();
	
	topbar = $("nav ul#top-bar-right");
	pagecount = $('<li id="top-bar-pagecount"><a href="//dogcraft.net/wiki/Special:AllPages"><span></span><span>pages</span></a></li>');
	
	topbar.prepend(pagecount);
	
	api.get({action:"query",meta:"siteinfo",siprop:"statistics",formatversion:"2"}).done( function ( data ) {
		pages = data.query.statistics.articles;
		console.log( pages );
		var temp = $("#top-bar-pagecount a span:nth-child(1)");
		temp[0].innerText = pages;
	});
			
});
This page was last modified on 7 April 2021, at 14:19. (13 months ago)
Background Dragon Slayer - Retriever by Ironboundred