All pastes #91543 Raw Edit

Unnamed

public javascript v1 · immutable
#91543 ·published 2006-07-18 18:26 UTC
rendered paste body
var csmstats = {  checkURL: function(e) { // cheers biznatchio!		var doc = e.originalTarget;	var loc = doc.location;	try {		if ( loc && loc.href ) {			//alert("Checking URL: "+loc.href);			var reg = new RegExp("^http://www\\d?\\.cs-manager\\.com/csm/\\?p=(?:office_transfer|clan_players)(.*?)","i");			if ( loc.href.match(reg) ) { alert("URL Matched"); this.doCheck(doc); }		}	}	catch (ex) { }  },    doCheck: function(doc) {	alert("Checking for players!");	total = 0;	var tables = doc.getElementsByTagName("table");	for (var i = 0; i < tables.length; i++) {		if ( tables[i].className == "dev" && table[i].style.margin-bottom == "15px" && table[i].getAttribute("cellspacing") == "0" && table[i].getAttribute("cellpadding") == "0" ) {			// pretty sure the current table is a player table!			var skills = tables[i].getElementsByTagName("img");			for (var j = 0; j < skills.length; j++) {				if ( skills[j].getAttribute("src").match("skill_bar") ) {					var ts = skills[j].getAttribute("src").split("skill=");					total = total + Number(ts[1]);				}			}			alert("Total Skills"+total);		}	}  }  };window.addEventListener('load', csmstats.checkURL, true);