Manuel Friedli
621468b27f
All checks were successful
continuous-integration/drone/push Build is passing
1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
"use strict";var t,i,e,n,s,o,h,a;!function(t){var i,e,n,s={id:0,languages:[],themes:[],registerLanguage:function(t,i){s.languages.some((function(e){return t===e.code&&(console.error("Error: Language code '"+t+"' cannot be registered for language '"+i.language+"' because it is already registered for language '"+e.language+"'!"),!0)}))||(i.code=t,s.languages.push(i))}};t("link[rel=stylesheet]").each((function(i,e){var n=t(e),o=n.attr("data-class");if(void 0!==o){var h=n.attr("data-name");void 0===h&&(h=o),s.themes.push({styleClass:o,name:h})}})),0===s.themes.length&&s.themes.push({});var o;function h(t,i){var e=t,n=i||"";this.addStyle=function(t){""===n?n=t:n+=" "+t},this.toString=function(){return'<span class="item letter '+n+'">'+e+"</span>"}}function a(t){var i={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]},e={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]},n={3:[3],4:[2,3],5:[3],6:[3],7:[3],8:[3],9:[2,3,4]},s={3:[9],4:[8,9],5:[9],6:[9],7:[9],8:[9],9:[8,9,10]},o={3:[2,3,4],4:[1,5],5:[5],6:[4],7:[3],8:[2],9:[1,2,3,4,5]},a={3:[8,9,10],4:[7,11],5:[11],6:[10],7:[9],8:[8],9:[7,8,9,10,11]},r={3:[1,2,3,4,5],4:[4],5:[3],6:[4],7:[5],8:[1,5],9:[2,3,4]},c={3:[7,8,9,10,11],4:[10],5:[9],6:[10],7:[11],8:[7,11],9:[8,9,10]},d={3:[4],4:[3,4],5:[2,4],6:[1,4],7:[1,2,3,4,5],8:[4],9:[4]},u={3:[10],4:[9,10],5:[8,10],6:[7,10],7:[7,8,9,10,11],8:[10],9:[10]},l={3:[1,2,3,4,5],4:[1],5:[1,2,3,4],6:[5],7:[5],8:[1,5],9:[2,3,4]},f={3:[7,8,9,10,11],4:[7],5:[7,8,9,10],6:[11],7:[11],8:[7,11],9:[8,9,10]},p={3:[9,10],4:[8],5:[7],6:[7,8,9,10],7:[7,11],8:[7,11],9:[8,9,10]},g={3:[7,8,9,10,11],4:[11],5:[10],6:[9],7:[8],8:[8],9:[8]},m={3:[8,9,10],4:[7,11],5:[7,11],6:[8,9,10],7:[7,11],8:[7,11],9:[8,9,10]},v={3:[8,9,10],4:[7,11],5:[7,11],6:[8,9,10,11],7:[11],8:[10],9:[8,9]},b={0:[i,e],1:[i,s],2:[i,a],3:[i,c],4:[i,u],5:[i,f],6:[i,p],7:[i,g],8:[i,m],9:[i,v],10:[n,e],11:[n,s],12:[n,a],13:[n,c],14:[n,u],15:[n,f],16:[n,p],17:[n,g],18:[n,m],19:[n,v],20:[o,e],21:[o,s],22:[o,a],23:[o,c],24:[o,u],25:[o,f],26:[o,p],27:[o,g],28:[o,m],29:[o,v],30:[r,e],31:[r,s],32:[r,a],33:[r,c],34:[r,u],35:[r,f],36:[r,p],37:[r,g],38:[r,m],39:[r,v],40:[d,e],41:[d,s],42:[d,a],43:[d,c],44:[d,u],45:[d,f],46:[d,p],47:[d,g],48:[d,m],49:[d,v],50:[l,e],51:[l,s],52:[l,a],53:[l,c],54:[l,u],55:[l,f],56:[l,p],57:[l,g],58:[l,m],59:[l,v]};function w(t,i,e){null!=e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[n-1][e-1].addStyle(i)}))}))}function k(t,i,e){null!=e&&(Array.isArray(e)?e.forEach((function(e){w(t,i,e)})):w(t,i,e))}function y(t,i,e){null!=e&&Object.keys(e).forEach((function(n){var s=n.split(","),o=e[n];s.forEach((function(e){k(t,i+e,o)}))}))}this.parse=function(){var i=[];return t.letters.forEach((function(t){for(var e=[],n=0;n<t.length;n++){var s=new h(t[n]);e.push(s)}i.push(e)})),k(i,"on",t.permanent),void 0!==t.seconds&&null!==t.seconds?y(i,"second",t.seconds):y(i,"second",b),y(i,"minute",t.minutes),y(i,"hour",t.hours),i}}function r(t,i){this.render=function(e){if(void 0===t.parsed)switch(t.version){case 2:var n=new a(t).parse();Object.defineProperty(t,"parsed",{value:n,writable:!1,configurable:!1});break;default:return void console.warn("Unknown layout version: '"+t.version+"'")}var s=t.parsed;i.fadeOut("fast",(function(){i.empty(),s.forEach((function(t,e,n){t.forEach((function(t){i.append(t.toString())})),e<n.length-1&&i.append("<br/>")})),"function"==typeof e&&e(),i.fadeIn("fast")}))}}var c,d,u=function(t){this.options.mode=t,this.currentMinute=-1,n.bind(this)(),i.bind(this)("uhr-mode",t)},l=function(t){var i=this.element;i.css("width",t);var e=i.width();i.width(e),i.height(e),i.css("font-size",e/40+"px")},f=function(){t("#uhr-controlpanel"+this.id).toggle("fast")};c=function(){var i=this.element;if(i.addClass("uhr"),i.empty(),i.append('<span class="item dot dot1"></span>'),i.append('<span class="item dot dot2"></span>'),i.append('<span class="item dot dot3"></span>'),i.append('<span class="item dot dot4"></span>'),i.append('<div class="letterarea"></div>'),i.append('<div class="reflection"></div>'),l.bind(this)(this.options.width),this.options.controls){var e=t('<div class="uhr-controlpanel" id="uhr-controlpanel'+this.id+'"></div>'),n=t('<div class="content"></div>');e.append(n);var o=t('<div class="onoffswitch" id="uhr-onoffswitch'+this.id+'"></div>');o.append('<input type="checkbox" class="onoffswitch-checkbox" id="uhr-onoffswitch-checkbox'+this.id+'" checked="checked" />'),o.append('<label class="onoffswitch-label" for="uhr-onoffswitch-checkbox'+this.id+'"><div class="onoffswitch-inner"></div><div class="onoffswitch-switch"></div></label>'),n.append(o);var h=t('<div class="onoffswitch" id="uhr-modeswitch'+this.id+'"></div>');if(h.append('<input type="checkbox" class="onoffswitch-checkbox" id="uhr-modeswitch-checkbox'+this.id+'" checked="checked" />'),h.append('<label class="onoffswitch-label" for="uhr-modeswitch-checkbox'+this.id+'"><div class="modeswitch-inner"></div><div class="onoffswitch-switch"></div></label>'),n.append(h),s.languages.length>1){var a=t('<select id="uhr-languagechooser'+this.id+'"></select>');s.languages.forEach((function(t){a.append('<option value="'+t.code+'">'+t.language+"</option>")})),n.append(a)}if(s.themes.length>1){var r=t('<select id="uhr-themechooser'+this.id+'"></select>');s.themes.forEach((function(t){r.append('<option value="'+t.styleClass+'">'+t.name+"</option>")})),n.append(r)}var c=t('<a class="uhr-closecontrolpanel" id="uhr-closecontrolpanel'+this.id+'"></a>');c.on("click",function(){t("#uhr-controlpanel"+this.id).hide("fast")}.bind(this)),n.append(c),i.after(e),e.hide();var d=t('<a class="uhr-configlink" id="uhr-configlink'+this.id+'"></a>');d.on("click",function(){f.bind(this)()}.bind(this)),i.after(d)}},d=function(){var i=t("#uhr-onoffswitch-checkbox"+this.id);i.on("click",function(){this.toggle()}.bind(this));var e=t.cookie("uhr-status"+this.id);(void 0===e||this.options.force)&&(e=this.options.status),i.prop("checked","on"===e),"on"===e?this.start():this.stop();var n=t("#uhr-modeswitch-checkbox"+this.id);n.on("click",function(){"seconds"===this.options.mode?u.bind(this)("normal"):u.bind(this)("seconds")}.bind(this));var o=t.cookie("uhr-mode"+this.id);(void 0===o||this.options.force)&&(o=this.options.mode),n.prop("checked","seconds"!==o),"seconds"===o?u.bind(this)("seconds"):u.bind(this)("normal");var h=t("#uhr-languagechooser"+this.id);h.on("change",function(){var i=t("#uhr-languagechooser"+this.id).val();this.language(i)}.bind(this));var a=t.cookie("uhr-language"+this.id);(void 0===a||this.options.force)&&(a=this.options.language);var r,c=s.languages.some((function(t){return a===t.code}));c||(r=s.languages.length>0?s.languages[0].code:"",console.warn("Language '"+a+"' not found! Using fallback '"+r+"'"),a=r);h.val(a),this.options.language="",this.language(a);var d=t("#uhr-themechooser"+this.id);d.on("change",function(){var i=t("#uhr-themechooser"+this.id).val();this.theme(i)}.bind(this));var f=t.cookie("uhr-theme"+this.id);if((void 0===f||this.options.force)&&(f=this.options.theme),!(c=s.themes.some((function(t){return f===t.styleClass})))){var p=s.themes[0].styleClass;console.warn("Theme '"+f+"' not found! Using fallback '"+p+"'"),f=p}d.val(f),this.options.theme="",this.theme(f),this.options.autoresize&&t(window).on("resize",function(){var i=this.element.parent(),e=t(window),n=i.width(),s=i.height(),o=e.width(),h=e.height(),a=Math.min(n,s,o,h)+"px";l.bind(this)(a)}.bind(this))};var p,g,m,v,b,w,k;i=function(i,e){var n={};n=void 0!==this.options.cookiePath?{expires:365,path:this.options.cookiePath}:{expires:365},t.cookie(i+this.id,e,n)},e=function(){return null!==this.timer},n=function(){if(e.bind(this)()){var t=this.options.time;if(!o.bind(this)().hasOwnProperty("seconds")&&"seconds"!==this.options.mode){if(t.getMinutes()===this.currentMinute)return;this.currentMinute=t.getMinutes()}p.bind(this)(t)}else g.bind(this)(),this.currentMinute=-1},p=function(t){var i=v.bind(this)(t),e=b.bind(this)(t),n=k.bind(this)(t),s=w.bind(this)(t);if(g.bind(this)(),"seconds"===this.options.mode)m.bind(this)("second"+i);else{m.bind(this)("on");for(var o=1;o<=e;o++)m.bind(this)("dot"+o);m.bind(this)("minute"+s),m.bind(this)("hour"+n)}},m=function(t){this.element.find(".item."+t).addClass("active")},g=function(){this.element.find(".item").removeClass("active")},v=function(t){return"function"==typeof o.bind(this)().getSeconds?o.bind(this)().getSeconds(t):t.getSeconds()},b=function(t){return"function"==typeof o.bind(this)().getDotMinute?o.bind(this)().getDotMinute(t):t.getMinutes()%5},w=function(t){return"function"==typeof o.bind(this)().getCoarseMinute?o.bind(this)().getCoarseMinute(t):t.getMinutes()},k=function(t){if("function"==typeof o.bind(this)().getHour)return o.bind(this)().getHour(t);var i=t.getHours();return t.getMinutes()>=25?(i+1)%24:i},o=function(){var t=s.languages.filter((function(t){return t.code===this.options.language}),this);return t.length>0?t[0]:{}},t.widget("fritteli.uhr",{options:{width:"100%",status:"on",language:"de_CH",theme:s.themes[0].styleClass,force:!1,controls:!0,cookiePath:void 0,autoresize:!0,mode:"normal"},start:function(){e.bind(this)()||(this.timer=window.setInterval(function(){this.options.time=new Date,n.bind(this)()}.bind(this),1e3),n.bind(this)(),i.bind(this)("uhr-status","on"))},stop:function(){e.bind(this)()&&(window.clearInterval(this.timer),this.timer=null,n.bind(this)(),i.bind(this)("uhr-status","off"))},toggle:function(){e.bind(this)()?this.stop():this.start()},language:function(t){t!==this.options.language&&(this.options.language=t,new r(o.bind(this)(),this.element.find(".letterarea")).render.bind(this)(function(){this.currentMinute=-1,n.bind(this)()}.bind(this)),i.bind(this)("uhr-language",t),n.bind(this)())},theme:function(e){e!==this.options.theme&&(this.element.removeClass(this.options.theme).addClass(e),t("#uhr-onoffswitch"+this.id).removeClass(this.options.theme).addClass(e),this.options.theme=e,i.bind(this)("uhr-theme",e))},time:function(t){this.currentMinute=-1,null===t?this.options.time=new Date:(null!==this.timer&&window.clearInterval(this.timer),this.options.time=t),n.bind(this)()},mode:u,width:l,_create:function(){this.id=s.id++,this.timer=null,this.currentMinute=-1;var t,i=this.options.time;void 0===this.options.time&&(this.options.time=new Date),void 0!==(t=window.location.hash)&&"string"==typeof t&&"#"===t.charAt(0)&&(t=t.substring(1),(t=decodeURIComponent(t)).split("&").forEach(function(t){var i=t.split("="),e=i[0],n=i[1];switch(e){case"l":case"language":this.options.language=n,this.options.force=!0;break;case"t":case"theme":this.options.theme=n,this.options.force=!0;break;case"m":case"mode":this.options.mode=n,this.options.force=!0;break;case"s":case"status":this.options.status=n,this.options.force=!0}}.bind(this))),c.bind(this)(),d.bind(this)(),void 0!==i&&this.time(i)},_destroy:function(){this.timer=null,t(this.element).removeAttr("style").removeAttr("class").empty(),t("#uhr-configlink"+this.id).remove(),t("#uhr-controlpanel"+this.id).remove()}}),t.fritteli.uhr.register=s.registerLanguage}(jQuery),a={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:{1:[1,2,4,5,6,7]},minutes:{"5,6,7,8,9":[n={1:[9,10,11]},t={4:[1,2]}],"10,11,12,13,14":[s={2:[9,10,11]},t],"15,16,17,18,19":[o={2:[1,2,3,4,5,6]},t],"20,21,22,23,24":[h={3:[1,2,3,4,5,6]},t],"25,26,27,28,29":[n,i={3:[9,10,11]},e={4:[4,5,6,7,8]}],"30,31,32,33,34":e,"35,36,37,38,39":[n,t,e],"40,41,42,43,44":[h,i],"45,46,47,48,49":[o,i],"50,51,52,53,54":[s,i],"55,56,57,58,59":[n,i]},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]}}},jQuery.fritteli.uhr.register("de_CH",a);
|