Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alwaysOpen: true & scramble #276

Closed
vasanthb9 opened this issue May 27, 2014 · 23 comments
Closed

alwaysOpen: true & scramble #276

vasanthb9 opened this issue May 27, 2014 · 23 comments

Comments

@vasanthb9
Copy link

hi all, My requirement is " alwaysOpen : true " , but if i make it as TRUE virtual keyboard keys are not shuffulling. i.e keys are not getting randomized. pls help me how to make keys randomized when " alwaysOpen : true"

great thanks

@Mottie Mottie changed the title hi all, My requirement is " alwaysOpen : true " , but if i make it as TRUE virtual keyboard keys are not shuffulling. i.e keys are not getting randomized. pls help me how to make keys randomized when " alwaysOpen : true" alwaysOpen: true & scramble May 27, 2014
@Mottie
Copy link
Owner

Mottie commented May 27, 2014

Hi @vasanthb9!

Hmm, that does look like a problem. I had it working before I switched the core to save already built keyboards.

@Mottie Mottie added the Bug label May 27, 2014
@vasanthb9
Copy link
Author

Hi Mottie,
thank you very much for replied me. Is there any solution for this problem, or else any alternative solution? plz help me from this problem. i am integrating this virtual keyboard(randomized) into my bank application. its very urgent requirement to me, my client is waiting for this virtual keyboard implementation.
heart full thanks in advance ....

@Mottie
Copy link
Owner

Mottie commented May 28, 2014

I'll see what I can get done today.

@Mottie
Copy link
Owner

Mottie commented May 28, 2014

For now try this code (demo):

$(function () {
    $('#keyboard').keyboard({
        alwaysOpen: true,
        initialized: function (e, keyboard, el) {
            setTimeout(function () {
                keyboard.$keyboard = keyboard.scramble_setup(keyboard.$keyboard);
            }, 0);
        }
    })
    .addScramble({
        targetKeys: /[a-z\d]/i, // keys to randomize
        byRow: true, // randomize by row, otherwise randomize all keys
        randomizeOnce: true // if false, randomize every time the keyboard opens
    });
});

I'll see what I can do to better fix this issue when I have more time.

@vasanthb9
Copy link
Author

Oh!!! u awesome Mottie, its working fine, you saved me like anything else from that issue. i have few more issues.

issue#1. how to set keyboard in a specific position .
example: in ' keyBoardDiv ' need to display the keyboard. like

<div id="keyBoardDiv">
       here i need to show the Virtual Keyboard
</div>

Issue#2 : how to disable the keyboard on page load. need to display disabled/enabled keyboard in keyBoardDiv . when user click checkbox then it should be enabled and password field should get focused. till that it should be disabled.

<div id="checkBoxDiv">
    <input type="checkbox" name="keyboardCHK" id="keyboardCHKboxID" />
</div>

below is the complete code in login.jsp

<div id="passwordDiv">
    <input type="password" name="userPassword" id="passwordID" />
</div>
<div id="checkBoxDiv">Click here to use virtual keyboard for the password only(Recommended) 
    <input type="checkbox" name="keyboardCHK" id="keyboardCHKboxID" />
</div>
<div id="keyBoardDiv">
    here i need to show the Virtual Keyboard
</div>

please help me from above mentioned issue. awaiting for your reply.
heart full thanks in advance.

@vasanthb9
Copy link
Author

i don't want special keys like Accept, Cancel, Tag, Enter, Space buttons on my keyboard. i tried removing those keys in $.keyboard.layouts .i.e in QWERTY layout. still its showing those keys in keyboard. any solution or suggestion plzzzzzzzzz.....

@Mottie
Copy link
Owner

Mottie commented May 29, 2014

Try this (demo):

CSS

/* turn off blue outline */
#passwordID[disabled] {
    box-shadow: none;
}
/* fade out keyboard keys */
.ui-keyboard-button[disabled] {
    opacity: 0.5;
}

HTML

<div id="passwordDivWrap">
    <input type="password" name="userPassword" id="passwordID" />
</div>
<div id="checkBoxDiv">Click here to use virtual keyboard for the password only(Recommended)
    <input type="checkbox" name="keyboardCHK" id="keyboardCHKboxID" />
</div>
<div id="keyBoardDiv"><!--here i need to show the Virtual Keyboard--></div>

Script

$(function () {

    $('#passwordID')
        // apply keyboard
        .keyboard({
            layout: 'custom',
            customLayout : {
                'default': [
                    '` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',
                    'q w e r t y u i o p [ ] \\',
                    'a s d f g h j k l ; \'',
                    '{shift} z x c v b n m , . / {shift}'
                ],
                'shift': [
                    '~ ! @ # $ % ^ & * ( ) _ + {bksp}',
                    'Q W E R T Y U I O P { } |',
                    'A S D F G H J K L : "',
                    '{shift} Z X C V B N M < > ? {shift}'
                ]
            },
            // keyboard always visible
            alwaysOpen: true,
            // disable position utility
            position: '',
            // use original input only
            usePreview: false,
            // add keyboard to desired div
            appendTo: '#keyBoardDiv',
            // initialize scramble
            initialized: function (e, keyboard, el) {
                setTimeout(function () {
                    keyboard.$keyboard = keyboard.scramble_setup(keyboard.$keyboard);
                    $('#passwordID, .ui-keyboard-button').prop('disabled', true);
                }, 0);
            }
        })
        .addScramble({
            targetKeys: /[a-z\d]/i, // keys to randomize
            byRow: true, // randomize by row, otherwise randomize all keys
            randomizeOnce: true // if false, randomize every time the keyboard opens
        });

    $('#keyboardCHKboxID').change(function () {
        // enable/disable input & keyboard
        $('#passwordID, .ui-keyboard-button').prop('disabled', !this.checked);
    });

});

@vasanthb9
Copy link
Author

Hi Mottie,
i'm using your virtual keyboard, on page load cursor is always pointing on "passwordID" field which is wrong in my requirement. My requirement is " on page load the cursor should always point to "userNameID" . and user need to enter the userName and password through physical keyboard only. when user clicks the checkBox, then virtual keyboard get enabled and cursor should point on the password field need to enter the password through virtual keyboard only. when he uncheck the checkBox then he should enter the userName and password through physical keyboard only.

I want one CLEAR button on keyboard. when user clicks on CLEAR it should clear the values in password field.
please help me from this issue .
waiting for your response like any thing.

heart full thanks in advance.

below is the complete code for virtual Keyboard.
code in login.jsp

<div id="passwordDivWrap">
    <input type="password" name="userPassword" id="passwordID" />
  <input type="text" name="userName" id="userNameID" />
</div>
<div id="checkBoxDiv">Click here to use virtual keyboard for the password only(Recommended)
    <input type="checkbox" name="keyboardCHK" id="keyboardCHKboxID" />
</div>
<div id="keyBoardDiv"><!--here i'm displaying the Virtual Keyboard--></div>

