// ==UserScript==
// @name           I Can't SeeSaw ur Ads
// @namespace      http://1stvamp.org/icantseesawurads
// @description    Script to disable ads on video playback on seesaw.com
// @include        http://*.seesaw.com/*
// @include        https://*.seesaw.com/*
// @include        http://seesaw.com/*
// @include        https://seesaw.com/*
// ==/UserScript==

try {
        if (unsafeWindow && unsafeWindow.VODCO) {
        	unsafeWindow.VODCO.ads.player = null;
        } else if (window && window.VODCO) {
                window.VODCO.ads.player = null;
        } else if (VODCO) {
                VODCO.ads.player = null;
        }
} catch (e) {
        // Nothing
}
// We're going to modify the script and reattach it into the DOM,
// doing this rather than just modifying VODCO.ads.config directly
// to allow for other attacks against the ad init script later on,
// also you don't have to do the unsafeWindow/window checks as above
// for Chrome support.
var init_re = /Initialise the player/i;
var scripts = document.getElementsByTagName('script');
var body = document.getElementsByTagName('body')[0];
for (var i = 0; i < scripts.length; i++) {
	if (scripts[i].text.match(init_re)) {
		t = scripts[i].text.replace(/,time:30000/gi, ',time:0');
		t = t.replace(/<breakOffset>(.*?)<\\\/breakOffset>/gi, '<breakOffset>10:00:00.01<\/breakOffset>');
		t = t.replace(/<resumeOffset>(.*?)<\\\/resumeOffset>/gi, '<resumeOffset>10:00:00.05<\/resumeOffset>');
                script = document.createElement('script');
                script.type = 'text/javascript';
                script.innerHTML = t;
		body.appendChild(script);
		break;
	}
}

