Skip to content

Instantly share code, notes, and snippets.

@arestifo
Created July 26, 2015 23:59
Show Gist options
  • Select an option

  • Save arestifo/4505a10673f2b32dbe37 to your computer and use it in GitHub Desktop.

Select an option

Save arestifo/4505a10673f2b32dbe37 to your computer and use it in GitHub Desktop.
(function() {
var f5_cspm = {
f5_p: 'BDNINOGGMDOLHFCOJAANDEJOKLPHMMBONGPBGOGCAJFBGBLCNAFONCMEODJAAHKJPNMGCACOAKDOOLOIAJDPBBPMJCFFCEBFDOLLDCOONKDIPFNKNNFOOFCIBBGFCBHA',
setCharAt: function(str, index, chr) {
if (index > str.length - 1) return str;
return str.substr(0, index) + chr + str.substr(index + 1);
},
get_byte: function(str, i) {
var s = (i / 16) | 0;
i = (i & 15);
s = s * 32;
return ((str.charCodeAt(i + 16 + s) - 65) << 4) | (str.charCodeAt(i + s) - 65);
},
set_byte: function(str, i, b) {
var s = (i / 16) | 0;
i = (i & 15);
s = s * 32;
str = f5_cspm.setCharAt(str, (i + 16 + s), String.fromCharCode((b >> 4) + 65));
str = f5_cspm.setCharAt(str, (i + s), String.fromCharCode((b & 15) + 65));
return str;
},
set_latency: function(str, latency) {
latency = latency & 0xffff;
str = f5_cspm.set_byte(str, 32, (latency >> 8));
str = f5_cspm.set_byte(str, 33, (latency & 0xff));
str = f5_cspm.set_byte(str, 27, 2);
return str;
},
wait_perf_data: function() {
try {
var wp = window.performance.timing;
if (wp.loadEventEnd > 0) {
var res = wp.loadEventEnd - wp.navigationStart;
if (res < 60001) {
var cookie_val = f5_cspm.set_latency(f5_cspm.f5_p, res);
window.document.cookie = 'aaaaaaaaaaaaaaa=' + encodeURIComponent(cookie_val) + ';path=/';
}
return;
}
} catch (err) {
return;
}
setTimeout(f5_cspm.wait_perf_data, 100);
return;
},
go: function() {
var chunk = window.document.cookie.split(/\s*;\s*/);
for (var i = 0; i < chunk.length; ++i) {
var pair = chunk[i].split(/\s*=\s*/);
if (pair[0] == 'f5_cspm') {
if (pair[1] == '1234') {
var d = new Date();
d.setTime(d.getTime() - 1);
window.document.cookie = 'f5_cspm=;expires=' + d.toUTCString() + ';path=/;';
setTimeout(f5_cspm.wait_perf_data, 100);
}
}
}
}
}
f5_cspm.go();
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment