Koha/koha-tmpl/intranet-tmpl/lib/keyboard/js/jquery.keyboard.extension-mobile.min.js
Agustin Moyano 9e91662ac7
Bug 17178: Add virtual keyboard to advanced cataloguing editor
This patch adds Mottie keyboard (https://github.com/Mottie/Keyboard) to advanced editor.

To test:
1) Apply patches
2) perl install/data/mysql/updatedatabase.pl
3) Enable EnableAdvancedCatalogingEditor system preference
4) Go to cataloguing and to Advanced editor
5) Click on Keyboard shortcuts
SUCCESS => the keyboard shortcut "Ctrl-K" should be displayed, with "Toggle keyboard" as description
6) press Ctrl-K
SUCCESS => a virtual keyboard should be displayed, and a new toolbar button labeled "Keyboard layout" should appear.
	=> when you press a letter on both the physical and virtual keyboard, they should be added to the editor.
7) Click on "Keyboard layout"
SUCCESS => a modal should appear, where you can filter and select keyboard layouts.
	=> when you select a layout, it should be reflected on the keyboard.
	=> when you close the modal without selecting a layout, it should keep using the previous layout.
8) Sign off

Sponsored-by: Round Rock Public Library

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-06-28 15:54:33 +01:00

2 lines
No EOL
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(a){a.fn.addMobile=function(e){var n,t={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=a(this).data("keyboard");o&&void 0!==a.fn.textinput&&(o.mobile_options=n=a.extend(!0,{},t,e),o.mobile_themes=a.trim((" "+n.allThemes).split(" ").join(" "+n.buttonMarkup.cssClass+"-")+(" "+n.allThemes).split(" ").join(" "+n.buttonAction.cssClass+"-")+(" "+n.allThemes).split(" ").join(" "+n.buttonActive.cssClass+"-")),void 0===o.options.mobile_savedActiveClass&&(o.options.mobile_savedActiveClass=""+o.options.css.buttonActive),o.mobile_init=function(){var e=o.namespace+"Mobile";a("."+a.keyboard.css.input).textinput(),o.options.alwaysOpen&&o.isVisible&&o.mobile_setup(),o.extensionNamespace.push(e),o.$el.unbind(e).bind(a.keyboard.events.kbBeforeVisible+e,function(){o&&o.el.active&&o.$keyboard.length&&o.$keyboard.css("visibility","hidden")}).bind(a.keyboard.events.kbVisible+e,function(){o&&o.el.active&&o.$keyboard.length&&(o.mobile_setup(),o.$keyboard.css("visibility","visible"),o.$preview.focus())})},o.mobile_setup=function(){var e,t=a.keyboard.css,s=o.options,i=o.mobile_themes;o.mobile_$actionKeys=o.$keyboard.find("."+o.options.css.buttonAction),s.css.buttonActive=s.mobile_savedActiveClass+" "+o.modOptions(n.buttonActive,n.buttonMarkup),o.$keyboard.addClass(o.modOptions(n.container,n.container)).find("."+t.preview).removeClass("ui-widget ui-widget-content").addClass(o.modOptions(n.input,n.input)).end().find("button").removeClass(a.trim("ui-corner-all ui-state-default "+i)).addClass(o.modOptions(n.buttonMarkup,n.buttonMarkup)).not(o.mobile_$actionKeys).hover(function(){a(this).removeClass(i).addClass(o.modOptions(n.buttonHover,n.buttonMarkup))},function(){a(this).removeClass(i+" "+n.buttonHover.cssClass).addClass(o.modOptions(n.buttonMarkup,n.buttonMarkup))}),o.mobile_$actionKeys.removeClass(i).addClass(o.modOptions(n.buttonAction,n.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()),a.ui&&a.ui.position&&((e=s.position).of=e.of||o.$el.data("keyboardPosition")||o.$el,e.collision=e.collision||"flipfit flipfit",o.$keyboard.position(e))},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())})}});