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",function(n){var o=e(this).attr("data-action");o in t.keyaction&&e.isFunction(t.keyaction[o])?t.keyaction[o](i,this,n):i.insertText(o),i.altKeyPopup_close()}).bind("mouseover mouseleave",function(t){r.removeClass(i.options.css.buttonHover),"mouseleave"!==t.type&&e(this).addClass(i.options.css.buttonHover)}),i.altKeyPopup_navigate(!0),i.altKeyPopup_savedIgnoreEsc=i.options.ignoreEsc,i.options.ignoreEsc=!0,e(document).unbind(i.altkeypopup_namespace).bind("keydown"+i.altkeypopup_namespace,function(e){return!1}).bind("keyup"+i.altkeypopup_namespace,function(e){return e.which===t.navigationKeys.escape?(e.which=0,i.altKeyPopup_close()):i.altKeyPopup_navigate(e),!1}),f.$popup=s,c=s.outerWidth(),(p=o.position().left-c/2)+c>f.kbWidth&&(p=f.kbWidth-c)<0&&s.css({width:f.kbWidth,height:"auto"}),u=o.position().top-o.outerHeight()-5,d=s.outerHeight(),l=i.$keyboard.find("."+b.keySet).position().top,u+d>f.kbHeight&&(u=f.kbHeight-d)<l&&s.css({height:f.popupHeight,width:"auto"}),f.popupWidth=s.outerWidth(),f.popupHeight=s.outerHeight(),f.popupLeft=p<0?0:p,f.popupTop=u<l?l:u,s.css({position:"absolute",left:f.popupLeft,top:f.popupTop}),"function"==typeof i.altkeypopup_options.popupPosition&&i.altkeypopup_options.popupPosition(i,f),i.$preview.blur(),i.$el.trigger(i.altkeypopup_options.popupVisible,[i])}},i.altKeyPopup_navigate=function(e){var n,o=t.css,a=t.navigationKeys,s=i.options.css.buttonHover,r=i.$keyboard.find("."+o.altKeyPopup).find("."+o.keyButton),p=r.length-1;if(!0===e)return r.eq(0).addClass(s),void(i.altKeyPopup_currentIndex=0);if(n=i.altKeyPopup_currentIndex,e.which===a.enter)return i.insertText(r.eq(n).attr("data-value")),i.altKeyPopup_close(),!0;switch(e.which){case a.end:n=p;break;case a.home:n=0;break;case a.left:n-=1;break;case a.right:n+=1}n<0&&(n=0),n>p&&(n=p),i.altKeyPopup_currentIndex=n,r.removeClass(s).eq(n).addClass(s)},i.options.alwaysOpen&&i.isVisible()&&i.altkeypopup_setup(),i.$el.unbind(t.events.kbBeforeVisible+i.altkeypopup_namespace).bind(t.events.kbBeforeVisible+i.altkeypopup_namespace,function(){i.altkeypopup_setup()})}})}}),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";e.fn.addAutocomplete=function(t){var n={position:{of:null,my:"right top",at:"left top",collision:"flip"},events:"autocomplete",data:""};return this.each(function(){var o,i,a=e(this).data("keyboard");a&&(i=a.namespace+"Autocomplete",a.autocomplete_namespace=i,a.extensionNamespace.push(i),a.autocomplete_init=function(){var s=(o=a.autocomplete_options=e.extend(!0,{},n,t)).events||o.data||"autocomplete";a.options.alwaysOpen&&a.isVisible()&&a.autocomplete_setup(),a.$el.unbind(i).bind(e.keyboard.events.kbVisible+i,function(){a.autocomplete_setup()}).bind(e.keyboard.events.kbHidden+i,function(){a.$el[o.data||"autocomplete"]("close")}).bind(e.keyboard.events.kbChange+i,function(){a.hasAutocomplete&&a.isVisible()&&a.$el.val(a.$preview.val())}).bind(s+"open"+i,function(){if(a.hasAutocomplete){var t=e.extend({},o.position);t.of=t.of||a.$keyboard,a.$autocomplete.menu.element.position(t)}}).bind(s+"select"+i,function(e,t){a.autocomplete_getVal(t.item)})},a.autocomplete_getVal=function(e){var t;switch(typeof e){case"string":t=e||"";break;case"object":t=e.label||e.value||"";break;default:t=a.preview&&a.preview.value||a.el.value}t=t.toString(),a.hasAutocomplete&&""!==t&&((a.$preview||a.$el).val(t).focus(),a.last.start=t.length,a.last.end=t.length,a.last.val=t)},a.autocomplete_update=function(e){clearTimeout(a.$autocomplete.searching),a.$autocomplete.searching=setTimeout(function(){a.$autocomplete.term!==a.$autocomplete.element.val()&&(a.$autocomplete.selectedItem=null,a.$autocomplete.search(null,e))},a.$autocomplete.options.delay)},a.autocomplete_navKeys={8:"backSpace",9:"tab",13:"enter",20:"capsLock",27:"escape",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"delete"},a.autocomplete_setup=function(){var e;if(a.$autocomplete=a.$el.data(a.autocomplete_options.data)||a.$el.data("uiAutocomplete")||a.$el.data("ui-autocomplete")||a.$el.data("autocomplete"),a.hasAutocomplete=void 0!==a.$autocomplete&&!a.$autocomplete.options.disabled,a.hasAutocomplete){a.$preview.bind("keydown"+i+" keypress"+i,function(t){a.$preview&&t.namespace!==a.$autocomplete.eventNamespace&&(t.namespace=a.$autocomplete.eventNamespace.slice(1),(e=a.autocomplete_navKeys[t.which])?a.el!==a.preview&&(a.$el.triggerHandler(t),"enter"===e&&setTimeout(function(){a.$preview.val(a.$autocomplete.selectedItem.value),a.$preview.focus()},100)):a.autocomplete_update(t))});var t="mouseup mousedown mouseleave touchstart touchend touchcancel ".split(" ").join(i+" ");a.$allKeys.bind(t,function(e){a.autocomplete_update(e)})}a.escCloseCallback.autocomplete||(a.escCloseCallback.autocomplete=a.checkAutocompleteMenu)},a.checkAutocompleteMenu=function(e){return a.hasAutocomplete&&e.closest("ul").hasClass("ui-autocomplete")},a.autocomplete_init())})}}),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;t.firefox=void 0!==window.mozInnerScreenX,e.extend(t.css,{caret:"ui-keyboard-caret",caretMirror:"ui-keyboard-mirror-div"}),e.fn.addCaret=function(n){var o={caretClass:"",charAttr:"data-character",charIndex:1,offsetX:0,offsetY:0,adjustHt:0};return this.each(function(){var i,a,s=t.events,r=e(this).data("keyboard");r&&(i=r.caret_options=e.extend({},o,n),a=r.caret_namespace=r.namespace+"caret",r.extensionNamespace.push(a),r.textareaCaretProperties=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],r.caret_setup=function(){var n=t.css,o="keyup keypress mouseup mouseleave ".split(" ").join(a+" "),p="position:absolute;visibility:hidden;top:-9999em;left:-9999em;white-space:pre-wrap;z-index:-10;"+("INPUT"===r.preview.nodeName?"":"word-wrap:break-word;");r.$keyboard.find("."+n.caretMirror).remove(),r.caret_$div=e('<div class="'+n.caretMirror+'" style="'+p+'">').appendTo(r.$keyboard),r.$caret&&r.$caret.remove(),r.$caret=e('<div class="'+n.caret+" "+i.caretClass+'" style="position:absolute;">').insertAfter(r.$preview),r.$el.unbind(s.kbChange+a).bind(s.kbChange+a,function(){r.findCaretPos()}),r.$preview.unbind(o).bind(o,function(){r.findCaretPos()})},r.findCaretPos=function(){if(r.caret_$div){var n,o,a,s,p,u,l,c,d=r.preview,y=parseFloat(r.$preview.css("fontSize")),b="INPUT"===d.nodeName,f=r.caret_$div[0];n=f.style,o=window.getComputedStyle?getComputedStyle(d,null):d.currentStyle,s=t.caret(r.$preview),p=Math["ltr"===o.direction?"max":"min"](s.start,s.end),r.textareaCaretProperties.forEach(function(e){n[e]=o[e]}),t.firefox&&(n.width=parseInt(o.width,10)-2+"px",d.scrollHeight>parseInt(o.height,10)&&(n.overflowY="scroll")),n.width=parseInt(b?d.scrollWidth:o.width,10)+(b?2*y:0)+"px",f.textContent=d.value.substring(0,p),"INPUT"===d.nodeName&&(f.textContent=f.textContent.replace(/\x20/g," ")),(l=document.createElement("span")).textContent=d.value.substring(p)||"",f.appendChild(l),c=e(l).position(),s="center"===n.textAlign?y:0,r.caretPos={top:c.top+parseInt(o.borderTopWidth,10)+i.offsetY,left:c.left+parseInt(o.borderLeftWidth,10)+i.offsetX-s},a=parseInt(r.$caret.css("margin-top"),10),n=Math.round(y+2*a)+i.adjustHt,c=r.$preview.position(),r.$caret.css({top:c.top-d.scrollTop+r.caretPos.top-a,left:c.left-d.scrollLeft+r.caretPos.left,height:n}),u=d.value.substring(p,p+i.charIndex).replace(/\s/," ")||" ",r.$caret.attr(i.charAttr,u)}},r.$el.unbind(a).bind(s.kbBeforeVisible+a,function(){r.caret_setup()}).bind(s.kbVisible+a,function(){r.findCaretPos()}).bind(s.kbHidden+a,function(){var e="keyup keypress mouseup mouseleave ".split(" ").join(a+" ");r.$preview.unbind(e),r.$caret.remove(),r.$caret=null,r.caret_$div=null}),r.options.alwaysOpen&&r.isVisible()&&(r.caret_setup(),r.findCaretPos()))})}}),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;t.css.extender="ui-keyboard-extender",t.language.en.display.extender=" :toggle_numpad",t.layouts.numpad={normal:["{clear} / * -","7 8 9 +","4 5 6 %","1 2 3 =","0 {dec} {left} {right}"]},t.keyaction.extender=function(e,t){return e.extender_toggle(),!1},e.fn.addExtender=function(n){var o={layout:"numpad",showing:!1,reposition:!0};return this.each(function(){var i=e(this).data("keyboard");if(i){if(i.extender_options=e.extend({},o,i.extender_options,n),i.extender_namespace)return i.extender_layoutSwitcher();i.extender_namespace=i.namespace+"extender",i.extensionNamespace.push(i.extender_namespace),i.extender_layoutSwitcher=function(){i.extender_lastKeyset=i.last.keyset,i.extender_bindEvents(!1),i.$el.one(t.events.kbBeforeVisible,function(){i.shiftActive=i.extender_lastKeyset[0],i.altActive=i.extender_lastKeyset[1],i.metaActive=i.extender_lastKeyset[2],i.showKeySet(),i.extender_setup(),i.extender_bindEvents()}),i.redraw()},i.extender_bindEvents=function(e){var n=t.events.kbBeforeVisible+i.extender_namespace;i.$el.unbind(n),!1!==e&&i.$el.bind(n,function(){i.extender_setup()})},i.extender_setup=function(){var e,n=i.extender_options.layout;void 0===t.builtLayouts[n]&&i.buildKeyboard(n),(e=t.builtLayouts[n].$keyboard.find("."+t.css.keySet+"-normal").clone()).removeClass().removeAttr("name").addClass(t.css.extender).children("button").removeAttr("data-pos"),e[0].style.display=i.extender_options.showing?"inline-block":"none",i.$keyboard.find("div."+t.css.extender).remove(),i.$keyboard.append(e),i.extender_toggle(i.extender_options.showing),i.bindKeys()},i.extender_toggle=function(n){i.extender_options.showing=void 0===n?!i.extender_options.showing:n,i.$keyboard.find("button."+t.css.extender).toggleClass(i.options.css.buttonActive,i.extender_options.showing).end().find("div."+t.css.extender)[0].style.display=i.extender_options.showing?"inline-block":"none",i.extender_options.reposition&&e(window).trigger("resize")},i.options.alwaysOpen&&i.isVisible()&&i.extender_setup(),i.extender_bindEvents()}})}}),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){e.fn.addMobile=function(t){var n,o={container:{theme:"b",cssClass:"ui-body"},input:{theme:"b",cssClass:""},buttonMarkup:{theme:"b",cssClass:"ui-btn",shadow:"true",corners:"true"},buttonHover:{theme:"b",cssClass:"ui-btn-hover"},buttonAction:{theme:"b",cssClass:"ui-btn-active"},buttonActive:{theme:"b",cssClass:"ui-btn-active"},allThemes:"a b c"};return this.each(function(){var i=e(this).data("keyboard");i&&void 0!==e.fn.textinput&&(i.mobile_options=n=e.extend(!0,{},o,t),i.mobile_themes=e.trim((" "+n.allThemes).split(" ").join(" "+n.buttonMarkup.cssClass+"-")+(" "+n.allThemes).split(" ").join(" "+n.buttonAction.cssClass+"-")+(" "+n.allThemes).split(" ").join(" "+n.buttonActive.cssClass+"-")),void 0===i.options.mobile_savedActiveClass&&(i.options.mobile_savedActiveClass=""+i.options.css.buttonActive),i.mobile_init=function(){var t=i.namespace+"Mobile";e("."+e.keyboard.css.input).textinput(),i.options.alwaysOpen&&i.isVisible&&i.mobile_setup(),i.extensionNamespace.push(t),i.$el.unbind(t).bind(e.keyboard.events.kbBeforeVisible+t,function(){i&&i.el.active&&i.$keyboard.length&&i.$keyboard.css("visibility","hidden")}).bind(e.keyboard.events.kbVisible+t,function(){i&&i.el.active&&i.$keyboard.length&&(i.mobile_setup(),i.$keyboard.css("visibility","visible"),i.$preview.focus())})},i.mobile_setup=function(){var t,o=e.keyboard.css,a=i.options,s=i.mobile_themes;i.mobile_$actionKeys=i.$keyboard.find("."+i.options.css.buttonAction),a.css.buttonActive=a.mobile_savedActiveClass+" "+i.modOptions(n.buttonActive,n.buttonMarkup),i.$keyboard.addClass(i.modOptions(n.container,n.container)).find("."+o.preview).removeClass("ui-widget ui-widget-content").addClass(i.modOptions(n.input,n.input)).end().find("button").removeClass(e.trim("ui-corner-all ui-state-default "+s)).addClass(i.modOptions(n.buttonMarkup,n.buttonMarkup)).not(i.mobile_$actionKeys).hover(function(){e(this).removeClass(s).addClass(i.modOptions(n.buttonHover,n.buttonMarkup))},function(){e(this).removeClass(s+" "+n.buttonHover.cssClass).addClass(i.modOptions(n.buttonMarkup,n.buttonMarkup))}),i.mobile_$actionKeys.removeClass(s).addClass(i.modOptions(n.buttonAction,n.buttonMarkup)),i.msie&&i.$preview[0]!==i.el&&(i.$preview.hide(),i.$keyboard.css("width",""),i.width=i.$keyboard.outerWidth(),i.$keyboard.width(i.width+parseInt(i.$preview.css("fontSize"),10)),i.$preview.width(i.width),i.$preview.show()),e.ui&&e.ui.position&&((t=a.position).of=t.of||i.$el.data("keyboardPosition")||i.$el,t.collision=t.collision||"flipfit flipfit",i.$keyboard.position(t))},i.modOptions=function(e,t){return" "+(e.cssClass||"")+" "+(t&&t.cssClass?t.cssClass+"-"+(e.theme||""):"")+("true"==e.shadow?" ui-shadow":"")+("true"==e.corners?" ui-corner-all":"")},i.mobile_init())})}}),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";e.keyboard=e.keyboard||{},e.keyboard.navigationKeys={toggle:112,enter:13,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,caretrt:45,caretlt:46,caretright:function(t){e.keyboard.keyaction.right(t)},caretleft:function(t){e.keyboard.keyaction.left(t)}},e.fn.addNavigation=function(t){return this.each(function(){var n,o,i=e(this).data("keyboard"),a=i.options,s={position:[0,0],toggleMode:!1,focusClass:"hasFocus",toggleKey:null,rowLooping:!1},r=e.keyboard.events,p=e.keyboard.css;i&&(i.navigation_options=n=e.extend({},s,t),i.navigation_keys=o=e.extend({},e.keyboard.navigationKeys),i.navigation_namespace=i.namespace+"Nav",i.extensionNamespace.push(i.navigation_namespace),i.saveNav=[i.options.tabNavigation,i.options.enterNavigation],i.allNavKeys=e.map(o,function(e,t){return e}),i.navigation_init=function(){i.$keyboard.toggleClass(n.focusClass,n.toggleMode).find("."+p.keySet+":visible").find("."+p.keyButton+'[data-pos="'+n.position[0]+","+n.position[1]+'"]').addClass(a.css.buttonHover),i.$preview.unbind(i.navigation_namespace).bind("keydown"+i.navigation_namespace,function(e){return i.checkKeys(e.which)})},i.checkKeys=function(t,o){if(void 0!==t){var a=i.navigation_keys;return(t===(n.toggleKey||a.toggle)||o)&&(n.toggleMode=!o&&!n.toggleMode,i.options.tabNavigation=!n.toggleMode&&i.saveNav[0],i.options.enterNavigation=!n.toggleMode&&i.saveNav[1]),i.$keyboard.toggleClass(n.focusClass,n.toggleMode),n.toggleMode&&t===a.enter?(i.$keyboard.find("."+p.keySet+":visible").find("."+p.keyButton+'[data-pos="'+n.position[0]+","+n.position[1]+'"]').trigger(r.kbRepeater),!1):n.toggleMode&&e.inArray(t,i.allNavKeys)>=0?(i.navigateKeys(t),!1):void 0}},i.getMaxIndex=function(e,t){return e.find("."+p.keyButton+'[data-pos^="'+t+',"]').length-1},i.leftNavigateKey=function(e,t){var n=i.navigation_options.rowLooping,o=e-1;return o>=0?o:n?t:0},i.rightNavigateKey=function(e,t){var n=i.navigation_options.rowLooping,o=e+1;return o<=t?o:n?0:t},i.navigateKeys=function(t,o,s){if(i.isVisible()){s="number"==typeof s?s:n.position[1],o="number"==typeof o?o:n.position[0];var r,u=i.$keyboard.find("."+p.keySet+":visible"),l=u.find("."+p.endRow).length-1,c=i.getMaxIndex(u,o),d=i.last,y=i.$preview.val().length,b=i.navigation_keys;switch(t){case b.pageup:o=0;break;case b.pagedown:o=l;break;case b.end:s=c;break;case b.home:s=0;break;case b.left:s=i.leftNavigateKey(s,c);break;case b.up:o+=o>0?-1:0,r=i.getMaxIndex(u,o),s=s===c?r:s;break;case b.right:s=i.rightNavigateKey(s,c);break;case b.down:o+=o+1>l?0:1,r=i.getMaxIndex(u,o),s=s===c?r:s;break;case b.caretrt:d.start++;break;case b.caretlt:d.start--}t!==b.caretrt&&t!==b.caretlt||(d.start=d.start<0?0:d.start>y?y:d.start,i.last.start=i.last.end=d.end=d.start,e.keyboard.caret(i.$preview,i.last)),s>(c=i.getMaxIndex(u,o))&&(s=c),u.find("."+a.css.buttonHover).removeClass(a.css.buttonHover),u.find("."+p.keyButton+'[data-pos="'+o+","+s+'"]').addClass(a.css.buttonHover),n.position=[o,s]}},i.options.alwaysOpen&&i.isVisible()&&(i.$keyboard.find("."+a.css.buttonHover).removeClass(a.css.buttonHover),i.navigation_init()),i.$el.unbind(i.navigation_namespace).bind(r.kbVisible,function(){i.$keyboard.find("."+a.css.buttonHover).removeClass(a.css.buttonHover),i.navigation_init()}).bind(r.kbInactive+" "+r.kbHidden,function(e){i.checkKeys(e.which,!0)}).bind(r.kbKeysetChange,function(){i.navigateKeys(null)}).bind("navigate navigateTo",function(t,n,o){var a;(n=isNaN(n)?n.toLowerCase():n)in i.navigation_keys?(a=i.navigation_keys[n],isNaN(a)&&a in e.keyboard.keyaction?e.keyboard.keyaction[a](i,this,t):e.isFunction(a)?a(i):i.checkKeys(a)):"string"==typeof n&&n in e.keyboard.keyaction?e.keyboard.keyaction[n](i,this,t):i.navigateKeys(null,n,o)}))})}}),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";e.keyboard=e.keyboard||{},e.fn.previewKeyset=function(t){return this.each(function(){var n=e(this).data("keyboard"),o=n.namespace+"Preview",i={sets:["normal","shift","alt","alt-shift"]};n&&(n.previewKeyset_options=e.extend({},i,t),n.extensionNamespace.push(o),n.previewKeyset=function(){var t=e.keyboard.css,o=n.previewKeyset_options.sets,i=n.$keyboard.find("."+t.keySet).filter('[name="'+o.join('"],[name="')+'"]');i.length>1&&i.eq(0).find("."+t.keyButton).not("."+t.keyAction).each(function(){var n,a,s={},r=o.length,p=i.find('button[data-pos="'+e(this).attr("data-pos")+'"]');for(n=0;n<r;n++)a=p.eq(n).parent().attr("name"),e.inArray(a,o)>=0&&(s["data-"+a]=p.eq(n).find("."+t.keyText).text());p.attr(s)})},n.options.alwaysOpen&&n.isVisible()?n.previewKeyset():n.$el.unbind(e.keyboard.events.kbBeforeVisible+o).bind(e.keyboard.events.kbBeforeVisible+o,function(){n.previewKeyset()}))})}}),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";e.keyboard=e.keyboard||{},e.fn.addScramble=function(t){var n={targetKeys:/[a-z\d]/i,byRow:!0,byKeySet:!1,randomizeOnce:!0,randomizeInput:!1,init:null,sameForAll:!1};return this.each(function(){var o,i=e(this).data("keyboard"),a=i.namespace+"Scramble",s=i.options;i&&!i.scramble_options&&(o=i.scramble_options=e.extend({},n,t),i.extensionNamespace.push(a),o.orig_create=s.create,i.scramble_setup=function(t){var n,a,s,r,p,u,l,c,d,y,b;if(n=t.find("."+e.keyboard.css.keySet),t.length){for(o.byKeySet&&(n=n.eq(0)),a=0;a<n.length;a++)if(s=n.eq(a),l=0,b=[],d=[],c=[],y=[],s.children("button, span, br").each(function(){"BR"===this.tagName?o.byRow?(b.push(this),d.push(!1),y[l]=b,c[l]=d,b=[],d=[],l++):(y[l]=this,c[l]=!1,l++):(u=e(this).attr("data-value")||"",u=!(1!==u.length||!o.targetKeys.test(u))&&u,o.byRow?(b.push(this),d.push(u)):(y[l]=this,c[l]=u,l++))}),s.find("."+e.keyboard.css.endRow).remove(),o.byRow)for(p=0;p<y.length;p++)for(b=i.shuffle(y[p],c[p]),r=0;r<b.length;r++)s.append(b[r]);else for(b=i.shuffle(y,c),r=0;r<b.length;r++)s.append(b[r]);return o.byKeySet&&(t=i.realign(t)),t}},i.shuffle=function(e,t){for(var n,o,i=e.length;i>0;)o=Math.floor(Math.random()*i),!1===t[i-1]&&i--,!1!==t[i-1]&&!1!==t[o]&&(n=e[--i],e[i]=e[o],e[o]=n);return e},i.realign=function(t){var n,o,i,a=t.find("."+e.keyboard.css.keySet),s=a.eq(0);return a=a.filter(":gt(0)"),s.children().each(function(t,s){o="BR"===s.tagName,i=e(s).attr("data-pos"),a.each(function(t,a){n=o?"br:first":'button[data-pos="'+i+'"]',e(a).find(n).appendTo(a)})}),t},i.setScrambleLayout=function(){if(!/^scrambled/.test(s.layout)){i.orig_layout=s.layout;var e=e||"scrambled"+Math.round(1e4*Math.random());s.layout=o.sameForAll?e:"scrambled"+Math.round(1e4*Math.random())}},s.create=function(){var t=s.layout;e.keyboard.builtLayouts[t]={mappedKeys:{},acceptedKeys:[],$keyboard:null},i.layout=s.layout=i.orig_layout,i.buildKeyboard(i.layout,!0),i.layout=s.layout=t,e.keyboard.builtLayouts[t]=e.extend(!0,{},e.keyboard.builtLayouts[i.orig_layout]),o.randomizeOnce&&(e.keyboard.builtLayouts[t].$keyboard=i.scramble_setup(e.keyboard.builtLayouts[i.orig_layout].$keyboard.clone())),i.$keyboard=e.keyboard.builtLayouts[t].$keyboard,o.randomizeInput?i.$el.unbind(e.keyboard.events.kbChange+a).bind(e.keyboard.events.kbChange+a,function(t,n){o.targetKeys.test(n.last.key)&&(n.$keyboard.find("."+s.css.buttonHover).removeClass(s.css.buttonHover),n.$keyboard=n.scramble_setup(n.$keyboard),e(document.elementFromPoint(t.clientX,t.clientY)).trigger("mouseenter"))}):o.randomizeOnce||i.$el.unbind(e.keyboard.events.kbBeforeVisible+a).bind(e.keyboard.events.kbBeforeVisible+a,function(e,t){t.$keyboard=t.scramble_setup(t.$keyboard)}),e.isFunction(o.orig_create)&&o.orig_create(i)},i.setScrambleLayout(),s.alwaysOpen&&i.$keyboard.length?setTimeout(function(){var t=e.keyboard.builtLayouts;i.$keyboard=i.scramble_setup(i.$keyboard),i.setScrambleLayout(),void 0===t[s.layout]&&(t[s.layout]={mappedKeys:e.extend({},t[i.layout].mappedKeys),acceptedKeys:e.extend([],t[i.layout].acceptedKeys),$keyboard:i.$keyboard.clone()}),e.isFunction(o.init)&&o.init(i)},0):e.isFunction(o.init)&&o.init(i))})}}),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){e.fn.addTyping=function(t){var n={showTyping:!0,lockTypeIn:!1,delay:250,hoverDelay:250},o=e.keyboard;return this.each(function(){var i,a=e(this).data("keyboard");a&&(i=a.typing_options=e.extend({},n,t),a.typing_keymap={" ":"space",'"':"34","'":"39"," ":"space","\b":"bksp","{b}":"bksp","{d}":"del","{l}":"left","{r}":"right","\n":"enter","\r":"enter","{e}":"enter","\t":"tab","{t}":"tab"},a.typing_xref={8:"bksp",9:"tab",13:"enter",32:"space",37:"left",39:"right",46:"del"},a.typing_event=!1,a.typing_namespace=a.namespace+"typing",a.extensionNamespace.push(a.typing_namespace),i.savedLockInput=a.options.lockInput,a.typing_setup_reset=function(){var e=o.events,t=a.typing_namespace,n=[e.kbHidden,e.kbInactive,""].join(t+" ");a.$el.unbind(t).bind(n,function(){a.typing_reset()}),a.$allKeys.unbind(t).bind("mousedown"+t,function(){a.typing_reset()})},a.typing_setup=function(){var e=a.typing_namespace;a.typing_setup_reset(),a.$el.bind(o.events.kbBeforeVisible+e,function(){a.typing_setup()}),a.$preview.unbind(e).bind("keyup"+e,function(e){if(i.init&&i.lockTypeIn||!i.showTyping)return!1;if(!(e.which>=37&&e.which<=40))return 16===e.which&&(a.shiftActive=!1),18===e.which&&(a.altActive=!1),16===e.which||18===e.which?(a.showSet(),void setTimeout(function(){a.$preview.focus()},200)):void 0}).bind("keydown"+e,function(e){if(i.init&&i.lockTypeIn||!i.showTyping)return!1;e.temp=!1,16===e.which&&(e.temp=!a.shiftActive,a.shiftActive=!0),18===e.which&&(e.temp=!a.altActive,a.altActive=!0),e.temp&&(a.showSet(),a.$preview.focus()),a.typing_event=!0,a.typing_xref[e.which]&&a.typing_findKey("",e)}).bind("keypress"+e,function(e){if(i.init&&i.lockTypeIn)return!1;a.typing_event&&!a.options.lockInput&&(a.typing_reset(),a.typing_event=!0,a.typing_findKey("",e))})},a.typing_reset=function(){a.typing_event=i.init=!1,i.text="",i.len=i.current=0,a.options.lockInput=i.savedLockInput},a.typeIn=function(e,t,n,o){if(!a.isVisible())return clearTimeout(a.typing_timer),void a.typing_reset();if(a.typing_event){if(void 0===e)return a.typing_event=!1,void(a.options.lockInput=i.savedLockInput)}else!0!==i.init&&(i.init=!0,a.options.lockInput=i.lockTypeIn,i.text=e||i.text||"",i.len=i.text.length,i.delay=t||i.delay,i.current=0,n&&(i.callback=n)),"{"===(e=i.text.substring(i.current,++i.current))&&"}"===i.text.substring(i.current+1,i.current+2)&&(e+=i.text.substring(i.current,i.current+=2)),a.typing_findKey(e,o)},a.typing_findKey=function(t,n){var s,r,p,u,l,c,d,y,b=o.css,f=o.builtLayouts[a.layout].mappedKeys;if(a.isOpen&&a.$keyboard.length)if(c=a.$keyboard.find("."+b.keySet),u=t in a.typing_keymap?a.typing_keymap[t]:t,s="."+b.keyButton+'[data-action="'+u+'"]',a.typing_event&&n&&("keypress"!==n.type&&a.typing_xref.hasOwnProperty(n.keyCode||n.which)?s="."+b.keyPrefix+a.processName(a.typing_xref[n.keyCode||n.which]):(r=String.fromCharCode(n.charCode||n.which),s=f.hasOwnProperty(r)?"."+b.keyButton+'[data-value="'+f[r].replace(/"/g,'\\"')+'"]':"."+b.keyPrefix+a.processName(r))),l=c.filter(":visible").find(s),l.length?a.typing_simulateKey(l,t,n):(a.typing_event?l=c.find(s):(p=t in a.typing_keymap?a.typing_keymap[t]:a.processName(t),l=c.find("."+b.keyPrefix+p)),(y=l.closest("."+b.keySet)).attr("name")?(i.showTyping&&(d=y.attr("name"),a.shiftActive=/shift/.test(d),a.altActive=/alt/.test(d),a.metaActive=a.last.keyset[2]=!!/\bmeta/.test(d)&&d.match(/meta[\w-]+/)[0],a.showSet(a.metaActive)),a.typing_simulateKey(l,t,n)):a.typing_event||(t in a.typing_keymap&&a.typing_keymap[t]in o.keyaction?o.keyaction[a.typing_keymap[t]](a,l,n):a.insertText(t),a.checkCombos(),a.$el.trigger(o.events.kbChange,[a,a.el]))),i.current<=i.len&&0!==i.len){if(!a.isVisible())return;a.typing_timer=setTimeout(function(){a.typeIn()},i.delay)}else{if(0!==i.len)return a.typing_reset(),void(e.isFunction(i.callback)&&(a.typing_timer=setTimeout(function(){e.isFunction(i.callback)&&i.callback(a)},i.delay)));a.typing_reset()}},a.typing_simulateKey=function(t,n,s){var r=t.length;a.isVisible()&&(i.showTyping&&r&&(t.filter(":visible").trigger("mouseenter"+a.namespace),i.showTyping&&r&&setTimeout(function(){t.trigger("mouseleave"+a.namespace)},Math.min(i.hoverDelay,i.delay))),a.typing_event||setTimeout(function(){n in a.typing_keymap&&a.typing_keymap[n]in o.keyaction?((s=s||e.Event("keypress")).target=t,o.keyaction[a.typing_keymap[n]](a,t,s)):a.insertText(n),a.checkCombos(),a.$el.trigger(o.events.kbChange,[a,a.el])},i.delay/3))},i.showTyping&&a.options.alwaysOpen&&a.isVisible()?a.typing_setup():a.$el.unbind(o.events.kbBeforeVisible+a.typing_namespace).bind(o.events.kbBeforeVisible+a.typing_namespace,function(){i.showTyping?a.typing_setup():a.typing_setup_reset()}))})}}),/*! Mousewheel version: 3.1.12 * (c) 2014 Brandon Aaron * MIT License */
|
||
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)}})}); |