Matthias Mees 1c49f0319e Switch 2k11 frontend to new details polyfill.
The old polyfill was still using the deprecated browser function.
2014-10-29 20:25:39 +01:00

21 lines
14 KiB
JavaScript

/*! Respond.js v1.4.2: min/max-width media query polyfill
* Copyright 2013 Scott Jehl * Licensed under MIT * http://j.mp/respondjs */
!function(a){"use strict";function y(){u(!0)}var b={};a.respond=b,b.update=function(){};var c=[],d=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),e=function(a,b){var c=d();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},f=function(a){return a.replace(b.regex.minmaxwh,"").match(b.regex.other)};if(b.ajax=e,b.queue=c,b.unsupportedmq=f,b.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},b.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!b.mediaQueriesSupported){var q,r,s,g=a.document,h=g.documentElement,i=[],j=[],k=[],l={},m=30,n=g.getElementsByTagName("head")[0]||h,o=g.getElementsByTagName("base")[0],p=n.getElementsByTagName("link"),t=function(){var a,b=g.createElement("div"),c=g.body,d=h.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=g.createElement("body"),c.style.background="none"),h.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&h.insertBefore(c,h.firstChild),a=b.offsetWidth,f?h.removeChild(c):c.removeChild(b),h.style.fontSize=d,e&&(c.style.fontSize=e),a=s=parseFloat(a)},u=function(b){var c="clientWidth",d=h[c],e="CSS1Compat"===g.compatMode&&d||g.body[c]||d,f={},l=p[p.length-1],o=(new Date).getTime();if(b&&q&&m>o-q)return a.clearTimeout(r),r=a.setTimeout(u,m),void 0;q=o;for(var v in i)if(i.hasOwnProperty(v)){var w=i[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?s||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?s||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(j[w.rules]))}for(var C in k)k.hasOwnProperty(C)&&k[C]&&k[C].parentNode===n&&n.removeChild(k[C]);k.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=g.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,n.insertBefore(E,l.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(g.createTextNode(F)),k.push(E)}},v=function(a,c,d){var e=a.replace(b.regex.comments,"").replace(b.regex.keyframes,"").match(b.regex.media),g=e&&e.length||0;c=c.substring(0,c.lastIndexOf("/"));var h=function(a){return a.replace(b.regex.urls,"$1"+c+"$2$3")},k=!g&&d;c.length&&(c+="/"),k&&(g=1);for(var l=0;g>l;l++){var m,n,o,p;k?(m=d,j.push(h(a))):(m=e[l].match(b.regex.findStyles)&&RegExp.$1,j.push(RegExp.$2&&h(RegExp.$2))),o=m.split(","),p=o.length;for(var q=0;p>q;q++)n=o[q],f(n)||i.push({media:n.split("(")[0].match(b.regex.only)&&RegExp.$2||"all",rules:j.length-1,hasquery:n.indexOf("(")>-1,minw:n.match(b.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:n.match(b.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(c.length){var b=c.shift();e(b.href,function(c){v(c,b.href,b.media),l[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<p.length;b++){var d=p[b],e=d.href,f=d.media,g=d.rel&&"stylesheet"===d.rel.toLowerCase();e&&g&&!l[e]&&(d.styleSheet&&d.styleSheet.rawCssText?(v(d.styleSheet.rawCssText,e,f),l[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!o||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),c.push({href:e,media:f})))}w()};x(),b.update=x,b.getEmValue=t,a.addEventListener?a.addEventListener("resize",y,!1):a.attachEvent&&a.attachEvent("onresize",y)}}(this);
/*! A fix for the iOS orientationchange zoom bug.
Script by @scottjehl, rebound by @wilto. * MIT / GPLv2 License. */
!function(a){function m(){d.setAttribute("content",g),h=!0}function n(){d.setAttribute("content",f),h=!1}function o(b){l=b.accelerationIncludingGravity,i=Math.abs(l.x),j=Math.abs(l.y),k=Math.abs(l.z),a.orientation&&180!==a.orientation||!(i>7||(k>6&&8>j||8>k&&j>6)&&i>5)?h||m():h&&n()}var b=navigator.userAgent;if(/iPhone|iPad|iPod/.test(navigator.platform)&&/OS [1-5]_[0-9_]* like Mac OS X/i.test(b)&&b.indexOf("AppleWebKit")>-1){var c=a.document;if(c.querySelector){var i,j,k,l,d=c.querySelector("meta[name=viewport]"),e=d&&d.getAttribute("content"),f=e+",maximum-scale=1",g=e+",maximum-scale=10",h=!0;d&&(a.addEventListener("orientationchange",m,!1),a.addEventListener("devicemotion",o,!1))}}}(this);
/*global jQuery */
/*jshint multistr:true browser:true */
/*!
* FitVids 1.0.3
* Copyright 2013, 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){"use strict";a.fn.fitVids=function(b){var c={customSelector:null};if(!document.getElementById("fit-vids-style")){var d=document.createElement("div"),e=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0],f="&shy;<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.className="fit-vids-style",d.id="fit-vids-style",d.style.display="none",d.innerHTML=f,e.parentNode.insertBefore(d,e)}return b&&a.extend(c,b),this.each(function(){var b=["iframe[src*='player.vimeo.com']","iframe[src*='youtube.com']","iframe[src*='youtube-nocookie.com']","iframe[src*='kickstarter.com'][src*='video.html']","object","embed"];c.customSelector&&b.push(c.customSelector);var d=a(this).find(b.join(","));d=d.not("object object"),d.each(function(){var b=a(this);if(!("embed"===this.tagName.toLowerCase()&&b.parent("object").length||b.parent(".fluid-width-video-wrapper").length)){var c="object"===this.tagName.toLowerCase()||b.attr("height")&&!isNaN(parseInt(b.attr("height"),10))?parseInt(b.attr("height"),10):b.height(),d=isNaN(parseInt(b.attr("width"),10))?b.width():parseInt(b.attr("width"),10),e=c/d;if(!b.attr("id")){var f="fitvid"+Math.floor(999999*Math.random());b.attr("id",f)}b.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",100*e+"%"),b.removeAttr("height").removeAttr("width")}})})}}(window.jQuery||window.Zepto);
/*! http://mths.be/details v0.1.0 by @mathias | includes http://mths.be/noselect v1.0.3 */
;(function(a,f){var e=f.fn,d,c=Object.prototype.toString.call(window.opera)=='[object Opera]',g=(function(l){var j=l.createElement('details'),i,h,k;if(!('open' in j)){return false}h=l.body||(function(){var m=l.documentElement;i=true;return m.insertBefore(l.createElement('body'),m.firstElementChild||m.firstChild)}());j.innerHTML='<summary>a</summary>b';j.style.display='block';h.appendChild(j);k=j.offsetHeight;j.open=true;k=k!=j.offsetHeight;h.removeChild(j);if(i){h.parentNode.removeChild(h)}return k}(a)),b=function(i,l,k,h){var j=i.prop('open'),m=j&&h||!j&&!h;if(m){i.removeClass('open').prop('open',false).triggerHandler('close.details');l.attr('aria-expanded',false);k.hide()}else{i.addClass('open').prop('open',true).triggerHandler('open.details');l.attr('aria-expanded',true);k.show()}};e.noSelect=function(){var h='none';return this.bind('selectstart dragstart mousedown',function(){return false}).css({MozUserSelect:h,msUserSelect:h,webkitUserSelect:h,userSelect:h})};if(g){d=e.details=function(){return this.each(function(){var i=f(this),h=f('summary',i).first();h.attr({role:'button','aria-expanded':i.prop('open')}).on('click',function(){var j=i.prop('open');h.attr('aria-expanded',!j);i.triggerHandler((j?'close':'open')+'.details')})})};d.support=g}else{d=e.details=function(){return this.each(function(){var h=f(this),j=f('summary',h).first(),i=h.children(':not(summary)'),k=h.contents(':not(summary)');if(!j.length){j=f('<summary>').text('Details').prependTo(h)}if(i.length!=k.length){k.filter(function(){return this.nodeType==3&&/[^ \t\n\f\r]/.test(this.data)}).wrap('<span>');i=h.children(':not(summary)')}h.prop('open',typeof h.attr('open')=='string');b(h,j,i);j.attr('role','button').noSelect().prop('tabIndex',0).on('click',function(){j.focus();b(h,j,i,true)}).keyup(function(l){if(32==l.keyCode||(13==l.keyCode&&!c)){l.preventDefault();j.click()}})})};d.support=g}}(document,jQuery));
/* Accessifyhtml5.js * Source: https://github.com/yatil/accessifyhtml5.js */
var AccessifyHTML5=function(a,b){"use strict";var f,g,h,i,j,k,l,m,n,o,c={article:{role:"article"},aside:{role:"complementary"},nav:{role:"navigation"},main:{role:"main"},output:{"aria-live":"polite"},section:{role:"region"},"[required]":{"aria-required":"true"}},d={ok:[],warn:[],fail:[]},e=d.fail,p=new RegExp("aria-[a-z]+|role|tabindex|title|alt|data-[\\w-]+|lang|style|maxlength|placeholder|pattern|required|type|target|accesskey|longdesc"),q="acfy-id-",r=0,s=document;if(s.querySelectorAll){if(a&&(a.header&&(c[a.header]={role:"banner"}),a.footer&&(c[a.footer]={role:"contentinfo"}),a.main&&(c[a.main]={role:"main"},c.main={role:""})),b&&b._CONFIG_&&b._CONFIG_.ignore_defaults)c=b;else for(m in b)c[m]=b[m];for(f in c)if(!f.match(/^_(CONFIG|[A-Z]+)_/)&&c.hasOwnProperty(f)){try{g=s.querySelectorAll(f)}catch(t){e.push({sel:f,attr:null,val:null,msg:"Invalid syntax for `document.querySelectorAll` function",ex:t})}for(k=c[f],(!g||g.length<1)&&d.warn.push({sel:f,attr:null,val:null,msg:"Not found"}),l=0;l<g.length;l++)for(j in k)if(k.hasOwnProperty(j)){if(h=j,i=k[j],h.match(/_?note/))continue;if(!h.match(p)){e.push({sel:f,attr:h,val:null,msg:"Attribute not allowed",re:p});continue}if(!(typeof i).match(/string|number|boolean/)){e.push({sel:f,attr:h,val:i,msg:"Value-type not allowed"});continue}if(n=h.match(/(describ|label)l?edby/)){try{o=s.querySelector(i)}catch(t){e.push({sel:f,attr:h,val:i,msg:"Invalid selector syntax (2) - see 'val'",ex:t})}if(!o){e.push({sel:f,attr:h,val:i,msg:"Labelledby ref not found - see 'val'"});continue}o.id||(o.id=q+r),i=o.id,h="aria-"+("label"===n[1]?"labelledby":"describedby"),r++}g[l].hasAttribute(h)?d.warn.push({sel:f,attr:h,val:i,msg:"Already present, skipped"}):(g[l].setAttribute(h,i),d.ok.push({sel:f,attr:h,val:i,msg:"Added"}))}}}return d.input=c,d};
/*! http://mths.be/placeholder v2.0.7 by @mathias */
!function(a,b,c){function k(a){var b={},d=/^jQuery\d+$/;return c.each(a.attributes,function(a,c){c.specified&&!d.test(c.name)&&(b[c.name]=c.value)}),b}function l(a,b){var d=this,e=c(d);if(d.value==e.attr("placeholder")&&e.hasClass("placeholder"))if(e.data("placeholder-password")){if(e=e.hide().next().show().attr("id",e.removeAttr("id").data("placeholder-id")),a===!0)return e[0].value=b;e.focus()}else d.value="",e.removeClass("placeholder"),d==n()&&d.select()}function m(){var a,b=this,d=c(b),e=this.id;if(""==b.value){if("password"==b.type){if(!d.data("placeholder-textinput")){try{a=d.clone().attr({type:"text"})}catch(f){a=c("<input>").attr(c.extend(k(this),{type:"text"}))}a.removeAttr("name").data({"placeholder-password":d,"placeholder-id":e}).bind("focus.placeholder",l),d.data({"placeholder-textinput":a,"placeholder-id":e}).before(a)}d=d.removeAttr("id").hide().prev().attr("id",e).show()}d.addClass("placeholder"),d[0].value=d.attr("placeholder")}else d.removeClass("placeholder")}function n(){try{return b.activeElement}catch(a){}}var i,j,d="placeholder"in b.createElement("input"),e="placeholder"in b.createElement("textarea"),f=c.fn,g=c.valHooks,h=c.propHooks;d&&e?(j=f.placeholder=function(){return this},j.input=j.textarea=!0):(j=f.placeholder=function(){var a=this;return a.filter((d?"textarea":":input")+"[placeholder]").not(".placeholder").bind({"focus.placeholder":l,"blur.placeholder":m}).data("placeholder-enabled",!0).trigger("blur.placeholder"),a},j.input=d,j.textarea=e,i={get:function(a){var b=c(a),d=b.data("placeholder-password");return d?d[0].value:b.data("placeholder-enabled")&&b.hasClass("placeholder")?"":a.value},set:function(a,b){var d=c(a),e=d.data("placeholder-password");return e?e[0].value=b:d.data("placeholder-enabled")?(""==b?(a.value=b,a!=n()&&m.call(a)):d.hasClass("placeholder")?l.call(a,!0,b)||(a.value=b):a.value=b,d):a.value=b}},d||(g.input=i,h.value=i),e||(g.textarea=i,h.value=i),c(function(){c(b).delegate("form","submit.placeholder",function(){var a=c(".placeholder",this).each(l);setTimeout(function(){a.each(m)},10)})}),c(a).bind("beforeunload.placeholder",function(){c(".placeholder").each(function(){this.value=""})}))}(this,document,jQuery);
/*! 2k11 main JS */
jQuery(document).ready(function(a){AccessifyHTML5({header:"#banner",footer:"#colophon"}),a("input[type=search]").parents("form").attr("role","search");a('html').addClass(a.fn.details.support ? 'details' : 'no-details');a('details').details();var b=a("<select/>");a("#primary-nav li").each(function(){var c=a(this);c.find("span").length?a("<option/>",{selected:"selected",value:"",text:c.text()}).appendTo(b):a("<option/>",{value:c.find("a").attr("href"),text:c.text()}).appendTo(b)}),b.children().size()>0&&b.appendTo("#primary-nav").change(function(){window.location=a(this).find("option:selected").val()}),"string"==typeof lsbase&&a('<div id="LSResult" style="display: none;"><div id="LSShadow"></div></div>').appendTo("#searchform>div"),a("input, textarea").placeholder(),a("#content>article").fitVids(),a("#trackback_url>a,.short-url").click(function(){var b=a(this).attr("title");return alert(b),!1}),a(".comment_reply").click(function(){var b=a(this).attr("id").replace(/serendipity_reply_/g,"");a("#serendipity_replyTo").val(b)}),a(".comment_source_ownerlink").click(function(){var b=a(this).attr("title");return confirm(b)}),a("#c").insertAfter("#feedback"),a(".comment_reply").click(function(){a("#reply-to-comment").remove();var b='<p id="reply-to-comment">'+a("#reply-to-hint").text()+" "+a("#serendipity_replyTo :selected").text()+"</p>";a("#serendipity_replyTo").after(b)}),a("#reply-to-hint,#serendipity_replyTo").addClass("visuallyhidden"),a(".reply_origin").click(function(){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var b=a(this.hash);if(b=b.length&&b||a("[name="+this.hash.slice(1)+"]"),b.length){var c=b.offset().top;return a("html,body").animate({scrollTop:c},700),!1}}})});