Skip to content

Instantly share code, notes, and snippets.

(function(window){
/* clears any divs we've created before */
function cl() {
// clear colours
var s=document.getElementsByClassName('fpser-lay');
var l = s.length-1;
for (var i=l;i>=0;i--) {
try {document.body.removeChild(s[i])} catch(e) {continue;}
}
(function(){
/* scrolls the page to the bottom */
function s2b() {
window.scrollTo(0,0); // reset screen position
count = 0;
sh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
h = Math.max(document.body.offsetHeight,document.body.scrollHeight) - sh;
chunk = 100; // scrollwheel distance?
if (h - chunk < 0) {
@simonhearne
simonhearne / SPA.js
Last active November 25, 2016 02:01
Custom metric for WebPageTest to detect single page application frameworks
var SPA="none";
if (typeof(app)=="object") SPA = "unknown";
if (window.hasOwnProperty('require')) {
if(window.require.hasOwnProperty('defined')){
if(window.require.defined('troopjs-compose/decorator')) SPA = "troop";
if(window.require.defined('flight/lib/component')) SPA = "flight";
}
}
function getCumulativeOffset(obj) {
var left, top;
left = top = 0;
if (obj.offsetParent) {
do {
left += obj.offsetLeft;
top += obj.offsetTop;
} while (obj = obj.offsetParent);
}
return {
[
{"date":"2018-06", "origin":"https://www.cdnetworks.com","effective_connection_type":{"name":"3G"},"form_factor":{"name":"desktop"},"first_paint":{"histogram":{"bin":[{"start":"200","end":"400","density":"0.0021"},{"start":"400","end":"600","density":"0.0062"},{"start":"600","end":"800","density":"0.0052"},{"start":"800","end":"1000","density":"0.0027"},{"start":"1000","end":"1200","density":"0.0039"},{"start":"1200","end":"1400","density":"4.0E-4"},{"start":"1400","end":"1600","density":"0.0017"},{"start":"1600","end":"1800","density":"0.0025"},{"start":"1800","end":"2000","density":"8.0E-4"},{"start":"2000","end":"2200","density":"8.0E-4"},{"start":"2200","end":"2400","density":"0.0017"},{"start":"2400","end":"2600","density":"0.004"},{"start":"2600","end":"2800","density":"0.001"},{"start":"2800","end":"3000","density":"0.0014"},{"start":"3000","end":"3500","density":"0.0011"},{"start":"4000","end":"4500","density":"0.0025"},{"start":"4500","end":"5000","density":"4.0E-4"},{"start":"5000","end":"5500","d
{
"$schema": "https://vega.github.io/schema/vega/v4.json",
"width": 1000,
"height": 600,
"padding": 20,
"autosize": {
"type": "fit",
"resize": true,
"contains": "padding"
},
[
{"origin":"https://www.google.com","json":{"desktop":{"onload":{"median":1.2,"histogram":[{"bin":0,"density":0.0021},{"bin":0.1,"density":0.0021},{"bin":0.2,"density":0.00755},{"bin":0.3,"density":0.00755},{"bin":0.4,"density":0.01},{"bin":0.5,"density":0.01},{"bin":0.6,"density":0.0152},{"bin":0.7,"density":0.0152},{"bin":0.8,"density":0.022},{"bin":0.9,"density":0.022},{"bin":1,"density":0.0236},{"bin":1.1,"density":0.0236},{"bin":1.2,"density":0.02055},{"bin":1.3,"density":0.02055},{"bin":1.4,"density":0.016700000000000003},{"bin":1.5,"density":0.016700000000000003},{"bin":1.6,"density":0.01315},{"bin":1.7,"density":0.01315},{"bin":1.8,"density":0.01025},{"bin":1.9,"density":0.01025},{"bin":2,"density":0.0084},{"bin":2.1,"density":0.0084},{"bin":2.2,"density":0.00685},{"bin":2.3,"density":0.00685},{"bin":2.4,"density":0.0052},{"bin":2.5,"density":0.0052},{"bin":2.6,"density":0.004200000000000001},{"bin":2.7,"density":0.004200000000000001},{"bin":2.8,"density":0.0033499999999999997},{"bin":2.9,"densit
(function(e,t){var n=window.jQuery||window.$||window.optimizely&&window.optimizely.$;n("head").append("<scr"+"ipt>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-49590743-2', 'derp',{'name': 'optimizelyspytool'});ga('optimizelyspytool.send', 'pageview','/"+
(!t?"x/":"")+"'+location.hostname);</sc"+"ript>");n("#opt_container,#opt_styles,#opt_backdrop").remove();n("body").append("<div id='opt_backdrop'/>");n("head").append("<style id='opt_styles'> #opt_backdrop {position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.4);z-index:99999998} .f404 li {font-size:25px !important;margin-top:4px;height:40px;} #opt_container{ position:fixed; overflow-y:auto; backg
This file has been truncated, but you can view the full file.
[{"bin":0,"density":0.00005,"origin":"Ebay","device":"Desktop","timer":"Page Load"},{"bin":0.1,"density":0.00005,"origin":"Ebay","device":"Desktop","timer":"Page Load"},{"bin":0.2,"density":0.0026000000000000003,"origin":"Ebay","device":"Desktop","timer":"Page Load"},{"bin":0.3,"density":0.0026000000000000003,"origin":"Ebay","device":"Desktop","timer":"Page Load"},{"bin":0.4,"density":0.0092,"origin":"Ebay","device":"Desktop","timer":"Page Load"},{"bin":0.5,"density":0.0092,"origin":"Ebay","device":"Desktop","timer":"Page Load"},{"bin":0.6,"density":0.01255,"origin":"Ebay","device":"Desktop","timer":"Page Load"},{"bin":0.7,"density":0.01255,"origin":"Ebay","device":"Desktop","timer":"Page Load"},{"bin":0.8,"density":0.0165,"origin":"Ebay","device":"Desktop","timer":"Page Load"},{"bin":0.9,"density":0.0165,"origin":"Ebay","device":"Desktop","timer":"Page Load"},{"bin":1,"density":0.0243,"origin":"Ebay","device":"Desktop","timer":"Page Load"},{"bin":1.1,"density":0.0243,"origin":"Ebay","device":"Desktop","time
[{"bin":0,"density":0.0003,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":0.1,"density":0.0003,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":0.2,"density":0.00195,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":0.3,"density":0.00195,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":0.4,"density":0.00445,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":0.5,"density":0.00445,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":0.6,"density":0.00685,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":0.7,"density":0.00685,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":0.8,"density":0.00825,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":0.9,"density":0.00825,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":1,"density":0.0091,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":1.1,"density":0.0091,"origin":"Amazon","device":"desktop","timer":"onload"},{"bin":1.2,"density":0.