4 lines
33 KiB
JavaScript
4 lines
33 KiB
JavaScript
|
/*! jQuery UI Virtual Keyboard (1.27.3) - ALL Extensions + Mousewheel */
|
|||
|
/*! jQuery UI Virtual Keyboard Alt Key Popup v1.1.4 */
|
|||
|
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var t=e.keyboard;e.extend(t.css,{altKeyPopup:"ui-keyboard-popup",altKeyOverlay:"ui-keyboard-overlay"}),t.altKeys=e.extend({a:"å æ ā ă ą à á â ã ä",A:"Å Æ Ā Ă Ą À Á  à Ä",c:"ç ć ĉ ċ č",C:"Ç Ć Ĉ Ċ Č",d:"ď ð ď",D:"Ď Ð Ď",e:"ė ę ĕ ě ə è é ê ë ē",E:"Ė Ę Ĕ Ě Ǝ È É Ê Ë Ē",g:"ģ ğ ĝ ġ",G:"Ģ Ğ Ĝ Ġ",h:"ĥ ħ",H:"Ĥ Ħ",i:"ı į ī ï î í ì ĩ ĭ",I:"İ Į Ī Ï Î Í Ì Ĩ Ĭ",j:"ĵ",J:"Ĵ",k:"ķ",K:"Ķ",l:"Ł Ľ Ļ Ĺ Ŀ",L:"ł ľ ļ ĺ ŀ",n:"ʼn ň ņ ń ñ",N:"ʼn Ň Ņ Ń Ñ",o:"œ ő ø ö õ ô ó ò ō ŏ",O:"Œ Ő Ø Ö Õ Ô Ó Ò Ō Ŏ",r:"ŕ ř ŗ",R:"Ŕ Ř Ŗ",s:"ś š ş ß § ŝ",S:"Ś Š Ş ẞ § Ŝ",t:"þ ť ț ţ ŧ",T:"Þ Ť Ț Ţ Ŧ",u:"ų ű ů ū ü û ú ù ũ ŭ",U:"Ų Ű Ů Ū Ü Û Ú Ù Ũ Ŭ",w:"ŵ",W:"Ŵ",y:"ý",Y:"Ý",z:"ź ż ž",Z:"Ź Ż Ž","!":"¡",$:"€ £ ¤ ¥ ¢ ₡ ₱ ₩ ₹ ₪ ₭ ₮ ₦ ₤","?":"¿","'":"〈 「 『 “",'"':"〉 」 』 ”","(":"《 【 〔",")":"》 】 〕"},t.altKeys),t.navigationKeys=e.extend({enter:13,escape:27,end:35,home:36,left:37,right:39},t.navigationKeys),e.fn.addAltKeyPopup=function(n){var o={holdTime:500,popupVisible:"popup-visible",popupHidden:"popup-hidden",popupPosition:null};return this.each(function(){var i=e(this).data("keyboard");if(i){if(i.altkeypopup_options=e.extend({},o,i.altkeypopup_options,n),i.altkeypopup_namespace)return i.altkeypopup_setup();i.altkeypopup_namespace=i.namespace+"AltKeyPopup",i.extensionNamespace.push(i.altkeypopup_namespace),i.altkeypopup_setup=function(){var n,o="mousedown touchstart ".split(" ").join(i.altkeypopup_namespace+" "),a="mouseup touchend touchcancel ".split(" ").join(i.altkeypopup_namespace+" ");i.options.repeatRate=0,i.$allKeys.unbind(i.altkeypopup_namespace).bind(o,function(){clearTimeout(n);var o=e(this),a=o.attr("data-value")||"",s=i.altkeypopup_options.holdTime;a in t.altKeys&&(s?n=setTimeout(function(){i.altKeyPopup_popup(a,o)},s):i.altKeyPopup_popup(a,o))}).bind(a,function(){clearTimeout(n)}),i.altkeypopup_blockingFlag=!1,i.$preview.unbind("keypress keydown keyup ".split(" ").join(i.altkeypopup_namespace+" ").trim()).bind("keypress keydown keyup ".split(" ").join(i.altkeypopup_namespace+" "),function(o){if("keyup"===o.type)return clearTimeout(n),i.altkeypopup_blockingFlag=!1,o.which!==t.navigationKeys.escape;var a,s=t.builtLayouts[i.layout],r=t.keyCodes,p=e(o.target),u=o.charCode||o.which,l=String.fromCharCode(u);return"keydown"===o.type&&l in t.altKeys?(a=i.altkeypopup_blockingFlag,i.altkeypopup_blockingFlag=!0,!a):i.altkeypopup_blockingFlag?(u>=r.a&&u<=r.z&&!o.shiftKey&&(l=l.toLowerCase()),s.hasMappedKeys&&s.mappedKeys.hasOwnProperty(l)&&(l=s.mappedKeys[l]),l in t.altKeys&&(n=setTimeout(function(){i.altkeypopup_blockingFlag&&i.altKeyPopup_popup(l,p)},i.altkeypopup_options.holdTime)),!0):void 0})},i.altKeyPopup_close=function(){i.altkeypopup_blockingFlag=!1,i.altKeyPopup_$overlay=null,i.$keyboard.find("."+t.css.altKeyOverlay).remove(),e(document).unbind(i.altkeypopup_namespace),i.$preview.focus(),i.options.ignoreEsc=i.altKeyPopup_savedIgnoreEsc,i.$el.trigger(i.altkeypopup_options.popupHidden,[i])},i.altKeyPopup_popup=function(n,o){if(!i.$keyboard.find("."+t.css.altKeyOverlay).length){var a,s,r,p,u,l,c,d,y,b=t.css,f={$kb:i.$keyboard,kbWidth:i.$keyboard.outerWidth(),kbHeight:i.$keyboard.outerHeight(),$key:o};i.altKeyPopup_$overlay=e('<div class="'+b.altKeyOverlay+'" />').css({width:f.kbWidth,height:f.kbHeight}).appendTo(i.$keyboard).bind("click touchstart",function(){i.altKeyPopup_close()}),y="inactive hidden ".split(" ").join(i.altkeypopup_namespace+" "),i.$el.unbind(y).bind(y,function(){i.altKeyPopup_close()}),"bksp"!==n&&t.keyaction.bksp(i),s=e('<div class="'+b.altKeyPopup+" "+i.options.css.container+'" />'),a=t.altKeys[n].split(/\s+/),i.buildRow(s,0,a,[]),r=s.appendTo(i.altKeyPopup_$overlay).children().bind("mousedown touchstart",functi
|
|||
|
function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var s=t||window.event,r=p.call(arguments,1),u=0,c=0,d=0,y=0,b=0,f=0;if(t=e.event.fix(s),t.type="mousewheel","detail"in s&&(d=-1*s.detail),"wheelDelta"in s&&(d=s.wheelDelta),"wheelDeltaY"in s&&(d=s.wheelDeltaY),"wheelDeltaX"in s&&(c=-1*s.wheelDeltaX),"axis"in s&&s.axis===s.HORIZONTAL_AXIS&&(c=-1*d,d=0),u=0===d?c:d,"deltaY"in s&&(u=d=-1*s.deltaY),"deltaX"in s&&(c=s.deltaX,0===d&&(u=-1*c)),0!==d||0!==c){if(1===s.deltaMode){var h=e.data(this,"mousewheel-line-height");u*=h,d*=h,c*=h}else if(2===s.deltaMode){var m=e.data(this,"mousewheel-page-height");u*=m,d*=m,c*=m}if(y=Math.max(Math.abs(d),Math.abs(c)),(!a||y<a)&&(a=y,o(s,y)&&(a/=40)),o(s,y)&&(u/=40,c/=40,d/=40),u=Math[u>=1?"floor":"ceil"](u/a),c=Math[c>=1?"floor":"ceil"](c/a),d=Math[d>=1?"floor":"ceil"](d/a),l.settings.normalizeOffset&&this.getBoundingClientRect){var v=this.getBoundingClientRect();b=t.clientX-v.left,f=t.clientY-v.top}return t.deltaX=c,t.deltaY=d,t.deltaFactor=a,t.offsetX=b,t.offsetY=f,t.deltaMode=0,r.unshift(t,u,c,d),i&&clearTimeout(i),i=setTimeout(n,200),(e.event.dispatch||e.event.handle).apply(this,r)}}function n(){a=null}function o(e,t){return l.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}var i,a,s=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],r="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],p=Array.prototype.slice;if(e.event.fixHooks)for(var u=s.length;u;)e.event.fixHooks[s[--u]]=e.event.mouseHooks;var l=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var n=r.length;n;)this.addEventListener(r[--n],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",l.getLineHeight(this)),e.data(this,"mousewheel-page-height",l.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var n=r.length;n;)this.removeEventListener(r[--n],t,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var n=e(t),o=n["offsetParent"in e.fn?"offsetParent":"parent"]();return o.length||(o=e("body")),parseInt(o.css("fontSize"),10)||parseInt(n.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})});
|