Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added meta mod keysets

  • Loading branch information...
commit f23befbc5fbf8b389a00cb5e2a3615dcafdc54a5 1 parent a5147ec
@Mottie Mottie authored
View
13 README.markdown
@@ -5,8 +5,9 @@ Originally posted by Jeremy Satterfield in his [blog][1], [jQuery plugins][2] an
* An on-screen virtual keyboard embedded within the browser window which will popup when a specified entry field is focused.
* The user can then type and preview their input before Accepting or Canceling.
* Add custom keyboard layouts easily.
-* Add up to four standard key sets to each layout that use the shift and alt keys.
+* Add up to four standard key sets to each layout that use the shift and alt keys (default, shift, alt and alt-shift).
* Add any number of optional modifier keys (meta keys) to add more key sets.
+* Each meta key set also includes the shift, alt and alt-shift keysets - New in version 1.8.9.
* Position the keyboard in any location around the element, or target another element on the page.
* Easily modify the key text to any language or symbol.
* Allow direct input or lock the preview window.
@@ -24,8 +25,8 @@ Originally posted by Jeremy Satterfield in his [blog][1], [jQuery plugins][2] an
* Enable, disable or add more diacritic functionality as desired.
* Use callbacks and event triggers that occur when the keyboard is open or closed and when the content has changed, been accepted or canceled.
* ARIA support (may not be fully implemented)
-* As jQuery UI is a dependancy, this plugin's styling will automatically match the selected jQuery UI theme with the exception of the required CSS listed below.
-* Built in watermarking. It emulates HTML5's placeholder if the browser doesn't support it.
+* As jQuery UI is a dependancy, this plugin's styling will automatically match the selected jQuery UI theme with the exception of the required CSS found in the keyboard.css file.
+* Built in watermarking. It emulates HTML5's placeholder, if the browser doesn't support it.
* Typing extension allows you to simulate typing into the keyboard for demo purposes or to assist user input.
* Autocomplete extension will integrate this keyboard plugin with jQuery UI's autocomplete widget.
* Multiple region specific keyboard layouts included in a separate directory. This is a work in progress and slowly growing.
@@ -72,6 +73,12 @@ Moved to the Wiki Pages: [Home][6] | [FAQ][7] | [Setup][8] | [Options][9] ( [Lay
Only the latest changes will be shown below, see the wiki log to view older versions.
+####Version 1.8.9
+* Added shift, alt and shift-alt keysets to meta keysets.
+ * When adding these keysets to the layout, use `meta#`, `meta#-shift`, `meta#-alt` and `meta#-alt-shift`.
+ * Enhancement request from [pascal-bach](https://github.com/pascal-bach) in [issue #17](https://github.com/Mottie/Keyboard/issues/17), thanks for the suggestion!
+ * Updated the [Custom: Meta Sets](http://mottie.github.com/Keyboard/) demo to reflect these enhancements.
+
####Version 1.8.8
* Fixed a bug where multiple "alwaysOpen" keyboards would not switch focus.
View
32 demo/demo.js
@@ -77,10 +77,10 @@ jQuery(function($) {
layout : 'custom',
display: {
'alt' : 'AltGr:It\'s all Greek to me',
- 'meta1' : '\u2666:russian lower-case', // Diamond with label that shows in the title (spaces are okay here)
- 'meta2' : '\u2665:RUSSIAN upper-case', // Heart
- 'meta3' : '\u2663:zodiac', // Club
- 'meta99' : '\u2660:numbers' // Spade
+ 'meta1' : '\u2666:end of alphabet', // Diamond with label that shows in the title (spaces are okay here)
+ 'meta2' : '\u2665:Russian', // Heart
+ 'meta3' : '\u2663:zodiac', // Club
+ 'meta99' : '\u2660:numbers' // Spade
},
customLayout: {
'default' : [
@@ -106,11 +106,31 @@ jQuery(function($) {
'{bksp} {sp:1} {accept} {cancel}'
],
'meta1' : [
- '\u0430 \u0431 \u0432 \u0433 \u0434 \u0435 \u0436', // lower case Russian
+ 't u v w x y z', // lower case end of alphabet
+ '{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
+ '{bksp} {sp:1} {accept} {cancel}'
+ ],
+ 'meta1-shift' : [
+ 'T U V W X Y Z', // upper case
+ '{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
+ '{bksp} {sp:1} {accept} {cancel}'
+ ],
+ 'meta1-alt' : [
+ '0 9 8 7 6 5 4', // numbers
+ '{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
+ '{bksp} {sp:1} {accept} {cancel}'
+ ],
+ 'meta1-alt-shift' : [
+ ') ( * & ^ % $', // shifted numbers
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'meta2' : [
+ '\u0430 \u0431 \u0432 \u0433 \u0434 \u0435 \u0436', // lower case Russian
+ '{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
+ '{bksp} {sp:1} {accept} {cancel}'
+ ],
+ 'meta2-shift' : [
'\u0410 \u0411 \u0412 \u0413 \u0414 \u0415 \u0416', // upper case Russian
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
@@ -259,7 +279,7 @@ jQuery(function($) {
});
$('#meta-type').click(function(){
var meta = $('#meta').getkeyboard();
- meta.reveal().typeIn('aBcD11123\u2648\u2649', 700, function(){ meta.accept(); alert('all done!'); });
+ meta.reveal().typeIn('aBcD1112389\u2648\u2649', 700, function(){ meta.accept(); alert('all done!'); });
return false;
});
View
32 index.html
@@ -277,10 +277,10 @@
layout: 'custom',
display: {
'alt' : 'AltGr:It\'s all Greek to me',
- 'meta1' : '\u2666:russian lower-case', <span class="comment">// Diamond with label that shows in the title (spaces are okay here)</span>
- 'meta2' : '\u2665:RUSSIAN upper-case', <span class="comment">// Heart</span>
- 'meta3' : '\u2663:zodiac', <span class="comment">// Club</span>
- 'meta99' : '\u2660:numbers' <span class="comment">// Spade</span>
+ 'meta1' : '\u2666:end of alphabet', <span class="comment">// Diamond with label that shows in the title (spaces are okay here)</span>
+ 'meta2' : '\u2665:Russian', <span class="comment">// Heart</span>
+ 'meta3' : '\u2663:zodiac', <span class="comment">// Club</span>
+ 'meta99' : '\u2660:numbers' <span class="comment">// Spade</span>
},
customLayout: {
'default' : [
@@ -306,11 +306,31 @@
'{bksp} {sp:1} {accept} {cancel}'
],
'meta1' : [
- '\u0430 \u0431 \u0432 \u0433 \u0434 \u0435 \u0436', <span class="comment">// lower case Russian</span>
+ 't u v w x y z', <span class="comment">// lower case end of alphabet</span>
+ '{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
+ '{bksp} {sp:1} {accept} {cancel}'
+ ],
+ 'meta1-shift' : [
+ 'T U V W X Y Z', <span class="comment">// upper case</span>
+ '{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
+ '{bksp} {sp:1} {accept} {cancel}'
+ ],
+ 'meta1-alt' : [
+ '0 9 8 7 6 5 4', <span class="comment">// numbers</span>
+ '{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
+ '{bksp} {sp:1} {accept} {cancel}'
+ ],
+ 'meta1-alt-shift' : [
+ ') ( * & ^ % $', <span class="comment">// shifted numbers</span>
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
],
'meta2' : [
+ '\u0430 \u0431 \u0432 \u0433 \u0434 \u0435 \u0436', <span class="comment">// lower case Russian</span>
+ '{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
+ '{bksp} {sp:1} {accept} {cancel}'
+ ],
+ 'meta2-shift' : [
'\u0410 \u0411 \u0412 \u0413 \u0414 \u0415 \u0416', <span class="comment">// upper case Russian</span>
'{shift} {alt} {meta1} {meta2} {meta3} {meta99}',
'{bksp} {sp:1} {accept} {cancel}'
@@ -332,7 +352,7 @@
<span class="ct">Script - typing extension
=======</span>
var meta = $('#meta').getkeyboard();
-meta.reveal().typeIn('aBcD11123\u2648\u2649', 700, function(){ meta.accept(); alert('all done!'); });</code></pre>
+meta.reveal().typeIn('aBcD1112389\u2648\u2649', 700, function(){ meta.accept(); alert('all done!'); });</code></pre>
</div>
</div>
View
24 js/jquery.keyboard.extension-typing.js
@@ -180,29 +180,19 @@
if (set.attr('name')) {
// get meta key name
meta = set.attr('name');
- // reset back to default keys
- if (meta === 'default'){
- base.metaActive = base.shiftActive = base.altActive = false;
- base.showKeySet();
-
- // Meta Key: If it's a meta key we have to do something a little
- // different because "meta" will have a number following it
- } else if (meta.match('meta')){
- base.metaActive = true;
- // make the plugin think we're passing it an jQuery object with a name
- base.showKeySet({ name : '_' + meta});
- // Shift or Alt key
- } else if ($.keyboard.keyaction.hasOwnProperty(meta)) {
- $.keyboard.keyaction[meta](base);
- }
+ // show correct key set
+ base.shiftActive = /shift/.test(meta);
+ base.altActive = /alt/.test(meta);
+ base.metaActive = (meta).match(/meta\d+/) || false;
+ // make the plugin think we're passing it a jQuery object with a name
+ base.showKeySet({ name : '_' + base.metaActive});
// Add the key
base.typing_simulateKey(key,txt);
-
- // Key doesn't exist on the keyboard, so just enter it
} else {
if (!base.typing_event) {
+ // Key doesn't exist on the keyboard, so just enter it
base.insertText(txt);
base.checkCombos();
}
View
52 js/jquery.keyboard.js
@@ -1,6 +1,6 @@
/*
jQuery UI Virtual Keyboard
-Version 1.8.8
+Version 1.8.9
Author: Jeremy Satterfield
Modified: Rob Garrison (Mottie on github)
@@ -109,8 +109,9 @@ $.keyboard = function(el, options){
// Shift and Alt key toggles, sets is true if a layout has more than one keyset - used for mousewheel message
base.shiftActive = base.altActive = base.metaActive = base.sets = false;
+ base.lastKeyset = [false, false, false]; // [shift, alt, meta]
// Class names of the basic key set - meta keysets are handled by the keyname
- base.rows = ['ui-keyboard-keyset-default', 'ui-keyboard-keyset-shift', 'ui-keyboard-keyset-alt', 'ui-keyboard-keyset-alt-shift' ];
+ base.rows = ['', '-shift', '-alt', '-alt-shift' ];
base.acceptedKeys = [];
base.mappedKeys = {}; // for remapping manually typed in keys
base.msie = $.browser.msie; // IE flag, used for caret positioning
@@ -489,26 +490,35 @@ $.keyboard = function(el, options){
};
base.showKeySet = function(el){
- var key, toShow;
- base.$keyboard.find('.ui-keyboard-actionkey[name*=key_meta]').removeClass(o.actionClass);
+ var key = '',
+ toShow = (base.shiftActive) ? 1 : 0;
+ toShow += (base.altActive) ? 2 : 0;
+ // check meta key set
if (base.metaActive) {
- key = el.name.split('_')[1];
- if (!base.$keyboard.find('.ui-keyboard-keyset-' + key ).length) { return; } // keyset doesn't exist
- base.$keyboard
- .find('.ui-keyboard-alt, .ui-keyboard-shift, .ui-keyboard-actionkey[class*=meta]').removeClass(o.actionClass).end()
- .find('.ui-keyboard-actionkey.ui-keyboard-' + key).addClass(o.actionClass).end()
- .find('.ui-keyboard-keyset').hide().end()
- .find('.ui-keyboard-keyset-' + key ).show();
- } else {
- toShow = (base.shiftActive) ? 1 : 0;
- toShow += (base.altActive) ? 2 : 0;
- if (!base.$keyboard.find('.' + base.rows[toShow]).length) { return; } // keyset doesn't exist
- base.$keyboard
- .find('.ui-keyboard-alt')[(base.altActive) ? 'addClass' : 'removeClass'](o.actionClass).end()
- .find('.ui-keyboard-shift')[(base.shiftActive) ? 'addClass' : 'removeClass'](o.actionClass).end()
- .find('.ui-keyboard-keyset').hide().end()
- .find('.' + base.rows[toShow]).show();
+ key = (el && el.name && el.name.match('meta') ? el.name.split('_')[1] : '');
+ // save active meta keyset name
+ if (key === '') {
+ key = (base.metaActive === true) ? '' : base.metaActive;
+ } else {
+ base.metaActive = key;
+ }
}
+ key = (toShow === 0 && !base.metaActive) ? '-default' : (key === '') ? '' : '-' + key;
+ if (!base.$keyboard.find('.ui-keyboard-keyset' + key + base.rows[toShow]).length) {
+ // keyset doesn't exist, so restore last keyset settings
+ base.shiftActive = base.lastKeyset[0];
+ base.altActive = base.lastKeyset[1];
+ base.metaActive = base.lastKeyset[2];
+ return;
+ }
+ base.$keyboard
+ .find('.ui-keyboard-alt, .ui-keyboard-shift, .ui-keyboard-actionkey[class*=meta]').removeClass(o.actionClass).end()
+ .find('.ui-keyboard-alt')[(base.altActive) ? 'addClass' : 'removeClass'](o.actionClass).end()
+ .find('.ui-keyboard-shift')[(base.shiftActive) ? 'addClass' : 'removeClass'](o.actionClass).end()
+ .find('.ui-keyboard-keyset').hide().end()
+ .find('.ui-keyboard-keyset' + key + base.rows[toShow]).show().end()
+ .find('.ui-keyboard-actionkey.ui-keyboard' + key).addClass(o.actionClass);
+ base.lastKeyset = [ base.shiftActive, base.altActive, base.metaActive ];
};
// check for key combos (dead keys)
@@ -875,7 +885,6 @@ $.keyboard = function(el, options){
},
alt : function(base,el){
base.altActive = !base.altActive;
- base.metaActive = false;
base.showKeySet(el);
},
bksp : function(base){
@@ -908,7 +917,6 @@ $.keyboard = function(el, options){
},
shift : function(base,el){
base.shiftActive = !base.shiftActive;
- base.metaActive = false;
base.showKeySet(el);
},
sign : function(base){
View
6 js/jquery.keyboard.min.js
@@ -1,6 +1,6 @@
/*
jQuery UI Virtual Keyboard
-Version 1.8.8 minified
+Version 1.8.9 minified
Author: Jeremy Satterfield
Modified: Rob Garrison (Mottie on github)
@@ -14,6 +14,6 @@ http://www.opensource.org/licenses/mit-license.php
-----------------------------------------
*/
-(function(f){f.keyboard=function(c,l){var a=this,d;a.$el=f(c);a.el=c;a.$el.data("keyboard",a);a.init=function(){a.options=d=f.extend(!0,{},f.keyboard.defaultOptions,l);a.shiftActive=a.altActive=a.metaActive=a.sets=!1;a.rows=["ui-keyboard-keyset-default","ui-keyboard-keyset-shift","ui-keyboard-keyset-alt","ui-keyboard-keyset-alt-shift"];a.acceptedKeys=[];a.mappedKeys={};a.msie=f.browser.msie;a.opera=f.browser.opera;a.inPlaceholder=a.$el.attr("placeholder")||"";a.watermark=typeof document.createElement("input").placeholder!== "undefined"&&a.inPlaceholder!=="";a.regex=f.keyboard.comboRegex;a.decimal=/^\./.test(d.display.dec)?!0:!1;a.checkCaret=d.lockInput||a.msie||a.opera?!0:!1;f.each("initialized visible change hidden canceled accepted beforeClose".split(" "),function(b,k){f.isFunction(d[k])&&a.$el.bind(k+".keyboard",d[k])});if(d.alwaysOpen)d.stayOpen=!0;d.stayOpen||f(document).bind("mousedown.keyboard keyup.keyboard",function(b){a.isVisible&&(b.type==="mousedown"||b.type==="keyup"&&b.which===27)&&a.escClose(b)});a.$el.addClass("ui-keyboard-input ui-widget-content ui-corner-all").attr({"aria-haspopup":"true", role:"textbox"});(a.$el.is(":disabled")||a.$el.attr("readonly"))&&a.$el.addClass("ui-keyboard-nokeyboard");d.openOn&&a.$el.bind(d.openOn+".keyboard",function(){a.focusOn()});!a.watermark&&a.$el.val()===""&&a.inPlaceholder!==""&&a.$el.attr("placeholder")!==""&&a.$el.addClass("ui-keyboard-placeholder").val(a.inPlaceholder);a.$el.trigger("initialized.keyboard",[a,a.el]);d.alwaysOpen&&a.reveal()};a.focusOn=function(){if(!a.isVisible||d.alwaysOpen)clearTimeout(a.timer),a.reveal(),d.usePreview||setTimeout(function(){a.preview.focus()}, 100)};a.reveal=function(){f(".ui-keyboard:not(.ui-keyboard-always-open)").hide();f(".ui-keyboard-has-focus").removeClass("ui-keyboard-has-focus");if(a.$el.is(":disabled")||a.$el.attr("readonly"))a.$el.addClass("ui-keyboard-nokeyboard");else{a.$el.removeClass("ui-keyboard-nokeyboard");d.usePreview||a.$el.unbind(d.openOn?d.openOn+".keyboard":"");typeof a.$keyboard==="undefined"&&a.startup();!a.watermark&&a.el.value===a.inPlaceholder&&a.$el.removeClass("ui-keyboard-placeholder").val("");a.originalContent= a.$el.val();a.$preview.val(a.originalContent);var b;b=d.position;b.of=b.of||a.$el.data("keyboardPosition")||a.$el;b.collision=d.usePreview?b.collision||"fit fit":"flip flip";a.$keyboard.css({position:"absolute",left:0,top:0}).addClass("ui-keyboard-has-focus").show().position(b);if(typeof a.width==="undefined")a.width=Math.ceil(a.$keyboard.width());d.usePreview&&a.$preview.width(a.width);a.preview.focus();a.isVisible=!0;a.checkDecimal();a.lineHeight=parseInt(a.$preview.css("lineHeight"),10)||parseInt(a.$preview.css("font-size"), 10)+4;if(a.msie||a.opera){b=a.originalContent.length;b={start:b,end:b};if(!a.lastCaret)a.lastCaret=b;if(a.lastCaret.end===0&&a.lastCaret.start>0)a.lastCaret.end=a.lastCaret.start;if(a.lastCaret.start<0)a.lastCaret=b;a.$preview.caret(a.lastCaret.start,a.lastCaret.end);f('<div class="ui-keyboard-overlay"></div>').click(function(){f(this).remove();a.close();return!1}).appendTo("body");d.usePreview||a.$el.addClass("ui-keyboard-overlay-input")}a.$el.trigger("visible.keyboard",[a,a.el]);return a}};a.startup= function(){a.$keyboard=a.buildKeyboard();a.$allKeys=a.$keyboard.find(".ui-keyboard-button");a.$preview=d.usePreview?a.$keyboard.find(".ui-keyboard-preview"):a.$el;a.preview=a.$preview[0];a.$decBtn=a.$keyboard.find(".ui-keyboard-dec");a.wheel=f.isFunction(f.fn.mousewheel);a.alwaysAllowed=[33,34,35,36,37,38,39,40,45,46];a.lastCaret={start:0,end:0};a.$preview.bind("keypress.keyboard",function(b){var k=String.fromCharCode(b.charCode||b.which);if(a.checkCaret)a.lastCaret=a.$preview.caret();if(d.restrictInput){if((b.which=== 8||b.which===0)&&f.inArray(b.keyCode,a.alwaysAllowed))return;f.inArray(k,a.acceptedKeys)===-1&&b.preventDefault()}else if((b.ctrlKey||b.metaKey)&&(b.which===97||b.which===99||b.which===118||b.which===120))return;a.hasMappedKeys&&a.mappedKeys.hasOwnProperty(k)&&(a.insertText(a.mappedKeys[k]),b.preventDefault());a.checkMaxLength()}).bind("keyup.keyboard",function(b){switch(b.which){case 9:if(a.tab&&!d.lockInput)f.keyboard.keyaction.tab(a),a.tab=!1;break;case 27:return a.close(),!1}clearTimeout(a.throttled); a.throttled=setTimeout(function(){a.checkCombos()},100);a.checkMaxLength();a.$el.trigger("change.keyboard",[a,a.el])}).bind("keydown.keyboard",function(b){switch(b.which){case 9:a.tab=!0;b.preventDefault();break;case 13:if(b.shiftKey)return a.close(!0),!1;break;case 86:if(b.ctrlKey||b.metaKey){if(d.preventPaste){b.preventDefault();break}a.checkCombos()}}}).bind("mouseup.keyboard",function(){if(a.checkCaret)a.lastCaret=a.$preview.caret()}).bind("blur.keyboard",function(){if(d.alwaysOpen)clearTimeout(a.timer), a.timer=setTimeout(function(){f(":focus")[0]!==a.el&&a.close(d.autoAccept)},300)});d.preventPaste&&(a.$preview.bind("contextmenu.keyboard",function(a){a.preventDefault()}),a.$el.bind("contextmenu.keyboard",function(a){a.preventDefault()}));a.$keyboard.appendTo("body");a.$allKeys.bind(d.keyBinding+".keyboard",function(b){var k;k=f.data(this,"key");var g=k.action.split(":")[0];a.preview.focus();a.checkCaret&&a.$preview.caret(a.lastCaret.start,a.lastCaret.end);g.match("meta")&&(g="meta");if(f.keyboard.keyaction.hasOwnProperty(g)&& f(this).is(".ui-keyboard-actionkey")){if(f.keyboard.keyaction[g](a,this)===!1)return}else typeof k.action!=="undefined"&&(k=a.wheel&&!f(this).is(".ui-keyboard-actionkey")?k.curTxt:k.action,a.insertText(k));a.checkCombos();a.checkMaxLength();a.$el.trigger("change.keyboard",[a,a.el]);d.usePreview&&a.preview.focus();b.preventDefault()}).bind("mouseenter.keyboard mouseleave.keyboard",function(b){var k=f(this),g=f.data(this,"key");b.type==="mouseenter"&&a.el.type!=="password"&&k.addClass("ui-state-hover").attr("title", function(b,e){return a.wheel&&e===""&&a.sets?d.wheelMessage:e});if(b.type==="mouseleave")g.curTxt=g.original,g.curNum=0,f.data(this,"key",g),k.removeClass(a.el.type==="password"?"":"ui-state-hover").attr("title",function(a,b){return b===d.wheelMessage?"":b}).find("span").text(g.original)}).bind("mousewheel.keyboard",function(b,d){if(a.wheel){var g,c=f(this),e=f.data(this,"key");g=e.layers||a.getLayers(c);e.curNum+=d>0?-1:1;if(e.curNum>g.length-1)e.curNum=0;if(e.curNum<0)e.curNum=g.length-1;e.layers= g;e.curTxt=g[e.curNum];f.data(this,"key",e);c.find("span").text(g[e.curNum]);return!1}}).bind("mouseup.keyboard",function(){a.preview.focus()})};a.insertText=function(b){var d,g,f=a.$preview.val(),e=a.$preview.caret(),c=a.$preview.scrollLeft();d=a.$preview.scrollTop();g=f.length;if(e.end<e.start)e.end=e.start;if(e.start>g)e.end=e.start=g;if(a.preview.tagName==="TEXTAREA"){a.msie&&f.substr(e.start,1)==="\n"&&(e.start+=1,e.end+=1);if((a.msie||a.opera)&&f.substr(0,e.start).split("\n").length-1>0)g=f.substr(0, e.start).split("\n").length-1,e.start+=g,e.end+=g;g=f.split("\n").length-1;a.preview.scrollTop=g>0?a.lineHeight*g:d}d=b==="bksp"&&e.start===e.end?!0:!1;b=b==="bksp"?"":b;g=e.start+(d?-1:b.length);c+=parseInt(a.$preview.css("fontSize"),10)*(b==="bksp"?-1:1);a.$preview.val(f.substr(0,e.start-(d?1:0))+b+f.substr(e.end)).caret(g,g).scrollLeft(c);if(a.checkCaret)a.lastCaret={start:g,end:g}};a.checkMaxLength=function(){var b,f=a.$preview.val();if(d.maxLength!==!1&&f.length>d.maxLength)b=Math.min(a.$preview.caret().start, d.maxLength),a.$preview.val(f.substring(0,d.maxLength)),a.$preview.caret(b,b),a.lastCaret={start:b,end:b};a.$decBtn.length&&a.checkDecimal()};a.showKeySet=function(b){a.$keyboard.find(".ui-keyboard-actionkey[name*=key_meta]").removeClass(d.actionClass);a.metaActive?(b=b.name.split("_")[1],a.$keyboard.find(".ui-keyboard-keyset-"+b).length&&a.$keyboard.find(".ui-keyboard-alt, .ui-keyboard-shift, .ui-keyboard-actionkey[class*=meta]").removeClass(d.actionClass).end().find(".ui-keyboard-actionkey.ui-keyboard-"+ b).addClass(d.actionClass).end().find(".ui-keyboard-keyset").hide().end().find(".ui-keyboard-keyset-"+b).show()):(b=a.shiftActive?1:0,b+=a.altActive?2:0,a.$keyboard.find("."+a.rows[b]).length&&a.$keyboard.find(".ui-keyboard-alt")[a.altActive?"addClass":"removeClass"](d.actionClass).end().find(".ui-keyboard-shift")[a.shiftActive?"addClass":"removeClass"](d.actionClass).end().find(".ui-keyboard-keyset").hide().end().find("."+a.rows[b]).show())};a.checkCombos=function(){var b,c,g,j=a.$preview.val(), e=a.$preview.caret(),h=j.length;if(e.end<e.start)e.end=e.start;if(e.start>h)e.end=e.start=h;a.msie&&j.substr(e.start,1)==="\n"&&(e.start+=1,e.end+=1);if((a.msie||a.opera)&&j.substr(0,e.start).split("\n").length-1>0)g=j.substr(0,e.start).split("\n").length-1,e.start+=g,e.end+=g;d.useCombos&&(j=j.replace(a.regex,function(a,b,e){return d.combos.hasOwnProperty(b)?d.combos[b][e]||a:a}));if(d.restrictInput){g=j.split("");c=g.length;for(b=0;b<c;b++)f.inArray(g[b],a.acceptedKeys)<0&&(j=j.replace(g[b],""))}e.start+= j.length-h;e.end+=j.length-h;a.$preview.val(j);a.$preview.caret(e.start,e.end);a.preview.scrollTop=a.lineHeight*(j.substring(0,e.start).split("\n").length-1);a.lastCaret={start:e.start,end:e.end};return j};a.checkDecimal=function(){a.decimal&&/\./g.test(a.preview.value)||!a.decimal&&/\,/g.test(a.preview.value)?a.$decBtn.attr({disabled:"disabled","aria-disabled":"true"}).removeClass("ui-state-default ui-state-hover").addClass("ui-state-disabled"):a.$decBtn.removeAttr("disabled").attr({"aria-disabled":"false"}).addClass("ui-state-default").removeClass("ui-state-disabled")}; a.getLayers=function(a){var d;d=a.attr("name");return a.closest(".ui-keyboard").find("button[name="+d+"]").map(function(){return f(this).find("span").text()}).get()};a.close=function(b){if(a.$keyboard.is(":visible")){clearTimeout(a.throttled);a.$el.trigger(d.alwaysOpen?"":"beforeClose.keyboard",[a,a.el,b||!1]).val(b?d.alwaysOpen?a.$el.val():a.checkCombos():a.originalContent).scrollTop(a.el.scrollHeight).trigger(b?"accepted.keyboard":"canceled.keyboard",[a,a.el]).trigger(d.alwaysOpen?"":"hidden.keyboard", [a,a.el]).removeClass("ui-keyboard-overlay-input");!d.usePreview&&d.openOn!==""&&a.$el.bind(d.openOn+".keyboard",function(){a.focusOn()});f(".ui-keyboard-overlay").remove();if(!d.alwaysOpen)a.$keyboard.hide(),a.isVisible=!1;!a.watermark&&a.el.value===""&&a.inPlaceholder!==""&&a.$el.addClass("ui-keyboard-placeholder").val(a.inPlaceholder)}return!1};a.accept=function(){a.close(!0)};a.escClose=function(b){b.target!==a.el&&(f(b.target).closest(".ui-keyboard").length||a.close(d.autoAccept?!0:!1),a.msie&& b.preventDefault())};a.keyBtn=f("<button />").attr({role:"button","aria-disabled":"false"}).addClass("ui-keyboard-button ui-state-default ui-corner-all");a.addKey=function(b,c,g,j){var e,h,i,c=j===!0?b:d.display[c]||b;/\(.+\)/.test(c)&&(h=c.replace(/\(([^()]+)\)/,""),e=c.match(/\(([^()]+)\)/)[1],c=h,i=h.split(":"),h=i[0]!==""&&i.length>1?i[0]:h,a.mappedKeys[e]=h);i=c.split(":");i[0]===""&&i[1]===""&&(c=":");c=i[0]!==""&&i.length>1?f.trim(i[0]):c;e=i.length>1?f.trim(i[1]).replace(/_/g," ")||"":""; h=c.length>1?" ui-keyboard-widekey":"";h+=j?"":" ui-keyboard-actionkey";return a.keyBtn.clone().attr({"data-value":c,name:"key_"+b,title:e}).data("key",{action:b,original:c,curTxt:c,curNum:0}).addClass("ui-keyboard-"+(j===!0?b.charCodeAt(0):b)+h).html("<span>"+c+"</span>").appendTo(g)};a.buildKeyboard=function(){var b,c,g,j,e,h,i,l=0,m=f("<div />").addClass("ui-keyboard ui-widget-content ui-widget ui-corner-all ui-helper-clearfix"+(d.alwaysOpen?" ui-keyboard-always-open":"")).attr({role:"textbox"}).hide(); d.usePreview?a.$preview=a.$el.clone(!1).removeAttr("id").removeAttr("placeholder").removeClass("ui-keyboard-placeholder").addClass("ui-widget-content ui-keyboard-preview ui-corner-all").show():(a.$preview=a.$el,d.position.at=d.position.at2);a.$preview.attr(d.lockInput?{readonly:"readonly"}:{});d.usePreview&&f("<div />").append(a.$preview).appendTo(m);if(d.layout==="custom"||!f.keyboard.layouts.hasOwnProperty(d.layout))d.layout="custom",f.keyboard.layouts.custom=d.customLayout||{"default":["{cancel}"]}; f.each(f.keyboard.layouts[d.layout],function(n,o){if(n!==""){l++;g=f("<div />").attr("name",n).addClass("ui-keyboard-keyset ui-keyboard-keyset-"+n).appendTo(m)[n==="default"?"show":"hide"]();for(c=0;c<o.length;c++){j=f.trim(o[c]).replace(/\{(\.?)[\s+]?:[\s+]?(\.?)\}/g,"{$1:$2}");h=j.split(/\s+/);for(e=0;e<h.length;e++)if(h[e].length!==0)if(/^\{\S+\}$/.test(h[e]))if(b=h[e].match(/^\{(\S+)\}$/)[1].toLowerCase(),/^sp:(\.?\d+)$/.test(b)&&(i=b.match(/^sp:(\.?\d+)$/)[1]||0,f("<span>&nbsp;</span>").css("margin", "0 "+i+"em").appendTo(g)),/^meta\d+\:?(\w+)?/.test(b))a.addKey(b,b,g);else switch(b){case "a":case "accept":a.addKey("accept",b,g).addClass(d.actionClass);break;case "alt":case "altgr":a.addKey("alt","alt",g);break;case "b":case "bksp":a.addKey("bksp",b,g);break;case "c":case "cancel":a.addKey("cancel",b,g).addClass(d.actionClass);break;case "combo":a.addKey("combo","combo",g).addClass(d.actionClass);break;case "dec":a.acceptedKeys.push(a.decimal?".":",");a.addKey("dec","dec",g);break;case "e":case "enter":a.addKey("enter", b,g).addClass(d.actionClass);break;case "s":case "shift":a.addKey("shift",b,g);break;case "sign":a.acceptedKeys.push("-");a.addKey("sign","sign",g);break;case "space":a.acceptedKeys.push(" ");a.addKey("space","&nbsp;",g);break;case "t":case "tab":a.addKey("tab",b,g);break;default:f.keyboard.keyaction.hasOwnProperty(b)&&a.addKey(b,b,g)}else a.acceptedKeys.push(h[e].split(":")[0]),a.addKey(h[e],h[e],g,!0).attr("name","key_"+c+"_"+e);g.find(".ui-keyboard-button:last").after('<br class="ui-keyboard-button-endrow">')}}}); if(l>1)a.sets=!0;a.hasMappedKeys=!f.isEmptyObject(a.mappedKeys);return m};a.destroy=function(){f(document).unbind("mousedown.keyboard keyup.keyboard",a.escClose);a.$keyboard&&a.$keyboard.remove();a.$el.removeClass("ui-keyboard-input ui-widget-content ui-corner-all ui-keyboard-placeholder ui-keyboard-notallowed ui-keyboard-always-open").removeAttr("aria-haspopup").removeAttr("role").unbind(d.openOn+".keyboard blur.keyboard accepted.keyboard canceled.keyboard beforeClose.keyboard hidden.keyboard visible.keyboard keydown.keyboard keypress.keyboard keyup.keyboard contextmenu.keyboard initialized.keyboard").removeData("keyboard")}; a.init()};f.keyboard.keyaction={accept:function(c){c.close(!0);return!1},alt:function(c,f){c.altActive=!c.altActive;c.metaActive=!1;c.showKeySet(f)},bksp:function(c){c.insertText("bksp")},cancel:function(c){c.close();return!1},clear:function(c){c.$preview.val("")},combo:function(c){var f=!c.options.useCombos;c.options.useCombos=f;c.$keyboard.find(".ui-keyboard-combo")[f?"addClass":"removeClass"](c.options.actionClass);f&&c.checkCombos();return!1},dec:function(c){c.insertText(c.decimal?".":",")},enter:function(c){c.el.tagName!== "INPUT"&&c.insertText("\r\n")},meta:function(c,l){c.metaActive=f(l).is("."+c.options.actionClass)?!1:!0;c.showKeySet(l)},shift:function(c,f){c.shiftActive=!c.shiftActive;c.metaActive=!1;c.showKeySet(f)},sign:function(c){/^\-?\d*\.?\d*$/.test(c.$preview.val())&&c.$preview.val(c.$preview.val()*-1)},space:function(c){c.insertText(" ")},tab:function(c){c.el.tagName!=="INPUT"&&c.insertText("\t")}};f.keyboard.layouts={alpha:{"default":["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} a b c d e f g h i j [ ] \\", "k l m n o p q r s ; ' {enter}","{shift} t u v w x y z , . / {shift}","{accept} {space} {cancel}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} A B C D E F G H I J { } |",'K L M N O P Q R S : " {enter}',"{shift} T U V W X Y Z < > ? {shift}","{accept} {space} {cancel}"]},qwerty:{"default":["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}","{accept} {space} {cancel}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}", "{tab} Q W E R T Y U I O P { } |",'A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}","{accept} {space} {cancel}"]},international:{"default":["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}","{accept} {alt} {space} {alt} {cancel}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}","{accept} {alt} {space} {alt} {cancel}"], alt:["~ \u00a1 \u00b2 \u00b3 \u00a4 \u20ac \u00bc \u00bd \u00be \u2018 \u2019 \u00a5 \u00d7 {bksp}","{tab} \u00e4 \u00e5 \u00e9 \u00ae \u00fe \u00fc \u00fa \u00ed \u00f3 \u00f6 \u00ab \u00bb \u00ac","\u00e1 \u00df \u00f0 f g h j k \u00f8 \u00b6 \u00b4 {enter}","{shift} \u00e6 x \u00a9 v b \u00f1 \u00b5 \u00e7 > \u00bf {shift}","{accept} {alt} {space} {alt} {cancel}"],"alt-shift":["~ \u00b9 \u00b2 \u00b3 \u00a3 \u20ac \u00bc \u00bd \u00be \u2018 \u2019 \u00a5 \u00f7 {bksp}","{tab} \u00c4 \u00c5 \u00c9 \u00ae \u00de \u00dc \u00da \u00cd \u00d3 \u00d6 \u00ab \u00bb \u00a6", "\u00c4 \u00a7 \u00d0 F G H J K \u00d8 \u00b0 \u00a8 {enter}","{shift} \u00c6 X \u00a2 V B \u00d1 \u00b5 \u00c7 . \u00bf {shift}","{accept} {alt} {space} {alt} {cancel}"]},dvorak:{"default":["` 1 2 3 4 5 6 7 8 9 0 [ ] {bksp}","{tab} ' , . p y f g c r l / = \\","a o e u i d h t n s - {enter}","{shift} ; q j k x b m w v z {shift}","{accept} {space} {cancel}"],shift:["~ ! @ # $ % ^ & * ( ) { } {bksp}",'{tab} " < > P Y F G C R L ? + |',"A O E U I D H T N S _ {enter}","{shift} : Q J K X B M W V Z {shift}", "{accept} {space} {cancel}"]},num:{"default":"= ( ) {b},{clear} / * -,7 8 9 +,4 5 6 {sign},1 2 3 %,0 . {a} {c}".split(",")}};f.keyboard.defaultOptions={layout:"qwerty",customLayout:null,position:{of:null,my:"center top",at:"center top",at2:"center bottom"},usePreview:!0,alwaysOpen:!1,stayOpen:!1,display:{a:"\u2714:Accept (Shift-Enter)",accept:"Accept:Accept (Shift-Enter)",alt:"AltGr:Alternate Graphemes",b:"\u2190:Backspace",bksp:"Bksp:Backspace",c:"\u2716:Cancel (Esc)",cancel:"Cancel:Cancel (Esc)", clear:"C:Clear",combo:"\u00f6:Toggle Combo Keys",dec:".:Decimal",e:"\u21b5:Enter",enter:"Enter:Enter",s:"\u21e7:Shift",shift:"Shift:Shift",sign:"\u00b1:Change Sign",space:" :Space",t:"\u21e5:Tab",tab:"\u21e5 Tab:Tab"},wheelMessage:"Use mousewheel to see other keys",actionClass:"ui-state-active",autoAccept:!1,lockInput:!1,restrictInput:!1,preventPaste:!1,maxLength:!1,openOn:"focus",keyBinding:"mousedown",useCombos:!0,combos:{"`":{a:"\u00e0",A:"\u00c0",e:"\u00e8",E:"\u00c8",i:"\u00ec",I:"\u00cc",o:"\u00f2", O:"\u00d2",u:"\u00f9",U:"\u00d9",y:"\u1ef3",Y:"\u1ef2"},"'":{a:"\u00e1",A:"\u00c1",e:"\u00e9",E:"\u00c9",i:"\u00ed",I:"\u00cd",o:"\u00f3",O:"\u00d3",u:"\u00fa",U:"\u00da",y:"\u00fd",Y:"\u00dd",c:"\u00e7",C:"\u00c7"},'"':{a:"\u00e4",A:"\u00c4",e:"\u00eb",E:"\u00cb",i:"\u00ef",I:"\u00cf",o:"\u00f6",O:"\u00d6",u:"\u00fc",U:"\u00dc",y:"\u00ff",Y:"\u0178"},"^":{a:"\u00e2",A:"\u00c2",e:"\u00ea",E:"\u00ca",i:"\u00ee",I:"\u00ce",o:"\u00f4",O:"\u00d4",u:"\u00fb",U:"\u00db",y:"\u0177",Y:"\u0176"},"~":{a:"\u00e3", A:"\u00c3",e:"\u1ebd",E:"\u1ebc",i:"\u0129",I:"\u0128",o:"\u00f5",O:"\u00d5",u:"\u0169",U:"\u0168",y:"\u1ef9",Y:"\u1ef8",n:"\u00f1",N:"\u00d1"},a:{e:"\u00e6"},A:{E:"\u00c6"},o:{e:"\u0153"},O:{E:"\u0152"}},initialized:null,accepted:null,canceled:null,hidden:null,visible:null,beforeClose:null};f.keyboard.comboRegex=/([`\'~\^\"ao])([a-z])/mig;f.fn.keyboard=function(c){return this.each(function(){new f.keyboard(this,c)})};f.fn.getkeyboard=function(){return this.data("keyboard")}})(jQuery);
+(function(g){g.keyboard=function(f,k){var a=this,c;a.$el=g(f);a.el=f;a.$el.data("keyboard",a);a.init=function(){a.options=c=g.extend(!0,{},g.keyboard.defaultOptions,k);a.shiftActive=a.altActive=a.metaActive=a.sets=!1;a.lastKeyset=[!1,!1,!1];a.rows=["","-shift","-alt","-alt-shift"];a.acceptedKeys=[];a.mappedKeys={};a.msie=g.browser.msie;a.opera=g.browser.opera;a.inPlaceholder=a.$el.attr("placeholder")||"";a.watermark=typeof document.createElement("input").placeholder!=="undefined"&&a.inPlaceholder!== "";a.regex=g.keyboard.comboRegex;a.decimal=/^\./.test(c.display.dec)?!0:!1;a.checkCaret=c.lockInput||a.msie||a.opera?!0:!1;g.each("initialized visible change hidden canceled accepted beforeClose".split(" "),function(b,h){g.isFunction(c[h])&&a.$el.bind(h+".keyboard",c[h])});if(c.alwaysOpen)c.stayOpen=!0;c.stayOpen||g(document).bind("mousedown.keyboard keyup.keyboard",function(b){a.isVisible&&(b.type==="mousedown"||b.type==="keyup"&&b.which===27)&&a.escClose(b)});a.$el.addClass("ui-keyboard-input ui-widget-content ui-corner-all").attr({"aria-haspopup":"true", role:"textbox"});(a.$el.is(":disabled")||a.$el.attr("readonly"))&&a.$el.addClass("ui-keyboard-nokeyboard");c.openOn&&a.$el.bind(c.openOn+".keyboard",function(){a.focusOn()});!a.watermark&&a.$el.val()===""&&a.inPlaceholder!==""&&a.$el.attr("placeholder")!==""&&a.$el.addClass("ui-keyboard-placeholder").val(a.inPlaceholder);a.$el.trigger("initialized.keyboard",[a,a.el]);c.alwaysOpen&&a.reveal()};a.focusOn=function(){if(!a.isVisible||c.alwaysOpen)clearTimeout(a.timer),a.reveal(),c.usePreview||setTimeout(function(){a.preview.focus()}, 100)};a.reveal=function(){g(".ui-keyboard:not(.ui-keyboard-always-open)").hide();g(".ui-keyboard-has-focus").removeClass("ui-keyboard-has-focus");if(a.$el.is(":disabled")||a.$el.attr("readonly"))a.$el.addClass("ui-keyboard-nokeyboard");else{a.$el.removeClass("ui-keyboard-nokeyboard");c.usePreview||a.$el.unbind(c.openOn?c.openOn+".keyboard":"");typeof a.$keyboard==="undefined"&&a.startup();!a.watermark&&a.el.value===a.inPlaceholder&&a.$el.removeClass("ui-keyboard-placeholder").val("");a.originalContent= a.$el.val();a.$preview.val(a.originalContent);var b;b=c.position;b.of=b.of||a.$el.data("keyboardPosition")||a.$el;b.collision=c.usePreview?b.collision||"fit fit":"flip flip";a.$keyboard.css({position:"absolute",left:0,top:0}).addClass("ui-keyboard-has-focus").show().position(b);if(typeof a.width==="undefined")a.width=Math.ceil(a.$keyboard.width());c.usePreview&&a.$preview.width(a.width);a.preview.focus();a.isVisible=!0;a.checkDecimal();a.lineHeight=parseInt(a.$preview.css("lineHeight"),10)||parseInt(a.$preview.css("font-size"), 10)+4;if(a.msie||a.opera){b=a.originalContent.length;b={start:b,end:b};if(!a.lastCaret)a.lastCaret=b;if(a.lastCaret.end===0&&a.lastCaret.start>0)a.lastCaret.end=a.lastCaret.start;if(a.lastCaret.start<0)a.lastCaret=b;a.$preview.caret(a.lastCaret.start,a.lastCaret.end);g('<div class="ui-keyboard-overlay"></div>').click(function(){g(this).remove();a.close();return!1}).appendTo("body");c.usePreview||a.$el.addClass("ui-keyboard-overlay-input")}a.$el.trigger("visible.keyboard",[a,a.el]);return a}};a.startup= function(){a.$keyboard=a.buildKeyboard();a.$allKeys=a.$keyboard.find(".ui-keyboard-button");a.$preview=c.usePreview?a.$keyboard.find(".ui-keyboard-preview"):a.$el;a.preview=a.$preview[0];a.$decBtn=a.$keyboard.find(".ui-keyboard-dec");a.wheel=g.isFunction(g.fn.mousewheel);a.alwaysAllowed=[33,34,35,36,37,38,39,40,45,46];a.lastCaret={start:0,end:0};a.$preview.bind("keypress.keyboard",function(b){var h=String.fromCharCode(b.charCode||b.which);if(a.checkCaret)a.lastCaret=a.$preview.caret();if(c.restrictInput){if((b.which=== 8||b.which===0)&&g.inArray(b.keyCode,a.alwaysAllowed))return;g.inArray(h,a.acceptedKeys)===-1&&b.preventDefault()}else if((b.ctrlKey||b.metaKey)&&(b.which===97||b.which===99||b.which===118||b.which===120))return;a.hasMappedKeys&&a.mappedKeys.hasOwnProperty(h)&&(a.insertText(a.mappedKeys[h]),b.preventDefault());a.checkMaxLength()}).bind("keyup.keyboard",function(b){switch(b.which){case 9:if(a.tab&&!c.lockInput)g.keyboard.keyaction.tab(a),a.tab=!1;break;case 27:return a.close(),!1}clearTimeout(a.throttled); a.throttled=setTimeout(function(){a.checkCombos()},100);a.checkMaxLength();a.$el.trigger("change.keyboard",[a,a.el])}).bind("keydown.keyboard",function(b){switch(b.which){case 9:a.tab=!0;b.preventDefault();break;case 13:if(b.shiftKey)return a.close(!0),!1;break;case 86:if(b.ctrlKey||b.metaKey){if(c.preventPaste){b.preventDefault();break}a.checkCombos()}}}).bind("mouseup.keyboard",function(){if(a.checkCaret)a.lastCaret=a.$preview.caret()}).bind("blur.keyboard",function(){if(c.alwaysOpen)clearTimeout(a.timer), a.timer=setTimeout(function(){g(":focus")[0]!==a.el&&a.close(c.autoAccept)},300)});c.preventPaste&&(a.$preview.bind("contextmenu.keyboard",function(a){a.preventDefault()}),a.$el.bind("contextmenu.keyboard",function(a){a.preventDefault()}));a.$keyboard.appendTo("body");a.$allKeys.bind(c.keyBinding+".keyboard",function(b){var h;h=g.data(this,"key");var d=h.action.split(":")[0];a.preview.focus();a.checkCaret&&a.$preview.caret(a.lastCaret.start,a.lastCaret.end);d.match("meta")&&(d="meta");if(g.keyboard.keyaction.hasOwnProperty(d)&& g(this).is(".ui-keyboard-actionkey")){if(g.keyboard.keyaction[d](a,this)===!1)return}else typeof h.action!=="undefined"&&(h=a.wheel&&!g(this).is(".ui-keyboard-actionkey")?h.curTxt:h.action,a.insertText(h));a.checkCombos();a.checkMaxLength();a.$el.trigger("change.keyboard",[a,a.el]);c.usePreview&&a.preview.focus();b.preventDefault()}).bind("mouseenter.keyboard mouseleave.keyboard",function(b){var h=g(this),d=g.data(this,"key");b.type==="mouseenter"&&a.el.type!=="password"&&h.addClass("ui-state-hover").attr("title", function(b,e){return a.wheel&&e===""&&a.sets?c.wheelMessage:e});if(b.type==="mouseleave")d.curTxt=d.original,d.curNum=0,g.data(this,"key",d),h.removeClass(a.el.type==="password"?"":"ui-state-hover").attr("title",function(a,b){return b===c.wheelMessage?"":b}).find("span").text(d.original)}).bind("mousewheel.keyboard",function(b,h){if(a.wheel){var d,c=g(this),e=g.data(this,"key");d=e.layers||a.getLayers(c);e.curNum+=h>0?-1:1;if(e.curNum>d.length-1)e.curNum=0;if(e.curNum<0)e.curNum=d.length-1;e.layers= d;e.curTxt=d[e.curNum];g.data(this,"key",e);c.find("span").text(d[e.curNum]);return!1}}).bind("mouseup.keyboard",function(){a.preview.focus()})};a.insertText=function(b){var h,d,c=a.$preview.val(),e=a.$preview.caret(),g=a.$preview.scrollLeft();h=a.$preview.scrollTop();d=c.length;if(e.end<e.start)e.end=e.start;if(e.start>d)e.end=e.start=d;if(a.preview.tagName==="TEXTAREA"){a.msie&&c.substr(e.start,1)==="\n"&&(e.start+=1,e.end+=1);if((a.msie||a.opera)&&c.substr(0,e.start).split("\n").length-1>0)d=c.substr(0, e.start).split("\n").length-1,e.start+=d,e.end+=d;d=c.split("\n").length-1;a.preview.scrollTop=d>0?a.lineHeight*d:h}h=b==="bksp"&&e.start===e.end?!0:!1;b=b==="bksp"?"":b;d=e.start+(h?-1:b.length);g+=parseInt(a.$preview.css("fontSize"),10)*(b==="bksp"?-1:1);a.$preview.val(c.substr(0,e.start-(h?1:0))+b+c.substr(e.end)).caret(d,d).scrollLeft(g);if(a.checkCaret)a.lastCaret={start:d,end:d}};a.checkMaxLength=function(){var b,h=a.$preview.val();if(c.maxLength!==!1&&h.length>c.maxLength)b=Math.min(a.$preview.caret().start, c.maxLength),a.$preview.val(h.substring(0,c.maxLength)),a.$preview.caret(b,b),a.lastCaret={start:b,end:b};a.$decBtn.length&&a.checkDecimal()};a.showKeySet=function(b){var h="",d=a.shiftActive?1:0;d+=a.altActive?2:0;if(a.metaActive)h=b&&b.name&&b.name.match("meta")?b.name.split("_")[1]:"",h===""?h=a.metaActive===!0?"":a.metaActive:a.metaActive=h;h=d===0&&!a.metaActive?"-default":h===""?"":"-"+h;a.$keyboard.find(".ui-keyboard-keyset"+h+a.rows[d]).length?(a.$keyboard.find(".ui-keyboard-alt, .ui-keyboard-shift, .ui-keyboard-actionkey[class*=meta]").removeClass(c.actionClass).end().find(".ui-keyboard-alt")[a.altActive? "addClass":"removeClass"](c.actionClass).end().find(".ui-keyboard-shift")[a.shiftActive?"addClass":"removeClass"](c.actionClass).end().find(".ui-keyboard-keyset").hide().end().find(".ui-keyboard-keyset"+h+a.rows[d]).show().end().find(".ui-keyboard-actionkey.ui-keyboard"+h).addClass(c.actionClass),a.lastKeyset=[a.shiftActive,a.altActive,a.metaActive]):(a.shiftActive=a.lastKeyset[0],a.altActive=a.lastKeyset[1],a.metaActive=a.lastKeyset[2])};a.checkCombos=function(){var b,h,d,f=a.$preview.val(),e=a.$preview.caret(), i=f.length;if(e.end<e.start)e.end=e.start;if(e.start>i)e.end=e.start=i;a.msie&&f.substr(e.start,1)==="\n"&&(e.start+=1,e.end+=1);if((a.msie||a.opera)&&f.substr(0,e.start).split("\n").length-1>0)d=f.substr(0,e.start).split("\n").length-1,e.start+=d,e.end+=d;c.useCombos&&(f=f.replace(a.regex,function(a,b,d){return c.combos.hasOwnProperty(b)?c.combos[b][d]||a:a}));if(c.restrictInput){d=f.split("");h=d.length;for(b=0;b<h;b++)g.inArray(d[b],a.acceptedKeys)<0&&(f=f.replace(d[b],""))}e.start+=f.length-i; e.end+=f.length-i;a.$preview.val(f);a.$preview.caret(e.start,e.end);a.preview.scrollTop=a.lineHeight*(f.substring(0,e.start).split("\n").length-1);a.lastCaret={start:e.start,end:e.end};return f};a.checkDecimal=function(){a.decimal&&/\./g.test(a.preview.value)||!a.decimal&&/\,/g.test(a.preview.value)?a.$decBtn.attr({disabled:"disabled","aria-disabled":"true"}).removeClass("ui-state-default ui-state-hover").addClass("ui-state-disabled"):a.$decBtn.removeAttr("disabled").attr({"aria-disabled":"false"}).addClass("ui-state-default").removeClass("ui-state-disabled")}; a.getLayers=function(a){var c;c=a.attr("name");return a.closest(".ui-keyboard").find("button[name="+c+"]").map(function(){return g(this).find("span").text()}).get()};a.close=function(b){if(a.$keyboard.is(":visible")){clearTimeout(a.throttled);a.$el.trigger(c.alwaysOpen?"":"beforeClose.keyboard",[a,a.el,b||!1]).val(b?c.alwaysOpen?a.$el.val():a.checkCombos():a.originalContent).scrollTop(a.el.scrollHeight).trigger(b?"accepted.keyboard":"canceled.keyboard",[a,a.el]).trigger(c.alwaysOpen?"":"hidden.keyboard", [a,a.el]).removeClass("ui-keyboard-overlay-input");!c.usePreview&&c.openOn!==""&&a.$el.bind(c.openOn+".keyboard",function(){a.focusOn()});g(".ui-keyboard-overlay").remove();if(!c.alwaysOpen)a.$keyboard.hide(),a.isVisible=!1;!a.watermark&&a.el.value===""&&a.inPlaceholder!==""&&a.$el.addClass("ui-keyboard-placeholder").val(a.inPlaceholder)}return!1};a.accept=function(){a.close(!0)};a.escClose=function(b){b.target!==a.el&&(g(b.target).closest(".ui-keyboard").length||a.close(c.autoAccept?!0:!1),a.msie&& b.preventDefault())};a.keyBtn=g("<button />").attr({role:"button","aria-disabled":"false"}).addClass("ui-keyboard-button ui-state-default ui-corner-all");a.addKey=function(b,h,d,f){var e,i,j,h=f===!0?b:c.display[h]||b;/\(.+\)/.test(h)&&(i=h.replace(/\(([^()]+)\)/,""),e=h.match(/\(([^()]+)\)/)[1],h=i,j=i.split(":"),i=j[0]!==""&&j.length>1?j[0]:i,a.mappedKeys[e]=i);j=h.split(":");j[0]===""&&j[1]===""&&(h=":");h=j[0]!==""&&j.length>1?g.trim(j[0]):h;e=j.length>1?g.trim(j[1]).replace(/_/g," ")||"":""; i=h.length>1?" ui-keyboard-widekey":"";i+=f?"":" ui-keyboard-actionkey";return a.keyBtn.clone().attr({"data-value":h,name:"key_"+b,title:e}).data("key",{action:b,original:h,curTxt:h,curNum:0}).addClass("ui-keyboard-"+(f===!0?b.charCodeAt(0):b)+i).html("<span>"+h+"</span>").appendTo(d)};a.buildKeyboard=function(){var b,f,d,k,e,i,j,n=0,m=g("<div />").addClass("ui-keyboard ui-widget-content ui-widget ui-corner-all ui-helper-clearfix"+(c.alwaysOpen?" ui-keyboard-always-open":"")).attr({role:"textbox"}).hide(); c.usePreview?a.$preview=a.$el.clone(!1).removeAttr("id").removeAttr("placeholder").removeClass("ui-keyboard-placeholder").addClass("ui-widget-content ui-keyboard-preview ui-corner-all").show():(a.$preview=a.$el,c.position.at=c.position.at2);a.$preview.attr(c.lockInput?{readonly:"readonly"}:{});c.usePreview&&g("<div />").append(a.$preview).appendTo(m);if(c.layout==="custom"||!g.keyboard.layouts.hasOwnProperty(c.layout))c.layout="custom",g.keyboard.layouts.custom=c.customLayout||{"default":["{cancel}"]}; g.each(g.keyboard.layouts[c.layout],function(o,p){if(o!==""){n++;d=g("<div />").attr("name",o).addClass("ui-keyboard-keyset ui-keyboard-keyset-"+o).appendTo(m)[o==="default"?"show":"hide"]();for(f=0;f<p.length;f++){k=g.trim(p[f]).replace(/\{(\.?)[\s+]?:[\s+]?(\.?)\}/g,"{$1:$2}");i=k.split(/\s+/);for(e=0;e<i.length;e++)if(i[e].length!==0)if(/^\{\S+\}$/.test(i[e]))if(b=i[e].match(/^\{(\S+)\}$/)[1].toLowerCase(),/^sp:(\.?\d+)$/.test(b)&&(j=b.match(/^sp:(\.?\d+)$/)[1]||0,g("<span>&nbsp;</span>").css("margin", "0 "+j+"em").appendTo(d)),/^meta\d+\:?(\w+)?/.test(b))a.addKey(b,b,d);else switch(b){case "a":case "accept":a.addKey("accept",b,d).addClass(c.actionClass);break;case "alt":case "altgr":a.addKey("alt","alt",d);break;case "b":case "bksp":a.addKey("bksp",b,d);break;case "c":case "cancel":a.addKey("cancel",b,d).addClass(c.actionClass);break;case "combo":a.addKey("combo","combo",d).addClass(c.actionClass);break;case "dec":a.acceptedKeys.push(a.decimal?".":",");a.addKey("dec","dec",d);break;case "e":case "enter":a.addKey("enter", b,d).addClass(c.actionClass);break;case "s":case "shift":a.addKey("shift",b,d);break;case "sign":a.acceptedKeys.push("-");a.addKey("sign","sign",d);break;case "space":a.acceptedKeys.push(" ");a.addKey("space","&nbsp;",d);break;case "t":case "tab":a.addKey("tab",b,d);break;default:g.keyboard.keyaction.hasOwnProperty(b)&&a.addKey(b,b,d)}else a.acceptedKeys.push(i[e].split(":")[0]),a.addKey(i[e],i[e],d,!0).attr("name","key_"+f+"_"+e);d.find(".ui-keyboard-button:last").after('<br class="ui-keyboard-button-endrow">')}}}); if(n>1)a.sets=!0;a.hasMappedKeys=!g.isEmptyObject(a.mappedKeys);return m};a.destroy=function(){g(document).unbind("mousedown.keyboard keyup.keyboard",a.escClose);a.$keyboard&&a.$keyboard.remove();a.$el.removeClass("ui-keyboard-input ui-widget-content ui-corner-all ui-keyboard-placeholder ui-keyboard-notallowed ui-keyboard-always-open").removeAttr("aria-haspopup").removeAttr("role").unbind(c.openOn+".keyboard blur.keyboard accepted.keyboard canceled.keyboard beforeClose.keyboard hidden.keyboard visible.keyboard keydown.keyboard keypress.keyboard keyup.keyboard contextmenu.keyboard initialized.keyboard").removeData("keyboard")}; a.init()};g.keyboard.keyaction={accept:function(f){f.close(!0);return!1},alt:function(f,g){f.altActive=!f.altActive;f.showKeySet(g)},bksp:function(f){f.insertText("bksp")},cancel:function(f){f.close();return!1},clear:function(f){f.$preview.val("")},combo:function(f){var g=!f.options.useCombos;f.options.useCombos=g;f.$keyboard.find(".ui-keyboard-combo")[g?"addClass":"removeClass"](f.options.actionClass);g&&f.checkCombos();return!1},dec:function(f){f.insertText(f.decimal?".":",")},enter:function(f){f.el.tagName!== "INPUT"&&f.insertText("\r\n")},meta:function(f,k){f.metaActive=g(k).is("."+f.options.actionClass)?!1:!0;f.showKeySet(k)},shift:function(f,g){f.shiftActive=!f.shiftActive;f.showKeySet(g)},sign:function(f){/^\-?\d*\.?\d*$/.test(f.$preview.val())&&f.$preview.val(f.$preview.val()*-1)},space:function(f){f.insertText(" ")},tab:function(f){f.el.tagName!=="INPUT"&&f.insertText("\t")}};g.keyboard.layouts={alpha:{"default":["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} a b c d e f g h i j [ ] \\","k l m n o p q r s ; ' {enter}", "{shift} t u v w x y z , . / {shift}","{accept} {space} {cancel}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} A B C D E F G H I J { } |",'K L M N O P Q R S : " {enter}',"{shift} T U V W X Y Z < > ? {shift}","{accept} {space} {cancel}"]},qwerty:{"default":["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}","{accept} {space} {cancel}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |", 'A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}","{accept} {space} {cancel}"]},international:{"default":["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}","{accept} {alt} {space} {alt} {cancel}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}","{accept} {alt} {space} {alt} {cancel}"],alt:["~ \u00a1 \u00b2 \u00b3 \u00a4 \u20ac \u00bc \u00bd \u00be \u2018 \u2019 \u00a5 \u00d7 {bksp}", "{tab} \u00e4 \u00e5 \u00e9 \u00ae \u00fe \u00fc \u00fa \u00ed \u00f3 \u00f6 \u00ab \u00bb \u00ac","\u00e1 \u00df \u00f0 f g h j k \u00f8 \u00b6 \u00b4 {enter}","{shift} \u00e6 x \u00a9 v b \u00f1 \u00b5 \u00e7 > \u00bf {shift}","{accept} {alt} {space} {alt} {cancel}"],"alt-shift":["~ \u00b9 \u00b2 \u00b3 \u00a3 \u20ac \u00bc \u00bd \u00be \u2018 \u2019 \u00a5 \u00f7 {bksp}","{tab} \u00c4 \u00c5 \u00c9 \u00ae \u00de \u00dc \u00da \u00cd \u00d3 \u00d6 \u00ab \u00bb \u00a6","\u00c4 \u00a7 \u00d0 F G H J K \u00d8 \u00b0 \u00a8 {enter}", "{shift} \u00c6 X \u00a2 V B \u00d1 \u00b5 \u00c7 . \u00bf {shift}","{accept} {alt} {space} {alt} {cancel}"]},dvorak:{"default":["` 1 2 3 4 5 6 7 8 9 0 [ ] {bksp}","{tab} ' , . p y f g c r l / = \\","a o e u i d h t n s - {enter}","{shift} ; q j k x b m w v z {shift}","{accept} {space} {cancel}"],shift:["~ ! @ # $ % ^ & * ( ) { } {bksp}",'{tab} " < > P Y F G C R L ? + |',"A O E U I D H T N S _ {enter}","{shift} : Q J K X B M W V Z {shift}","{accept} {space} {cancel}"]},num:{"default":"= ( ) {b},{clear} / * -,7 8 9 +,4 5 6 {sign},1 2 3 %,0 . {a} {c}".split(",")}}; g.keyboard.defaultOptions={layout:"qwerty",customLayout:null,position:{of:null,my:"center top",at:"center top",at2:"center bottom"},usePreview:!0,alwaysOpen:!1,stayOpen:!1,display:{a:"\u2714:Accept (Shift-Enter)",accept:"Accept:Accept (Shift-Enter)",alt:"AltGr:Alternate Graphemes",b:"\u2190:Backspace",bksp:"Bksp:Backspace",c:"\u2716:Cancel (Esc)",cancel:"Cancel:Cancel (Esc)",clear:"C:Clear",combo:"\u00f6:Toggle Combo Keys",dec:".:Decimal",e:"\u21b5:Enter",enter:"Enter:Enter",s:"\u21e7:Shift",shift:"Shift:Shift", sign:"\u00b1:Change Sign",space:" :Space",t:"\u21e5:Tab",tab:"\u21e5 Tab:Tab"},wheelMessage:"Use mousewheel to see other keys",actionClass:"ui-state-active",autoAccept:!1,lockInput:!1,restrictInput:!1,preventPaste:!1,maxLength:!1,openOn:"focus",keyBinding:"mousedown",useCombos:!0,combos:{"`":{a:"\u00e0",A:"\u00c0",e:"\u00e8",E:"\u00c8",i:"\u00ec",I:"\u00cc",o:"\u00f2",O:"\u00d2",u:"\u00f9",U:"\u00d9",y:"\u1ef3",Y:"\u1ef2"},"'":{a:"\u00e1",A:"\u00c1",e:"\u00e9",E:"\u00c9",i:"\u00ed",I:"\u00cd",o:"\u00f3", O:"\u00d3",u:"\u00fa",U:"\u00da",y:"\u00fd",Y:"\u00dd",c:"\u00e7",C:"\u00c7"},'"':{a:"\u00e4",A:"\u00c4",e:"\u00eb",E:"\u00cb",i:"\u00ef",I:"\u00cf",o:"\u00f6",O:"\u00d6",u:"\u00fc",U:"\u00dc",y:"\u00ff",Y:"\u0178"},"^":{a:"\u00e2",A:"\u00c2",e:"\u00ea",E:"\u00ca",i:"\u00ee",I:"\u00ce",o:"\u00f4",O:"\u00d4",u:"\u00fb",U:"\u00db",y:"\u0177",Y:"\u0176"},"~":{a:"\u00e3",A:"\u00c3",e:"\u1ebd",E:"\u1ebc",i:"\u0129",I:"\u0128",o:"\u00f5",O:"\u00d5",u:"\u0169",U:"\u0168",y:"\u1ef9",Y:"\u1ef8",n:"\u00f1", N:"\u00d1"},a:{e:"\u00e6"},A:{E:"\u00c6"},o:{e:"\u0153"},O:{E:"\u0152"}},initialized:null,accepted:null,canceled:null,hidden:null,visible:null,beforeClose:null};g.keyboard.comboRegex=/([`\'~\^\"ao])([a-z])/mig;g.fn.keyboard=function(f){return this.each(function(){new g.keyboard(this,f)})};g.fn.getkeyboard=function(){return this.data("keyboard")}})(jQuery);
-(function(f,c,l,a){f.fn.caret=function(d,b){var k,g,j,e,h;h=document.selection;var i=this[0],p=i.scrollTop,m=f.browser.msie;if(typeof i!=="undefined")return typeof d==="number"&&typeof b==="number"&&(g=d,e=b),typeof g!=="undefined"?(m?(h=i.createTextRange(),h.collapse(!0),h.moveStart("character",g),h.moveEnd("character",e-g),h.select()):(i.selectionStart=g,i.selectionEnd=e),i.focus(),i.scrollTop=p,this):(m?i.tagName.toLowerCase()!=="textarea"?(e=this.val(),g=h[l]()[a](),g.moveEnd("character",e[c]), k=g.text===""?e[c]:e.lastIndexOf(g.text),g=h[l]()[a](),g.moveStart("character",-e[c]),j=g.text[c]):(g=h[l](),h=g[a](),h.moveToElementText(i),h.setEndPoint("EndToEnd",g),k=h.text[c]-g.text[c],j=k+g.text[c]):(k=i.selectionStart,j=i.selectionEnd),h=i.value.substring(k,j),{start:k,end:j,text:h,replace:function(a){return i.value.substring(0,k)+a+i.value.substring(j,i.value[c])}})}})(jQuery,"length","createRange","duplicate");
+(function(g,f,k,a){g.fn.caret=function(c,b){var h,d,l,e,i;i=document.selection;var j=this[0],n=j.scrollTop,m=g.browser.msie;if(typeof j!=="undefined")return typeof c==="number"&&typeof b==="number"&&(d=c,e=b),typeof d!=="undefined"?(m?(i=j.createTextRange(),i.collapse(!0),i.moveStart("character",d),i.moveEnd("character",e-d),i.select()):(j.selectionStart=d,j.selectionEnd=e),j.focus(),j.scrollTop=n,this):(m?j.tagName.toLowerCase()!=="textarea"?(e=this.val(),d=i[k]()[a](),d.moveEnd("character",e[f]), h=d.text===""?e[f]:e.lastIndexOf(d.text),d=i[k]()[a](),d.moveStart("character",-e[f]),l=d.text[f]):(d=i[k](),i=d[a](),i.moveToElementText(j),i.setEndPoint("EndToEnd",d),h=i.text[f]-d.text[f],l=h+d.text[f]):(h=j.selectionStart,l=j.selectionEnd),i=j.value.substring(h,l),{start:h,end:l,text:i,replace:function(a){return j.value.substring(0,h)+a+j.value.substring(l,j.value[f])}})}})(jQuery,"length","createRange","duplicate");
Please sign in to comment.
Something went wrong with that request. Please try again.