MediaWiki:Gadget-ShowPageStats.js
aus Wiki Aventurica, dem DSA-Fanprojekt
Leere nach dem Speichern den Browser-Cache, um die Änderungen sehen zu können.
Mehr Hilfe zu Cascading Style Sheets und JavaScript gibt es auf Hilfe:CSS und Hilfe:Javascript. |
/*
* Simple script to scrape a page's html comments (looking for 'served by', 'newpp' and 'Transclusion expansion time report').
* imported 20.05.2024 from https://en.wikipedia.org/wiki/User:Splarka/showcomments.js
* author: [[wpen:User:Splarka]] on https://en.wikipedia.org
* adapted for Wiki Aventurica by StipenTreublatt
*/
$(function() {
mw.util.addPortletLink('p-tb','#','Seitenerstellungs-Statistik','t-sps');
$("#t-sps").on("click", function(){
alert(dumpComments(document.getElementsByTagName("body")[0]));
});
})
function dumpComments(obj) {
var childs = 0; var txt = '';
if(obj.nodeType == 8 && obj.nodeValue.search(/(NewPP|Served by|Transclusion expansion time report)/) != -1) {
txt += obj.nodeValue;
}
while(obj.childNodes[childs]) {
txt += dumpComments(obj.childNodes[childs]);
childs++;
}
return txt;
}