Skip to content

Instantly share code, notes, and snippets.

@ameshkov
Created March 14, 2016 08:28
Show Gist options
  • Save ameshkov/4f08b25eb2ad4a8b7e3f to your computer and use it in GitHub Desktop.
Save ameshkov/4f08b25eb2ad4a8b7e3f to your computer and use it in GitHub Desktop.
720video.tv decoded script
(function() {
var a = '1.0.0.0';
var b = 'data.initialcontroledge.info';
var c = '//ads.comeadvertisewithus.com/ads/ads.js';
var d = '//adss.comeadvertisewithus.com/ads/ads.js';
var e = '13842';
var f = 360;
var g = 1;
var h = false;
var i = {
route: 'get_pop',
stid: '1920',
sbid: '1',
p1: window.spot_code
};
var j = function(a, b, c) {
var d = "";
if (c) {
var e = new Date();
e.setTime(e.getTime() + (c * 60 * 1000));
d = "; expires=" + e.toGMTString()
} else d = "";
document.cookie = a + "=" + b + d + "; path=/"
};
var k = function(a) {
var b = a + "=";
var c = document.cookie.split(';');
for (var d = 0; d < c.length; d++) {
var e = c[d];
while (e.charAt(0) == ' ') e = e.substring(1, e.length);
if (e.indexOf(b) == 0) return e.substring(b.length, e.length)
}
return null
};
var l = function(a) {
if (h) return;
var b = k(e) == null ? 0 : parseInt(k(e));
if (b >= g) return;
var c = window.location.href;
var d = n(i);
if (a.target.tagName.toLowerCase() == 'a') {
c = a.target.href;
a.preventDefault()
} else if (a.target.parentNode.tagName != undefined && a.target.parentNode.tagName.toLowerCase() == 'a') {
c = a.target.parentNode.href;
a.preventDefault()
}
h = true;
j(e, b + 1, f);
var l = m().toLowerCase();
if (l.indexOf('chrome') != -1) {
var o = document.createElement('a');
o.href = c;
var p = document.createEvent('MouseEvents');
p.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, true ? 1 : 0, null);
o.dispatchEvent(p)
} else window.open(c, '');
window.location.href = d
};
var m = function() {
var a = navigator.userAgent,
b, c = a.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if (/trident/i.test(c[1])) {
b = /\brv[ :]+(\d+)/g.exec(a) || [];
return 'IE ' + (b[1] || '')
}
if (c[1] === 'Chrome') {
b = a.match(/\b(OPR|Edge)\/(\d+)/);
if (b != null) return b.slice(1).join(' ').replace('OPR', 'Opera')
}
c = c[2] ? [c[1], c[2]] : [navigator.appName, navigator.appVersion, '-?'];
if ((b = a.match(/version\/(\d+)/i)) != null) c.splice(1, 1, b[1]);
return c.join(' ')
};
var n = function(a) {
function c() {
var a = '';
var b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var c = 0; c < 5; c++) a += b.charAt(Math.floor(Math.random() * b.length));
return a
}
var d = JSON.stringify(a);
var e = o().encode(d);
e = c() + e + c();
e = e.replace(/\//g, '-');
var f = location.protocol + '//' + b + '/' + e;
return f
};
var o = function() {
var a = "=",
b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
c = "1.0";
function d(a, c) {
var d = b.indexOf(a.charAt(c));
if (d === -1) throw "Cannot decode base64";
return d
}
function e(b) {
var c = 0,
e, f, g = b.length,
h = [];
b = String(b);
if (g === 0) return b;
if (g % 4 !== 0) throw "Cannot decode base64";
if (b.charAt(g - 1) === a) {
c = 1;
if (b.charAt(g - 2) === a) c = 2;
g -= 4
}
for (e = 0; e < g; e += 4) {
f = (d(b, e) << 18) | (d(b, e + 1) << 12) | (d(b, e + 2) << 6) | d(b, e + 3);
h.push(String.fromCharCode(f >> 16, (f >> 8) & 255, f & 255))
}
switch (c) {
case 1:
f = (d(b, e) << 18) | (d(b, e + 1) << 12) | (d(b, e + 2) << 6);
h.push(String.fromCharCode(f >> 16, (f >> 8) & 255));
break;
case 2:
f = (d(b, e) << 18) | (d(b, e + 1) << 12);
h.push(String.fromCharCode(f >> 16));
break
}
return h.join("")
}
function f(a, b) {
var c = a.charCodeAt(b);
if (c > 255) throw "INVALID_CHARACTER_ERR: DOM Exception 5";
return c
}
function g(c) {
if (arguments.length !== 1) throw "SyntaxError: exactly one argument required";
c = String(c);
var d, e, g = [],
h = c.length - c.length % 3;
if (c.length === 0) return c;
for (d = 0; d < h; d += 3) {
e = (f(c, d) << 16) | (f(c, d + 1) << 8) | f(c, d + 2);
g.push(b.charAt(e >> 18));
g.push(b.charAt((e >> 12) & 63));
g.push(b.charAt((e >> 6) & 63));
g.push(b.charAt(e & 63))
}
switch (c.length - h) {
case 1:
e = f(c, d) << 16;
g.push(b.charAt(e >> 18) + b.charAt((e >> 12) & 63) + a + a);
break;
case 2:
e = (f(c, d) << 16) | (f(c, d + 1) << 8);
g.push(b.charAt(e >> 18) + b.charAt((e >> 12) & 63) + b.charAt((e >> 6) & 63) + a);
break
}
return g.join("")
}
return {
encode: g,
decode: e
}
};
var p = function(a, b) {
var c, d, e;
d = false;
c = document.createElement('script');
c.type = 'text/javascript';
c.src = a;
c.onload = c.onreadystatechange = function() {
if (!d && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
d = true;
if (b) b()
}
};
c.onerror = function() {
b()
};
e = document.getElementsByTagName('script')[0];
e.parentNode.insertBefore(c, e)
};
var q = location.protocol == 'http:' ? c : d;
p(q, function() {
if (window._impspcabe == false) return;
if (document.addEventListener) document.addEventListener('click', l, false);
else document.attachEvent('onclick', l)
})
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment