This repository has been archived by the owner on Nov 23, 2019. It is now read-only.
forked from COSCUP/2011-theme
-
Notifications
You must be signed in to change notification settings - Fork 3
/
script.min.js
34 lines (33 loc) · 16.3 KB
/
script.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"use stricts";
(function(){var a={b:function(){var j=document,k=j.body,l=window.applicationCache;if(l)if(k){this.info=j.getElementById("appcache_info");if(!this.info){j.a=j.createElement;var g=j.a("a"),j=j.a("div");j.id="appcache_info";g.href="";g.addEventListener("click",function(a){a.stopPropagation();window.location.reload()},!0);j.appendChild(g);k.firstChild&&k.insertBefore(j,k.firstChild);this.info=j}"checking,downloading,progress,noupdate,cached,updateready,obsolete,error".split(",").forEach(function(j){l.addEventListener(j,a)})}else console.log("Premature init. Put the <script> in <body>.")},
handleEvent:function(a){this.info.className=this.info.className.replace(/ ?appcache\-.+\b/g,"")+" appcache-"+a.type;"downloading"===a.type&&(this.count=0);"progress"===a.type&&(this.count++,this.info.setAttribute("data-progress",a.total?a.loaded+1+"/"+a.total:this.count))}};a.b()})();
jQuery(function(a){function j(){return!a("#title:visible").length}function k(){var d=[];a("#mobileSponsorLogo").remove();a.each({diamond:10,gold:5,silver:2,bronze:1},function(b,e){a("#sidebar > .sponsors ."+b+" a").each(function(){for(var a=e;a--;)d.push(this)})});0!==d.length&&a("#nav").after(a('<p id="mobileSponsorLogo" />').append(a(d[Math.floor(d.length*Math.random())]).clone()))}function l(){if(a("table.program").length)if(n){a("#video_modal, #video_close_button").live("click",function(){a(".video_box").remove();
a(window).unbind("scroll.repositionvideo resize.repositionvideo pageload.repositionvideo")});a(".shortcuts a").live("click",function(f){a(window).trigger("scroll");f.preventDefault();a(document.body).animate({scrollTop:a(this.hash).offset().top-20},180)});var d=function(){var f={};a(".types li").each(function(c){f[(c+1).toString(10)]=a(this).text()});return f}();a.fn.translateTo=function(a){return a?(a+=10,this.addClass("translate").css({"-webkit-transform":"translateX("+a.toString(10)+"px)","-moz-transform":"translateX("+
a.toString(10)+"px)","-ms-transform":"translateX("+a.toString(10)+"px)",transform:"translateX("+a.toString(10)+"px)"})):this.removeClass("translate").css({"-webkit-transform":"","-moz-transform":"","-ms-transform":"",transform:""})};var b;a("table.program").each(function(){var f=a(this);f.prev().after(a('<div class="program" />').append(f).bind("scroll",function(){var c=a(this);c.find("thead th:first, tbody th").translateTo(0);clearTimeout(b);b=setTimeout(function(){c.find("thead th:first, tbody th").translateTo(c.scrollLeft())},
200)}).bind("touchstart",function(c){var f=a(this),b=a(window),d=c.clientX||c.originalEvent.touches[0].clientX,h=c.clientY||c.originalEvent.touches[0].clientY;f.hasClass("expend")&&!j()&&(f.addClass("movestart"),b.bind("touchmove",function(a){f.removeClass("movestart").addClass("moving").scrollLeft(f.scrollLeft()+d-(a.clientX||a.originalEvent.touches[0].clientX));"touchmove"!==a.type&&b.scrollTop(b.scrollTop()+h-(a.clientY||a.originalEvent.touches[0].clientY));d=a.clientX||a.originalEvent.touches[0].clientX;
h=a.clientY||a.originalEvent.touches[0].clientY}).bind("touchend",function(){b.unbind("touchmove touchend");setTimeout(function(){f.removeClass("moving movestart")},0);return!1}))}))});a("table.program td").each(function(){var f=a(this),c=n[f.data("pid")];if(c)if(0===c.type){var b=a('<ul class="meta" />');if(c.slide){var i=a('<li><a href="'+c.slide+'">'+{en:"Slide","zh-tw":"\u6295\u5f71\u7247","zh-cn":"\u6295\u5f71\u7247"}[g||"en"]+"</a></li>");b.append(i)}if(c.youtube){var i=[].concat(c.youtube),
e="http://www.youtube.com/embed/"+i.shift()+"?hd=1";c.youtube.length&&(e+="&playlist="+i.join(","));i=a('<li><a href="'+e+'" class="youtube_video">'+{en:"Video","zh-tw":"\u6f14\u8b1b\u9304\u5f71","zh-cn":"\u6f14\u8bb2\u5f55\u5f71"}[g||"en"]+"</a></li>");b.append(i)}b.children().length&&f.append(b)}else{var h=a('<ul class="meta" />'),b=a('<ul class="meta" />'),i={en:"English",zh:"\u6f22\u8a9e"}[(this.className.match(/program_lang_(\w+)\b/)||[])[1]],e=d[(this.className.match(/program_type_(\w+)\b/)||
[])[1]];i&&h.append(a("<li />").text(i));e&&h.append(a("<li />").text(e));c.slide&&(i=a('<li><a href="'+c.slide+'">'+{en:"Slide","zh-tw":"\u6295\u5f71\u7247","zh-cn":"\u6295\u5f71\u7247"}[g||"en"]+"</a></li>"),b.append(i),h.append(i.clone()));c.youtube&&(i=[].concat(c.youtube),e="http://www.youtube.com/embed/"+i.shift()+"?hd=1",c.youtube.length&&(e+="&playlist="+i.join(",")),i=a('<li><a href="'+e+'" class="youtube_video">'+{en:"Video","zh-tw":"\u6f14\u8b1b\u9304\u5f71","zh-cn":"\u6f14\u8bb2\u5f55\u5f71"}[g||
"en"]+"</a></li>"),b.append(i),h.append(i.clone()));i=a('<div class="info" />');h.children().length&&i.append(h);c["abstract"]&&i.append(a('<div class="abstract" />').html(c["abstract"]));c.bio&&i.append(a('<div class="bio" />').html(c.bio));b.children().length&&f.append(b);i.children().length&&f.append(i)}}).bind("click",function(){var b=a(this),c=b.parents("div.program"),d=parseInt((this.className.match(/program_room_(\w+)\b/)||[])[1]),e=a(window).scrollTop()-b.offset().top;if(c.hasClass("moving"))return!1;
window._gaq&&_gaq.push(["_trackEvent","Program 2012",this.hash]);a(this).toggleClass("expend");c.toggleClass("expend");c.find("thead th:first, tbody th").translateTo(c.scrollLeft());switch(d){case 0:c.scrollLeft(0.26*c[0].scrollWidth);break;case 1:c.scrollLeft(0);break;case 2:c.scrollLeft(0.13*c[0].scrollWidth);break;case 3:c.scrollLeft(0.38*c[0].scrollWidth);break;case 4:c.scrollLeft(c[0].scrollWidth)}a(window).scrollTop(b.offset().top+e)});a(".program p.name a").bind("click",function(a){if(2==a.which||
a.metaKey)return!0;a.preventDefault()});a(".program .meta a, .program .info a").bind("click",function(b){if(2==b.which||b.metaKey)return!0;if(a(this).hasClass("youtube_video")&&!j()){if(a(document.body).append('<div id="video_modal" class="video_box" />').append('<iframe id="video_iframe" class="video_box" title="YouTube video player" width="854" height="483" src="'+this.href+'" frameborder="0" allowfullscreen="allowfullscreen"></iframe>').append('<div id="video_close_button" class="video_box" />'),
0===a("#video_modal").offset().top){a(".video_box").css("position","absolute");var c=function(){a("#video_modal").css({top:0,left:0,width:document.body.scrollWidth,height:document.body.scrollHeight});a("#video_iframe, #video_close_button").css({top:a(window).scrollTop()+(window.innerHeight||a(window).height())/2,left:a(window).scrollLeft()+(window.innerWidth||a(window).width())/2})};c();a(window).bind("scroll.repositionvideo resize.repositionvideo",c).bind("pageload.repositionvideo",function(b){a(window).unbind("scroll.repositionvideo resize.repositionvideo").unbind(b)})}}else window.open(this.href);
b.preventDefault();b.stopPropagation()})}else{var e=window.location.href.match(/^http:\/\/coscup.org\/[^\/]+\//)[0]+"api/program/";a.getJSON(e,function(a){n=a.program;l()})}}var g=(a("html").attr("lang")||"zh-TW").toLowerCase(),m={init:function(){this._loadPage();if(window.history.pushState){var d="state"in window.history,b=location.href;a("a").live("click",function(b){if(2==b.which||b.metaKey||this.hostname!==window.location.hostname||!/2012/.test(this.pathname)||!RegExp(g).test(this.pathname.toLowerCase())||
"#"===this.getAttribute("href").substr(0,1)||/nocache/.test(this.getAttribute("rel")))return!0;a(this).parent("#nav li").addClass("loading");var b=this.href,f=this.href===window.location.href;history.pushState({is:"pushed"},"",b);m._getPage(b,f,!0);d=!0;return!1});window.onpopstate=function(){var a=!d&&location.href==b;d=!0;a||m._getPage(window.location.href,!1,!1)}}},_getPage:function(d,b,e){a(window).unbind("resize.defer");this._xhr&&this._xhr.abort();var f=a("#content").addClass("loading");this._xhr=
a.ajax({url:d,dataType:"html",complete:function(b,g){if("success"!==g&&"notmodified"!==g)window.location.replace(d);else{f.removeClass("loading");e&&a(window).scrollTop(0);var i=a("<div />").append(b.responseText.match(/<body\b([^\u0000]+)<\/body>/)[0].replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,""));document.title=b.responseText.match(/<title>(.+)<\/title>/)[1];a("#content").html(i.find("#content").children()).removeClass("loading");i.find("#nav").is(".empty")||a("#nav").html(i.find("#nav").children());
window._gaq&&_gaq.push(["_trackPageview"]);this._loadPage()}}})},_xhr:void 0,_loadPage:function(){a(window).trigger("pageload");j()?(window._gaq&&_gaq.push(["_trackEvent","Mobile 2012",window.location.href]),a(window).bind("resize.defer",function(){j()||(a(this).unbind("resize.defer"),m._fullLoad(),m._resumeLoad())}),this._deferLoad()):this._fullLoad()},_deferLoad:function(){a(window).trigger("deferpageload")},_resumeLoad:function(){a(window).trigger("resumepageload");a(window).trigger("fullpageload")},
_fullLoad:function(){a(window).trigger("fullpageload")}};a("#nav.empty").length&&a.getJSON("http://coscup.org/2012/api/menu/?callback=?",function(d){a("#nav").removeClass("empty").html(d[g].replace(/href="(\/[^\/])/g,'href="http://coscup.org$1'));a('#nav a[href*="'+window.location.hostname+'"]').parent().addClass("current")});a("#sidebar > .sponsors.empty").length&&a.getJSON("http://coscup.org/2012/api/sponsors/?callback=?",function(d){var b=a("#sidebar > .sponsors").removeClass("empty"),e={en:{diamond:"Diamond Level Sponsors",
gold:"Gold Level Sponsors",silver:"Silver Level Sponsors",bronze:"Bronze Level Sponsors",media:"Media Partners"},"zh-tw":{diamond:"\u947d\u77f3\u7d1a\u8d0a\u52a9",gold:"\u9ec3\u91d1\u7d1a\u8d0a\u52a9",silver:"\u767d\u9280\u7d1a\u8d0a\u52a9",bronze:"\u9752\u9285\u7d1a\u8d0a\u52a9",media:"\u5a92\u9ad4\u5925\u4f34"},"zh-cn":{diamond:"\u94bb\u77f3\u7ea7\u8d5e\u52a9",gold:"\u9ec4\u91d1\u7ea7\u8d5e\u52a9",silver:"\u767d\u94f6\u7ea7\u8d5e\u52a9",bronze:"\u9752\u94dc\u7ea7\u8d5e\u52a9",media:"\u5a92\u4f53\u4f19\u4f34"}}[g];
a.each(["diamond","gold","silver","bronze","media"],function(f,c){if(d[c]){b.append("<h2>"+e[c]+"</h2>");var j=a('<ul class="'+c+'" />');a.each(d[c],function(a,b){j.append('<li><a href="'+b.url+'" target="_blank"><img title="'+b.name[g]+'" src="'+b.logoUrl+'" /></a></li>')});b.append(j)}});k()});a(".sponsors a, #mobileSponsorLogo a").live("click",function(){window._gaq&&_gaq.push(["_trackEvent","Sponsors 2012",this.href]);return!0});a("#mobileSponsorLogo a").live("click",function(){window._gaq&&_gaq.push(["_trackEvent",
"Sponsors 2012 (Mobile only)",this.href]);return!0});a("#nav > ul > li").bind("touchstart",function(){var d=a(this);d.addClass("selected");a(document.body).bind("touchend",function(b){d.removeClass("selected");a(this).unbind(b)})});a(window).bind("pageload",k);a(window).bind("pageload",function(){if(a(".shortcuts").length&&!((new Date).getTime()>parseInt(a(".program tbody th:last").attr("rel")+"000",10))){var d=a('<a href="#" />').text({"zh-tw":"\u76ee\u524d\u8b70\u7a0b","zh-cn":"\u76ee\u524d\u8bae\u7a0b",
en:"Current Session"}[g]);d.bind("click",function(b){var c=(new Date).getTime(),d;b.stopPropagation();b.preventDefault();a(".program tbody th").each(function(b,f){var e=parseInt(a(f).attr("rel")+"000",10);if(c<e&&d)return a(document.body).animate({scrollTop:a(d).offset().top-20},180),a(window).trigger("scroll"),!1;c>e&&(d=f)});d||(a(document.body).animate({scrollTop:a(".program tbody th:first").offset().top-20},180),a(window).trigger("scroll"))});a(".shortcuts").append(a('<li class="fullwidth" />').append(d));
a(".shortcuts").after('<a class="mobile_top" href="#"></a>');var b=a(".mobile_top"),e;b.bind("click",function(){a(window).trigger("scroll");a(document.body).animate({scrollTop:a(".shortcuts").offset().top-20},180);return!1});a(window).bind("resize.mt scroll.mt",function(){b.removeClass("show");clearTimeout(e);e=setTimeout(function(){a(".shortcuts").offset().top<a(document.body).scrollTop()&&b.css("top",a(document.body).scrollTop()+(window.innerHeight||a(window).height())-b.height()-15).addClass("show")},
200)});a(window).bind("pageload",function(b){clearTimeout(e);a(window).unbind("resize.mt scroll.mt").unbind(b)})}});a(window).bind("pageload",function(){a("#header").css("background-position","center -"+(75*Math.floor(4*Math.random())).toString(10)+"px");a("#footer").css("background-position","center -"+(75*Math.floor(6*Math.random())).toString(10)+"px")});a(window).bind("fullpageload",function(){if(a("#sidebar2 > .images").length){var d=function(){a("#sidebar2 > .images").imageTile({num:12,photos:yuren_54,
beforeImageLoad:function(a){a.css("opacity",0)},imageLoad:function(a){a.css("opacity",1)}})};a.fn.imageTile?d():a.ajax({url:"http://coscup.org/2012-theme/assets/imagetile.min.js",dataType:"script",cache:!0,success:d})}});a(window).bind("fullpageload",function(){if(a("#sidebar2 > .socialbuzz").length){a(".socialbuzz a").live("click",function(){window.open(this.href);return!1});var d,b,e=function(b,c){var d=a("<ul />"),e=[];if(c)for(var g=0,h;2>g;){h=c.results.shift();if(!h)break;!/plurk\.com/.test(h.source)&&
!/^RT/.test(h.text)&&-1===a.inArray(h.from_user,e)&&(e.push(h.from_user),d.append(a("<li />").append(a('<span class="text" />').html(h.text)).append('<span class="meta"><a href="https://twitter.com/#!/'+h.from_user+"/status/"+h.id_str+'">@'+h.from_user+"</a></span>")),g++)}if(b)for(g=0;2>g;){h=b.plurks.shift();if(!h)break;b.users[h.user_id]&&!/plurk\.com\/(m\/)?\p\//.test(h.content)&&-1===a.inArray(b.users[h.user_id].nick_name,e)&&(e.push(b.users[h.user_id].nick_name),d.append(a("<li />").append(a('<span class="text" />').html(h.content)).append('<span class="meta"><a href="http://www.plurk.com/p/'+
h.plurk_id.toString(36)+'">@'+b.users[h.user_id].nick_name+"</a></span>")),g++)}a("#sidebar2 > .socialbuzz").empty().append(d)};a.getJSON("http://coscup.org/2012/api/plurk/",function(a){d=a;e(d,b)});a.getJSON("https://search.twitter.com/search.json?q=coscup+OR+from%3Acoscup&callback=?",function(a){b=a;e(d,b)})}});a(window).bind("fullpageload",function(){a("#ipv6block").length&&("ipv6.coscup.org"===window.location.hostname?(window._gaq&&_gaq.push(["_trackEvent","IPv6 2012","connected"]),a("#ipv6block").addClass("show").append("<h2>IPv6 Connectivity</h2><p>You are currently using IPv6 connection.</p>")):
a.getJSON("http://v6.ipv6-test.com/api/myip.php?json&callback=?",function(){window._gaq&&_gaq.push(["_trackEvent","IPv6 2012","ready but not connected"]);a("#ipv6block").addClass("show").append('<h2>Connect using IPv6</h2><p>Your network is IPv6 ready. Try it now by connect to <a href="http://ipv6.coscup.org/">ipv6.coscup.org</a>.</p>')}))});a(window).bind("fullpageload",function(){clearTimeout(d);if(a("#countdown-time").length){var d=setInterval(function(){var b=Math.floor((new Date("Fri Jul 16 2012 20:00:00 GMT+0800 (CST)")-
new Date)/1E3);0>b&&(clearTimeout(ctTimer),a("#countdown").html({en:'<a href="http://registrano.com/events/coscup2012-regist?locale=en">Register Now!</a>',"zh-tw":'<a href="http://registrano.com/events/coscup2012-regist">\u7acb\u523b\u5831\u540d\uff01</a>',"zh-cn":'<a href="http://registrano.com/events/coscup2012-regist">\u7acb\u523b\u62a5\u540d\uff01</a>'}[g]));s=[];s[0]=(b%60).toString(10)+{en:" seconds","zh-cn":" \u79d2","zh-tw":" \u79d2"}[g];b=Math.floor(b/60);s[1]=(b%60).toString(10)+{en:" minutes ",
"zh-cn":" \u5206 ","zh-tw":" \u5206 "}[g];b=Math.floor(b/60);s[2]=(b%24).toString(10)+{en:" hours ","zh-cn":" \u65f6 ","zh-tw":" \u6642 "}[g];(b=Math.floor(b/24))&&(s[3]=b.toString(10)+{en:" days ","zh-cn":" \u5929 ","zh-tw":" \u5929 "}[g]);a("#countdown-time").text(s.reverse().join(""))},1E3);a(window).one("pageload",function(){clearTimeout(ctTimer)})}});a(window).bind("deferpageload",function(){a(".hideInMobile iframe").each(function(){a(this).attr("data-src",this.src);this.src=""});a(window).bind("resumepageload",
function(){a(".hideInMobile iframe").each(function(){a(this).attr("data-src")&&(this.src=a(this).attr("data-src"))})})});var n;a(window).bind("pageload",l);window.applicationCache&&0!==window.applicationCache.status&&a.ajax({url:"",success:function(d,b,e){var d={en:["Ver: ","Check for update now"],"zh-tw":["\u7248\u672c\uff1a","\u7acb\u523b\u6aa2\u67e5\u66f4\u65b0"],"zh-cn":["\u7248\u672c\uff1a","\u7acb\u523b\u68c0\u67e5\u66f4\u65b0"]},b=new Date(e.getResponseHeader("Last-Modified")),f=function(a){return(10>
a?"0":"")+a},e=a("#copyright"),d=a('<a href="#" title="'+d[g][1]+'">'+d[g][0]+"v"+b.getUTCFullYear()+f(b.getUTCMonth()+1)+f(b.getUTCDate())+"."+f(b.getUTCHours())+f(b.getUTCMinutes())+"</a>");d.bind("click",function(b){b.preventDefault();b.stopPropagation();a(document.body).addClass("appcache-allinfo");a("#appcache_info")[0].className="appcache-checking";setTimeout(function(){window.applicationCache.update()},500);return!1});e.append('<span class="separator"> | </span>');e.append(d)}});m.init()});