2 lines
6.1 KiB
JavaScript
2 lines
6.1 KiB
JavaScript
|
/*! 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 p=e.keyboard;e.extend(p.css,{altKeyPopup:"ui-keyboard-popup",altKeyOverlay:"ui-keyboard-overlay"}),p.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:"Ź Ż Ž","!":"¡",$:"€ £ ¤ ¥ ¢ ₡ ₱ ₩ ₹ ₪ ₭ ₮ ₦ ₤","?":"¿","'":"〈 「 『 “",'"':"〉 」 』 ”","(":"《 【 〔",")":"》 】 〕"},p.altKeys),p.navigationKeys=e.extend({enter:13,escape:27,end:35,home:36,left:37,right:39},p.navigationKeys),e.fn.addAltKeyPopup=function(o){var t={holdTime:500,popupVisible:"popup-visible",popupHidden:"popup-hidden",popupPosition:null};return this.each(function(){var a=e(this).data("keyboard");if(a){if(a.altkeypopup_options=e.extend({},t,a.altkeypopup_options,o),a.altkeypopup_namespace)return a.altkeypopup_setup();a.altkeypopup_namespace=a.namespace+"AltKeyPopup",a.extensionNamespace.push(a.altkeypopup_namespace),a.altkeypopup_setup=function(){var o,t="mousedown touchstart ".split(" ").join(a.altkeypopup_namespace+" "),i="mouseup touchend touchcancel ".split(" ").join(a.altkeypopup_namespace+" ");a.options.repeatRate=0,a.$allKeys.unbind(a.altkeypopup_namespace).bind(t,function(){clearTimeout(o);var t=e(this),i=t.attr("data-value")||"",n=a.altkeypopup_options.holdTime;i in p.altKeys&&(n?o=setTimeout(function(){a.altKeyPopup_popup(i,t)},n):a.altKeyPopup_popup(i,t))}).bind(i,function(){clearTimeout(o)}),a.altkeypopup_blockingFlag=!1,a.$preview.unbind("keypress keydown keyup ".split(" ").join(a.altkeypopup_namespace+" ").trim()).bind("keypress keydown keyup ".split(" ").join(a.altkeypopup_namespace+" "),function(t){if("keyup"===t.type)return clearTimeout(o),a.altkeypopup_blockingFlag=!1,t.which!==p.navigationKeys.escape;var i,n=p.builtLayouts[a.layout],u=p.keyCodes,s=e(t.target),l=t.charCode||t.which,y=String.fromCharCode(l);return"keydown"===t.type&&y in p.altKeys?(i=a.altkeypopup_blockingFlag,a.altkeypopup_blockingFlag=!0,!i):a.altkeypopup_blockingFlag?(l>=u.a&&l<=u.z&&!t.shiftKey&&(y=y.toLowerCase()),n.hasMappedKeys&&n.mappedKeys.hasOwnProperty(y)&&(y=n.mappedKeys[y]),y in p.altKeys&&(o=setTimeout(function(){a.altkeypopup_blockingFlag&&a.altKeyPopup_popup(y,s)},a.altkeypopup_options.holdTime)),!0):void 0})},a.altKeyPopup_close=function(){a.altkeypopup_blockingFlag=!1,a.altKeyPopup_$overlay=null,a.$keyboard.find("."+p.css.altKeyOverlay).remove(),e(document).unbind(a.altkeypopup_namespace),a.$preview.focus(),a.options.ignoreEsc=a.altKeyPopup_savedIgnoreEsc,a.$el.trigger(a.altkeypopup_options.popupHidden,[a])},a.altKeyPopup_popup=function(o,t){if(!a.$keyboard.find("."+p.css.altKeyOverlay).length){var i,n,u,s,l,y,r,c,d,k=p.css,h={$kb:a.$keyboard,kbWidth:a.$keyboard.outerWidth(),kbHeight:a.$keyboard.outerHeight(),$key:t};a.altKeyPopup_$overlay=e('<div class="'+k.altKeyOverlay+'" />').css({width:h.kbWidth,height:h.kbHeight}).appendTo(a.$keyboard).bind("click touchstart",function(){a.altKeyPopup_close()}),d="inactive hidden ".split(" ").join(a.altkeypopup_namespace+" "),a.$el.unbind(d).bind(d,function(){a.altKeyPopup_close()}),"bksp"!==o&&p.keyaction.bksp(a),n=e('<div class="'+k.altKeyPopup+" "+a.options.css.container+'" />'),i=p.altKeys[o].split(/\s+/),a.buildRow(n,0,i,[]),u=n.appendTo(a.altKeyPopup_$overlay).children().bind("mousedown touchstart",functi
|