User:Splarka/showcomments.js

//Simple script to scrape a page's html comments (looking for 'served by' and 'newpp').

$(function { mw.util.addPortletLink('p-tb','javascript:alert(dumpComments(document.getElementsByTagName("body")[0]));','Page stats'); })

function dumpComments(obj) { var childs = 0; var txt = ''; if(obj.nodeType == 8 && obj.nodeValue.search(/(NewPP|Served by)/) != -1) { txt += obj.nodeValue; } while(obj.childNodes[childs]) { txt += dumpComments(obj.childNodes[childs]); childs++; } return txt; }