!function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=12)}({0:function(t,e){t.exports=Cookies},1:function(t,e){t.exports=jQuery},12:function(t,e,n){"use strict";n.r(e);var i=function(){function t(){}return t.registerTheme=function(e,n){t.themes.some(function(t){return t.name===e})?console.warn("Theme with name '"+e+"' already registered; ignoring register request for styleClass '"+n+"'."):t.themes.push({name:e,styleClass:n})},t.hasThemes=function(){return t.themes.length>0},t.hasMultipleThemes=function(){return t.themes.length>1},t.getFirstTheme=function(){return t.getTheme(0)},t.getTheme=function(e){return t.themes[e]},t.getThemes=function(){return t.themes},t.registerLayout=function(e){!t.layouts.some(function(t){return e.code===t.code&&(e.prettyName!==t.prettyName&&console.error("Error: Language code '"+e.code+"' cannot be registered for layout '"+e.prettyName+"' because it is already registered for layout '"+t.prettyName+"'!"),!0)})&&(t.layouts.push(e),t.layouts.sort(function(t,e){return t.prettyName.localeCompare(e.prettyName)}))},t.hasLayouts=function(){return t.layouts.length>0},t.hasMultipleLayouts=function(){return t.layouts.length>1},t.getFirstLayout=function(){return t.layouts[0]},t.getLayouts=function(){return t.layouts},t.layouts=[],t.themes=[],t}(),o={code:null,hours:null,letters:[],minutes:null,permanent:[],prettyName:null,version:2},s=n(0),r=function(){function t(t,e){this.widgetId=t,this.cookiePath=e}return t.prototype.getLayout=function(){var t=this.getCookie("uhr-language");return t&&(this.removeCookie("uhr-language"),this.setLayout(t)),this.getCookie("uhr-layout")},t.prototype.setLayout=function(t){this.setCookie("uhr-layout",t)},t.prototype.getMode=function(){return this.getCookie("uhr-mode")},t.prototype.setMode=function(t){this.setCookie("uhr-mode",t)},t.prototype.getStatus=function(){return this.getCookie("uhr-status")},t.prototype.setStatus=function(t){this.setCookie("uhr-status",t)},t.prototype.getTheme=function(){return this.getCookie("uhr-theme")},t.prototype.setTheme=function(t){this.setCookie("uhr-theme",t)},t.prototype.getCookie=function(t){return s.get(t+this.widgetId)},t.prototype.setCookie=function(t,e){var n;n=this.cookiePath?{expires:365,path:this.cookiePath}:{expires:365},s.set(t+this.widgetId,e,n)},t.prototype.removeCookie=function(t){this.cookiePath?s.remove(t+this.widgetId,{path:this.cookiePath}):s.remove(t+this.widgetId)},t}(),h=function(){function t(t,e){void 0===e&&(e=""),this.value=t,this.value=t,this.style=e}return t.prototype.addStyle=function(t){""===this.style?this.style=t:this.style+=" "+t},t.prototype.toString=function(){return''+this.value+""},t}(),a=function(){function t(t){this.layout=t}return t.prototype.parse=function(){var e=[];return this.layout.letters.forEach(function(t){for(var n=[],i=0;i")}),t&&t(),e.renderarea.fadeIn("fast")})},t}(),c=function(){function t(t,e,n,i){this.uhr=t,this.$element=e,this.options=n,this.id=i,this.cookieHandler=new r(i,n.cookiePath)}return t.prototype.render=function(){this.setupHTML(),this.wireFunctionality()},t.prototype.setWidth=function(t){this.$element.css("width",t);var e=this.$element.width();this.$element.width(e),this.$element.height(e),this.$element.css("font-size",e/40+"px")},t.prototype.setupHTML=function(){var t=this;if(this.$element.addClass("uhr").empty().append('').append('').append('').append('').append('
').append('
'),this.setWidth(this.options.width),this.options.controls){var e=$('
'),n=$('
');e.append(n);var o=$('
');o.append(''),o.append(''),n.append(o);var s=$('
');if(s.append(''),s.append(''),n.append(s),i.hasMultipleLayouts()){var r=$('');i.getLayouts().forEach(function(t){r.append('")}),n.append(r)}if(i.hasMultipleThemes()){var h=$('');i.getThemes().forEach(function(t){h.append('")}),n.append(h)}var a=$('');a.on({click:function(){return $("#uhr-controlpanel"+t.id).hide("fast")}}),n.append(a),this.$element.after(e),e.hide();var u=$('');u.on({click:function(){return t.toggleConfigScreen()}}),this.$element.after(u)}},t.prototype.wireFunctionality=function(){var t=this,e=$("#uhr-onoffswitch-checkbox"+this.id);e.on({click:function(){return t.uhr.toggle()}});var n=this.cookieHandler.getStatus();(void 0===n||this.options.force)&&(n=this.options.status),e.prop("checked","on"===n),"on"===n?this.uhr.start():this.uhr.stop();var o=$("#uhr-modeswitch-checkbox"+this.id);o.on({click:function(){"seconds"===t.options.mode?t.uhr.setMode("normal"):t.uhr.setMode("seconds")}});var s=this.cookieHandler.getMode();(void 0===s||this.options.force)&&(s=this.options.mode),o.prop("checked","seconds"!==s),"seconds"===s?this.uhr.setMode("seconds"):this.uhr.setMode("normal");var r=$("#uhr-languagechooser"+this.id);r.on({change:function(){var e=$("#uhr-languagechooser"+t.id).val();t.uhr.setLayout(e)}});var h=this.cookieHandler.getLayout();(void 0===h||this.options.force)&&(h=this.options.language);var a=i.getLayouts().some(function(t){return h===t.code});if(!a){var u=void 0;u=i.hasLayouts()?i.getFirstLayout().code:"",console.warn("Language '"+h+"' not found! Using fallback '"+u+"'."),h=u}r.val(h),this.options.language="",this.uhr.setLayout(h);var c=$("#uhr-themechooser"+this.id);c.on({change:function(){var e=$("#uhr-themechooser"+t.id).val();t.uhr.setTheme(e)}});var l=this.cookieHandler.getTheme();if((void 0===l||this.options.force)&&(l=this.options.theme),!(a=i.getThemes().some(function(t){return l===t.styleClass}))){var d=i.getFirstTheme().styleClass;console.warn("Theme '"+l+"' not found! Using fallback '"+d+"'."),l=d}c.val(l),this.options.theme="",this.uhr.setTheme(l),this.options.autoresize&&$(window).on({resize:function(){var e=t.$element.parent(),n=$(window),i=e.width(),o=e.height(),s=n.width(),r=n.height(),h=Math.min(i,o,s,r)+"px";t.setWidth(h)}})},t.prototype.toggleConfigScreen=function(){$("#uhr-controlpanel"+this.id).toggle("fast")},t}(),l=function(){function t(t){this.widgetInstance=t,this.timer=null,this.currentMinute=null;var e=this.widgetInstance.options.time;void 0===this.widgetInstance.options.time&&(this.widgetInstance.options.time=new Date),this.cookieHandler=new r(this.widgetInstance.uuid,this.widgetInstance.options.cookiePath),this.parseHash(),this.renderer=new c(this,this.widgetInstance.element,this.widgetInstance.options,this.widgetInstance.uuid),this.renderer.render(),void 0!==e&&this.setTime(e)}return t.prototype.destroy=function(){this.timer&&(window.clearInterval(this.timer),this.timer=null),this.widgetInstance.element.removeAttr("style").removeAttr("class").empty(),$("#uhr-configlink"+this.widgetInstance.uuid).remove(),$("#uhr-controlpanel"+this.widgetInstance.uuid).remove()},t.prototype.start=function(){var t=this;this.isOn()||(this.timer=window.setInterval(function(){t.widgetInstance.options.time=new Date,t.update()},1e3),this.update(),this.cookieHandler.setStatus("on"))},t.prototype.stop=function(){this.isOn()&&(window.clearInterval(this.timer),this.timer=null,this.update(),this.cookieHandler.setStatus("off"))},t.prototype.toggle=function(){this.isOn()?this.stop():this.start()},t.prototype.setLayout=function(t){var e=this;t!==this.widgetInstance.options.language&&(this.widgetInstance.options.language=t,new u(this.getCurrentLayout(),this.widgetInstance.element.find(".letterarea")).render(function(){e.currentMinute=-1,e.update()}),this.cookieHandler.setLayout(t),this.update())},t.prototype.setTheme=function(t){t!==this.widgetInstance.options.theme&&(this.widgetInstance.element.removeClass(this.widgetInstance.options.theme).addClass(t),$("#uhr-onoffswitch"+this.widgetInstance.uuid).removeClass(this.widgetInstance.options.theme).addClass(t),this.widgetInstance.options.theme=t,this.cookieHandler.setTheme(t))},t.prototype.setTime=function(t){this.currentMinute=null,null===t?this.widgetInstance.options.time=new Date:(null!==this.timer&&window.clearInterval(this.timer),this.widgetInstance.options.time=t),this.update()},t.prototype.setMode=function(t){this.widgetInstance.options.mode=t,this.currentMinute=null,this.update(),this.cookieHandler.setMode(t)},t.prototype.setWidth=function(t){this.renderer.setWidth(t)},t.prototype.isOn=function(){return null!==this.timer},t.prototype.update=function(){if(this.isOn()){var t=this.widgetInstance.options.time;if(!this.getCurrentLayout().hasOwnProperty("seconds")&&"seconds"!==this.widgetInstance.options.mode){if(t.getMinutes()===this.currentMinute)return;this.currentMinute=t.getMinutes()}this.show(t)}else this.clear(),this.currentMinute=-1},t.prototype.show=function(t){var e=this.getSecond(t),n=this.getDotMinute(t),i=this.getHour(t),o=this.getCoarseMinute(t);if(this.clear(),"seconds"===this.widgetInstance.options.mode)this.highlight("second"+e);else{this.highlight("on");for(var s=1;s<=n;s++)this.highlight("dot"+s);this.highlight("minute"+o),this.highlight("hour"+i)}},t.prototype.clear=function(){this.widgetInstance.element.find(".item").removeClass("active")},t.prototype.highlight=function(t){this.widgetInstance.element.find(".item."+t).addClass("active")},t.prototype.getSecond=function(t){return"function"==typeof this.getCurrentLayout().getSeconds?this.getCurrentLayout().getSeconds(t):t.getSeconds()},t.prototype.getDotMinute=function(t){return"function"==typeof this.getCurrentLayout().getDotMinute?this.getCurrentLayout().getDotMinute(t):t.getMinutes()%5},t.prototype.getCoarseMinute=function(t){return"function"==typeof this.getCurrentLayout().getCoarseMinute?this.getCurrentLayout().getCoarseMinute(t):t.getMinutes()},t.prototype.getHour=function(t){if("function"==typeof this.getCurrentLayout().getHour)return this.getCurrentLayout().getHour(t);var e=t.getHours();return t.getMinutes()>=25?(e+1)%24:e},t.prototype.parseHash=function(){var t=this,e=window.location.hash;void 0!==e&&"#"===e.charAt(0)&&(e=e.substring(1),(e=decodeURIComponent(e)).split("&").forEach(function(e){var n=e.split("="),i=n[0],o=n[1];switch(i){case"l":case"language":t.widgetInstance.options.language=o,t.widgetInstance.options.force=!0;break;case"t":case"theme":t.widgetInstance.options.theme=o,t.widgetInstance.options.force=!0;break;case"m":case"mode":t.widgetInstance.options.mode=o,t.widgetInstance.options.force=!0;break;case"s":case"status":t.widgetInstance.options.status=o,t.widgetInstance.options.force=!0}}))},t.prototype.getCurrentLayout=function(){var t=this,e=i.getLayouts().filter(function(e){return e.code===t.widgetInstance.options.language},this);return e.length>0?e[0]:o},t}(),d=n(1);d("link[rel=stylesheet]").each(function(t,e){var n=d(e),o=n.attr("data-class");if(void 0!==o){var s=n.attr("data-name");void 0===s&&(s=o),i.registerTheme(s,o)}}),i.hasThemes()||i.registerTheme("","");var p={options:{width:"100%",status:"on",language:"de_CH",theme:i.getFirstTheme().styleClass,force:!1,controls:!0,cookiePath:void 0,autoresize:!0,mode:"normal"},start:function(){this._fritteliUhrInstance.start()},stop:function(){this._fritteliUhrInstance.stop()},toggle:function(){this._fritteliUhrInstance.toggle()},language:function(t){this._fritteliUhrInstance.setLayout(t)},theme:function(t){this._fritteliUhrInstance.setTheme(t)},time:function(t){this._fritteliUhrInstance.setTime(t)},mode:function(t){this._fritteliUhrInstance.setMode(t)},width:function(t){this._fritteliUhrInstance.setWidth(t)},_create:function(){this._fritteliUhrInstance=new l(this)},_destroy:function(){this._fritteliUhrInstance.destroy()},_fritteliUhrInstance:null};$.widget("fritteli.uhr",p),$.fritteli.uhr.register=i.registerLayout}}); //# sourceMappingURL=uhr.js.map