Created
October 14, 2009 16:31
-
-
Save cdecker/210203 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name FWX Klick4 | |
// @namespace net.snyke | |
// @include http://p4.klammgeil.de/banner/forcedklick.html* | |
// ==/UserScript== | |
window.count = 10; | |
setTimeout(function(){ | |
var nodes = document.evaluate("//a[contains(@href,'forced/')]", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ); | |
//console.log(nodes); | |
for ( var i=0 ; i < nodes.snapshotLength; i++ ){ | |
var iframe = document.createElement("iframe"); | |
var link = nodes.snapshotItem(i); | |
iframe.src = link.href; | |
iframe.width = 468; | |
iframe.height = 120; | |
link.parentNode.insertBefore(iframe,link); | |
link.parentNode.removeChild(link); | |
} | |
// Aufenthalt: 72 Sekunden | |
var reloadPattern = /([0-9]+) Sek. Aufenthalt/g | |
var content = document.body.textContent; | |
var times = content.match(reloadPattern, "$1"); | |
var reloadTime = 0; | |
for(var i in times){ | |
var time = times[i].substr(0,times[i].indexOf(' ')); | |
// time = time.substr(0,time.length - e.length); | |
reloadTime = (reloadTime<time?time:reloadTime); | |
// console.log(reloadTime); | |
} | |
window.count = parseInt(reloadTime) + 10; | |
},5000); | |
setInterval(function(){ | |
window.count--; | |
if(window.count == 0) | |
document.location = "http://p4.klammgeil.de/banner/forcedklick.html"; | |
else | |
document.title = count; | |
},1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment