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
/** | |
* Throttle functions. | |
* | |
* @param {Function} fn - The function to be throttled. | |
* @param {number} delay - The delay time in milliseconds. | |
* @param {Object|HTMLElement} scope - What this should be inside the function. | |
* @return {Function} - The throttled function wrapped with a new function. | |
*/ | |
function throttle(fn, delay, scope) { | |
delay = delay || 250; |
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
/** | |
* Determines if the passed iframe is a friendly iframe. | |
* | |
* @param {HTMLElement} iframe The iframe under test. | |
* @return {boolean} True if friendly iframe, False otherwise. | |
*/ | |
function isFriendlyIframe(iframe) { | |
var html = null; | |
try { | |
// deal with older browsers |
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
/** | |
* Gathers the page targeting data. | |
* | |
* @private | |
* @param {Object} page - The internal object to append data to. | |
* @returns {undefined} | |
*/ | |
function getPageTargeting(page) { | |
window.googletag.pubads().getTargetingKeys().forEach(function(keys) { | |
page.pageTargeting[keys] = window.googletag.pubads().getTargeting(keys); |
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
(function f() { | |
var frm = document.createElement("iframe"); | |
frm.style.display = "none"; | |
document.body.appendChild(frm); | |
var a = Object.getOwnPropertyNames(frm.contentWindow); | |
var b = Object.getOwnPropertyNames(window); | |
var tab = {}; | |
b.filter(function(c) { | |
return a.indexOf(c) === -1; | |
}).map(function(i) { |
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
(function() { | |
var h = {}; | |
var e = ["background-color", "color", "border-top-color", "border-right-color", "border-bottom-color", "border-left-color"]; | |
var g = { | |
"rgb(0, 0, 0)": 1, | |
"rgba(0, 0, 0, 0)": 1, | |
"rgb(255, 255, 255)": 1 | |
}; | |
[].forEach.call(document.querySelectorAll("*"), function(i) { | |
var j = {}; |
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
(function() { | |
var tab = [].slice.call(document.styleSheets).map(function(e) { | |
return { | |
size: e.cssRules.length / 1e3 + " kb", | |
url: e.href || "Block" | |
} | |
}); | |
console.group("CSS Data"); | |
console.table(tab); | |
console.groupEnd("CSS Data"); |
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
/** | |
* Checks for an elements existence within a RAF within a promise. | |
* | |
* @param {string} selector - The element you wish to find. Defaults to 'body'. | |
* @param {string} target - The parent element to search within. Defaults to document. | |
* @return {Promise} Resolves when the element exists. | |
*/ | |
function elementReady(selector, target) { | |
var options = { |
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
/** | |
* Checks for an elements existence within a RAF within a promise. | |
* | |
* @param {string} selector - The element you wish to find. Defaults to 'body'. | |
* @param {string} target - The parent element to search within. Defaults to document. | |
* @return {Promise} Resolves when the element exists. | |
*/ | |
function elementReady(selector, target) { | |
var options = { | |
target: target || document, |
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
(function() { | |
var tab = [].slice.call(document.styleSheets).map(function(e) { | |
return { | |
size: e.cssRules.length / 1e3 + " kb", | |
url: e.href || "Block" | |
} | |
}); | |
console.group("CSS Data"); | |
console.table(tab); | |
console.groupEnd("CSS Data"); |
NewerOlder