Koha/koha-tmpl/intranet-tmpl/lib/keyboard/js/jquery.keyboard.extension-previewkeyset.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
1.1 KiB
JavaScript

/*! jQuery UI Virtual Keyboard previewKeyset v1.1.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(d){"use strict";d.keyboard=d.keyboard||{},d.fn.previewKeyset=function(n){return this.each(function(){var e=d(this).data("keyboard"),t=e.namespace+"Preview";e&&(e.previewKeyset_options=d.extend({},{sets:["normal","shift","alt","alt-shift"]},n),e.extensionNamespace.push(t),e.previewKeyset=function(){var a=d.keyboard.css,r=e.previewKeyset_options.sets,s=e.$keyboard.find("."+a.keySet).filter('[name="'+r.join('"],[name="')+'"]');1<s.length&&s.eq(0).find("."+a.keyButton).not("."+a.keyAction).each(function(){var e,t,n={},i=r.length,o=s.find('button[data-pos="'+d(this).attr("data-pos")+'"]');for(e=0;e<i;e++)t=o.eq(e).parent().attr("name"),0<=d.inArray(t,r)&&(n["data-"+t]=o.eq(e).find("."+a.keyText).text());o.attr(n)})},e.options.alwaysOpen&&e.isVisible()?e.previewKeyset():e.$el.unbind(d.keyboard.events.kbBeforeVisible+t).bind(d.keyboard.events.kbBeforeVisible+t,function(){e.previewKeyset()}))})}});