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

if there have 2 different custom layouts, the second one won't be built. #494

Merged
merged 1 commit into from
Nov 27, 2016

Conversation

ohohyeah
Copy link
Contributor

I have problem with 2 custom keyboard layouts with scramble , there is the detail. (Issue).

I trace the code that it will create the keyboard in this block in the jquery.keyboard.js

if (typeof $keyboard.builtLayouts[base.layout] === 'undefined') {
    if ($.isFunction(o.create)) {
        // create must call buildKeyboard() function; or create it's own keyboard
        base.$keyboard = o.create(base);
    } else if (!base.$keyboard.length) {
        base.buildKeyboard(base.layout, true);
    }
}

and it will go to the jquery.keyboard.extension-scramble.js to create the scrambled keyboard,
however, the "base.orig_layout" in jquery.keyboard.extension-scramble.js is "custom", not the layout named with scrambledXXXX, so the code woun't enter the block to build keyboard

if ( typeof $.keyboard.builtLayouts[base.orig_layout] === 'undefined' ) {
                    base.layout = opts.layout = base.orig_layout;
                    // build original layout, if not already built, e.g. "qwerty"
                    base.buildKeyboard( base.layout, true );
                    base.layout = opts.layout = layout;
                }

I consider that the check of $.keyboard.builtLayouts[base.orig_layout] should be removed in the "jquery.keyboard.extension-scramble.js", because it will check whether the keyboard layout exists in the " jquery.keyboard.js".
My problem is resolved after remove this, and share for you review.
Thank you!

@Mottie Mottie merged commit f7ba97a into Mottie:master Nov 27, 2016
@Mottie
Copy link
Owner

Mottie commented Nov 27, 2016

Hi @ohohyeah!

Sorry for taking so long to respond! That looks like a great fix, thanks!

@ohohyeah
Copy link
Contributor Author

Thanks, It’s my pleasure to contribute to this awesome project 😊

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

Successfully merging this pull request may close these issues.

2 participants