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
/** | |
* Convert a string into a standard slug by replacing all non alpha numeric characters | |
* with the passed separator or a hyphen. Also removing duplicate separators, and | |
* separators at the beginning or end of a slug. | |
* | |
* @param {String} tring The string slugify. | |
* @param {String} eparator The character or string to substitute. | |
* @returns {String|Undefined} The original, slugified, or undefined string. | |
*/ | |
function slugify(string, separator) { |
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
(function iffe() { | |
var body = document.body; | |
var frm = document.createElement('iframe') | |
body.appendChild(frm); | |
function checkFrm(i) { | |
return !!frm.contentWindow[i] && i !== 'checkFrm'; | |
} | |
var result = Object.keys(window).filter(checkFrm); | |
body.removeChild(frm); | |
console.log(result); |
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
/** | |
* IFFE to kick it all off. | |
*/ | |
(function iffe() { | |
// setup the fbq facebook queue | |
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? | |
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n; | |
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0; | |
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window, | |
document,'script','https://connect.facebook.net/en_US/fbevents.js'); |
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"); |
OlderNewer