Last active
January 18, 2018 17:09
-
-
Save jiaz/19820589575bdcc09b61f6cf7396f06e to your computer and use it in GitHub Desktop.
reduce dnvod ad time to 1 second
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 Disable Ads in DNVOD | |
// @namespace https://jiajizhou.com/ | |
// @version 0.1 | |
// @description Disable Ads in DNVOD | |
// @match http://www.dnvod.tv/* | |
// @copyright 2018+, jiajzhou | |
// @require http://code.jquery.com/jquery-latest.js | |
// ==/UserScript== | |
function ReplaceFunction () { | |
$(document).ready(function() { | |
console.log(window.CKobject); | |
if (window.CKobject && window.CKobject.embedSWF && window.CKobject.embedSWF.length === 7 && !window.CKobject.embedSWF.patched) { | |
console.log('abc'); | |
console.log(window.CKobject); | |
var old = window.CKobject.embedSWF.bind(window.CKobject); | |
window.CKobject.embedSWF = function(C, D, N, W, H, V, P) { | |
V.l = V.l.substring(0, V.l.indexOf('|')); | |
V.d = V.d.substring(0, V.d.indexOf('|')); | |
V.u = V.u.substring(0, V.u.indexOf('|')); | |
V.r = V.r.substring(0, V.r.indexOf('|')); | |
V.t = '1'; | |
old(C, D, N, W, H, V, P); | |
}; | |
window.CKobject.embedSWF.patched = true; | |
} | |
}); | |
} | |
addJS_Node (null, null, ReplaceFunction); | |
function addJS_Node (text, s_URL, funcToRun, runOnLoad) { | |
var D = document; | |
var scriptNode = D.createElement ('script'); | |
if (runOnLoad) { | |
scriptNode.addEventListener ("load", runOnLoad, false); | |
} | |
scriptNode.type = "text/javascript"; | |
if (text) scriptNode.textContent = text; | |
if (s_URL) scriptNode.src = s_URL; | |
if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()'; | |
var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement; | |
targ.appendChild (scriptNode); | |
console.log('added a node'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install it as a tempermonkey plugin.