script code:

     this.onload=intialize;
    function intialize(){
        $(function () {

            $('#password')
                // apply keyboard
                .keyboard({
                    layout: 'custom',
                    customLayout : {
                        'default': [
                            '` 1 2 3 4 5 6 7 8 9 0 - = ',
                            'q w e r t y u i o p [ ] \\',
                            'a s d f g h j k l ; \'',
                            '{shift} z x c v b n m , . / {backspace}'
                        ],
                        'shift': [
                            '~ ! @ # $ % ^ & * ( ) _ + ',
                            'Q W E R T Y U I O P { } |',
                            'A S D F G H J K L : "',
                            '{shift} Z X C V B N M < > ? {backspace}'
                        ]
                    },
                    // keyboard always visible
                    alwaysOpen: true,
                    // disable position utility
                    position: '',
                    // use original input only
                    usePreview: false,
                    // add keyboard to desired div
                    appendTo: '#keyBoardDiv',
                    // initialize scramble
                    initialized: function (e, keyboard, el) {
                        setTimeout(function () {
                            keyboard.$keyboard = keyboard.scramble_setup(keyboard.$keyboard);
                            $('.ui-keyboard-button').prop('disabled', true);
                        }, 0);
                    }
                })
                .addScramble({
                    targetKeys: /[a-z\d]/i, // keys to randomize
                    byRow: true, // randomize by row, otherwise randomize all keys
                    randomizeOnce: false // if false, randomize every time the keyboard opens
                });

            $('#keyboardCHKboxID').change(function () {
                // enable/disable input & keyboard
                $('.ui-keyboard-button').prop('disabled', !this.checked);
            });

        });
      } 

in CSS file:

.ui-keyboard { padding: .3em; z-index: 16000; }
.ui-keyboard-has-focus { z-index: 16001; }
.ui-keyboard div { font-size: 0.9em; }
.ui-keyboard-button { height: 2em; width: 2em; min-width: .8em; overflow: hidden; line-height: 2.5em; -moz-user-focus: ignore; }
.ui-keyboard-button span { padding: 0; margin: 0; white-space:nowrap; display: inline-block; }
.ui-keyboard-button-endrow { clear: lef5t; }
.ui-keyboard-widekey { min-width: 4em; width: auto; }
.ui-keyboard-space { width: 15em; }
.ui-keyboard-space span, .ui-keyboard-empty span { font: 0/0 a; text-shadow: none; color: transparent; } /* see http://nicolasgallagher.com/another-css-image-replacement-technique/ */
.ui-keyboard-preview-wrapper { text-align: center; }
.ui-keyboard-preview { text-align: left; margin: 0 0 3px 0; display: inline; width: 99%;} /* width is calculated in IE, since 99% = 99% full browser width =( */ 
.ui-keyboard-keyset { text-align: center; white-space: nowrap; }
.ui-keyboard-input { text-align: left; }
.ui-keyboard-input-current { -moz-box-shadow: 1px 1px 10px #fff; -webkit-box-shadow: 1px 1px 10px #fff; box-shadow: 1px 1px 10px #fff; background-color: white;}
.ui-keyboard-placeholder { color: #888; }
.ui-keyboard-nokeyboard { color: #888; border-color: #888; } /* disabled or readonly inputs, or use input[disabled='disabled'] { color: #f00; } */
.ui-keyboard-button.disabled { opacity: 0.5; filter: alpha(opacity=50); } /* used by the acceptValid option to make the accept button appear faded */
.ui-keyboard-spacer { display: inline-block; width: 1px; height: 0; }


/* turn off blue outline */
.ui-keyboard-button[disabled] {
    opacity: 0.5;
}

@Mottie
Copy link
Owner

Mottie commented Jul 1, 2014

I had to make seven changes (demo):

  1. Removed this.onload=intialize; and the wrapping function intialize(){ ... } as they aren't needed.

  2. Changed $('#password') to $('#passwordID').

  3. Changed {backspace} to {bksp} in the layout, otherwise it won't work

  4. Added {clear} to keyboard - I don't know where you wanted it exactly, so move it as desired

  5. Added a display option for the clear button to change the clear to a symbol, otherwise the scramble extension thinks the "C" is just another letter to scramble.

    display: {
      // this needs to be set otherwise the scramble
      // extension thinks the "C" is another letter
      // to scramble
      'clear' : '\u2717'
    },
  6. Added initialFocus option, set to false. This doesn't give focus to the password field upon initialization

  7. Added a focus to username inside of the initialized function

    initialized: function (e, keyboard, el) {
      setTimeout(function () {
        keyboard.$keyboard = keyboard.scramble_setup(keyboard.$keyboard);
        $('.ui-keyboard-button').prop('disabled', true);
        $('#userNameID').focus();
      }, 0);
    }

@vasanthb9
Copy link
Author

Dear Mottie,

right now am using virtual keyboard only for the field PASSWORD. but i need the same to USERNAME field also. can you please help me in code how can i do this with below code.
in login.jsp:

<div id="passwordDivWrap">
    <input type="password" name="userPassword" id="password" />
  <input type="text" name="userName" id="userName" />
</div>
<div id="checkBoxDiv">Click here to use virtual keyboard for the userName and password (Recommended)
    <input type="checkbox" name="keyboardCHK" id="keyboardCHKboxID" />
</div>
<div id="keyBoardDiv"><!--here i'm displaying the Virtual Keyboard--></div>

script:

this.onload = intialize;

function intialize() {
    $(function () {

        $('#password')
        // apply keyboard
        .keyboard({
            layout: 'custom',
            customLayout: {
                'default': [
                    '` 1 2 3 4 5 6 7 8 9 0 - = ',
                    'q w e r t y u i o p [ ] \\',
                    'a s d f g h j k l ; \' {clear}',
                    '{shift} z x c v b n m , . / {bksp}'],
                    'shift': [
                    '~ ! @ # $ % ^ & * ( ) _ + ',
                    'Q W E R T Y U I O P { } |',
                        'A S D F G H J K L : " {clear}',
                    '{shift} Z X C V B N M < > ? {bksp}']
            },
            display: {
                // this needs to be set otherwise the scramble
                // extension thinks the "C" is another letter 
                // to scramble
                'clear' : '\u2717'
            },
            // keyboard always visible
            alwaysOpen: true,
            // disable position utility
            position: '',
            // use original input only
            usePreview: false,
            // add keyboard to desired div
            appendTo: '#keyBoardDiv',
            // give the preview initial focus when the keyboard becomes visible
            initialFocus : false,
            // initialize scramble
            initialized: function (e, keyboard, el) {
                setTimeout(function () {
                    keyboard.$keyboard = keyboard.scramble_setup(keyboard.$keyboard);
                    $('.ui-keyboard-button').prop('disabled', true);
                    $('#userName').focus();
                }, 0);
            }
        })
        .addScramble({
            targetKeys: /[a-z\d]/i, // keys to randomize
            byRow: true, // randomize by row, otherwise randomize all keys
            randomizeOnce: false // if false, randomize every time the keyboard opens
        });

        $('#keyboardCHKboxID').change(function () {
            // enable/disable input & keyboard
            $('.ui-keyboard-button').prop('disabled', !this.checked);
        });

    });
}

heart full thanks in Advance.

@Mottie
Copy link
Owner

Mottie commented Aug 12, 2014

Hi @vasanthb9!

Do you want the username keyboard to be scrambled? I wouldn't think so... so in that case do the following:

$(function () {

    $('#password, #keyboardCHKboxID').keyboard({ /* set options */ });

    $('#password').addScramble({ /* scramble options */ });

});

there is no need for the this.onload = intialize; or wrapping the whole thing within a

function intialize() { ... }

@vasanthb9
Copy link
Author

Dear Mottie,

my requirement is , when user wants to enter his USERNAME , PASSWORD through virtual keyboard , first he needs to click the checkBox. i.e(Click here to use virtual keyboard for the userName and password (Recommended)). when he clicks this checkBox, then virtual keyboard should be enabled and user should enter his credentials(userName and password) through virtual keyboard only. if unchecks the checkBox, then virtual keyboard should be disabled. he can enter his credentials(userName and password) through physical keyboard .

below are the test case scenarios:
scenario 1:
user may enter his USERNAME through physical keyboard, if user wants to enter his PASSWORD through virtual keyboard then he need to click the checkbox to enable the virtual keyboard and he can fill password.

scenario 2:
if user wants to enter his USERNAME through virtual keyboard then he needs to click the checkbox to enable the virtual keyboard and he can fill USERNAME. when he uncheck the checkbox, virtual keyboard should be disabled , he can enter his PASSWORD through physical keyboard.

scenarios3:
user may enter his USERNAME and PASSWORD through virtual keyboard by clicking on checkbox to enable virtual keyboard.

for both username and password, virtual keyboard keys should be randomized. we are not providing two virtual keyboards(one for username and another for password). we are providing only ONE virtual keyboard to enter his credentials.

very heart full thanks in advance.

@vasanthb9
Copy link
Author

Dear Mottie, could you please provide me solution for the above mentioned issue. this is very urgent requirement. my client is waiting for this enhancement.
i'm waiting for your response like anything.

heart full thatnks in advance.

@Mottie
Copy link
Owner

Mottie commented Aug 14, 2014

I too am under a serious time-crunch situation... I won't be free of it for one more week.

The problem is that each input will show a different scrambled keyboard. So to keep the keyboards the same, I would have to modify the scramble extension. If that isn't a necessary requirement, there are other examples within these issues of using a checkbox to enable/disable a keyboard (was that you I helped with before as well?). Sorry, my time is very limited (5 more days...)

@vasanthb9
Copy link
Author

Dear Mottie,
Physical keyboard Tab button is not working on non-virtual keyboard and virtual keyboard input fields.
could you please provide me any solution for this problem.

thanks in advance.

@Mottie
Copy link
Owner

Mottie commented Aug 21, 2014

Using the tab key within an input allows tabbing to the next input in the form. So when the virtual keyboard is open, this ability is disabled by default because if the usePreview option is set as true, there is an additional input on the page which messes up the tab indexing order.

If you want to allow tabbing between inputs, then set the tabNavigation option to true.

@vasanthb9
Copy link
Author

Dear Mottie, Thank you very much for your response.

if i set usePreview= true with tabNavigation=true, then only tab is working fine. but in requirement we don't want usePreview=true. so for this i made it as usePreview=false and tabNavigation=true. but tab button is not working properly. in this case if i tab out then focus is coming on to next input field. please help me how to fix this tab issue.

below is the complete code.
in login.jsp

<div id="passwordDivWrap">
  <input type="text" name="userName" id="userName" onfocus="changes('username');"/>
  <input type="password" name="userPassword" id="password" onfocus="changes('password');"/>

</div>
<div id="checkBoxDiv">Click here to use virtual keyboard for the userName and password (Recommended)
    <input type="checkbox" name="keyboardCHK" id="keyboardCHKboxID" />
</div>
<div id="keyBoardDiv" style="display:none"><!--here i'm displaying the Virtual Keyboard for  keyboardForUserName --></div>
<div id="keyBoardDiv1" style="display:none"> <!--here i'm displaying the Virtual Keyboard for  keyboardForPassword--></div>

<div id="keyBoardDiv2"> <!--here i'm displaying the Virtual Keyboard for keyboardForDefault-->/div>

Script:

    $(document).ready(function() {
       keyboardForDefault();
       keyboardForUserName();
       keyboardForPassword();
    });
    function changes(property){
        if($('#keyboardCHKboxID').is(':checked')){
           if(property == 'username'){
            keyboardForUserName();
              $('#keyBoardDiv').show();
              $('#keyBoardDiv1').hide();
              $('#keyBoardDiv2').hide();
       }else if(property == 'password'){
             keyboardForPassword();
               $('#keyBoardDiv').hide();
               $('#keyBoardDiv2').show();
               $('#keyBoardDiv1').hide();
            }
       }
     }

   function keyboardForUserName() {
       $('#username')
       // apply keyboard
       .keyboard({
           layout: 'custom',
           customLayout: {
               'default': [
                   '` 1 2 3 4 5 6 7 8 9 0 - = ',
                   'q w e r t y u i o p [ ] \\',
                   'a s d f g h j k l ; \' {clear}',
                   '{shift} z x c v b n m , . / {bksp}'],
                   'shift': [
                   '~ ! @ # $ % ^ & * ( ) _ + ',
                   'Q W E R T Y U I O P { } |',
                       'A S D F G H J K L : " {clear}',
                   '{shift} Z X C V B N M < > ? {bksp}']
           },
           display: {
               // this needs to be set otherwise the scramble
               // extension thinks the "C" is another letter 
               // to scramble
               'clear' : '\clear'
           },
           // keyboard always visible
           alwaysOpen: true,
           // disable position utility
           position: '',
           // use original input only
           usePreview: false,
           // add keyboard to desired div
           tabNavigation: true,
           appendTo: '#keyBoardDiv',
        // give the preview initial focus when the keyboard becomes visible
        initialFocus : false,
           // initialize scramble
           initialized: function (e, keyboard, el) {
               setTimeout(function () {
                   keyboard.$keyboard = keyboard.scramble_setup(keyboard.$keyboard);
                   $('.ui-keyboard-button').prop('disabled', true);
                  }, 0);
           }
       })
       .addScramble({
           targetKeys: /[a-z\d]/i, // keys to randomize
           byRow: true, // randomize by row, otherwise randomize all keys
           randomizeOnce: false // if false, randomize every time the keyboard opens
       });

       $('#keyboardCHKboxID').change(function () {
           // enable/disable input & keyboard
           $('.ui-keyboard-button').prop('disabled', !this.checked);
         });

   }

   function keyboardForPassword() {
       $('#password')
       // apply keyboard
       .keyboard({
           layout: 'custom',
           customLayout: {
               'default': [
                   '` 1 2 3 4 5 6 7 8 9 0 - = ',
                   'q w e r t y u i o p [ ] \\',
                   'a s d f g h j k l ; \' {clear}',
                   '{shift} z x c v b n m , . / {bskp}'],
                   'shift': [
                   '~ ! @ # $ % ^ & * ( ) _ + ',
                   'Q W E R T Y U I O P { } |',
                       'A S D F G H J K L : " {clear}',
                   '{shift} Z X C V B N M < > ? {bksp}']
           },
           display: {
               // this needs to be set otherwise the scramble
               // extension thinks the "C" is another letter 
               // to scramble
               'clear' : '\clear'
           },
           // keyboard always visible
           alwaysOpen: true,
           // disable position utility
           position: '',
           // use original input only
           usePreview: false,
           tabNavigation: true,
           // add keyboard to desired div
           appendTo: '#keyBoardDiv1',
        // give the preview initial focus when the keyboard becomes visible
        initialFocus : false,
           // initialize scramble
           initialized: function (e, keyboard, el) {
               setTimeout(function () {
                   keyboard.$keyboard = keyboard.scramble_setup(keyboard.$keyboard);
                   $('.ui-keyboard-button').prop('disabled', true);
                }, 0);
           }
       })
       .addScramble({
           targetKeys: /[a-z\d]/i, // keys to randomize
           byRow: true, // randomize by row, otherwise randomize all keys
           randomizeOnce: false // if false, randomize every time the keyboard opens
       });

       $('#keyboardCHKboxID').change(function () {
           // enable/disable input & keyboard
           $('.ui-keyboard-button').prop('disabled', !this.checked);
        });

   }

   function keyboardForDefault() {
      $('#password')
       // apply keyboard
       .keyboard({
           layout: 'custom',
           customLayout: {
               'default': [
                   '` 1 2 3 4 5 6 7 8 9 0 - = ',
                   'q w e r t y u i o p [ ] \\',
                   'a s d f g h j k l ; \' {clear}',
                   '{shift} z x c v b n m , . / {bksp}'],
                   'shift': [
                   '~ ! @ # $ % ^ & * ( ) _ + ',
                   'Q W E R T Y U I O P { } |',
                       'A S D F G H J K L : " {clear}',
                   '{shift} Z X C V B N M < > ? {bksp}']
           },
           display: {
               // this needs to be set otherwise the scramble
               // extension thinks the "C" is another letter 
               // to scramble
               'clear' : '\clear'
           },
           // keyboard always visible
           alwaysOpen: true,
           // disable position utility
           position: '',
           // use original input only
           usePreview: false,
           tabNavigation: true,
           // add keyboard to desired div
           appendTo: '#keyBoardDiv2',
        // give the preview initial focus when the keyboard becomes visible
          initialFocus : false,
           // initialize scramble
           initialized: function (e, keyboard, el) {
               setTimeout(function () {
                   keyboard.$keyboard = keyboard.scramble_setup(keyboard.$keyboard);
                   $('.ui-keyboard-button').prop('disabled', true);
                   }, 0);
           }
       })
       .addScramble({
           targetKeys: /[a-z\d]/i, // keys to randomize
           byRow: true, // randomize by row, otherwise randomize all keys
           randomizeOnce: false // if false, randomize every time the keyboard opens
       });

       $('#keyboardCHKboxID').change(function () {
           // enable/disable input & keyboard
           $('.ui-keyboard-button').prop('disabled', !this.checked);
       });

   }

please find the my application Login page screenshot.
user login page

@vasanthb9
Copy link
Author

Dear Mottie,

I downloaded jquery.keyboard.min.js from you and using this as for virtual keyboard. but js file is having lot of errors like
Multiple markers at this line
- Missing semicolon
- Syntax error on token ")",
invalid Label
- Missing semicolon
- Syntax error on token "Invalid
Regular Expression Options", no accurate
correction available
- The left-hand side of an
assignment must be a variable
I am not able to fix it. would you please solve the issue. please help me .
below is the complete code in jquery.keyboard.min.js

/!
jQuery UI Virtual Keyboard
Version 1.18.8 minified (MIT License)
Caret code modified from jquery.caret.1.02.js (MIT License)
*/
;(function(e){e.keyboard=function(b,m){var a=this,d;a.$el=e(b);a.el=b;a.$el.data("keyboard",a);a.init=function(){a.options=d=e.extend(!0,{},e.keyboard.defaultOptions,m);a.shiftActive=a.altActive=a.metaActive=a.sets=a.capsLock=!1;a.lastKeyset=[!1,!1,!1];a.rows=["","-shift","-alt","-alt-shift"];e('\x3c!--[if lte IE 8]><script>jQuery("body").addClass("oldie");\x3c/script><![endif]--\x3e\x3c!--[if IE]><script>jQuery("body").addClass("ie");\x3c/script><![endif]--\x3e').appendTo("body").remove();a.msie= e("body").hasClass("oldie");a.allie=e("body").hasClass("ie");a.inPlaceholder=a.$el.attr("placeholder")||"";a.watermark="undefined"!==typeof document.createElement("input").placeholder&&""!==a.inPlaceholder;a.regex=e.keyboard.comboRegex;a.decimal=/^./.test(d.display.dec)?!0:!1;a.repeatTime=1E3/(d.repeatRate||20);d.preventDoubleEventTime=d.preventDoubleEventTime||100;a.isOpen=!1;a.wheel=e.isFunction(e.fn.mousewheel);a.alwaysAllowed=[20,33,34,35,36,37,38,39,40,45,46];a.$keyboard=[];a.temp=e('').appendTo("body").caret(3, 3);a.checkCaret=d.lockInput||3!==a.temp.hide().show().caret().start?!0:!1;a.temp.remove();a.lastCaret={start:0,end:0};a.temp=["",0,0];e.each("initialized beforeVisible visible hidden canceled accepted beforeClose".split(" "),function(h,c){e.isFunction(d[c])&&a.$el.bind(c+".keyboard",d[c])});d.alwaysOpen&&(d.stayOpen=!0);e(document).bind(["mousedown","keyup","touchstart","checkkeyboard",""].join(".keyboard "),function(d){a.opening||(a.escClose(d),d.target&&e(d.target).hasClass("ui-keyboard-input")&& (d=e(d.target).data("keyboard"),d===a&&d.options.openOn&&d.focusOn()))});a.$el.addClass("ui-keyboard-input "+d.css.input).attr({"aria-haspopup":"true",role:"textbox"});(a.$el.is(":disabled")||a.$el.attr("readonly")&&!a.$el.hasClass("ui-keyboard-lockedinput"))&&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.setCurrent=function(){e(".ui-keyboard-has-focus").removeClass("ui-keyboard-has-focus");e(".ui-keyboard-input-current").removeClass("ui-keyboard-input-current");a.$el.addClass("ui-keyboard-input-current");a.$keyboard.addClass("ui-keyboard-has-focus");a.isCurrent(!0);a.isOpen=!0};a.isCurrent=function(d){var c=e.keyboard.currentKeyboard||!1;d?c=e.keyboard.currentKeyboard=a.el:!1===d&&c===a.el&&(c=e.keyboard.currentKeyboard=""); return c===a.el};a.isVisible=function(){return a.$keyboard.length?a.$keyboard.is(":visible"):!1};a.focusOn=function(){a.$el.is(":visible")&&setTimeout(function(){a.lastCaret=a.$el.caret()},20);a.isVisible()||(clearTimeout(a.timer),a.reveal());d.alwaysOpen&&a.setCurrent()};a.reveal=function(){a.opening=!0;e(".ui-keyboard").not(".ui-keyboard-always-open").remove();if(a.$el.is(":disabled")||a.$el.attr("readonly")&&!a.$el.hasClass("ui-keyboard-lockedinput"))a.$el.addClass("ui-keyboard-nokeyboard");else{a.$el.removeClass("ui-keyboard-nokeyboard"); d.openOn&&a.$el.unbind(d.openOn+".keyboard");a.$keyboard.length&&!e.contains(document.body,a.$keyboard[0])||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);d.acceptValid&&a.checkValid();var h;a.position=d.position;a.position.of=a.position.of||a.$el.data("keyboardPosition")||a.$el;a.position.collision=a.position.collision||"fit fit";d.resetDefault&&(a.shiftActive=a.altActive= a.metaActive=!1,a.showKeySet());d.appendLocally||"body"!==d.appendTo||a.$keyboard.css({position:"absolute",left:0,top:0});a.$el.trigger("beforeVisible.keyboard",[a,a.el]);a.setCurrent();a.$keyboard.show();d.usePreview&&a.msie&&("undefined"===typeof a.width&&(a.$preview.hide(),a.width=Math.ceil(a.$keyboard.width()),a.$preview.show()),a.$preview.width(a.width));e.ui&&e.ui.position&&a.$keyboard.position(a.position);a.checkDecimal();a.lineHeight=parseInt(a.$preview.css("lineHeight"),10)||parseInt(a.$preview.css("font-size"), 10)+4;d.caretToEnd&&(h=a.originalContent.length,a.lastCaret={start:h,end:h});a.allie&&(h=a.lastCaret.start||a.originalContent.length,h={start:h,end:h},a.lastCaret||(a.lastCaret=h),0===a.lastCaret.end&&0<a.lastCaret.start&&(a.lastCaret.end=a.lastCaret.start),0>a.lastCaret.start&&(a.lastCaret=h));setTimeout(function(){a.opening=!1;d.initialFocus&&a.$preview.focus().caret(a.lastCaret);a.$el.trigger("visible.keyboard",[a,a.el])},10);return a}};a.startup=function(){a.$keyboard.length||("custom"===d.layout&& (d.layoutHash="custom"+a.customHash()),a.layout="custom"===d.layout?d.layoutHash:d.layout,"undefined"===typeof e.keyboard.builtLayouts[a.layout]&&(e.isFunction(d.create)&&d.create(a),a.$keyboard.length||a.buildKeyboard()),a.$keyboard=e.keyboard.builtLayouts[a.layout].$keyboard.clone(),d.usePreview?(a.$preview=a.$el.clone(!1).removeAttr("id").removeClass("ui-keyboard-placeholder ui-keyboard-input").addClass("ui-keyboard-preview "+d.css.input).attr("tabindex","-1").show(),e("

").addClass("ui-keyboard-preview-wrapper").append(a.$preview).prependTo(a.$keyboard)): (a.$preview=a.$el,d.position.at=d.position.at2));a.preview=a.$preview[0];a.$decBtn=a.$keyboard.find(".ui-keyboard-dec");(d.enterNavigation||"TEXTAREA"===a.el.tagName)&&a.alwaysAllowed.push(13);d.lockInput&&a.$preview.addClass("ui-keyboard-lockedinput").attr({readonly:"readonly"});a.bindKeyboard();a.$keyboard.appendTo(d.appendLocally?a.$el.parent():d.appendTo||"body");a.bindKeys();e.ui&&e.ui.position&&e(window).bind("resize.keyboard",function(){a.isVisible()&&a.$keyboard.position(a.position)})};a.bindKeyboard= function(){var h=e.keyboard.builtLayouts[a.layout];a.$preview.unbind("keypress keyup keydown mouseup touchend ".split(" ").join(".keyboard ")).bind("keypress.keyboard",function(c){var g=a.lastKey=String.fromCharCode(c.charCode||c.which);a.$lastKey=[];a.checkCaret&&(a.lastCaret=a.$preview.caret());a.capsLock=65<=g&&90>=g&&!c.shiftKey||97<=g&&122>=g&&c.shiftKey?!0:!1;if(d.restrictInput){if((8===c.which||0===c.which)&&e.inArray(c.keyCode,a.alwaysAllowed))return;-1===e.inArray(g,h.acceptedKeys)&&c.preventDefault()}else if((c.ctrlKey|| c.metaKey)&&(97===c.which||99===c.which||118===c.which||120<=c.which&&122>=c.which))return;h.hasMappedKeys&&h.mappedKeys.hasOwnProperty(g)&&(a.lastKey=h.mappedKeys[g],a.insertText(a.lastKey),c.preventDefault());a.checkMaxLength()}).bind("keyup.keyboard",function(c){switch(c.which){case 9:if(a.tab&&d.tabNavigation&&!d.lockInput){if(a.shiftActive=c.shiftKey,c=e.keyboard.keyaction.tab(a),a.tab=!1,!c)return!1}else c.preventDefault();break;case 27:return a.close(),!1}clearTimeout(a.throttled);a.throttled= setTimeout(function(){a.isVisible()&&a.checkCombos()},100);a.checkMaxLength();e.isFunction(d.change)&&d.change(e.Event("change"),a,a.el);a.$el.trigger("change.keyboard",[a,a.el])}).bind("keydown.keyboard",function(c){switch(c.which){case 8:e.keyboard.keyaction.backspace(a,null,c);c.preventDefault();break;case 9:return a.tab=!0,!1;case 13:e.keyboard.keyaction.enter(a,null,c);break;case 20:a.shiftActive=a.capsLock=!a.capsLock;a.showKeySet(this);break;case 86:if(c.ctrlKey||c.metaKey){if(d.preventPaste){c.preventDefault(); break}a.checkCombos()}}}).bind("mouseup.keyboard touchend.keyboard",function(){a.checkCaret&&(a.lastCaret=a.$preview.caret())});a.$keyboard.bind("mousedown.keyboard click.keyboard touchstart.keyboard",function(c){c.stopPropagation();a.isCurrent()||(a.reveal(),e(document).trigger("checkkeyboard.keyboard"))});d.preventPaste&&(a.$preview.bind("contextmenu.keyboard",function(a){a.preventDefault()}),a.$el.bind("contextmenu.keyboard",function(a){a.preventDefault()}))};a.bindKeys=function(){var h=(d.keyBinding+ " repeater mouseenter mouseleave touchstart mousewheel mouseup click ").split(" ").join(".keyboard ")+"mouseleave.kb mousedown.kb touchstart.kb touchend.kb touchmove.kb touchcancel.kb ";a.$allKeys=a.$keyboard.find("button.ui-keyboard-button").unbind(h).bind(d.keyBinding.split(" ").join(".keyboard ")+".keyboard repeater.keyboard",function(c){if(!a.$keyboard.is(":visible"))return!1;var g;g=e(this);var h=g.attr("data-action"),b=(new Date).getTime(),h=":"===h?":":h.split(":")[0];if(!(b-(a.lastEventTime|| 0)<d.preventDoubleEventTime)){a.lastEventTime=b;a.$preview.focus();a.$lastKey=g;a.lastKey=g.attr("data-curtxt");a.checkCaret&&a.$preview.caret(a.lastCaret);h.match("meta")&&(h="meta");if(e.keyboard.keyaction.hasOwnProperty(h)&&e(this).hasClass("ui-keyboard-actionkey")){if(!1===e.keyboard.keyactionh)return!1}else"undefined"!==typeof h&&(g=a.lastKey=a.wheel&&!e(this).hasClass("ui-keyboard-actionkey")?a.lastKey:h,a.insertText(g),a.capsLock||d.stickyShift||c.shiftKey||(a.shiftActive=!1,a.showKeySet(this))); a.$preview.focus().caret(a.lastCaret);a.checkCombos();a.checkMaxLength();e.isFunction(d.change)&&d.change(e.Event("change"),a,a.el);a.$el.trigger("change.keyboard",[a,a.el]);c.preventDefault()}}).bind("mouseenter.keyboard mouseleave.keyboard touchstart.keyboard",function(c){if(a.isCurrent()){var h=e(this),b=h.data("layers")||a.getLayers(h);h.data("layers",b=e.grep(b,function(a,c){return e.inArray(a,b)===c}));"mouseenter"!==c.type&&"touchstart"!==c.type||"password"===a.el.type||h.hasClass(d.css.buttonDisabled)|| h.addClass(d.css.buttonHover).attr("title",function(h,e){return a.wheel&&""===e&&a.sets&&1<b.length&&"touchstart"!==c.type?d.wheelMessage:e});"mouseleave"===c.type&&(h.data({curtxt:h.data("original"),curnum:0}),h.removeClass("password"===a.el.type?"":d.css.buttonHover).attr("title",function(a,c){return c===d.wheelMessage?"":c}).find("span").html(h.data("original")))}}).bind("mousewheel.keyboard",function(c,d){if(a.wheel){var h,b,f=e(this);b=f.data("layers")||a.getLayers(f);1<b.length?(h=f.data("curnum")+ (0<d)?-1:1,h>b.length-1&&(h=0),0>h&&(h=b.length-1)):h=0;f.data({curnum:h,layers:b,curtxt:b[h]});f.find("span").html(b[h]);return!1}}).bind("mouseup.keyboard mouseleave.kb touchend.kb touchmove.kb touchcancel.kb",function(c){/(mouseleave|touchend|touchcancel)/.test(c.type)?e(this).removeClass(d.css.buttonHover):(a.isVisible()&&a.isCurrent()&&a.$preview.focus(),a.checkCaret&&a.$preview.caret(a.lastCaret));a.mouseRepeat=[!1,""];clearTimeout(a.repeater);return!1}).bind("click.keyboard",function(){return!1}).not(".ui-keyboard-actionkey").add(".ui-keyboard-tab, .ui-keyboard-backspace, .ui-keyboard-space, .ui-keyboard-enter", a.$keyboard).bind("mousedown.kb touchstart.kb",function(){if(0!==d.repeatRate){var c=e(this);a.mouseRepeat=[!0,c];setTimeout(function(){a.mouseRepeat[0]&&a.mouseRepeat[1]===c&&a.repeatKey(c)},d.repeatDelay)}return!1})};a.insertText=function(d){var c,b;b=a.$preview.val();var e=a.$preview.caret(),k=a.$preview.scrollLeft();c=a.$preview.scrollTop();var f=b.length;e.end<e.start&&(e.end=e.start);e.start>f&&(e.end=e.start=f);"TEXTAREA"===a.preview.tagName&&(a.msie&&"\n"===b.substr(e.start,1)&&(e.start+= 1,e.end+=1),b=b.split("\n").length-1,a.preview.scrollTop=0<b?a.lineHeight_b:c);c="backspace"===d&&e.start===e.end?!0:!1;d="backspace"===d?"":d;b=e.start+(c?-1:d.length);k+=parseInt(a.$preview.css("fontSize"),10)("backspace"===d?-1:1);a.$preview.val(a.$preview.val().substr(0,e.start-(c?1:0))+d+a.$preview.val().substr(e.end)).caret(b,b).scrollLeft(k);a.lastCaret={start:b,end:b}};a.checkMaxLength=function(){var h,c=a.$preview.val();!1!==d.maxLength&&c.length>d.maxLength&&(h=Math.min(a.$preview.caret().start,d.maxLength), a.$preview.val(c.substring(0,d.maxLength)),a.$preview.caret(h,h),a.lastCaret={start:h,end:h});a.$decBtn.length&&a.checkDecimal()};a.repeatKey=function(d){d.trigger("repeater.keyboard");a.mouseRepeat[0]&&(a.repeater=setTimeout(function(){a.repeatKey(d)},a.repeatTime))};a.showKeySet=function(b){var c="",e=(a.shiftActive?1:0)+(a.altActive?2:0);a.shiftActive||(a.capsLock=!1);if(a.metaActive){if(c=b&&b.name&&/meta/.test(b.name)?b.name:"",""===c?c=!0===a.metaActive?"":a.metaActive:a.metaActive=c,!d.stickyShift&& a.lastKeyset[2]!==a.metaActive||(a.shiftActive||a.altActive)&&!a.$keyboard.find(".ui-keyboard-keyset-"+c+a.rows[e]).length)a.shiftActive=a.altActive=!1}else!d.stickyShift&&a.lastKeyset[2]!==a.metaActive&&a.shiftActive&&(a.shiftActive=a.altActive=!1);e=(a.shiftActive?1:0)+(a.altActive?2:0);c=0!==e||a.metaActive?""===c?"":"-"+c:"-default";a.$keyboard.find(".ui-keyboard-keyset"+c+a.rows[e]).length?(a.$keyboard.find(".ui-keyboard-alt, .ui-keyboard-shift, .ui-keyboard-actionkey[class_=meta]").removeClass(d.css.buttonAction).end().find(".ui-keyboard-alt")a.altActive? "addClass":"removeClass".end().find(".ui-keyboard-shift")a.shiftActive?"addClass":"removeClass".end().find(".ui-keyboard-lock")a.capsLock?"addClass":"removeClass".end().find(".ui-keyboard-keyset").hide().end().find(".ui-keyboard-keyset"+c+a.rows[e]).show().end().find(".ui-keyboard-actionkey.ui-keyboard"+c).addClass(d.css.buttonAction),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(){if(!a.isVisible())return a.$preview.val();var b,c,g,l,k=a.$preview.val(),f=a.$preview.caret(),m=e.keyboard.builtLayouts[a.layout],p=k.length;f.end<f.start&&(f.end=f.start);f.start>p&&(f.end=f.start=p);a.msie&&"\n"===k.substr(f.start,1)&&(f.start+=1,f.end+=1);d.useCombos&&(a.msie?k=k.replace(a.regex,function(a,c,b){return d.combos.hasOwnProperty(c)?d.combos[c][b]||a:a}):a.$preview.length&&(g=f.start-(0<=f.start-2?2:0),a.$preview.caret(g,f.end), l=(a.$preview.caret().text||"").replace(a.regex,function(a,c,b){return d.combos.hasOwnProperty(c)?d.combos[c][b]||a:a}),a.$preview.val(a.$preview.caret().replace(l)),k=a.$preview.val()));if(d.restrictInput&&""!==k){g=k;c=m.acceptedKeys.length;for(b=0;b<c;b++)""!==g&&(l=m.acceptedKeys[b],0<=k.indexOf(l)&&(/[[|]|\|^|$|.|||?|*|+|(|)|{|}]/g.test(l)&&(l="\"+l),g=g.replace(new RegExp(l,"g"),"")));""!==g&&(k=k.replace(g,""))}f.start+=k.length-p;f.end+=k.length-p;a.$preview.val(k);a.$preview.caret(f.start, f.end);a.preview.scrollTop=a.lineHeight*(k.substring(0,f.start).split("\n").length-1);a.lastCaret={start:f.start,end:f.end};d.acceptValid&&a.checkValid();return k};a.checkValid=function(){var b=!0;d.validate&&"function"===typeof d.validate&&(b=d.validate(a,a.$preview.val(),!1));a.$keyboard.find(".ui-keyboard-accept")b?"removeClass":"addClass"b?"addClass":"removeClass"};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(d.css.buttonDefault+" "+d.css.buttonHover).addClass(d.css.buttonDisabled):a.$decBtn.removeAttr("disabled").attr({"aria-disabled":"false"}).addClass(d.css.buttonDefault).removeClass(d.css.buttonDisabled)};a.getLayers=function(a){var c;c=a.attr("data-pos");return a.closest(".ui-keyboard").find('button[data-pos="'+c+'"]').map(function(){return e(this).find("> span").html()}).get()};a.switchInput=function(b, c){if("function"===typeof d.switchInput)d.switchInput(a,b,c);else{a.$keyboard.hide();var g;g=!1;var l=e("button, input, textarea, a").filter(":visible"),k=l.index(a.$el)+(b?1:-1);a.$keyboard.show();k>l.length-1&&(g=d.stopAtEnd,k=0);0>k&&(g=d.stopAtEnd,k=l.length-1);if(!g){c=a.close(c);if(!c)return;(g=l.eq(k).data("keyboard"))&&g.options.openOn.length?g.focusOn():l.eq(k).focus()}}return!1};a.close=function(b){if(a.isOpen){clearTimeout(a.throttled);var c=b?a.checkCombos():a.originalContent;if(b&&d.validate&& "function"===typeof d.validate&&!d.validate(a,c,!0)&&(c=a.originalContent,b=!1,d.cancelClose))return;a.isCurrent(!1);a.isOpen=!1;a.$el.removeClass("ui-keyboard-input-current ui-keyboard-autoaccepted").addClass(b?!0===b?"":"ui-keyboard-autoaccepted":"").trigger(d.alwaysOpen?"":"beforeClose.keyboard",[a,a.el,b||!1]).val(c).scrollTop(a.el.scrollHeight).trigger(b?"accepted.keyboard":"canceled.keyboard",[a,a.el]).trigger(d.alwaysOpen?"inactive.keyboard":"hidden.keyboard",[a,a.el]).blur();a.$preview.val(c); d.openOn&&(a.timer=setTimeout(function(){a.$el.bind(d.openOn+".keyboard",function(){a.focusOn()});e(":focus")[0]===a.el&&a.$el.blur()},500));!d.alwaysOpen&&a.$keyboard&&(a.$keyboard.remove(),a.$keyboard=[]);a.watermark||""!==a.el.value||""===a.inPlaceholder||a.$el.addClass("ui-keyboard-placeholder").val(a.inPlaceholder);a.$el.trigger("change")}return!!b};a.accept=function(){return a.close(!0)};a.escClose=function(b){if(b&&"keyup"===b.type)return 27===b.which?a.close():"";a.isOpen&&(!a.isCurrent()&& a.isOpen||a.isOpen&&b.target!==a.el&&!d.stayOpen)&&(a.allie&&b.preventDefault(),a.close(d.autoAccept?"true":!1))};a.keyBtn=e("").attr({role:"button",type:"button","aria-disabled":"false",tabindex:"-1"}).addClass("ui-keyboard-button");a.addKey=function(b,c,g){var l,k,f;c=!0===g?b:d.display[c]||b;var m=!0===g?b.charCodeAt(0):b;/(.+)/.test(c)&&(k=c.replace(/(([^()]+))/,""),l=c.match(/(([^()]+))/)[1],c=k,f=k.split(":"),k=""!==f[0]&&1<f.length?f[0]:k,e.keyboard.builtLayouts[a.layout].mappedKeys[l]= k);f=c.split(":");""===f[0]&&""===f[1]&&(c=":");c=""!==f[0]&&1<f.length?e.trim(f[0]):c;l=1<f.length?e.trim(f[1]).replace(/_/g," ")||"":"";k=1<c.length?" ui-keyboard-widekey":"";k+=g?"":" ui-keyboard-actionkey";return a.keyBtn.clone().attr({"data-value":c,name:m,"data-pos":a.temp[1]+","+a.temp[2],title:l,"data-action":b,"data-original":c,"data-curtxt":c,"data-curnum":0}).addClass((""===m?"":"ui-keyboard-"+m+k+" ")+d.css.buttonDefault).html(""+c+"").appendTo(a.temp[0])};a.customHash=function(){var a, c,b;c=d.customLayout;b=[];var e=[];for(a in c)c.hasOwnProperty(a)&&b.push(c[a]);e=e.concat.apply(e,b).join(" ");if(Array.prototype.reduce)return e.split("").reduce(function(a,c){a=(a<<5)-a+c.charCodeAt(0);return a&a},0);c=0;if(0===e.length)return c;for(a=0;a<e.length;a++)b=e.charCodeAt(a),c=(c<<5)-c+b,c&=c;return c};a.buildKeyboard=function(){var b,c,g,m,k,f,n,p,q,t=0,r=e.keyboard.builtLayouts[a.layout]={mappedKeys:{},acceptedKeys:[]},s=r.acceptedKeys=[],u=e("
").addClass("ui-keyboard "+d.css.container+ (d.alwaysOpen?" ui-keyboard-always-open":"")).attr({role:"textbox"}).hide();"custom"!==d.layout&&e.keyboard.layouts.hasOwnProperty(d.layout)||(d.layout="custom",e.keyboard.layouts.custom=d.customLayout||{"default":["{cancel}"]});e.each(e.keyboard.layouts[d.layout],function(r,v){if(""!==r)for(t++,m=e("
").attr("name",r).addClass("ui-keyboard-keyset ui-keyboard-keyset-"+r).appendTo(u)"default"===r?"show":"hide",g=0;g<v.length;g++){f=e.trim(v[g]).replace(/{(.?)[\s+]?:[\s+]?(.?)}/g,"{$1:$2}"); p=f.split(/\s+/);for(n=0;n<p.length;n++)if(a.temp=[m,g,n],k=!1,0!==p[n].length)if(/^{\S+}$/.test(p[n]))if(c=p[n].match(/^{(\S+)}$/)[1].toLowerCase(),/!!/.test(c)&&(c=c.replace("!!",""),k=!0),/^sp:((\d+)?([.|,]\d+)?)(em|px)?$/.test(c)&&(q=parseFloat(c.replace(/,/,".").match(/^sp:((\d+)?([.|,]\d+)?)(em|px)?$/)[1]||0),e(" ").width(c.match("px")?q+"px":2_q+"em").addClass("ui-keyboard-button ui-keyboard-spacer").appendTo(m)),/^empty(:((\d+)?([.|,]\d+)?)(em|px)?)?$/.test(c)&& (q=/:/.test(c)?parseFloat(c.replace(/,/,".").match(/^empty:((\d+)?([.|,]\d+)?)(em|px)?$/)[1]||0):"",a.addKey(""," ").addClass(d.css.buttonDisabled+" "+d.css.buttonEmpty).attr("aria-disabled",!0).width(q?c.match("px")?q+"px":2_q+"em":"")),/^meta\d+:?(\w+)?/.test(c))a.addKey(c,c);else switch(c){case "a":case "accept":a.addKey("accept",c).addClass(d.css.buttonAction);break;case "alt":case "altgr":a.addKey("alt","alt");break;case "b":case "backspace":a.addKey("backspace",c);break;case "c":case "cancel":a.addKey("cancel", c).addClass(d.css.buttonAction);break;case "combo":a.addKey("combo","combo").addClass(d.css.buttonAction);break;case "dec":s.push(a.decimal?".":",");a.addKey("dec","dec");break;case "e":case "enter":a.addKey("enter",c).addClass(d.css.buttonAction);break;case "s":case "shift":a.addKey("shift",c);break;case "sign":s.push("-");a.addKey("sign","sign");break;case "space":s.push(" ");a.addKey("space","space");break;case "t":case "tab":a.addKey("tab",c);break;default:if(e.keyboard.keyaction.hasOwnProperty(c))a.addKey(c, c)k?"addClass":"removeClass"}else b=p[n],s.push(":"===b?b:b.split(":")[0]),a.addKey(b,b,!0);m.find(".ui-keyboard-button:last").after('
')}});1<t&&(a.sets=!0);r.hasMappedKeys=!e.isEmptyObject(r.mappedKeys);return r.$keyboard=u};a.destroy=function(){e(document).unbind("mousedown.keyboard keyup.keyboard touchstart.keyboard");a.$keyboard.length&&a.$keyboard.remove();var b=e.trim(d.openOn+" accepted beforeClose canceled change contextmenu hidden initialized keydown keypress keyup visible ").split(" ").join(".keyboard "); a.$el.removeClass("ui-keyboard-input ui-keyboard-lockedinput ui-keyboard-placeholder ui-keyboard-notallowed ui-keyboard-always-open "+d.css.input).removeAttr("aria-haspopup").removeAttr("role").unbind(b+".keyboard").removeData("keyboard")};a.init()};e.keyboard.keyaction={accept:function(b){b.close(!0);return!1},alt:function(b,e){b.altActive=!b.altActive;b.showKeySet(e)},backspace:function(b){b.insertText("backspace")},cancel:function(b){b.close();return!1},clear:function(b){b.$preview.val("")},combo:function(b){var e= !b.options.useCombos;b.options.useCombos=e;b.$keyboard.find(".ui-keyboard-combo").toggleClass(b.options.css.buttonAction,e);e&&b.checkCombos();return!1},dec:function(b){b.insertText(b.decimal?".":",")},"default":function(b,e){b.shiftActive=b.altActive=b.metaActive=!1;b.showKeySet(e)},enter:function(b,m,a){m=b.el.tagName;var d=b.options;if(a.shiftKey)return d.enterNavigation?b.switchInput(!a[d.enterMod],!0):b.close(!0);if(d.enterNavigation&&("TEXTAREA"!==m||a[d.enterMod]))return b.switchInput(!a[d.enterMod], d.autoAccept?"true":!1);"TEXTAREA"===m&&e(a.target).closest("button").length&&b.insertText(" \n")},lock:function(b,e){b.lastKeyset[0]=b.shiftActive=b.capsLock=!b.capsLock;b.showKeySet(e)},left:function(b){var e=b.$preview.caret();0<=e.start-1&&(b.lastCaret={start:e.start-1,end:e.start-1})},meta:function(b,m){b.metaActive=e(m).hasClass(b.options.css.buttonAction)?!1:!0;b.showKeySet(m)},next:function(b){b.switchInput(!0,b.options.autoAccept);return!1},prev:function(b){b.switchInput(!1,b.options.autoAccept); return!1},right:function(b){var e=b.$preview.caret();e.start+1<=b.$preview.val().length&&(b.lastCaret={start:e.start+1,end:e.start+1})},shift:function(b,e){b.lastKeyset[0]=b.shiftActive=!b.shiftActive;b.showKeySet(e)},sign:function(b){/^-?\d*.?\d*$/.test(b.$preview.val())&&b.$preview.val(-1*b.$preview.val())},space:function(b){b.insertText(" ")},tab:function(b){var e=b.options;if("INPUT"===b.el.tagName)return e.tabNavigation?b.switchInput(!b.shiftActive,!0):!1;b.insertText("\t")}};e.keyboard.builtLayouts= {};e.keyboard.layouts={alpha:{"default":[" 1 2 3 4 5 6 7 8 9 0 - = {backspace}","{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:["~ ! @ # $ % ^ & * ( ) _ + {backspace}","{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 - = {backspace}","{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:["~ ! @ # $ % ^ & * ( ) _ + {backspace}","{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 - = {backspace}","{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:["~ ! @ # $ % ^ & \* ( ) _ + {backspace}","{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 {backspace}","{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 {backspace}", "{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}"]},colemak:{"default":["1 2 3 4 5 6 7 8 9 0 - = {backspace}","{tab} q w f p g j l u y ; [ ] \","{backspace} a r s t d h n e i o ' {enter}","{shift} z x c v b k m , . / {shift}","{accept} {space} {cancel}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {backspace}", "{tab} Q W F P G J L U Y : { } |",'{backspace} A R S T D H N E I O " {enter}',"{shift} Z X C V B K M < > ? {shift}","{accept} {space} {cancel}"]},dvorak:{"default":[" 1 2 3 4 5 6 7 8 9 0 [ ] {backspace}","{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:["~ ! @ # $ % ^ & \* ( ) { } {backspace}",'{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(";")}};e.keyboard.defaultOptions={layout:"qwerty",customLayout:null,position:{of:null,my:"center top",at:"center top",at2:"center bottom"},usePreview:!0,alwaysOpen:!1,initialFocus:!0,stayOpen:!1,display:{a:"\u2714:Accept (Shift-Enter)",accept:"Accept:Accept (Shift-Enter)",alt:"Alt:\u2325 AltGr",b:"\u232b:Backspace",backspace:"backspace:Backspace",c:"\u2716:Cancel (Esc)",cancel:"Cancel:Cancel (Esc)",clear:"C:Clear",combo:"\u00f6:Toggle Combo Keys", dec:".:Decimal",e:"\u23ce:Enter",empty:"\u00a0",enter:"Enter:Enter \u23ce",left:"\u2190",lock:"Lock:\u21ea Caps Lock",next:"Next \u21e8",prev:"\u21e6 Prev",right:"\u2192",s:"\u21e7:Shift",shift:"Shift:Shift",sign:"\u00b1:Change Sign",space:"&nbsp;:Space",t:"\u21e5:Tab",tab:"\u21e5 Tab:Tab"},wheelMessage:"Use mousewheel to see other keys",css:{input:"ui-widget-content ui-corner-all",container:"ui-widget-content ui-widget ui-corner-all ui-helper-clearfix",buttonDefault:"ui-state-default ui-corner-all", buttonHover:"ui-state-hover",buttonAction:"ui-state-active",buttonDisabled:"ui-state-disabled",buttonEmpty:"ui-keyboard-empty"},autoAccept:!1,lockInput:!1,restrictInput:!1,acceptValid:!1,cancelClose:!0,tabNavigation:!1,enterNavigation:!1,enterMod:"altKey",stopAtEnd:!0,appendLocally:!1,appendTo:"body",stickyShift:!0,preventPaste:!1,caretToEnd:!1,maxLength:!1,repeatDelay:500,repeatRate:20,resetDefault:!1,openOn:"focus",keyBinding:"mousedown touchstart",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"},'"':{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"}},validate:function(b,e,a){return!0}};e.keyboard.comboRegex=/([`'^"ao])([a-z])/mig;e.keyboard.currentKeyboard="";e.fn.keyboard=function(b){return this.each(function(){e(this).data("keyboard")||new e.keyboard(this,b)})};e.fn.getkeyboard=function(){return this.data("keyboard")}})(jQuery);

(function(e,b,m,a){e.fn.caret=function(d,e){if("undefined"===typeof this[0]||this.is(":hidden")||"hidden"===this.css("visibility"))return this;var c,g,l,k,f;f=document.selection;var n=this[0],p=n.scrollTop,q="undefined"!==typeof n.selectionStart;"object"===typeof d&&d.start&&d.end?(g=d.start,k=d.end):"number"===typeof d&&"number"===typeof e&&(g=d,k=e);if("undefined"!==typeof g)return q?(n.selectionStart=g,n.selectionEnd=k):(f=n.createTextRange(),f.collapse(!0),f.moveStart("character",g),f.moveEnd("character", k-g),f.select()),(this.is(":visible")||"hidden"!==this.css("visibility"))&&this.focus(),n.scrollTop=p,this;q?(c=n.selectionStart,l=n.selectionEnd):"TEXTAREA"===n.tagName?(k=this.val(),g=fm,f=ga,f.moveToElementText(n),f.setEndPoint("EndToEnd",g),c=f.text.replace(/\r/g,"\n")[b],l=c+g.text.replace(/\r/g,"\n")[b]):(k=this.val().replace(/\r/g,"\n"),g=fma,g.moveEnd("character",k[b]),c=""===g.text?k[b]:k.lastIndexOf(g.text),g=fma,g.moveStart("character",-k[b]),l=g.text[b]);f=(n.value|| "").substring(c,l);return{start:c,end:l,text:f,replace:function(a){return n.value.substring(0,c)+a+n.value.substring(l,n.value[b])}}}})(jQuery,"length","createRange","duplicate");

awaiting for your repsonse like anything.
thanks in advance.
Vasanth.

@Mottie
Copy link
Owner

Mottie commented Nov 20, 2014

Oh wow, sorry about that! I'll get it fixed today.

@Mottie
Copy link
Owner

Mottie commented Nov 20, 2014

All fixed!

@vasanthb9
Copy link
Author

Dear Mottie,
is it possible to use the one virtual keyboard to two input fields like for User name and for Password.
based on the input field focus keyboard should work. please suggest me any solution for this same.
please find the screenshot , it is my application login page.
loginpage

thank you very much in Advance,
vasanth.

@Mottie
Copy link
Owner

Mottie commented Nov 25, 2014

Are you saying that you want the "User ID" and "Password" inputs to use the same scrambled keyboard, or am I not understanding your question?

@vasanthb9
Copy link
Author

Dear Mottie,
Thank you for your reply, yes i want to use the same scrambled keyboard for "User ID" and "Password".
how can i use it, please help me .

thanks in advance...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants