Tumortisch-Dist/resources/app/lib/3rdparty/virtual-keyboard/js/jquery.keyboard.min.js

2 lines
45 KiB
JavaScript
Raw Permalink Normal View History

2021-06-15 16:00:08 +02:00
/*! jQuery UI Virtual Keyboard v1.27.3 */
!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=function(a,i){var n,s=this;s.version="1.27.3",s.$el=e(a),s.el=a,s.$el.data("keyboard",s),s.init=function(){s.initialized=!1;var a,o,r,l=t.css,c=t.events;s.settings=i||{},i&&i.position&&(o=e.extend({},i.position),i.position=null),s.options=n=e.extend(!0,{},t.defaultOptions,i),o&&(n.position=o,i.position=o),s.el.active=!0,s.namespace=".keyboard"+Math.random().toString(16).slice(2),s.extensionNamespace=[],s.shiftActive=s.altActive=s.metaActive=s.sets=s.capsLock=!1,s.rows=["","-shift","-alt","-alt-shift"],s.inPlaceholder=s.$el.attr("placeholder")||"",s.watermark=t.watermark&&""!==s.inPlaceholder,s.repeatTime=1e3/(n.repeatRate||20),n.preventDoubleEventTime=n.preventDoubleEventTime||100,s.isOpen=!1,s.wheel=e.isFunction(e.fn.mousewheel),s.escapeRegex=/[-\/\\^$*+?.()|[\]{}]/g,s.isContentEditable=!/(input|textarea)/i.test(s.el.nodeName)&&s.el.isContentEditable,a=t.keyCodes,s.alwaysAllowed=[a.capsLock,a.pageUp,a.pageDown,a.end,a.home,a.left,a.up,a.right,a.down,a.insert,a.delete],s.$keyboard=[],s.enabled=!0,s.checkCaret=n.lockInput||t.checkCaretSupport(),s.isContentEditable&&(n.usePreview=!1),s.last={start:0,end:0,key:"",val:"",preVal:"",layout:"",virtual:!0,keyset:[!1,!1,!1],wheel_$Keys:null,wheelIndex:0,wheelLayers:[]},s.temp=["",0,0],e.each([c.kbInit,c.kbBeforeVisible,c.kbVisible,c.kbHidden,c.inputCanceled,c.inputAccepted,c.kbBeforeClose,c.inputRestricted],function(t,a){e.isFunction(n[a])&&s.$el.bind(a+s.namespace+"callbacks",n[a])}),n.alwaysOpen&&(n.stayOpen=!0),r=e(document),s.el.ownerDocument!==document&&(r=r.add(s.el.ownerDocument));var d="keyup checkkeyboard mousedown touchstart ";n.closeByClickEvent&&(d+="click "),r.bind(d.split(" ").join(s.namespace+" "),function(e){clearTimeout(s.timer3),s.timer3=setTimeout(function(){s.checkClose(e)},1)}),s.$el.addClass(l.input+" "+n.css.input).attr({"aria-haspopup":"true",role:"textbox"}),(n.lockInput||s.el.readOnly)&&(n.lockInput=!0,s.$el.addClass(l.locked).attr({readonly:"readonly"})),(s.$el.is(":disabled")||s.$el.attr("readonly")&&!s.$el.hasClass(l.locked))&&s.$el.addClass(l.noKeyboard),n.openOn&&s.bindFocus(),s.watermark||""!==s.getValue(s.$el)||""===s.inPlaceholder||""===s.$el.attr("placeholder")||(s.$el.addClass(l.placeholder),s.setValue(s.inPlaceholder,s.$el)),s.$el.trigger(c.kbInit,[s,s.el]),n.alwaysOpen&&s.reveal(),s.initialized=!0},s.toggle=function(){if(s.hasKeyboard()){var e=s.$keyboard.find("."+t.css.keyToggle),a=!s.enabled;return s.preview.readonly=a||s.options.lockInput,s.$keyboard.toggleClass(t.css.keyDisabled,a).find("."+t.css.keyButton).not(e).attr("aria-disabled",a).each(function(){this.disabled=a}),e.toggleClass(t.css.keyDisabled,a),a&&s.typing_options&&(s.typing_options.text=""),s}},s.setCurrent=function(){var a=t.css,i=e("."+a.isCurrent),n=i.data("keyboard");e.isEmptyObject(n)||n.el===s.el||n.close(!!n.options.autoAccept&&"true"),i.removeClass(a.isCurrent),e("."+a.hasFocus).removeClass(a.hasFocus),s.$el.addClass(a.isCurrent),s.$keyboard.addClass(a.hasFocus),s.isCurrent(!0),s.isOpen=!0},s.isCurrent=function(e){var a=t.currentKeyboard||!1;return e?a=t.currentKeyboard=s.el:!1===e&&a===s.el&&(a=t.currentKeyboard=""),a===s.el},s.hasKeyboard=function(){return s.$keyboard&&s.$keyboard.length>0},s.isVisible=function(){return!!s.hasKeyboard()&&s.$keyboard.is(":visible")},s.setFocus=function(){var e=s.$preview||s.$el;n.noFocus||e.focus(),s.isContentEditable?t.setEditableCaret(e,s.last.start,s.last.end):t.caret(e,s.last)},s.focusOn=function(){!s&&s.el.active||(s.isVisible()?s.setCurrent():(clearTimeout(s.timer),s.reveal()))},s.redraw=function(e){return e&&(s.options.layout=e),s.$keyboard.length&&(s.last.preVal=""+s.last.val,s.saveLastChange(),s.setValue(s.last.val,s.$el),s.removeKeyboard(),s.shiftActive=s.altActive=s.metaActive=!1),s.isOpen=n.alwaysOpen,s.reveal(!0),s},s.reveal=function(a){var i,o=s.isOpen,r=t.css;if(s.opening=!o,e("."+r.keyboard).not("."+r.al