Created
June 9, 2012 18:44
-
-
Save jlogsdon/2902164 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 Neave = Neave || {}; | |
| (function (e) { | |
| var d = false, | |
| g = 0, | |
| b = 0, | |
| i = 0; | |
| function h() { | |
| d = true; | |
| $("#lang").show(); | |
| $("#lang nav").animate({ | |
| left: 0 | |
| }, 100, "easeOutQuad"); | |
| $("#content").animate({ | |
| right: 50 | |
| }, 100, "easeOutQuad") | |
| } | |
| function f() { | |
| d = false; | |
| $("#lang nav").animate({ | |
| left: 50 | |
| }, 100, "easeInQuad", function () { | |
| $("#lang").hide() | |
| }); | |
| $("#content").animate({ | |
| right: 0 | |
| }, 100, "easeInQuad") | |
| } | |
| e.toggleLang = function (j) { | |
| j.preventDefault(); | |
| if (d) { | |
| f() | |
| } else { | |
| h() | |
| } | |
| }; | |
| e.updateDots = function () { | |
| if (!e.isIE7) { | |
| e.$dotsDivs.removeClass("dot-over"); | |
| $("#dots .dot:eq(" + i + ") div").addClass("dot-over") | |
| } | |
| }; | |
| e.getMenuItem = function () { | |
| if (i === 0) { | |
| return e.$menuIntro | |
| } | |
| return $("#menu li:eq(" + (i - 1) + ")") | |
| }; | |
| e.hideItems = function () { | |
| e.$menuIntro.hide(); | |
| e.$menuItems.hide() | |
| }; | |
| e.hideMenuItem = function () { | |
| var j = e.getMenuItem(); | |
| if (e.hasCSS3D) { | |
| j.addClass("hide-item").removeClass("show-item"); | |
| setTimeout(e.hideItems, 175) | |
| } else { | |
| j.stop(true, true).animate({ | |
| opacity: 0, | |
| marginTop: 50 | |
| }, 150, "easeInQuad", e.hideItems) | |
| } | |
| }; | |
| e.showMenuItem = function () { | |
| var j = e.getMenuItem(); | |
| if (e.hasCSS3D) { | |
| clearTimeout(b); | |
| j.addClass("reset-item").removeClass("hide-item").show(); | |
| b = setTimeout(function () { | |
| j.addClass("show-item").removeClass("reset-item") | |
| }, 50) | |
| } else { | |
| j.css({ | |
| opacity: 0, | |
| marginTop: -25 | |
| }).show().delay(50).animate({ | |
| opacity: 1, | |
| marginTop: 0 | |
| }, 150, "easeOutQuad") | |
| } | |
| e.updateDots() | |
| }; | |
| e.addVoronoiSWF = function () { | |
| if (window.swfobject && swfobject.hasFlashPlayerVersion("10.0.0")) { | |
| e.$viewH1.hide(); | |
| var j = e.$viewH1.css("background-image").replace(/^url|[\(\)]/g, "") || ""; | |
| swfobject.createSWF({ | |
| data: e.staticURL + "home-voronoi.1.swf", | |
| width: "800", | |
| height: "260", | |
| }, { | |
| wmode: "opaque", | |
| bgcolor: "#000000", | |
| menu: "false", | |
| allowscriptaccess: "always", | |
| flashvars: "logo=" + j | |
| }, "voronoi") | |
| } else { | |
| e.$viewH1.css("opacity", 1) | |
| } | |
| }; | |
| e.goToItem = function (j) { | |
| if (i === j || e.aboutMode) { | |
| return | |
| } | |
| if (j < 0) { | |
| j = e.totalItems | |
| } else { | |
| if (j > e.totalItems) { | |
| j = 0 | |
| } | |
| } | |
| if (window.Voronoi) { | |
| if (j === 0) { | |
| Voronoi.start() | |
| } else { | |
| Voronoi.stop() | |
| } | |
| } | |
| if (e.hasCSS3D) { | |
| e.hideMenuItem(); | |
| e.$viewDiv.css("-webkit-transform", "translate3d(" + (j * -800) + "px,0,0)"); | |
| clearTimeout(g); | |
| g = setTimeout(e.showMenuItem, 325) | |
| } else { | |
| e.$viewNav.stop(true, false).animate({ | |
| scrollLeft: j * 800 | |
| }, 300, "easeInOutQuad", e.showMenuItem) | |
| } | |
| e.hideMenuItem(); | |
| i = j; | |
| e.updateDots() | |
| }; | |
| e.previousItem = function () { | |
| e.goToItem(i - 1) | |
| }; | |
| e.nextItem = function () { | |
| e.goToItem(i + 1) | |
| }; | |
| e.goToHome = function () { | |
| if (e.aboutMode && !e.aboutPage) { | |
| if (e.hasHistory) { | |
| window.history.pushState(null, null, "../") | |
| } | |
| e.hideAbout() | |
| } else { | |
| e.goToItem(0) | |
| } | |
| }; | |
| e.goToLink = function () { | |
| if (i > 0) { | |
| window.location = $("#menu a:eq(" + i + ")").attr("href") | |
| } | |
| }; | |
| e.goToDot = function (k) { | |
| var j = $(k.target); | |
| var l = e.$dotsDivs.index(j); | |
| if (l === -1) { | |
| l = $("#dots .dot").index(j) | |
| } | |
| if (l !== -1) { | |
| e.goToItem(l) | |
| } | |
| }; | |
| e.showPrivacy = function () { | |
| $("#privacy").show(); | |
| $("#privacy a img").css("opacity", 1); | |
| if (!window.IubendaTrack) { | |
| e.addScript("https://cdn.iubenda.com/iubenda.js") | |
| } | |
| }; | |
| function a() { | |
| e.$viewButtons.hide(); | |
| if (e.hasCSS3D) { | |
| e.$aboutDiv.addClass("show-about").css("opacity", 1).removeClass("reset-about"); | |
| setTimeout(function () { | |
| e.$aboutBack.css("opacity", 1); | |
| e.$aboutPhoto.css("opacity", 1); | |
| setTimeout(function () { | |
| e.$aboutArticle.css("opacity", 1); | |
| e.$copyright.show(); | |
| e.showPrivacy() | |
| }, 100) | |
| }, 250) | |
| } else { | |
| e.$aboutDiv.animate({ | |
| opacity: 1, | |
| marginTop: 0 | |
| }, 250, "easeOutQuad", function () { | |
| e.$aboutBack.animate({ | |
| opacity: 1 | |
| }, 100); | |
| e.$aboutPhoto.animate({ | |
| opacity: 1 | |
| }, 100, function () { | |
| e.$aboutArticle.animate({ | |
| opacity: 1 | |
| }, 100); | |
| e.$copyright.show(); | |
| e.showPrivacy() | |
| }) | |
| }) | |
| } | |
| } | |
| e.showAbout = function () { | |
| if (e.aboutMode) { | |
| return | |
| } | |
| e.aboutMode = true; | |
| if (window.Voronoi) { | |
| Voronoi.stop() | |
| } else { | |
| if (window.swfobject) { | |
| swfobject.removeSWF("voronoi"); | |
| $("#view-home").append('<div id="voronoi"></div>') | |
| } | |
| } | |
| if (e.hasCSS3D) { | |
| $("#about>div,#about article,#about img,#about .button").css("opacity", 0); | |
| e.$aboutDiv.addClass("reset-about").show(); | |
| e.$viewDots.css("opacity", 0) | |
| } else { | |
| $("#about>div,#about article,#about img,#about .button").css("opacity", 0); | |
| e.$aboutDiv.css({ | |
| marginTop: -50 | |
| }).show(); | |
| e.$viewDots.animate({ | |
| opacity: 0 | |
| }, 250) | |
| } | |
| e.$copyright.hide(); | |
| setTimeout(function () { | |
| if (e.hasCSS3D) { | |
| e.$viewButtons.css("opacity", 0) | |
| } else { | |
| e.$viewButtons.fadeOut(150) | |
| } | |
| e.hideMenuItem(); | |
| setTimeout(a, 300) | |
| }, 300) | |
| }; | |
| function c() { | |
| e.$aboutDiv.hide(); | |
| if (e.hasCSS3D) { | |
| e.$aboutDiv.removeClass("hide-about"); | |
| e.$viewButtons.css("opacity", 1) | |
| } else { | |
| e.$viewButtons.fadeIn(150) | |
| } | |
| setTimeout(function () { | |
| if (e.hasCSS3D) { | |
| e.$viewDots.css("opacity", 1) | |
| } else { | |
| e.$viewDots.animate({ | |
| opacity: 1 | |
| }, 250) | |
| } | |
| e.showMenuItem(); | |
| e.aboutMode = false; | |
| if (window.Voronoi) { | |
| setTimeout(Voronoi.start, 100) | |
| } else { | |
| e.addVoronoiSWF() | |
| } | |
| }, 100) | |
| } | |
| e.hideAbout = function () { | |
| if (!e.aboutMode) { | |
| return | |
| } | |
| e.$copyright.hide(); | |
| if (e.hasCSS3D) { | |
| e.$aboutBack.css("opacity", 0); | |
| e.$aboutArticle.css("opacity", 0); | |
| setTimeout(function () { | |
| e.$aboutPhoto.css("opacity", 0); | |
| setTimeout(function () { | |
| e.$aboutDiv.addClass("hide-about").css("opacity", 0).removeClass("show-about"); | |
| e.$viewButtons.show(); | |
| setTimeout(c, 200) | |
| }, 100) | |
| }, 100) | |
| } else { | |
| e.$aboutBack.animate({ | |
| opacity: 0 | |
| }, 100); | |
| e.$aboutArticle.animate({ | |
| opacity: 0 | |
| }, 100, function () { | |
| e.$aboutPhoto.animate({ | |
| opacity: 0 | |
| }, 100, function () { | |
| e.$aboutDiv.animate({ | |
| opacity: 0, | |
| marginTop: 25 | |
| }, 150, "easeInQuad"); | |
| setTimeout(c, 200) | |
| }) | |
| }) | |
| } | |
| }; | |
| e.openContactWindow = function (o) { | |
| var q = 550, | |
| r = window.screenX || 0, | |
| l = r ? $(window).width() : screen.availWidth, | |
| m = 370, | |
| n = window.screenY || 0, | |
| j = n ? $(window).height() : screen.availHeight, | |
| k = r + (l - q) / 2, | |
| p = n + (j - m) / 2 + 50; | |
| window.open(o.target.href, "neavecontact", "resizable=yes,toolbar=no,scrollbars=yes,status=no,width=" + q + ",height=" + m + ",left=" + k + ",top=" + p); | |
| o.preventDefault() | |
| }; | |
| e.updateSize = function () { | |
| if ($(window).height() <= 640) { | |
| $("#sponsor").hide() | |
| } else { | |
| $("#sponsor").show() | |
| } | |
| } | |
| }(Neave)); | |
| $(document).ready(function (f) { | |
| if (Neave.isIE6) { | |
| return | |
| } | |
| var g = $("#view"), | |
| d = $("#dots"), | |
| c, j, a = new Image(), | |
| k = new Image(); | |
| a.src = Neave.staticURL + "assets/images/mt-dark.png"; | |
| k.src = Neave.staticURL + "assets/images/arrow-dark.png"; | |
| Neave.aboutMode = Neave.aboutPage = $("body").hasClass("about"); | |
| Neave.$viewNav = $("#view nav"); | |
| Neave.$viewDiv = $("#view nav>div"); | |
| Neave.$viewList = $("#view ul"); | |
| Neave.$viewH1 = $("#view h1"); | |
| Neave.$viewButtons = $("#left,#right"); | |
| Neave.$viewDots = $("#view,#dots"); | |
| Neave.$menuIntro = $("#menu>p"); | |
| Neave.$menuItems = $("#menu li"); | |
| Neave.$aboutDiv = $("#about>div"); | |
| Neave.$aboutArticle = $("#about article"); | |
| Neave.$aboutPhoto = $("#photo"); | |
| Neave.$aboutBack = $("#about .button"); | |
| Neave.totalItems = Neave.$menuItems.size(); | |
| Neave.$copyright = $("#copy"); | |
| $("#menu li a,#view li a").attr("target", "_top"); | |
| if (Neave.hasCSS3D) { | |
| Neave.$viewDiv.addClass("view-has3d") | |
| } | |
| if (Neave.hasCanvas) { | |
| $.ajaxSetup({ | |
| cache: true | |
| }); | |
| $.getScript(Neave.staticURL + "assets/js/home-voronoi.1.js", function () { | |
| if (window.Voronoi) { | |
| var i = $("#voronoi canvas"), | |
| e = i[0]; | |
| e.onselectstart = Neave.preventDefault; | |
| Voronoi.init(e, 800, 260, Neave.isTouch); | |
| Voronoi.start(); | |
| if (Neave.hasCSS3D) { | |
| Neave.$viewH1.addClass("fade-500"); | |
| i.addClass("fade-500"); | |
| setTimeout(function () { | |
| i.css("opacity", 1) | |
| }, 600); | |
| setTimeout(function () { | |
| Neave.$viewH1.css("opacity", 1) | |
| }, 300) | |
| } else { | |
| i.css("opacity", 1).hide().delay(600).fadeIn(500); | |
| Neave.$viewH1.delay(300).animate({ | |
| opacity: 1 | |
| }, 500, Voronoi.start) | |
| } | |
| } | |
| }); | |
| $.ajaxSetup({ | |
| cache: false | |
| }) | |
| } else { | |
| $.getScript(Neave.staticURL + "assets/js/libs/swfobject.2.2.js", Neave.addVoronoiSWF) | |
| } | |
| if (!Neave.isIE7) { | |
| for (c = Neave.totalItems + 1; c--;) { | |
| d.append('<div class="dot"><div class="dot-out"></div></div>') | |
| } | |
| Neave.$dotsDivs = $("#dots .dot div"); | |
| Neave.updateDots() | |
| } | |
| function h() { | |
| g.removeClass("view-down") | |
| } | |
| function b() { | |
| g.addClass("view-down") | |
| } | |
| if (Neave.isTouch) { | |
| $("#flag").bind({ | |
| touchstart: Neave.preventDefault, | |
| touchend: Neave.toggleLang | |
| }); | |
| $("#left").bind({ | |
| touchstart: Neave.preventDefault, | |
| touchend: Neave.previousItem | |
| }); | |
| $("#right").bind({ | |
| touchstart: Neave.preventDefault, | |
| touchend: Neave.nextItem | |
| }); | |
| $("#dots .dot").bind("touchend", Neave.goToDot); | |
| $("#logo div,header h1").bind("touchend", Neave.goToHome) | |
| } else { | |
| if (Neave.isIE7) { | |
| Neave.$viewList.width((Neave.totalItems + 1) * 800) | |
| } else { | |
| $("#flag").click(Neave.toggleLang); | |
| $("#dots .dot").mouseover(Neave.goToDot) | |
| } | |
| $("#left").buttonClick(Neave.previousItem); | |
| $("#right").buttonClick(Neave.nextItem); | |
| Neave.$viewButtons.mouseover(function () { | |
| $(this).addClass("view-button-hover") | |
| }).mouseout(function () { | |
| $(this).removeClass("view-button-hover") | |
| }); | |
| $("#logo div,header h1").click(Neave.goToHome); | |
| $("#head-contact a").click(Neave.openContactWindow); | |
| if (!Neave.aboutPage) { | |
| $("#view a").mousedown(b).mouseout(h).mouseup(h).focus(function (i) { | |
| Neave.hideItems(); | |
| setTimeout(function () { | |
| Neave.getMenuItem().css({ | |
| opacity: 1, | |
| marginTop: 0 | |
| }).show() | |
| }, 50) | |
| }); | |
| $(document).keydown(function (i) { | |
| if (i.keyCode === 37) { | |
| $("#left").addClass("view-button-active") | |
| } else { | |
| if (i.keyCode === 39) { | |
| $("#right").addClass("view-button-active") | |
| } | |
| } | |
| }).keyup(function (i) { | |
| if (i.keyCode === 37) { | |
| $("#left").removeClass("view-button-active"); | |
| Neave.previousItem() | |
| } else { | |
| if (i.keyCode === 39) { | |
| $("#right").removeClass("view-button-active"); | |
| Neave.nextItem() | |
| } else { | |
| if (i.keyCode === 13) { | |
| Neave.goToLink() | |
| } | |
| } | |
| } | |
| }) | |
| } | |
| } | |
| $("#lang a").click(function (l) { | |
| var i = $(l.target).attr("alt"); | |
| if (!i) { | |
| i = $(l.target).attr("hreflang"); | |
| if (!i) { | |
| i = "en" | |
| } | |
| } | |
| if (i === "pt-BR") { | |
| i = "pt" | |
| } | |
| Neave.setLangCookie(i) | |
| }); | |
| if (Neave.aboutPage) { | |
| Neave.showPrivacy() | |
| } else { | |
| $("#head-about a,#menu>p>a").click(function (i) { | |
| i.preventDefault(); | |
| if (Neave.hasHistory && !Neave.aboutMode) { | |
| window.history.pushState("about", null, i.target.href) | |
| } | |
| Neave.showAbout() | |
| }); | |
| Neave.$aboutBack.click(Neave.preventDefault).buttonClick(function () { | |
| if (Neave.hasHistory) { | |
| window.history.pushState(null, null, "../") | |
| } | |
| Neave.hideAbout() | |
| }); | |
| if (Neave.hasHistory) { | |
| $(window).bind("popstate", function (i) { | |
| if (i.originalEvent.state === "about") { | |
| Neave.showAbout() | |
| } else { | |
| Neave.hideAbout() | |
| } | |
| }) | |
| } | |
| if (Neave.hasCSS3D) { | |
| Neave.$viewButtons.addClass("fade-150"); | |
| Neave.$viewDots.addClass("fade-250"); | |
| $("#about img,#about article").addClass("fade-100") | |
| } | |
| } | |
| $("#about a").click(function (i) { | |
| Neave.trackLink("Outbound", i.target.href) | |
| }); | |
| $("#head-mt a").click(function (i) { | |
| Neave.trackLink("Outbound", i.target.href); | |
| if (!document.referrer) { | |
| i.preventDefault(); | |
| window.open("http://mediatemple.net/#a_aid=4fbca323cfb37", "_blank") | |
| } | |
| }); | |
| $("#content").noisy(); | |
| if (Neave.isIE7or8) { | |
| $(window).resize(Neave.updateSize) | |
| } | |
| Neave.updateSize(); | |
| if (!Neave.isiPad && !Neave.isIE7or8) { | |
| window.fbAsyncInit = function () { | |
| FB.init(); | |
| FB.XFBML.parse($("#head-share")[0]) | |
| }; | |
| Neave.addFBScript(); | |
| Neave.addScript("//platform.twitter.com/widgets.js") | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment