1
0

Switch 2k11 frontend to new details polyfill.

The old polyfill was still using the deprecated browser function.
This commit is contained in:
Matthias Mees
2014-10-29 20:25:39 +01:00
parent 55c321b678
commit 1c49f0319e
2 changed files with 9 additions and 5 deletions

View File

@ -10,13 +10,11 @@
* 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);
/**
* <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 b=this;this.hideDetailChildren=function(c){var d=c instanceof jQuery?c[0].childNodes:c.childNodes,e=d.length;if(a(c).attr("open",!1),1==a.browser.safari)for(var f=0;e>f;f++)if(3==d[f].nodeType&&""!=d[f].textContent){var g=a("<span />");g.text(d[f].textContent).hide(),a(d[f]).after(g),d[f].textContent="",e++}a.each(d,function(d,e){if(1==a(e)[0].nodeType&&e==a(e).parent().find("> summary:first-of-type")[0])1!=a(e).data("processed")&&(a(e).css({display:"block",cursor:"pointer"}).data("processed",!0).addClass("detailHidden").bind("click",function(){b.toggleDetailChildren(a(this))}),a(c).prepend(a(e)));else if(3!=a(e)[0].nodeType||e.isElementContentWhitespace||0!=!!a.browser.safari){if(0==a(c).find("> summary").length){var g=a("<summary />").text("Details").css({display:"block",cursor:"pointer"}).data("processed",!0).addClass("detailHidden").bind("click",function(){b.toggleDetailChildren(a(this))});a(c).prepend(g)}}else{var f=a("<span />");f.text(e.textContent).hide(),a(e).after(f),e.textContent=""}a(c).find("> :visible:not(summary:first-child)").hide()})},this.showDetailChildren=function(b){a(b).attr("open",!0),a.each(a(b).find("> *"),function(b,c){a(c).show()})},this.toggleDetailChildren=function(a){a.hasClass("detailHidden")?(a.removeClass("detailHidden"),b.showDetailChildren(a.parents("details")[0])):(a.addClass("detailHidden"),b.hideDetailChildren(a.parents("details")[0]))};var c=function(a){var c,d,e,b=a.createElement("details");return"open"in b?(d=a.body||function(){var b=a.documentElement;return c=!0,b.insertBefore(a.createElement("body"),b.firstElementChild||b.firstChild)}(),b.innerHTML="<summary>a</summary>b",b.style.display="block",d.appendChild(b),e=b.offsetHeight,b.open=!0,e=e!=b.offsetHeight,d.removeChild(b),c&&d.parentNode.removeChild(d),e):!1}(document);if(0==c){if(0!==a("details").length){var d=a("<style />").text('summary {-webkit-text-size-adjust: none;} details > summary:first-child:before {content: "\u25bc"; font-size:.9em;padding-right:6px;font-family:"Courier New";} details > summary.detailHidden:first-child:before {content: "\u25ba";font-size:.9em;padding-right:6px;font-family:"Courier New";}');a("head").append(d)}a.each(a("details"),function(a,c){b.hideDetailChildren(c)})}}()});
/*! 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");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}}})});
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}}})});

View File

@ -81,6 +81,12 @@ input[type="checkbox"] {
.no-js #searchsend { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
/* details polyfill */
.no-details details > * { display: none; }
.no-details details > summary:before { content: '\25BA '; float: left; width: 20px; }
.no-details details.open > summary:before { content: '\25BC '; }
.no-details details summary { display: block; }
input[type=text],
input[type=search],
input[type=email],