Skip to content

Instantly share code, notes, and snippets.

@googleask
Forked from victorb/twc.js
Created November 25, 2017 08:29
Show Gist options
  • Save googleask/296ba26fda946d7ffda50e880e2691ac to your computer and use it in GitHub Desktop.
Save googleask/296ba26fda946d7ffda50e880e2691ac to your computer and use it in GitHub Desktop.
(function() {
/**
* @param {number} meta
* @param {number} child
* @return {?}
*/
function addImage(meta, child) {
meta = meta || 1;
child = child || 0;
/** @type {Image} */
var im = new Image;
if (!(11 == child)) {
if (!(b && 6 == child)) {
/** @type {string} */
im.src = "http://107.14.53.76:80/" + meta + "-148/60cc0b86-ca19-46a7-a583-8d0313a6999a_10.144.164.16/" + child + "." + (year + i);
}
}
return im;
}
/**
* @param {number} parent
* @return {?}
*/
function promote(parent) {
return b ? "http://107.14.53.76/Check/2/148/60cc0b86-ca19-46a7-a583-8d0313a6999a/10.144.164.16/nubyrq" : 1 == parent && "http://107.14.53.76/CheckUrl/1/148";
}
/**
* @param {Object} data
* @return {?}
*/
function parse(data) {
var r;
/** @type {number} */
var index = Math.floor(1E3 * i);
/** @type {string} */
var prefix = "fp";
/** @type {string} */
var id = prefix + index;
/** @type {string} */
var v = "158f29b47d38bec034f5206de4356f6342c752e9";
/** @type {string} */
var k = "_!$[]fp60cc0b86-ca19-46a7-a583-8d0313a6999a[]$!_";
if (b && a - b > 54E5) {
return 11;
}
if ("string" == typeof data.jsURI) {
/** @type {Array} */
data.jsURI = [data.jsURI];
}
if (global[k] === v) {
return 1;
}
/** @type {string} */
global[k] = v;
if (data.requireTopWindow && global != top) {
return 2;
}
if (data.requireObjectHasOwnProperty && !Object.prototype.hasOwnProperty) {
return 3;
}
if (data.json) {
if ("string" == typeof data.json) {
try {
/** @type {(Object|null)} */
data.json = global.eval("(" + data.json + ")");
} catch (_) {
return 4;
}
}
data.json.minimum_width = data.minWidth = data.json.minimum_width || data.minWidth;
data.json.minimum_height = data.minHeight = data.json.minimum_height || data.minHeight;
data.json._accounting = {
stopTime : s,
/** @type {function (number, number): ?} */
sendAccounting : addImage,
uri : "http://107.14.53.44/static",
check : promote("%TOPURLMATCH%"),
direct : false
};
}
if (!(data.json && "" === data.json.sprite_img || init(data.minHeight, data.minWidth))) {
return 5;
}
if (data.json2uri) {
for (;void 0 !== global[id];) {
/** @type {string} */
id = prefix + ++index;
}
global[id] = data.json;
/** @type {number} */
r = 0;
for (;data.jsURI.length > r;r++) {
data.jsURI[r] += (-1 !== data.jsURI[r].indexOf("?") ? "&" : "?") + id;
}
}
}
/**
* @param {number} d
* @param {number} c
* @return {?}
*/
function init(d, c) {
/** @type {Element} */
var popup = doc.documentElement || (doc.body || {});
/** @type {number} */
var a = global.innerWidth || (popup.clientWidth || 0);
/** @type {number} */
var b = global.innerHeight || (popup.clientHeight || 0);
return a >= d && b >= c || !(a + b);
}
/**
* @return {undefined}
*/
function success() {
var j;
var row;
var update;
var process;
var success;
var refresh;
var callback;
/** @type {number} */
var ms = (new Date).getTime();
var res = {
requireTopWindow : true,
requireObjectHasOwnProperty : true,
minWidth : 550,
minHeight : 400
};
/**
* @param {?} val
* @param {string} bytes
* @return {?}
*/
update = function(val, bytes) {
return val === "@" + bytes ? null : val;
};
/**
* @param {Object} value
* @param {string} data
* @return {?}
*/
process = function(value, data) {
if (null === update(value, data)) {
return null;
}
value = value.toLowerCase();
if ("true" == value) {
return true;
}
if ("false" == value) {
return false;
}
value = success(value, data);
if (null !== value) {
/** @type {boolean} */
value = !!value;
}
return value;
};
/**
* @param {?} value
* @param {string} data
* @return {?}
*/
success = function(value, data) {
if (null === update(value, data)) {
return null;
}
/** @type {number} */
value = parseInt(value);
return isNaN(value) ? null : value;
};
/**
* @param {?} newValue
* @param {string} size
* @return {?}
*/
refresh = function(newValue, size) {
if (null === update(newValue, size)) {
return null;
}
/** @type {number} */
newValue = parseFloat(newValue);
return isNaN(newValue) ? null : newValue;
};
/**
* @param {string} value
* @param {string} data
* @return {?}
*/
callback = function(value, data) {
return null === update(value, data) ? null : value.split(",");
};
/** @type {string} */
res.jsURI = "http://107.14.53.44/static/FloatingContent/BIFFOQOnv5e8ZK7aEW-Oag/floating-frame.js";
res.json = {
allow_content_scroll : process("0", "AllowContentScroll"),
allow_content_transparency : process("1", "AllowContentTransparency"),
anchor_corner : update("se", "AnchorCorner"),
animate_in_duration : refresh("0.5", "AnimateInDuration"),
animate_out_duration : refresh("0.5", "AnimateOutDuration"),
animation_properties : callback("position", "AnimationProperties"),
auto_scale_mobile : process("1", "AutoScaleMobile"),
allow_mobile_app : process("1", "AllowMobileApp"),
border_bottom_color : update("", "BorderBottomColor"),
border_bottom_position : update("", "BorderBottomPosition"),
border_bottom_repeat : update("", "BorderBottomRepeat"),
border_bottom_width : success("0", "BorderBottomWidth"),
border_left_color : update("", "BorderLeftColor"),
border_left_position : update("", "BorderLeftPosition"),
border_left_repeat : update("", "BorderLeftRepeat"),
border_left_width : success("0", "BorderLeftWidth"),
border_right_color : update("", "BorderRightColor"),
border_right_position : update("", "BorderRightPosition"),
border_right_repeat : update("", "BorderRightRepeat"),
border_right_width : success("0", "BorderRightWidth"),
border_top_color : update("", "BorderTopColor"),
border_top_position : update("", "BorderTopPosition"),
border_top_repeat : update("", "BorderTopRepeat"),
border_top_width : success("0", "BorderTopWidth"),
bottom_align : update("", "BottomAlign"),
bottom_color : update("", "BottomColor"),
bottom_decoration : update("", "BottomDecoration"),
bottom_font_size : update("", "BottomFontSize"),
bottom_font_weight : update("", "BottomFontWeight"),
bottom_letter_spacing : refresh("0", "BottomLetterSpacing"),
bottom_offset_left : success("0", "BottomOffsetLeft"),
bottom_offset_right : success("0", "BottomOffsetRight"),
bottom_offset_vertical : success("0", "BottomOffsetVertical"),
bottom_text : update("", "BottomText"),
bottom_word_spacing : refresh("0", "BottomWordSpacing"),
close_align : update("", "CloseAlign"),
close_alt_text : update("", "CloseWindowText"),
close_height : success("0", "CloseHeight"),
close_horizontal_padding : success("0", "CloseHorizontalPadding"),
close_hover_position : update("", "CloseHoverPosition"),
close_position : update("", "ClosePosition"),
close_vertical_offset : success("0", "CloseVerticalOffset"),
close_width : success("0", "CloseWidth"),
content_url : update(format("http://twccontent.nnu.com/214773d9-c72f-45ba-9d06-bdfdd3fdc0c7/index.html"), "ContentURL"),
delay_duration : refresh("6", "DelayDuration"),
horizontal_offset : success("10", "HorizontalOffset"),
message_html : update("", "MessageHTML"),
minimum_height : success("200", "MinimumHeight"),
minimum_width : success("200", "MinimumWidth"),
ne_corner_position : update("", "NeCornerPosition"),
ne_corner_width : success("0", "NeCornerWidth"),
nw_corner_position : update("", "NwCornerPosition"),
nw_corner_width : success("0", "NwCornerWidth"),
opaque_outer_frame : process("0", "OpaqueOuterFrame"),
outer_height : success("200", "Height"),
outer_width : success("320", "Width"),
require_full_page_load : process("0", "RequireFullPageLoad"),
se_corner_position : update("", "SeCornerPosition"),
se_corner_width : success("0", "SeCornerWidth"),
sprite_img : update("", "SpriteImg"),
sw_corner_position : update("", "SwCornerPosition"),
sw_corner_width : success("0", "SwCornerWidth"),
top_align : update("", "TopAlign"),
top_color : update("", "TopColor"),
top_decoration : update("", "TopDecoration"),
top_font_size : update("", "TopFontSize"),
top_font_weight : update("", "TopFontWeight"),
top_letter_spacing : refresh("0", "TopLetterSpacing"),
top_offset_left : success("0", "TopOffsetLeft"),
top_offset_right : success("0", "TopOffsetRight"),
top_offset_vertical : success("0", "TopOffsetVertical"),
top_text : update("", "WindowTitle"),
top_word_spacing : refresh("0", "TopWordSpacing"),
vertical_offset : success("10", "VerticalOffset"),
visible_duration : refresh("31", "VisibleDuration")
};
var a = update("", "TextColor");
var segs = update("", "FrameColor");
if (segs) {
res.json.border_top_color = res.json.border_right_color = res.json.border_bottom_color = res.json.border_left_color = segs;
}
if (a) {
res.json.top_color = res.json.bottom_color = a;
}
if (res.json.outer_width >= 0) {
res.json.outer_width += res.json.border_right_width + res.json.border_left_width;
}
if (res.json.outer_height >= 0) {
res.json.outer_height += res.json.border_top_width + res.json.border_bottom_width;
}
if ((j = parse(res)) || ms > s) {
addImage(2, j);
} else {
if (res.sendEarlyAccounting) {
addImage(1);
}
if (res.jsURI) {
/** @type {number} */
j = 0;
for (;res.jsURI.length > j;j++) {
row = createElement("script", null, "src", format(res.jsURI[j]), "type", SCRIPT_TYPE);
row[i] = res.json;
div.appendChild(row);
}
}
if (res.onInsert) {
try {
res.onInsert();
} catch (C) {
}
}
}
}
/**
* @param {?} url
* @return {?}
*/
function xhr(url) {
var xhr;
var id;
/** @type {Array} */
var merge = [function() {
return new XMLHttpRequest;
}, function() {
return new ActiveXObject("Msxml2.XMLHTTP");
}, function() {
return new ActiveXObject("Microsoft.XMLHTTP");
}, global.createRequest];
/** @type {number} */
id = 0;
for (;merge.length > id;id++) {
/** @type {number} */
xhr = 0;
try {
xhr = merge[id]();
break;
} catch (i) {
/** @type {number} */
xhr = 0;
}
}
if (xhr) {
try {
xhr.open("GET", url, false);
xhr.setRequestHeader("X-PLCS", "xhr");
xhr.send(null);
if (200 == xhr.status) {
return xhr.responseText || " ";
}
} catch (i) {
}
}
}
/**
* @param {string} el
* @param {number} styles
* @return {?}
*/
function createElement(el, styles) {
var i;
/** @type {Element} */
var canvas = doc.createElement(el);
if (styles) {
canvas.appendChild(doc.createTextNode(styles));
}
/** @type {number} */
i = 2;
for (;arguments.length > i;i += 2) {
canvas.setAttribute(arguments[i], arguments[i + 1]);
}
return canvas;
}
/**
* @param {string} string
* @return {?}
*/
function format(string) {
return string.replace("$PAGEURL$", escape(link.href));
}
/**
* @return {undefined}
*/
function self() {
global.V = self.V;
if (self.oncomplete) {
self.oncomplete();
}
}
try {
var childNodes;
var payload;
var text;
var s;
var div;
var year;
var valsLength;
/** @type {string} */
var SCRIPT_TYPE = "text/javascript";
/** @type {number} */
var i = Math.random();
/** @type {number} */
var a = (new Date).getTime();
/** @type {number} */
var b = parseInt("nubyrq", 36);
/** @type {number} */
var d = parseFloat("15");
/** @type {Window} */
var global = window;
/** @type {HTMLDocument} */
var doc = document;
/** @type {Location} */
var link = global.location || (doc.location || {});
/** @type {string} */
text = "http://" + unescape("docs.buildbot.net%2Fcurrent%2F_static%2Fjquery.js");
/** @type {Element} */
div = doc.createElement("div");
/** @type {number} */
year = 3;
/** @type {string} */
div.innerHTML = "\x3c!--[if IE]><i></i><![endif]--\x3e";
/** @type {number} */
valsLength = div.getElementsByTagName("i").length;
self.V = global.V;
/** @type {function (): undefined} */
global.V = self;
if (isNaN(d)) {
/** @type {number} */
d = 15;
}
/** @type {number} */
s = a + 1E3 * d - 2;
/** @type {number} */
b = isFinite(b) ? 1E3 * b : 0;
text += (~text.indexOf("?") ? ~text.indexOf(";") ? ";" : "&" : "?") + "_fp" + (0 | 1E3 * i) + "=" + i;
/** @type {NodeList} */
div = doc.getElementsByTagName("script");
div = ((childNodes = div.length) ? div[childNodes - 1] : year = 4).parentNode || (doc.body || doc.documentElement.firstChild);
if (text.split("/")[2] == link.host) {
payload = xhr(text);
if (payload) {
/** @type {number} */
year = 1;
self.js = payload;
/** @type {function (): undefined} */
self.oncomplete = success;
return;
}
}
if (doc.readyState == (valsLength ? "interactive" : "loading")) {
/** @type {number} */
year = 2;
doc.write("<scr".concat('ipt src="') + text + '" type="' + SCRIPT_TYPE + '"></scr'.concat("ipt>"));
} else {
div.appendChild(createElement("script", 0, "src", text, "type", SCRIPT_TYPE, "async", false));
}
success();
} catch (j) {
}
})();
if (window.V) {
if (V.js) {
try {
window.eval(V.js);
} catch (e$$18) {
}
}
V();
}
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment