2 lines
2.9 KiB
JavaScript
2 lines
2.9 KiB
JavaScript
/*! jQuery UI Virtual Keyboard for jQuery Mobile Themes v1.4.1 */
|
|
!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 s,i={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 o=e(this).data("keyboard");o&&void 0!==e.fn.textinput&&(o.mobile_options=s=e.extend(!0,{},i,t),o.mobile_themes=e.trim((" "+s.allThemes).split(" ").join(" "+s.buttonMarkup.cssClass+"-")+(" "+s.allThemes).split(" ").join(" "+s.buttonAction.cssClass+"-")+(" "+s.allThemes).split(" ").join(" "+s.buttonActive.cssClass+"-")),void 0===o.options.mobile_savedActiveClass&&(o.options.mobile_savedActiveClass=""+o.options.css.buttonActive),o.mobile_init=function(){var t=o.namespace+"Mobile";e("."+e.keyboard.css.input).textinput(),o.options.alwaysOpen&&o.isVisible&&o.mobile_setup(),o.extensionNamespace.push(t),o.$el.unbind(t).bind(e.keyboard.events.kbBeforeVisible+t,function(){o&&o.el.active&&o.$keyboard.length&&o.$keyboard.css("visibility","hidden")}).bind(e.keyboard.events.kbVisible+t,function(){o&&o.el.active&&o.$keyboard.length&&(o.mobile_setup(),o.$keyboard.css("visibility","visible"),o.$preview.focus())})},o.mobile_setup=function(){var t,i=e.keyboard.css,n=o.options,a=o.mobile_themes;o.mobile_$actionKeys=o.$keyboard.find("."+o.options.css.buttonAction),n.css.buttonActive=n.mobile_savedActiveClass+" "+o.modOptions(s.buttonActive,s.buttonMarkup),o.$keyboard.addClass(o.modOptions(s.container,s.container)).find("."+i.preview).removeClass("ui-widget ui-widget-content").addClass(o.modOptions(s.input,s.input)).end().find("button").removeClass(e.trim("ui-corner-all ui-state-default "+a)).addClass(o.modOptions(s.buttonMarkup,s.buttonMarkup)).not(o.mobile_$actionKeys).hover(function(){e(this).removeClass(a).addClass(o.modOptions(s.buttonHover,s.buttonMarkup))},function(){e(this).removeClass(a+" "+s.buttonHover.cssClass).addClass(o.modOptions(s.buttonMarkup,s.buttonMarkup))}),o.mobile_$actionKeys.removeClass(a).addClass(o.modOptions(s.buttonAction,s.buttonMarkup)),o.msie&&o.$preview[0]!==o.el&&(o.$preview.hide(),o.$keyboard.css("width",""),o.width=o.$keyboard.outerWidth(),o.$keyboard.width(o.width+parseInt(o.$preview.css("fontSize"),10)),o.$preview.width(o.width),o.$preview.show()),e.ui&&e.ui.position&&((t=n.position).of=t.of||o.$el.data("keyboardPosition")||o.$el,t.collision=t.collision||"flipfit flipfit",o.$keyboard.position(t))},o.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":"")},o.mobile_init())})}}); |