Skip to content

Instantly share code, notes, and snippets.

@crizCraig
Created March 26, 2012 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crizCraig/2208619 to your computer and use it in GitHub Desktop.
Save crizCraig/2208619 to your computer and use it in GitHub Desktop.
var devsite = devsite || {};
devsite.devsite = devsite.devsite || {};
$(document).ready(function() {
$("a.sign-in-link").bind("mousedown click", devsite.devsite.login);
$("a.sign-out-link").bind("mousedown click", devsite.devsite.logout);
devsite.devsite.loggedIn(function(d, b) {
b ? devsite.devsite.showError("Error while signing in: " + b) : $("#sign-in-io").hasClass("trig") && devsite.reloadWindow()
})
});
window.IO_2012 = function() {
var d = function() {
var e, c, a = function() {
var a = $(this), i = a.parent(), a = a.siblings().clone(), k = i.position(), h = k.top, k = k.left, f = parseInt(i.css("padding-left"), 10);
if (0 === f || e.hasClass("resized")) {
var b = i.find(".photo").width(), f = (i.outerWidth() - b) / 2;
c.css("width", b + 4 * f + "px");
h += f
} else
k += f, c.css("width", "auto");
h += f;
i = f + f / 2;
c.show().empty().append(a).css({padding: 0,top: h + "px",left: k + "px"});
c.animate({paddingTop: i,paddingBottom: i,top: h - 2 * f - 15}, 150);
c.animate({paddingLeft: i,paddingRight: i,
left: k - i}, 150)
}, n = function() {
c.hide();
!e.hasClass("resized") && 980 > e.width() ? e.removeClass("full").addClass("resized") : e.hasClass("resized") && 980 <= e.width() && e.removeClass("resized").addClass("full")
}, j = function(a) {
var e = $(a.target);
c.is(":visible") && !e.is(c) && !$.contains(c[0], e[0]) && !e.is(".expand") && (c.hide(), a.stopPropagation())
}, b = function() {
e = $("#about-features.grid");
c = e.find("#grid-zoom").hide();
980 > e.width() && e.removeClass("full").addClass("resized");
e.find("button.expand").bind("click touchend",
a);
$(window).resize(n);
$(document).bind("click touchend", j)
};
return {init: b}
}(), b = function() {
var e = function() {
$(".expand").bind("click", function() {
$(".col").toggleClass("collapsed");
return !1
})
};
return {init: e}
}(), m = function() {
var e, c, a, b, j, d = function() {
b = b.getTime();
var a = new Date("March 27, 2012 7:00:00 am PDT");
e = a.getTime();
g();
j = setInterval(g, 1E3)
}, g = function() {
b += 1E3;
!a.hasClass("open") && b >= e && b < e + 6048E5 ? (a.addClass("open"), a.find("h3").html("Registration is open"), a.append('<input type="Submit" value="Register" class="small-button red" disabled="disabled" />')) :
b >= e + 6048E5 && (a.removeClass("open").addClass("closed"), a.find("#options").remove(), a.find("h3").html("Registration is closed"), clearInterval(j))
}, i = function() {
c = $("#reg-time");
a = c.find(".oclock");
a.hasClass("closed") ? a.find("h3").html("Registration is closed") : (b = new Date, d(), !a.find(".small-button").length && a.hasClass("open") && (a.find("h3").html("Registration is open"), a.append('<input type="Submit" value="Register" class="small-button red" disabled="disabled" />')));
$("#sign-in-io").click(function(a) {
a.stopPropagation();
$(this).addClass("trig");
devsite.devsite.login()
});
$("#terms").click(function() {
a.find(".small-button").attr("disabled", !$(this).is(":checked"))
})
};
return {init: i}
}(), p = function() {
var e, b, a, d = function() {
var g = this;
a.geocode({latLng: g.position}, function(a, j) {
var h = '<address class="adr"><strong>' + g.title + "</strong>";
if (j === google.maps.GeocoderStatus.OK)
var f = a[0].address_components, h = h + ('<span class="street-address">' + f[0].short_name + " " + f[1].short_name + "</span>"), h = void 0 !== f[7] ? h + ('<span class="locality">' +
f[3].long_name + '</span>, <span class="region">' + f[5].short_name + '</span> <span class="postal-code">' + f[7].short_name + "</span>") : h + ('<span class="locality">' + f[2].long_name + '</span>, <span class="region">' + f[3].short_name + '</span> <span class="postal-code">' + f[5].short_name + "</span>");
h += "</address>";
b.setContent(h);
b.open(e, g)
})
}, j = function(a, b) {
var c = new google.maps.LatLng(a.lat, a.lang), h = a.title, c = new google.maps.Marker({position: c,map: e,title: h,icon: new google.maps.MarkerImage(b.src, null, null,
new google.maps.Point(0, 42))});
google.maps.event.addListener(c, "click", d)
}, o = function() {
var g = [{title: "Moscone Center",lat: 37.783313,lang: -122.402614}, {title: "Marriott Marquis San Francisco",lat: 37.77264,lang: -122.409915}, {title: "W Hotel San Francisco",lat: 37.78512,lang: -122.400563}, {title: "Westin Market Street",lat: 37.786396,lang: -122.402853}, {title: "InterContinental San Francisco",lat: 37.782079,lang: -122.404764}];
b = new google.maps.InfoWindow({content: "holding..."});
a = new google.maps.Geocoder;
e =
new google.maps.Map($("#map")[0], {center: new google.maps.LatLng(g[0].lat, g[0].lang),zoom: 14,mapTypeId: google.maps.MapTypeId.ROADMAP});
var i = document.createElement("img"), d = document.createElement("img");
i.src = "https://chart.googleapis.com/chart?chst=d_map_xpin_letter&chld=pin%7C+%7C4D90FE%7C000000%7CFF0000";
d.src = "https://chart.googleapis.com/chart?chst=d_map_xpin_letter&chld=pin%7C+%7CFF7B6F%7C000000%7CFF0000";
google.maps.event.addDomListenerOnce(i, "load", function() {
j(g[0], i)
});
google.maps.event.addDomListenerOnce(d,
"load", function() {
for (var a = 1; a < g.length; a++)
j(g[a], d)
})
};
return {init: o}
}();
(function() {
for (var b = 0, c = ["ms", "moz", "webkit", "o"], a = 0; a < c.length && !window.requestAnimationFrame; ++a)
window.requestAnimationFrame = window[c[a] + "RequestAnimationFrame"], window.cancelAnimationFrame = window[c[a] + "CancelAnimationFrame"] || window[c[a] + "CancelRequestAnimationFrame"];
window.requestAnimationFrame || (window.requestAnimationFrame = function(a) {
var c = (new Date).getTime(), d = Math.max(0, 16 - (c - b)), g = window.setTimeout(function() {
a(c +
d)
}, d);
b = c + d;
return g
});
window.cancelAnimationFrame || (window.cancelAnimationFrame = function(a) {
clearTimeout(a)
})
})();
var l = function() {
var b = $("<div id='particle_sequence'></div>"), c = "/apps/images/io/particle_hover-frames.jpg", a = 60, d = 124, j = 0, l = function() {
var c = 0;
(function h(f) {
window.requestAnimationFrame(h);
var g = Math.floor(j) * d;
b.css("background-position", "0 -" + g + "px");
g = (f - c) / 10;
j += g / 2;
j >= a && (j = 0);
c = f
})(0)
}, g = function() {
$(window).load(function() {
var a = new Image;
a.onload = function() {
b.css("background",
"url('" + c + "') no-repeat 0 0");
b.hide().appendTo("#experiment .content").fadeIn(function() {
setTimeout(l, 20)
})
};
a.src = c
})
};
return {init: g}
}();
return {about: d,afterHours: b,register: m,travel: p,particle: l}
}();
$(document).ready(function() {
var d = $("#nav-events"), b = d.find(".subnav").hide().css("position", "fixed"), m = b.width();
$("#wrapper").append(b.remove()).bind("click", function(d) {
var l = $(d.target);
b.is(":visible") && !l.is(b) && !$.contains(b[0], l[0]) && !l.is(".subnav") && (b.hide(), d.stopPropagation())
});
d.bind("mouseenter click", function() {
b.show().css({top: d.offset().top + d.height(),left: d.offset().left + d.width() - m})
});
b.bind("mouseleave click", function() {
b.hide()
});
d.bind("click", function() {
b.show()
});
$("#nav-main li:not(#nav-events)").bind("mouseenter",
function() {
b.hide()
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment