85 lines
13 KiB
JavaScript
85 lines
13 KiB
JavaScript
/*! Respond.js v1.1.0 (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
|
|
(function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;
|
|
if(respond.mediaQueriesSupported){return;}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;
|
|
for(;B<y;B++){A=D[B],z=A.href,C=A.media,x=A.rel&&A.rel.toLowerCase()==="stylesheet";if(!!z&&x&&!o[z]){if(A.styleSheet&&A.styleSheet.rawCssText){m(A.styleSheet.rawCssText,z,C);
|
|
o[z]=true;}else{if((!/^([a-zA-Z:]*\/\/)/.test(z)&&!g)||z.replace(RegExp.$1,"").split("/")[0]===e.location.host){d.push({href:z,media:C});}}}}u();},u=function(){if(d.length){var x=d.shift();
|
|
n(x.href,function(y){m(y,x.href,x.media);o[x.href]=true;setTimeout(function(){u();},0);});}},m=function(I,x,z){var G=I.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),J=G&&G.length||0,x=x.substring(0,x.lastIndexOf("/")),y=function(K){return K.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+x+"$2$3");
|
|
},A=!J&&z,D=0,C,E,F,B,H;if(x.length){x+="/";}if(A){J=1;}for(;D<J;D++){C=0;if(A){E=z;k.push(y(I));}else{E=G[D].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1;
|
|
k.push(RegExp.$2&&y(RegExp.$2));}B=E.split(",");H=B.length;for(;C<H;C++){F=B[C];i.push({media:F.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:k.length-1,hasquery:F.indexOf("(")>-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")});
|
|
}}j();},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");
|
|
x.style.background="none";}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x);}else{x.removeChild(A);}z=p=parseFloat(z);
|
|
return z;},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l<h){clearTimeout(r);
|
|
r=setTimeout(j,h);return;}else{l=z;}for(var E in i){var K=i[E],C=K.minw,J=K.maxw,A=C===null,L=J===null,y="em";if(!!C){C=parseFloat(C)*(C.indexOf(y)>-1?(p||v()):1);
|
|
}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1);}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[];}D[K.media].push(k[K.rules]);
|
|
}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E]);}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";
|
|
M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F;}else{M.appendChild(w.createTextNode(F));}q.push(M);}},n=function(x,z){var y=c();
|
|
if(!y){return;}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return;}z(y.responseText);};if(y.readyState==4){return;
|
|
}y.send(null);},c=(function(){var x=false;try{x=new XMLHttpRequest();}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP");}return function(){return x;};})();
|
|
a();respond.update=a;function t(){j(true);}if(e.addEventListener){e.addEventListener("resize",t,false);}else{if(e.attachEvent){e.attachEvent("onresize",t);
|
|
}}})(this);
|
|
/*! A fix for the iOS orientationchange zoom bug. Script by @scottjehl, rebound by @wilto. MIT / GPLv2 License. */
|
|
(function(n){var d=navigator.userAgent;
|
|
if(!(/iPhone|iPad|iPod/.test(navigator.platform)&&/OS [1-5]_[0-9_]* like Mac OS X/i.test(d)&&d.indexOf("AppleWebKit")>-1)){return;}var m=n.document;if(!m.querySelector){return;
|
|
}var o=m.querySelector("meta[name=viewport]"),a=o&&o.getAttribute("content"),l=a+",maximum-scale=1",e=a+",maximum-scale=10",h=true,k,j,i,c;if(!o){return;
|
|
}function g(){o.setAttribute("content",e);h=true;}function b(){o.setAttribute("content",l);h=false;}function f(p){c=p.accelerationIncludingGravity;k=Math.abs(c.x);
|
|
j=Math.abs(c.y);i=Math.abs(c.z);if((!n.orientation||n.orientation===180)&&(k>7||((i>6&&j<8||i<8&&j>6)&&k>5))){if(h){b();}}else{if(!h){g();}}}n.addEventListener("orientationchange",g,false);
|
|
n.addEventListener("devicemotion",f,false);})(this);
|
|
/*! FitVids 1.0
|
|
* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
|
|
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
|
|
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
|
|
* Date: Thu Sept 01 18:00:00 2011 -0500
|
|
*/
|
|
(function(a){a.fn.fitVids=function(b){var c={customSelector:null};
|
|
var e=document.createElement("div"),d=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0];e.className="fit-vids-style";
|
|
e.innerHTML="­<style> .fluid-width-video-wrapper { width: 100%; position: relative; padding: 0; } .fluid-width-video-wrapper iframe, .fluid-width-video-wrapper object, .fluid-width-video-wrapper embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } </style>";
|
|
d.parentNode.insertBefore(e,d);if(b){a.extend(c,b);}return this.each(function(){var f=["iframe[src*='player.vimeo.com']","iframe[src*='www.youtube.com']","iframe[src*='www.youtube-nocookie.com']","iframe[src*='www.kickstarter.com']","object","embed"];
|
|
if(c.customSelector){f.push(c.customSelector);}var g=a(this).find(f.join(","));g.each(function(){var l=a(this);if(this.tagName.toLowerCase()==="embed"&&l.parent("object").length||l.parent(".fluid-width-video-wrapper").length){return;
|
|
}var h=(this.tagName.toLowerCase()==="object"||(l.attr("height")&&!isNaN(parseInt(l.attr("height"),10))))?parseInt(l.attr("height"),10):l.height(),i=!isNaN(parseInt(l.attr("width"),10))?parseInt(l.attr("width"),10):l.width(),j=h/i;
|
|
if(!l.attr("id")){var k="fitvid"+Math.floor(Math.random()*999999);l.attr("id",k);}l.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",(j*100)+"%");
|
|
l.removeAttr("height").removeAttr("width");});});};})(jQuery);
|
|
/*! <details> crossbrowser support
|
|
* @author Manuel Bieh
|
|
* @url http://www.manuel-bieh.de/
|
|
* @version 0.9
|
|
* @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPL
|
|
* Date $LastChangedDate: 2011-08-03 08:43:30 +0200 (Mi, 03 Aug 2011) $
|
|
*/
|
|
jQuery(function(a){(function(){var c=this;
|
|
this.hideDetailChildren=function(h){var f=h instanceof jQuery?h[0].childNodes:h.childNodes,j=f.length;a(h).attr("open",false);if(a.browser.safari==true){for(var e=0;
|
|
e<j;e++){if(f[e].nodeType==3&&f[e].textContent!=""){var g=a("<span />");g.text(f[e].textContent).hide();a(f[e]).after(g);f[e].textContent="";j++;}}}a.each(f,function(i,l){if(a(l)[0].nodeType==1&&l==a(l).parent().find("> summary:first-of-type")[0]){if(a(l).data("processed")!=true){a(l).css({display:"block",cursor:"pointer"}).data("processed",true).addClass("detailHidden").bind("click",function(){c.toggleDetailChildren(a(this));
|
|
});a(h).prepend(a(l));}}else{if(a(l)[0].nodeType==3&&!l.isElementContentWhitespace&&!!a.browser.safari==false){var m=a("<span />");m.text(l.textContent).hide();
|
|
a(l).after(m);l.textContent="";}else{if(a(h).find("> summary").length==0){var k=a("<summary />").text("Details").css({display:"block",cursor:"pointer"}).data("processed",true).addClass("detailHidden").bind("click",function(){c.toggleDetailChildren(a(this));
|
|
});a(h).prepend(k);}}}a(h).find("> :visible:not(summary:first-child)").hide();});};this.showDetailChildren=function(e){a(e).attr("open",true);a.each(a(e).find("> *"),function(g,f){a(f).show();
|
|
});};this.toggleDetailChildren=function(e){if(e.hasClass("detailHidden")){e.removeClass("detailHidden");c.showDetailChildren(e.parents("details")[0]);}else{e.addClass("detailHidden");
|
|
c.hideDetailChildren(e.parents("details")[0]);}};var d=(function(i){var g=i.createElement("details"),f,e,h;if(!("open" in g)){return false;}e=i.body||(function(){var j=i.documentElement;
|
|
f=true;return j.insertBefore(i.createElement("body"),j.firstElementChild||j.firstChild);}());g.innerHTML="<summary>a</summary>b";g.style.display="block";
|
|
e.appendChild(g);h=g.offsetHeight;g.open=true;h=h!=g.offsetHeight;e.removeChild(g);if(f){e.parentNode.removeChild(e);}return h;}(document));if(d==false){if(a("details").length!==0){var b=a("<style />").text('summary {-webkit-text-size-adjust: none;} details > summary:first-child:before {content: "▼"; font-size:.9em;padding-right:6px;font-family:"Courier New";} details > summary.detailHidden:first-child:before {content: "►";font-size:.9em;padding-right:6px;font-family:"Courier New";}');
|
|
a("head").append(b);}a.each(a("details"),function(f,e){c.hideDetailChildren(e);});}})();});
|
|
/*! Accessifyhtml5.js Source: https://github.com/yatil/accessifyhtml5.js */
|
|
var AccessifyHTML5=function(b){var a={article:{role:"article"},aside:{role:"complementary"},nav:{role:"navigation"},output:{"aria-live":"polite"},section:{role:"region"},"[required]":{"aria-required":"true"}};
|
|
if(b){if(b.header){a[b.header]={role:"banner"};}if(b.footer){a[b.footer]={role:"contentinfo"};}if(b.main){a[b.main]={role:"main"};}}jQuery.each(a,function(c,d){jQuery(c).attr(d);
|
|
});};
|
|
/*! http://mths.be/placeholder v2.0.7 by @mathias */
|
|
(function(g,i,d){var a="placeholder" in i.createElement("input"),e="placeholder" in i.createElement("textarea"),j=d.fn,c=d.valHooks,l,k;
|
|
if(a&&e){k=j.placeholder=function(){return this;};k.input=k.textarea=true;}else{k=j.placeholder=function(){var m=this;m.filter((a?"textarea":":input")+"[placeholder]").not(".placeholder").bind({"focus.placeholder":b,"blur.placeholder":f}).data("placeholder-enabled",true).trigger("blur.placeholder");
|
|
return m;};k.input=a;k.textarea=e;l={get:function(n){var m=d(n);return m.data("placeholder-enabled")&&m.hasClass("placeholder")?"":n.value;},set:function(n,o){var m=d(n);
|
|
if(!m.data("placeholder-enabled")){return n.value=o;}if(o==""){n.value=o;if(n!=i.activeElement){f.call(n);}}else{if(m.hasClass("placeholder")){b.call(n,true,o)||(n.value=o);
|
|
}else{n.value=o;}}return m;}};a||(c.input=l);e||(c.textarea=l);d(function(){d(i).delegate("form","submit.placeholder",function(){var m=d(".placeholder",this).each(b);
|
|
setTimeout(function(){m.each(f);},10);});});d(g).bind("beforeunload.placeholder",function(){d(".placeholder").each(function(){this.value="";});});}function h(n){var m={},o=/^jQuery\d+$/;
|
|
d.each(n.attributes,function(q,p){if(p.specified&&!o.test(p.name)){m[p.name]=p.value;}});return m;}function b(n,o){var m=this,p=d(m);if(m.value==p.attr("placeholder")&&p.hasClass("placeholder")){if(p.data("placeholder-password")){p=p.hide().next().show().attr("id",p.removeAttr("id").data("placeholder-id"));
|
|
if(n===true){return p[0].value=o;}p.focus();}else{m.value="";p.removeClass("placeholder");m==i.activeElement&&m.select();}}}function f(){var r,m=this,q=d(m),n=q,p=this.id;
|
|
if(m.value==""){if(m.type=="password"){if(!q.data("placeholder-textinput")){try{r=q.clone().attr({type:"text"});}catch(o){r=d("<input>").attr(d.extend(h(this),{type:"text"}));
|
|
}r.removeAttr("name").data({"placeholder-password":true,"placeholder-id":p}).bind("focus.placeholder",b);q.data({"placeholder-textinput":r,"placeholder-id":p}).before(r);
|
|
}q=q.removeAttr("id").hide().prev().attr("id",p).show();}q.addClass("placeholder");q[0].value=q.attr("placeholder");}else{q.removeClass("placeholder");
|
|
}}}(this,document,jQuery));
|
|
/*! 2k11 main JS */
|
|
jQuery(document).ready(function(c){AccessifyHTML5({header:"#banner",main:"#main",footer:"#colophon"});c("input[type=search]").parents("form").attr("role","search");
|
|
var d=c("<select/>");c("#primary-nav li").each(function(){var a=c(this);if(a.find("span").length){c("<option/>",{selected:"selected",value:"",text:a.text()}).appendTo(d);
|
|
}else{c("<option/>",{value:a.find("a").attr("href"),text:a.text()}).appendTo(d);}});if(d.children().size()>0){d.appendTo("#primary-nav").change(function(){window.location=c(this).find("option:selected").val();
|
|
});}if(typeof(lsbase)=="string"){c('<div id="LSResult" style="display: none;"><div id="LSShadow"></div></div>').appendTo("#searchform>div");}c("input, textarea").placeholder();
|
|
c("#content>article").fitVids();c("#trackback_url>a,.short-url").click(function(){var a=c(this).attr("title");alert(a);return false;});c(".comment_reply").click(function(){var a=c(this).attr("id").replace(/serendipity_reply_/g,"");
|
|
c("#serendipity_replyTo").val(a);});c(".comment_source_ownerlink").click(function(){var a=c(this).attr("title");return confirm(a);});c("#c").insertAfter("#feedback");
|
|
c(".comment_reply").click(function(){c("#reply-to-comment").remove();var a='<p id="reply-to-comment">'+c("#reply-to-hint").text()+" "+c("#serendipity_replyTo :selected").text()+"</p>";
|
|
c("#serendipity_replyTo").after(a);});c("#reply-to-hint,#serendipity_replyTo").addClass("visuallyhidden");c(".reply_origin").click(function(){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var a=c(this.hash);
|
|
a=a.length&&a||c("[name="+this.hash.slice(1)+"]");if(a.length){var b=a.offset().top;c("html,body").animate({scrollTop:b},700);return false;}}});}); |