9e91662ac7
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>
2 lines
No EOL
3.3 KiB
JavaScript
2 lines
No EOL
3.3 KiB
JavaScript
/*! jQuery UI Virtual Keyboard Virtual Caret v1.1.5 (beta) */
|
||
!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(b){"use strict";var h=b.keyboard;h.firefox=void 0!==window.mozInnerScreenX,b.extend(h.css,{caret:"ui-keyboard-caret",caretMirror:"ui-keyboard-mirror-div"}),b.fn.addCaret=function(e){var t={caretClass:"",charAttr:"data-character",charIndex:1,offsetX:0,offsetY:0,adjustHt:0};return this.each(function(){var f,i,o=h.events,u=b(this).data("keyboard");u&&(f=u.caret_options=b.extend({},t,e),i=u.caret_namespace=u.namespace+"caret",u.extensionNamespace.push(i),u.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"],u.caret_setup=function(){var e=h.css,t="keyup keypress mouseup mouseleave ".split(" ").join(i+" "),r="position:absolute;visibility:hidden;top:-9999em;left:-9999em;white-space:pre-wrap;z-index:-10;"+("INPUT"===u.preview.nodeName?"":"word-wrap:break-word;");u.$keyboard.find("."+e.caretMirror).remove(),u.caret_$div=b('<div class="'+e.caretMirror+'" style="'+r+'">').appendTo(u.$keyboard),u.$caret&&u.$caret.remove(),u.$caret=b('<div class="'+e.caret+" "+f.caretClass+'" style="position:absolute;">').insertAfter(u.$preview),u.$el.unbind(o.kbChange+i).bind(o.kbChange+i,function(){u.findCaretPos()}),u.$preview.unbind(t).bind(t,function(){u.findCaretPos()})},u.findCaretPos=function(){if(u.caret_$div){var t,r,e,i,o,n,a,s,d=u.preview,c=parseFloat(u.$preview.css("fontSize")),p="INPUT"===d.nodeName,l=u.caret_$div[0];t=l.style,r=window.getComputedStyle?getComputedStyle(d,null):d.currentStyle,i=h.caret(u.$preview),o=Math["ltr"===r.direction?"max":"min"](i.start,i.end),u.textareaCaretProperties.forEach(function(e){t[e]=r[e]}),h.firefox&&(t.width=parseInt(r.width,10)-2+"px",d.scrollHeight>parseInt(r.height,10)&&(t.overflowY="scroll")),t.width=parseInt(p?d.scrollWidth:r.width,10)+(p?2*c:0)+"px",l.textContent=d.value.substring(0,o),"INPUT"===d.nodeName&&(l.textContent=l.textContent.replace(/\x20/g," ")),(a=document.createElement("span")).textContent=d.value.substring(o)||"",l.appendChild(a),s=b(a).position(),i="center"===t.textAlign?c:0,u.caretPos={top:s.top+parseInt(r.borderTopWidth,10)+f.offsetY,left:s.left+parseInt(r.borderLeftWidth,10)+f.offsetX-i},e=parseInt(u.$caret.css("margin-top"),10),t=Math.round(c+2*e)+f.adjustHt,s=u.$preview.position(),u.$caret.css({top:s.top-d.scrollTop+u.caretPos.top-e,left:s.left-d.scrollLeft+u.caretPos.left,height:t}),n=d.value.substring(o,o+f.charIndex).replace(/\s/," ")||" ",u.$caret.attr(f.charAttr,n)}},u.$el.unbind(i).bind(o.kbBeforeVisible+i,function(){u.caret_setup()}).bind(o.kbVisible+i,function(){u.findCaretPos()}).bind(o.kbHidden+i,function(){var e="keyup keypress mouseup mouseleave ".split(" ").join(i+" ");u.$preview.unbind(e),u.$caret.remove(),u.$caret=null,u.caret_$div=null}),u.options.alwaysOpen&&u.isVisible()&&(u.caret_setup(),u.findCaretPos()))})}}); |