User:Voice of All/monobook/parse.js

// Some functions for parsing raw HTML. // Need to be maintained...

window.getSumOfHistLI = function(li) {	var the_sum = ''; var l = document.getElementById('bodyContent').getElementsByTagName('li')[li]; var ls = l.getElementsByTagName('span'); for (k = 0; k < ls.length; k++) {		if (ls[k].className=='autocomment') {                       if (ls[k-1].innerHTML.indexOf("- ") !=-1) {the_sum = ls[k-1].innerHTML.split("- ")[1].split(" ")[0];} else if (ls[k-1].innerHTML.indexOf("- ") !=-1) {the_sum = ls[k-1].innerHTML.split("- ")[1].split(" ")[0];} else if (ls[k-1].innerHTML.indexOf(" ") !=-1) {the_sum = ls[k-1].innerHTML.split(" ")[1].split(" ")[0];} else {the_sum = '';} break; }		else if (ls[k].className=='comment') {the_sum = ls[k].innerHTML;} }	the_sum = the_sum.replace(/(-<\/span>|→)/gi,''); return the_sum; }

window.getSumOfContribsLI = function(li) {	return getSumOfHistLI(li); }

window.getTimeOfHistLI = function(li) {	var the_time = ''; var l = document.getElementById('bodyContent').getElementsByTagName('li')[li]; var la = l.getElementsByTagName('a'); for ( var k = 0; k < la.length; k++) {		if( la[k].href.indexOf('&oldid=') !=-1 && la[k].href.indexOf('&diff=') ==-1 ) { the_time = la[k].innerHTML; break; }	}	return the_time; }

window.getTimeOfContribsLI = function(li) {	var the_time = ''; var l = document.getElementById('bodyContent').getElementsByTagName('li')[li]; var la = l.getElementsByTagName('a'); for ( var k = 0; k < la.length; k++) {		if( la[k].href.indexOf('&oldid=') !=-1 && la[k].href.indexOf('&diff=') ==-1 ) { the_time = la[k].innerHTML; break; }	}	return the_time; }