/*! uhr - v7.0.0-next - 2015-01-16
* http://bärneruhr.ch/
* Copyright (c) 2015 Manuel Friedli; Licensed GPLv3 */
!function(a){"use strict";function b(a,b){this.render=function(d){if(void 0===a.parsed)switch(a.version){case 2:var e=new c(a),f=e.parse();Object.defineProperty(a,"parsed",{value:f,writable:!1,configurable:!1});break;default:return void console.warn("Unknown layout version: '"+a.version+"'")}var g=a.parsed;b.fadeOut("fast",function(){b.empty(),g.forEach(function(a,c,d){a.forEach(function(a){b.append(a.toString())}),c")}),"function"==typeof d&&d(),b.fadeIn("fast")})}}function c(a){function b(a,b,d){"undefined"!=typeof d&&null!==d&&(Array.isArray(d)?d.forEach(function(d){c(a,b,d)}):c(a,b,d))}function c(a,b,c){"undefined"!=typeof c&&null!==c&&Object.keys(c).forEach(function(d){var e=c[d];e.forEach(function(c){a[d-1][c-1].addStyle(b)})})}function e(a,c,d){"undefined"!=typeof d&&null!==d&&Object.keys(d).forEach(function(e){var f=e.split(","),g=d[e];f.forEach(function(d){b(a,c+d,g)})})}var f={3:[2,3,4],4:[1,5],5:[1,4,5],6:[1,3,5],7:[1,2,5],8:[1,5],9:[2,3,4]},g={3:[8,9,10],4:[7,11],5:[7,10,11],6:[7,9,11],7:[7,8,11],8:[7,11],9:[8,9,10]},h={3:[3],4:[2,3],5:[3],6:[3],7:[3],8:[3],9:[2,3,4]},i={3:[9],4:[8,9],5:[9],6:[9],7:[9],8:[9],9:[8,9,10]},j={3:[2,3,4],4:[1,5],5:[5],6:[4],7:[3],8:[2],9:[1,2,3,4,5]},k={3:[8,9,10],4:[7,11],5:[11],6:[10],7:[9],8:[8],9:[7,8,9,10,11]},l={3:[1,2,3,4,5],4:[4],5:[3],6:[4],7:[5],8:[1,5],9:[2,3,4]},m={3:[7,8,9,10,11],4:[10],5:[9],6:[10],7:[11],8:[7,11],9:[8,9,10]},n={3:[4],4:[3,4],5:[2,4],6:[1,4],7:[1,2,3,4,5],8:[4],9:[4]},o={3:[10],4:[9,10],5:[8,10],6:[7,10],7:[7,8,9,10,11],8:[10],9:[10]},p={3:[1,2,3,4,5],4:[1],5:[1,2,3,4],6:[5],7:[5],8:[1,5],9:[2,3,4]},q={3:[7,8,9,10,11],4:[7],5:[7,8,9,10],6:[11],7:[11],8:[7,11],9:[8,9,10]},r={3:[9,10],4:[8],5:[7],6:[7,8,9,10],7:[7,11],8:[7,11],9:[8,9,10]},s={3:[7,8,9,10,11],4:[11],5:[10],6:[9],7:[8],8:[8],9:[8]},t={3:[8,9,10],4:[7,11],5:[7,11],6:[8,9,10],7:[7,11],8:[7,11],9:[8,9,10]},u={3:[8,9,10],4:[7,11],5:[7,11],6:[8,9,10,11],7:[11],8:[10],9:[8,9]},v={0:[f,g],1:[f,i],2:[f,k],3:[f,m],4:[f,o],5:[f,q],6:[f,r],7:[f,s],8:[f,t],9:[f,u],10:[h,g],11:[h,i],12:[h,k],13:[h,m],14:[h,o],15:[h,q],16:[h,r],17:[h,s],18:[h,t],19:[h,u],20:[j,g],21:[j,i],22:[j,k],23:[j,m],24:[j,o],25:[j,q],26:[j,r],27:[j,s],28:[j,t],29:[j,u],30:[l,g],31:[l,i],32:[l,k],33:[l,m],34:[l,o],35:[l,q],36:[l,r],37:[l,s],38:[l,t],39:[l,u],40:[n,g],41:[n,i],42:[n,k],43:[n,m],44:[n,o],45:[n,q],46:[n,r],47:[n,s],48:[n,t],49:[n,u],50:[p,g],51:[p,i],52:[p,k],53:[p,m],54:[p,o],55:[p,q],56:[p,r],57:[p,s],58:[p,t],59:[p,u]};this.parse=function(){var c=[];return a.letters.forEach(function(a){for(var b=[],e=0;e'+c+""}}var e={id:0,languages:[],themes:[],registerLanguage:function(a,b){var c=e.languages.some(function(c){return a===c.code?(console.error("Error: Language code '"+a+"' cannot be registered for language '"+b.language+"' because it is already registered for language '"+c.language+"'!"),!0):!1});c||(b.code=a,e.languages.push(b))}};a("link[rel=stylesheet]").each(function(b,c){var d=a(c),f=d.attr("data-class");if(void 0!==f){var g=d.attr("data-name");void 0===g&&(g=f),e.themes.push({styleClass:f,name:g})}}),0===e.themes.length&&e.themes.push({});var f=function(){t.bind(this)()||(this.timer=window.setInterval(function(){this.options.time=new Date,u.bind(this)()}.bind(this),1e3),u.bind(this)(),s.bind(this)("uhr-status","on"))},g=function(){t.bind(this)()&&(window.clearInterval(this.timer),this.timer=null,u.bind(this)(),s.bind(this)("uhr-status","off"))},h=function(){t.bind(this)()?this.stop():this.start()},i=function(a){if(a!==this.options.language){this.options.language=a;var c=new b(C.bind(this)(),this.element.find(".letterarea"));c.render.bind(this)(function(){this.currentMinute=-1,u.bind(this)()}.bind(this)),s.bind(this)("uhr-language",a),u.bind(this)()}},j=function(b){b!==this.options.theme&&(this.element.removeClass(this.options.theme).addClass(b),a("#uhr-onoffswitch"+this.id).removeClass(this.options.theme).addClass(b),this.options.theme=b,s.bind(this)("uhr-theme",b))},k=function(a){this.currentMinute=-1,null===a?this.options.time=new Date:(null!==this.timer&&window.clearInterval(this.timer),this.options.time=a),u.bind(this)()},l=function(a){this.options.mode=a,this.currentMinute=-1,u.bind(this)(),s.bind(this)("uhr-mode",a)},m=function(a){var b=this.element;b.css("width",a);var c=b.width();b.width(c),b.height(c),b.css("font-size",c/40+"px")},n=function(){this.id=e.id++,this.timer=null,this.currentMinute=-1;var a,b,c=this.options.time;void 0===this.options.time&&(this.options.time=new Date),a=window.location.hash,void 0!==a&&"string"==typeof a&&"#"===a.charAt(0)&&(a=a.substring(1),a=decodeURIComponent(a),b=a.split("&"),b.forEach(function(a){var b=a.split("="),c=b[0],d=b[1];switch(c){case"l":case"language":this.options.language=d,this.options.force=!0;break;case"t":case"theme":this.options.theme=d,this.options.force=!0;break;case"m":case"mode":this.options.mode=d,this.options.force=!0;break;case"s":case"status":this.options.status=d,this.options.force=!0}}.bind(this))),p.bind(this)(),q.bind(this)(),void 0!==c&&this.time(c)},o=function(){a("#uhr-controlpanel"+this.id).toggle("fast")},p=function(){var b=this.element;if(b.addClass("uhr"),b.empty(),b.append(''),b.append(''),b.append(''),b.append(''),b.append(''),b.append(''),m.bind(this)(this.options.width),this.options.controls){var c=a(''),d=a('');c.append(d);var f=a('');f.append(''),f.append(''),d.append(f);var g=a('');if(g.append(''),g.append(''),d.append(g),e.languages.length>1){var h=a('');e.languages.forEach(function(a){h.append('")}),d.append(h)}if(e.themes.length>1){var i=a('');e.themes.forEach(function(a){i.append('")}),d.append(i)}var j=a('');j.on("click",function(){a("#uhr-controlpanel"+this.id).hide("fast")}.bind(this)),d.append(j),b.after(c),c.hide();var k=a('');k.on("click",function(){o.bind(this)()}.bind(this)),b.after(k)}},q=function(){var b=a("#uhr-onoffswitch-checkbox"+this.id);b.on("click",function(){this.toggle()}.bind(this));var c=a.cookie("uhr-status"+this.id);(void 0===c||this.options.force)&&(c=this.options.status),b.prop("checked","on"===c),"on"===c?this.start():this.stop();var d=a("#uhr-modeswitch-checkbox"+this.id);d.on("click",function(){l.bind(this)("seconds"===this.options.mode?"normal":"seconds")}.bind(this));var f=a.cookie("uhr-mode"+this.id);(void 0===f||this.options.force)&&(f=this.options.mode),d.prop("checked","seconds"!==f),l.bind(this)("seconds"===f?"seconds":"normal");var g=a("#uhr-languagechooser"+this.id);g.on("change",function(){var b=a("#uhr-languagechooser"+this.id).val();this.language(b)}.bind(this));var h=a.cookie("uhr-language"+this.id);(void 0===h||this.options.force)&&(h=this.options.language);var i=e.languages.some(function(a){return h===a.code});if(!i){var j;j=e.languages.length>0?e.languages[0].code:"",console.warn("Language '"+h+"' not found! Using fallback '"+j+"'"),h=j}g.val(h),this.options.language="",this.language(h);var k=a("#uhr-themechooser"+this.id);k.on("change",function(){var b=a("#uhr-themechooser"+this.id).val();this.theme(b)}.bind(this));var n=a.cookie("uhr-theme"+this.id);if((void 0===n||this.options.force)&&(n=this.options.theme),i=e.themes.some(function(a){return n===a.styleClass}),!i){var o=e.themes[0].styleClass;console.warn("Theme '"+n+"' not found! Using fallback '"+o+"'"),n=o}k.val(n),this.options.theme="",this.theme(n),this.options.autoresize&&a(window).on("resize",function(){var b=this.element,c=b.parent(),d=a(window),e=c.width(),f=c.height(),g=d.width(),h=d.height(),i=Math.min(e,f,g,h)+"px";m.bind(this)(i)}.bind(this))},r=function(){this.timer=null,a(this.element).removeAttr("style").removeAttr("class").empty(),a("#uhr-configlink"+this.id).remove(),a("#uhr-controlpanel"+this.id).remove()},s=function(b,c){var d={};d=void 0!==this.options.cookiePath?{expires:365,path:this.options.cookiePath}:{expires:365},a.cookie(b+this.id,c,d)},t=function(){return null!==this.timer},u=function(){if(t.bind(this)()){var a=this.options.time;if(!C.bind(this)().hasOwnProperty("seconds")&&"seconds"!==this.options.mode){if(a.getMinutes()===this.currentMinute)return;this.currentMinute=a.getMinutes()}v.bind(this)(a)}else x.bind(this)(),this.currentMinute=-1},v=function(a){var b=y.bind(this)(a),c=z.bind(this)(a),d=B.bind(this)(a),e=A.bind(this)(a);if(x.bind(this)(),"seconds"===this.options.mode)w.bind(this)("second"+b);else{w.bind(this)("on");for(var f=1;c>=f;f++)w.bind(this)("dot"+f);w.bind(this)("minute"+e),w.bind(this)("hour"+d)}},w=function(a){this.element.find(".item."+a).addClass("active")},x=function(){this.element.find(".item").removeClass("active")},y=function(a){return"function"==typeof C.bind(this)().getSeconds?C.bind(this)().getSeconds(a):a.getSeconds()},z=function(a){if("function"==typeof C.bind(this)().getDotMinute)return C.bind(this)().getDotMinute(a);var b=a.getMinutes();return b%5},A=function(a){return"function"==typeof C.bind(this)().getCoarseMinute?C.bind(this)().getCoarseMinute(a):a.getMinutes()},B=function(a){if("function"==typeof C.bind(this)().getHour)return C.bind(this)().getHour(a);var b=a.getHours();return a.getMinutes()>=25?(b+1)%24:b},C=function(){var a=e.languages.filter(function(a){return a.code===this.options.language},this);return a.length>0?a[0]:{}};a.widget("fritteli.uhr",{options:{width:"100%",status:"on",language:"de_CH",theme:e.themes[0].styleClass,force:!1,controls:!0,cookiePath:void 0,autoresize:!0,mode:"normal"},start:f,stop:g,toggle:h,language:i,theme:j,time:k,mode:l,width:m,_create:n,_destroy:r}),a.fritteli.uhr.register=e.registerLanguage}(jQuery),function(a){"use strict";var b={1:[1,2,4,5,6,7]},c={4:[1,2]},d={3:[9,10,11]},e={4:[4,5,6,7,8]},f={1:[9,10,11]},g={2:[9,10,11]},h={2:[1,2,3,4,5,6]},i={3:[1,2,3,4,5,6]},j={version:2,language:"Bärndütsch",letters:["ESKISCHAFÜF","VIERTUBFZÄÄ","ZWÄNZGSIVOR","ABOHAUBIEGE","EISZWÖISDRÜ","VIERIFÜFIQT","SÄCHSISIBNI","ACHTINÜNIEL","ZÄNIERBEUFI","ZWÖUFINAUHR"],permanent:b,minutes:{"5,6,7,8,9":[f,c],"10,11,12,13,14":[g,c],"15,16,17,18,19":[h,c],"20,21,22,23,24":[i,c],"25,26,27,28,29":[f,d,e],"30,31,32,33,34":e,"35,36,37,38,39":[f,c,e],"40,41,42,43,44":[i,d],"45,46,47,48,49":[h,d],"50,51,52,53,54":[g,d],"55,56,57,58,59":[f,d]},hours:{"0,12":{10:[1,2,3,4,5,6]},"1,13":{5:[1,2,3]},"2,14":{5:[4,5,6,7]},"3,15":{5:[9,10,11]},"4,16":{6:[1,2,3,4,5]},"5,17":{6:[6,7,8,9]},"6,18":{7:[1,2,3,4,5,6]},"7,19":{7:[7,8,9,10,11]},"8,20":{8:[1,2,3,4,5]},"9,21":{8:[6,7,8,9]},"10,22":{9:[1,2,3,4]},"11,23":{9:[8,9,10,11]}}};a.fritteli.uhr.register("de_CH",j)}(jQuery);