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
/* Don't forget, the currently unreleased IE10 is supposedly dropping support for conditional comments | |
so we'll need something else in this function to detect IE10 (hopefully, we'll never need to) */ | |
var ie = (function(){ | |
var undef, | |
v = 3, | |
div = document.createElement('div'), | |
all = div.getElementsByTagName('i'); | |
while ( | |
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', |
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
/* Example usage: | |
var widgets = getElementsByClassName(document, "a-css-classname"); | |
for (var i = 0; i < widgets.length; i++) { | |
//Do something with widgets[i] | |
} | |
*/ | |
function getElementsByClassName(node,classname) { | |
if (node.getElementsByClassName) { | |
return node.getElementsByClassName(classname); |
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
/* | |
!! DANGER DANGER WILL ROBINSON | |
*/ | |
document.documentElement.setAttribute('data-ua',navigator.userAgent); | |
document.documentElement.setAttribute('data-platform',navigator.platform); |
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
if (document.location.hostname.indexOf("mydomain.com") > -1) { | |
//GA: Event Tracking, for example | |
$("a[href$=pdf]").click(function () { | |
var name = $(this).attr("title") || ""; | |
_gaq.push(['_trackEvent', 'PDF', 'Download', name]); | |
}); | |
//etc |
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
/* | |
After the page loads, highlight important parts on the page (e.g. navigation), | |
by sequentially applying a css class to each, once. | |
Styles/animation handled by CSS. | |
*/ | |
var $delayHoverAnims = $("[data-delay-hover-anim]"); |
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
/* -------------------------------------- */ | |
//Body background | |
var $bodyBackground = $("[data-body-background]:eq(0)"), | |
backgroundURL = $bodyBackground.attr("data-body-background"); | |
if ($bodyBackground.length > 0) { | |
$body | |
.css("background", "url(" + backgroundURL + ") no-repeat top center #000"); | |
} |
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
/* -------------------------------------- */ | |
//Simple Rotator | |
var $rotatorContainers = $("[data-rotator]"); | |
$rotatorContainers.each(function () { | |
var $container = $(this), | |
$items = $container.children($container.attr("data-rotator")), | |
itemTotal = $items.length - 1, | |
autoplay = $container.attr("data-rotator-autoplay"); |
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
/* -------------------------------------- */ | |
//Content panes with navigation | |
var $panesContainers = $("[data-panes]"); | |
$panesContainers.each(function () { | |
var $container = $(this), | |
$items = $container.children($container.attr("data-panes")), | |
itemTotal = $items.length - 1, | |
$navigation = $container.find($container.attr("data-panes-navigation")); |
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
/* -------------------------------------- */ | |
//iOS-like scrollbar | |
var $niceScrollContainers = $("[data-ios-scroll]"); | |
$niceScrollContainers.each(function () { | |
var $container = $(this), | |
scrollClass = $container.attr("data-ios-scroll"), | |
cursorWidth = "6px", | |
$contentsLastChild = $container.children("*:last-child"); |
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
/* -------------------------------------- */ | |
//Char count & truncate | |
var $charCount = $("[data-char-count]"); | |
$charCount.each(function () { | |
var $this = $(this), | |
$charSelector = $($this.attr("data-char-count")), | |
charMax = $this.attr("data-char-count-max") || false; |
OlderNewer