Skip to content

Instantly share code, notes, and snippets.

@basilevs
Created January 9, 2015 13:37
Show Gist options
  • Save basilevs/9ac24e12543a4f8dd323 to your computer and use it in GitHub Desktop.
Save basilevs/9ac24e12543a4f8dd323 to your computer and use it in GitHub Desktop.
Skips ads
// ==UserScript==
// @name Click to play
// @namespace basilevs
// @description Skips legal warnings
// @include http://watch*series.*/open/cale/*
// @include http://daclips.in/*
// @version 1
// @grant GM_log
// ==/UserScript==
function getNodes(expression, parent) {
GM_log("Looking for " + expression);
if (!parent)
parent = document;
var i = document.evaluate(expression, parent, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE , null);
if (!i)
throw new Error("Invalid query: "+expression);
var rv = [];
while (data = i.iterateNext()) {
GM_log("Node");
rv.push(data);
}
GM_log("Found " + rv.length + " nodes");
return rv;
}
function getNode(expression, parent) {
var array = getNodes(expression, parent);
if (array.length != 1)
throw new Error("There are " + array.length + " elements of "+parent +" :" + array);
return array[0];
}
getNodes("//a[text()='Click Here to Play']").forEach(function(x){x.click();});
getNodes("id('content')/form").forEach(function(x){x.submit();});
window.setTimeout( function() {unsafeDocument.getElementById('flvplayer').sendEvent("PLAY");}, 4000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment