agenda-libre-ruby/public/webshims/1.15.10/shims/forms-picker.js

1 line
28 KiB
JavaScript
Raw Normal View History

!function(a){!function(){function b(b){var f=b||window.event,g=h.call(arguments,1),i=0,j=0,k=0,l=0;return b=a.event.fix(f),b.type="mousewheel","detail"in f&&(k=-1*f.detail),"wheelDelta"in f&&(k=f.wheelDelta),"wheelDeltaY"in f&&(k=f.wheelDeltaY),"wheelDeltaX"in f&&(j=-1*f.wheelDeltaX),"axis"in f&&f.axis===f.HORIZONTAL_AXIS&&(j=-1*k,k=0),i=0===k?j:k,"deltaY"in f&&(k=-1*f.deltaY,i=k),"deltaX"in f&&(j=f.deltaX,0===k&&(i=-1*j)),0!==k||0!==j?(l=Math.max(Math.abs(k),Math.abs(j)),(!e||e>l)&&(e=l),i=Math[i>=1?"floor":"ceil"](i/e),j=Math[j>=1?"floor":"ceil"](j/e),k=Math[k>=1?"floor":"ceil"](k/e),b.deltaX=j,b.deltaY=k,b.deltaFactor=e,g.unshift(b,i,j,k),d&&clearTimeout(d),d=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,g)):void 0}function c(){e=null}if(!a.event.special.mousewheel){var d,e,f=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],g="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],h=Array.prototype.slice;if(a.event.fixHooks)for(var i=f.length;i;)a.event.fixHooks[f[--i]]=a.event.mouseHooks;a.event.special.mousewheel={version:"3.1.6",setup:function(){if(this.addEventListener)for(var a=g.length;a;)this.addEventListener(g[--a],b,!1);else this.onmousewheel=b},teardown:function(){if(this.removeEventListener)for(var a=g.length;a;)this.removeEventListener(g[--a],b,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.on("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.off("mousewheel",a)}})}}(),function(){function b(){this===e.elem&&(e.pos=[-260,-260],e.elem=!1,f=3)}if(!a.event.special.mwheelIntent){var c,d,e={pos:[-260,-260]},f=3,g=document,h=g.documentElement,i=g.body;i||a(function(){i=g.body}),a.event.special.mwheelIntent={setup:function(){var c=a(this).on("mousewheel",a.event.special.mwheelIntent.handler);return this!==g&&this!==h&&this!==i&&c.on("mouseleave",b),c=null,!0},teardown:function(){return a(this).off("mousewheel",a.event.special.mwheelIntent.handler).off("mouseleave",b),!0},handler:function(b){var g=[b.clientX,b.clientY];return this===e.elem||Math.abs(e.pos[0]-g[0])>f||Math.abs(e.pos[1]-g[1])>f?(e.elem=this,e.pos=g,f=250,clearTimeout(d),d=setTimeout(function(){f=10},200),clearTimeout(c),c=setTimeout(function(){f=3},1500),b=a.extend({},b,{type:"mwheelIntent"}),(a.event.dispatch||a.event.handle).apply(this,arguments)):void 0}},a.fn.extend({mwheelIntent:function(a){return a?this.on("mwheelIntent",a):this.trigger("mwheelIntent")},unmwheelIntent:function(a){return this.off("mwheelIntent",a)}}),a(function(){i=g.body,a(g).on("mwheelIntent.mwheelIntentDefault",a.noop)})}}(),function(){if(!a.event.special.mousepress){var b=function(a,b){var c=a.data("mousepresstimer");c&&clearTimeout(c),b&&a.off("mouseup.mousepressext mouseleave.mousepressext"),a=null};a.event.special.mousepress={setup:function(){a(this).on("mousedown.mousepressext",function(c){var d=a(this),e=function(f){var g=0;b(d),d.data("mousepresstimer",setInterval(function(){a.event.special.mousepress.handler(d[0],c),g++,g>3&&f>45&&e(f-40)},f))},f=a(c.target).trigger("mousepressstart",[c]);b(d),d.data("mousepresstimer",setTimeout(function(){e(180)},200)),d.on("mouseup.mousepressext mouseleave.mousepressext",function(a){b(d,!0),f.trigger("mousepressend",[a]),d=null,f=null})})},teardown:function(){b(a(this).off(".mousepressext"),!0)},handler:function(b,c){return a.event.dispatch.call(b,{type:"mousepress",target:c.target,pageX:c.pageX,pageY:c.pageY})}}}}()}(webshims.$),webshims.register("forms-picker",function(a,b,c,d,e,f){"use strict";var g=b.picker,h=g._actions,i=f,j=function(a){var b=[a.getFullYear(),i.addZero(a.getMonth()+1),i.addZero(a.getDate())];return b.month=b[0]+"-"+b[1],b.date=b[0]+"-"+b[1]+"-"+b[2],b.time=i.addZero(a.getHours())+":"+i.addZero(a.getMinutes()),b["datetime-local"]=b.date+"T"+b.time,b},k=j(new Date),l=function(b){b=a(b||this.activeButton),this.activeButton.attr({tabindex:"-1","aria-selected":"false"}),this.activeButton=b.attr({tabindex:"0","aria-selected":"true"}),this.index=this.buttons.index(t