uhr/dist/jquery.uhr.complete.min.js

2 lines
21 KiB
JavaScript
Raw Normal View History

"use strict";var t,e,i,n,s,o,r;!function(t){var e,i,n,s={id:0,languages:[],themes:[],registerLanguage:function(t,e){s.languages.some((function(i){return t===i.code&&(console.error("Error: Language code '"+t+"' cannot be registered for language '"+e.language+"' because it is already registered for language '"+i.language+"'!"),!0)}))||(e.code=t,s.languages.push(e))}};t("link[rel=stylesheet]").each((function(e,i){var n=t(i),o=n.attr("data-class");if(void 0!==o){var r=n.attr("data-name");void 0===r&&(r=o),s.themes.push({styleClass:o,name:r})}})),0===s.themes.length&&s.themes.push({});var o;function r(t,e){var i=t,n=e||"";this.addStyle=function(t){""===n?n=t:n+=" "+t},this.toString=function(){return'<span class="item letter '+n+'">'+i+"</span>"}}function a(t){var e={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]},i={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]},h={3:[1,2,3,4,5],4:[4],5:[3],6:[4],7:[5],8:[1,5],9:[2,3,4]},u={3:[7,8,9,10,11],4:[10],5:[9],6:[10],7:[11],8:[7,11],9:[8,9,10]},c={3:[4],4:[3,4],5:[2,4],6:[1,4],7:[1,2,3,4,5],8:[4],9:[4]},d={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]},g={3:[9,10],4:[8],5:[7],6:[7,8,9,10],7:[7,11],8:[7,11],9:[8,9,10]},E={3:[7,8,9,10,11],4:[11],5:[10],6:[9],7:[8],8:[8],9:[8]},p={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]},m={0:[e,i],1:[e,s],2:[e,a],3:[e,u],4:[e,d],5:[e,f],6:[e,g],7:[e,E],8:[e,p],9:[e,v],10:[n,i],11:[n,s],12:[n,a],13:[n,u],14:[n,d],15:[n,f],16:[n,g],17:[n,E],18:[n,p],19:[n,v],20:[o,i],21:[o,s],22:[o,a],23:[o,u],24:[o,d],25:[o,f],26:[o,g],27:[o,E],28:[o,p],29:[o,v],30:[h,i],31:[h,s],32:[h,a],33:[h,u],34:[h,d],35:[h,f],36:[h,g],37:[h,E],38:[h,p],39:[h,v],40:[c,i],41:[c,s],42:[c,a],43:[c,u],44:[c,d],45:[c,f],46:[c,g],47:[c,E],48:[c,p],49:[c,v],50:[l,i],51:[l,s],52:[l,a],53:[l,u],54:[l,d],55:[l,f],56:[l,g],57:[l,E],58:[l,p],59:[l,v]};function I(t,e,i){null!=i&&Object.keys(i).forEach((function(n){i[n].forEach((function(i){t[n-1][i-1].addStyle(e)}))}))}function b(t,e,i){null!=i&&(Array.isArray(i)?i.forEach((function(i){I(t,e,i)})):I(t,e,i))}function N(t,e,i){null!=i&&Object.keys(i).forEach((function(n){var s=n.split(","),o=i[n];s.forEach((function(i){b(t,e+i,o)}))}))}this.parse=function(){var e=[];return t.letters.forEach((function(t){for(var i=[],n=0;n<t.length;n++){var s=new r(t[n]);i.push(s)}e.push(i)})),b(e,"on",t.permanent),void 0!==t.seconds&&null!==t.seconds?N(e,"second",t.seconds):N(e,"second",m),N(e,"minute",t.minutes),N(e,"hour",t.hours),e}}function h(t,e){this.render=function(i){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;e.fadeOut("fast",(function(){e.empty(),s.forEach((function(t,i,n){t.forEach((function(t){e.append(t.toString())})),i<n.length-1&&e.append("<br/>")})),"function"==typeof i&&i(),e.fadeIn("fast")}))}}var u,c,d=function(t){this.options.mode=t,this.currentMinute=-1,n.bind(this)(),e.bind(this)("uhr-mode",t)},l=function(t){var e=this.element;e.css("width",t);var i=e.width();e.width(i),e.height(i),e.css("font-size",i/40+"px")},f=function(){t("#uhr-controlpanel"+this.id).toggle("fast")};u=function(){var e=this.element;if(e.addClass("uhr"),e.empty(),e.append('<span class="item dot dot1"></span>'),e.append('<span class="item dot dot2"></span>'),e.append('<span class="item dot dot3"></span>'),e.append('<span class="item dot dot4"></span>'),e.append('<div class="letterarea"></div>'),e.append('<div class="reflection"></div>'),l.bind(this)(this.optio