Skip to content

Commit

Permalink
version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Jun 2, 2014
1 parent 3cfe798 commit bd3436d
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 79 deletions.
27 changes: 10 additions & 17 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ Wiki: [Home](https://github.com/Mottie/Keyboard/wiki/Home) | [FAQ](https://githu

Only the latest changes will be shown below, see the wiki log to view older versions.

### Version 1.18.9 (6/1/2014)

* Change keyboard collison fallback to "flipfit flipfit".
* Caret: prevent errors when input doesn't support caret positioning.
* Fix js error when base.$keyboard is removed.
* Scramble: now applied when keyboard is alwaysOpen. Fixes [issue #276](https://github.com/Mottie/Keyboard/issues/276).
* Ignore position utility if position option is empty.
* Set preview value before triggering accept event.
* Update Mobile extension & demos.

### Version 1.18.8 (5/16/2014)

* Fix position option
Expand All @@ -102,20 +112,3 @@ Only the latest changes will be shown below, see the wiki log to view older vers
top: 0;
}
```

### Version 1.18.6 (3/27/2014)

* Fix Colemak demo; contenteditable not yet supported.
* Check for jQuery UI before checking for position utility. Fixes [issue #263](https://github.com/Mottie/Keyboard/issues/263).
* Colon key now works without mousewheel script. Fixes [issue #264](https://github.com/Mottie/Keyboard/issues/264).

### Version 1.18.5 (3/20/2014)

* Add [Colemak](http://en.wikipedia.org/wiki/Colemak#Colemak) keyboard to the build-in layouts.
* Add `appendTo` option. Fixes [issue #253](https://github.com/Mottie/Keyboard/issues/253).
* Backspace action key function `$.keyboard.keyaction.bksp` is now correctly called. Fixes [issue #261](https://github.com/Mottie/Keyboard/issues/261).
* Add Chinese, Mongolian & Hindi layouts. Thanks to [Sh1n](https://github.com/Sh1n)!

### Version 1.18.4 (3/6/2014)

* Include minified version update...
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "keyboard",
"version": "1.18.8",
"version": "1.18.9",
"main": ["./js/jquery.keyboard.js", "./css/keyboard.css"],
"ignore": [
"**/.*"
Expand Down
115 changes: 71 additions & 44 deletions js/jquery.keyboard.extension-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ $.fn.addAutocomplete = function(){
})(jQuery);

/*
* jQuery UI Virtual Keyboard for jQuery Mobile Themes v1.1 for Keyboard v1.18+ (updated 3/1/2014)
* jQuery UI Virtual Keyboard for jQuery Mobile Themes v1.2 for Keyboard v1.18+ (updated 6/1/2014)
*
* By Rob Garrison (aka Mottie & Fudgey)
* Licensed under the MIT License
Expand Down Expand Up @@ -278,17 +278,19 @@ $.fn.addMobile = function(options){

var o, defaults = {
// keyboard wrapper theme
container : { theme:'a' },
container : { theme:'b', cssClass:'ui-body' },
// keyboard duplicate input
input : { theme:'b', cssClass:'' },
// theme added to all regular buttons
buttonMarkup : { theme:'a', shadow:'true', corners:'true' },
buttonMarkup : { theme:'b', cssClass:'ui-btn', shadow:'true', corners:'true' },
// theme added to all buttons when they are being hovered
buttonHover : { theme:'c' },
buttonHover : { theme:'b', cssClass:'ui-btn-hover' },
// theme added to action buttons (e.g. tab, shift, accept, cancel);
// parameters here will override the settings in the buttonMarkup
buttonAction : { theme:'b' },
buttonAction : { theme:'b', cssClass:'ui-btn-active' },
// theme added to button when it is active (e.g. shift is down)
// All extra parameters will be ignored
buttonActive : { theme:'e' }
buttonActive : { theme:'b', cssClass:'ui-btn-active' }
};

return this.each(function(){
Expand All @@ -297,7 +299,7 @@ $.fn.addMobile = function(options){
// Stop if no keyboard attached or if jQuery Mobile isn't loaded
if (!base || typeof($.fn.textinput) === 'undefined') { return; }

base.mobile_options = o = $.extend({}, defaults, options);
base.mobile_options = o = $.extend(true, {}, defaults, options);

// Setup
base.mobile_init = function(){
Expand All @@ -311,12 +313,13 @@ $.fn.addMobile = function(options){
}

// Setup mobile theme on keyboard once it is visible.
// Note: There is a 10ms delay after the keyboard is displayed before it actually fires 'visible.keyboard'.
// Note: There is a 10ms delay after the keyboard is displayed before it actually fires 'visible.keyboard'.
// Since we are restyling here, the user will experience FlashOfUnstyledContent (FOUC).
// This is avoided by first setting the visibility to hidden, then after the mobile styles are applied we
// This is avoided by first setting the visibility to hidden, then after the mobile styles are applied we
// set it visible.
//
base.$el.on('beforeVisible.keyboard', function () {
base.$el
.on('beforeVisible.keyboard', function () {
base.$keyboard.css("visibility", "hidden");
})
.on('visible.keyboard', function () {
Expand All @@ -328,50 +331,64 @@ $.fn.addMobile = function(options){
};

base.mobile_setup = function(){
var p, actn = $.extend({}, o.buttonMarkup, o.buttonAction);
var p,
opts = base.options,
markup = o.buttonMarkup.cssClass || '',
actions = opts.css.buttonAction;

opts.css.buttonAction += ' ' + o.buttonAction.cssClass;

base.$keyboard
// 'ui-bar ui-bar-a' classes to apply swatch theme
.addClass('ui-bar ui-bar-' + o.container.theme)
.addClass( base.modOptions(o.container, o.container) )
// preview input
.find('.ui-keyboard-preview').addClass( base.modOptions(o.input, o.input) ).end()
// removing 'ui-widget-content' will prevent jQuery UI theme from applying to the keyboard
.removeClass('ui-widget ui-widget-content')
.find('.' + actions).addClass( base.modOptions(o.buttonAction, o.buttonMarkup) ).end()
// apply jQuery Mobile button markup
// removed call to jQuery Mobile buttonMarkup function; replaced with base.modButton
.find('button:not(.' + base.options.css.buttonAction + ')').addClass( base.modButton(o.buttonMarkup) ).end()
.find('.' + base.options.css.buttonAction).addClass( base.modButton(actn) ).end()
.find('button').removeClass('ui-corner-all ui-state-default')
// removed call to jQuery Mobile buttonMarkup function; replaced with base.modOptions
.find('button')
.removeClass('ui-corner-all ui-state-default')
.addClass( base.modOptions(o.buttonMarkup) )
.hover(function(){
$(this).addClass('ui-btn-hover-' + o.buttonHover.theme);
$(this)
.removeClass( markup ? markup + '-' + o.buttonMarkup.theme : '' )
.addClass( base.modOptions(o.buttonHover, o.buttonMarkup) );
},function(){
$(this).removeClass('ui-btn-hover-' + o.buttonHover.theme);
$(this)
.removeClass( markup ? markup + '-' + o.buttonHover.theme : '' )
.addClass( base.modOptions(o.buttonMarkup, o.buttonMarkup) );
});

// set actionClass (default for jQuery UI = 'ui-state-active'),
// which is the active state of the button (shift is down)
base.options.css.buttonAction = 'ui-btn-down-' + o.buttonActive.theme;

// update keyboard width if preview is showing... after applying mobile theme
if (base.msie && base.$preview[0] !== base.el) {
base.$preview.hide();
base.$keyboard.css('width','');
base.width = base.$keyboard.outerWidth();
base.$keyboard.width(base.width + parseInt(base.$preview.css('fontSize'),10)); // add about 1em to input width for extra padding
// add about 1em to input width for extra padding
base.$keyboard.width(base.width + parseInt(base.$preview.css('fontSize'),10));
base.$preview.width(base.width);
base.$preview.show();
}

// adjust keyboard position after applying mobile theme
p = base.options.position;
p.of = p.of || base.$el.data('keyboardPosition') || base.$el;
p.collision = (base.options.usePreview) ? p.collision || 'fit fit' : 'flip flip';
base.$keyboard.position(p);
if ($.ui && $.ui.position) {
p = opts.position;
p.of = p.of || base.$el.data('keyboardPosition') || base.$el;
p.collision = p.collision || 'flipfit flipfit';
base.$keyboard.position(p);
}

};

base.modButton = function(t){
base.modOptions = function(t, btn){
var css = ' ' + ( t.cssClass || '' );
// Using this instead of the jQuery Mobile buttonMarkup because it is expecting <a>'s instead of <button>
// theme:'a', shadow:'true', inline:'true', corners:'false'
return 'ui-btn ui-btn-up-' + t.theme + ' ui-btn-' + t.theme + (t.shadow == 'true' ? ' ui-shadow' : '') + (t.corners == 'true' ? ' ui-btn-corner-all' : '');
return css + ' ' + (btn && btn.cssClass ? btn.cssClass + '-' + (t.theme || '') : '') +
(t.shadow == 'true' ? ' ui-shadow' : '') +
(t.corners == 'true' ? ' ui-corner-all' : '');
};

base.mobile_init();
Expand Down Expand Up @@ -554,7 +571,7 @@ $.fn.addNavigation = function(options){
})(jQuery);

/*
* jQuery UI Virtual Keyboard Scramble Extension v1.1 for Keyboard v1.18+ (updated 3/1/2014)
* jQuery UI Virtual Keyboard Scramble Extension v1.2 for Keyboard v1.18+ (updated 6/1/2014)
*
* By Rob Garrison (aka Mottie & Fudgey)
* Licensed under the MIT License
Expand Down Expand Up @@ -590,7 +607,10 @@ $.keyboard = $.keyboard || {};
};
return this.each(function() {
// make sure a keyboard is attached
var o, base = $(this).data('keyboard');
var o,
base = $(this).data('keyboard'),
opts = base.options;

if (!base) { return; }
o = base.scramble_options = $.extend({}, defaults, options);

Expand Down Expand Up @@ -681,34 +701,41 @@ $.keyboard = $.keyboard || {};
};

// create scrambled keyboard layout
base.options.create = function() {
var layout = base.options.layout;
opts.create = function() { console.log('create run');
var layout = opts.layout;
$.keyboard.builtLayouts[layout] = {
mappedKeys : {},
acceptedKeys : [],
$keyboard: null
};
if (typeof $.keyboard.builtLayouts[base.orig_layout] === 'undefined') {
base.layout = base.options.layout = base.orig_layout;
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 = base.options.layout = layout;
base.layout = opts.layout = layout;
}
// clone, scramble then save layout
$.keyboard.builtLayouts[layout] = $.extend({}, $.keyboard.builtLayouts[base.orig_layout]);
$.keyboard.builtLayouts[layout] = $.extend(true, {}, $.keyboard.builtLayouts[base.orig_layout]);
if (o.randomizeOnce) {
$.keyboard.builtLayouts[layout].$keyboard = base.scramble_setup( $.keyboard.builtLayouts[base.orig_layout].$keyboard.clone() );
}
base.$keyboard = $.keyboard.builtLayouts[layout].$keyboard;
if ( !o.randomizeOnce ) {
base.$el.bind('beforeVisible.keyboard', function(e, kb) {
kb.$keyboard = kb.scramble_setup(kb.$keyboard);
});
}
if ( !o.randomizeOnce ) {
base.$el.bind('beforeVisible.keyboard', function(e, kb) {
kb.$keyboard = kb.scramble_setup(kb.$keyboard);
});
}
};

base.orig_layout = base.options.layout;
base.options.layout = "scrambled" + Math.round(Math.random() * 10000);
base.orig_layout = opts.layout;
opts.layout = "scrambled" + Math.round(Math.random() * 10000);

// special case when keyboard is set to always be open
if (opts.alwaysOpen && base.$keyboard.length) {
setTimeout(function(){
base.$keyboard = base.scramble_setup(base.$keyboard);
}, 0);
}

});
};
Expand Down
Loading

0 comments on commit bd3436d

Please sign in to comment.