Created
July 16, 2013 01:57
-
-
Save brianyang/6005192 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var baseUrl = window.location.hostname, mobile = Modernizr.mq("only screen and ( max-device-width: 568px )"), largeScreen = Modernizr.mq("only screen and ( min-device-width: 1200px )"), prevSc = 0, loaded = !1, hasFlash = !1; | |
try { | |
var fo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); | |
fo && (hasFlash = !0) | |
} catch (e$$12) { | |
void 0 != navigator.mimeTypes["application/x-shockwave-flash"] && (hasFlash = !0) | |
} | |
function cl() { | |
var c = document.getElementsByTagName("body")[0]; | |
c.className += " loaded"; | |
setTimeout(function() { | |
var d = document.getElementById("loader"); | |
c.removeChild(d) | |
}, 1E3); | |
loaded = !0 | |
} | |
window.onload = function() { | |
loaded || cl() | |
}; | |
setTimeout(function() { | |
loaded || cl() | |
}, 5E3); | |
$(function() { | |
function c() { | |
$(".navbar").removeClass("asleep"); | |
$(".mid-nav.affix").addClass("awake") | |
} | |
function d(a) { | |
if (0 !== a.length) { | |
var f = a.offset().top; | |
a.affix({offset: {top: f}}) | |
} | |
} | |
function g() { | |
0 !== l && ($(".anime:in-viewport").parent().addClass("active"), $(".anime").parent(":in-viewport").addClass("active")) | |
} | |
$("a").not('a[href*="' + baseUrl + '"]').not('a[href^="/"]').not('a[href^="mailto:"]').attr({target: "_blank"}); | |
Modernizr.svg || $('img[src*=".svg"]').attr("src", function() { | |
return $(this).attr("src").replace(".svg", | |
".png") | |
}); | |
var e = 0; | |
0 !== $(".item.start").length && (e = $(".item.start").index()); | |
var l = $(".anime").length, m = $(".navbar").height(), b = $("body.case-home").length, h, e = {useCSS: !0,speed: 1E3,slideWidth: 1222,oneToOneTouch: !1,startSlide: e}; | |
mobile || (h = $(".footer .od47").bxSlider(e)); | |
$(".bx-prev").hover(function() { | |
$(".bxslider").stop().animate({marginLeft: "70px"}, 1E3) | |
}, function() { | |
$(".bxslider").stop().animate({marginLeft: 0}, 1E3) | |
}); | |
$(".bx-next").hover(function() { | |
$(".bxslider").stop().animate({marginLeft: "-70px"}, | |
1E3) | |
}, function() { | |
$(".bxslider").stop().animate({marginLeft: 0}, 1E3) | |
}); | |
g(); | |
$("#everything").on("click", ".navbar-over.open", function() { | |
$(".navbar, .navbar-over").removeClass("open") | |
}); | |
$(".navbar-inner").on("click", ".navbar-toggle", function(a) { | |
$(".navbar").hasClass("open") ? $(".navbar, .navbar-over").removeClass("open") : $(".navbar, .navbar-over").addClass("open"); | |
a.preventDefault() | |
}); | |
hasFlash || $(".has-flash").hide(); | |
$(".carousel .overlay, .carousel-inner").on("click", function(a) { | |
$(this).closest(".carousel").carousel("next"); | |
a.preventDefault() | |
}).swipeleft(function(a) { | |
$(this).closest(".carousel").carousel("next"); | |
a.preventDefault() | |
}).swiperight(function(a) { | |
$(this).closest(".carousel").carousel("prev"); | |
a.preventDefault() | |
}); | |
$(window).on({scroll: function() { | |
$("#everything").outerHeight(); | |
var a = $(document).height(), f = $(window).height(), b = $(window).scrollTop(); | |
g(); | |
b < m || b + f >= a - 200 ? c() : b > prevSc ? ($(".navbar-over, .navbar").removeClass("open"), $(".navbar").addClass("asleep"), $(".mid-nav").removeClass("awake")) : c(); | |
prevSc = b; | |
g() | |
}, | |
resize: function() { | |
d($(".mid-nav")) | |
}}); | |
$(document).keydown(function(a) { | |
if (0 !== $(".bxslider").length && !mobile) { | |
switch (a.which) { | |
case 37: | |
h.goToPrevSlide(); | |
break; | |
case 39: | |
h.goToNextSlide(); | |
break; | |
default: | |
return | |
} | |
a.preventDefault() | |
} | |
if (0 !== $(".carousel").length) { | |
switch (a.which) { | |
case 37: | |
$(".carousel").carousel("prev"); | |
break; | |
case 39: | |
$(".carousel").carousel("next"); | |
break; | |
default: | |
return | |
} | |
a.preventDefault() | |
} | |
}); | |
if (1 === b && ($(".shot").on("click", function(a) { | |
var b = $(this).find("a").attr("href"); | |
window.open(b, "_blank"); | |
a.preventDefault() | |
}).find("img").unveil(1E3).on("load", function() { | |
"/img/s.gif" !== $(this).attr("src") && $(this).closest(".shot").addClass("piss") | |
}), $(".mid-nav li").append("<i></i>"), $(".mid-nav li").mouseover(function() { | |
$(this).addClass("me").siblings().removeClass("me") | |
}), $(".mid-nav").mouseout(function() { | |
$(".mid-nav li.active").addClass("me").siblings().removeClass("me") | |
}), !mobile)) { | |
$(".wait").clone().appendTo(".shot"); | |
var j = $(".grid"), k = {itemSelector: ".shot",sortAscending: !1,resizable: !1,getSortData: {likes: function(a) { | |
return parseInt(a.attr("data-likescount"), | |
10) | |
},date: function(a) { | |
return a.attr("data-created") | |
}},sortBy: "date"}, b = $(".mid-nav ul"); | |
b.find("a"); | |
$(window).on("load", function() { | |
j.isotope(k); | |
d($(".mid-nav")) | |
}).smartresize(function() { | |
j.isotope(k); | |
d($(".mid-nav")); | |
$('a:contains("filter")').parent().addClass("active").siblings().removeClass("active") | |
}); | |
b.on("click", "li", function() { | |
var a = $(this), b = a.parents("ul"); | |
if (a.parent().hasClass("active")) | |
return !1; | |
b.find(".active").removeClass("active"); | |
a.addClass("active"); | |
$(".grid img").trigger("unveil"); | |
var c = {}, b = b.attr("data-option-key"), d = a.find("a").attr("data-option-value"); | |
c[b] = "false" === d ? !1 : d; | |
"layoutMode" === b && "function" === typeof changeLayoutMode ? changeLayoutMode(a, c) : j.isotope(c); | |
return !1 | |
}) | |
} | |
if (0 !== $("body.case-googledrive").length || 0 !== $("body.case-sxsw").length) | |
for (b = 1; 7 > b; b++) | |
$("div.clouds").append("<i class=c" + b + "></i>") | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment