Replays On Box Score

dfsdfsdf

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name           Replays On Box Score
// @namespace      robs
// @include        http://goallineblitz.com/game/game.pl?game_id=*
// @copyright      2009, pabst
// @license        (CC) Attribution Share Alike; http://creativecommons.org/licenses/by-sa/3.0/
// @version        09.02.21
// @description dfsdfsdf
// ==/UserScript==

window.setTimeout(
    function() {
        main();
    }
, 10);

function main() {
    var address = window.location.toString()+"&mode=pbp";
    getInetPage(address, run);
}

function run(address, page) {
    var div = document.createElement("div");
    div.innerHTML = page.responseText;
    //console.log(div.innerHTML);

    var plays = div.getElementsByClassName("pbp_play_row_scoring");
    var box = document.getElementsByClassName("pbp_play_row");

    var pidx = 0;
    for (var i=0; i<box.length; i++) {
        pidx = 0;
        var btime = box[i].getElementsByClassName("summary_time")[0];
        var btext = box[i].getElementsByClassName("summary_play")[0];
        for ( ; pidx<plays.length; pidx++) {
            var time = plays[pidx].getElementsByClassName("pbp_time_remaining")[0].innerHTML;
            var text = plays[pidx].getElementsByClassName("pbp_play")[0].innerHTML;
            if ((time == btime.innerHTML) && (text == btext.innerHTML)) {
                var replay = plays[pidx].getElementsByClassName("pbp_replay")[0];
                if (replay.firstChild.href != null) {
                    var a = document.createElement("a");
                    a.href = replay.firstChild.href;
                    a.innerHTML = "Replay";

                    btext.innerHTML += "&nbsp;(";
                    btext.appendChild(a);
                    btext.innerHTML += ")";
                }
                break;
            }
        }
    }
}

function getInetPage(address, func) {
    console.log("getInetPage : "+address);
    var req = new XMLHttpRequest();
	req.open( 'GET', address, true );
	req.onload = function() {
            if (this.status != 200) {
                alert("pbr gm script: Error "+this.status+" loading "+address);
            }
            else {
                console.log("loaded: "+address)
                func(address,this);
            }
	};

	req.send(null);
	return req;
}