summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTrent Richardson <trentdrichardson@gmail.com>2014-01-29 11:46:29 -0500
committerTrent Richardson <trentdrichardson@gmail.com>2014-01-29 11:46:29 -0500
commit4d4958e0fd1cec2d4d1d90c555a6c428f746c488 (patch)
treef588a52423cf8422cf579bdea7a04632b5db331b /src
parenta437b89e3bf82514022def2123e371806a9fcf9d (diff)
parent4d1b5a7fcac7b6cc6b01b1280246957df5caa501 (diff)
downloadjQuery-Impromptu-4d4958e0fd1cec2d4d1d90c555a6c428f746c488.zip
jQuery-Impromptu-4d4958e0fd1cec2d4d1d90c555a6c428f746c488.tar.gz
jQuery-Impromptu-4d4958e0fd1cec2d4d1d90c555a6c428f746c488.tar.bz2
Merge branch 'dev'
Diffstat (limited to 'src')
-rw-r--r--src/jquery-impromptu.js36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/jquery-impromptu.js b/src/jquery-impromptu.js
index 09f0ffe..26c327c 100644
--- a/src/jquery-impromptu.js
+++ b/src/jquery-impromptu.js
@@ -54,6 +54,7 @@
buttons: opts.buttons,
position: opts.position,
focus: opts.focus,
+ defaultButton: opts.defaultButton,
submit: opts.submit
}
};
@@ -136,7 +137,7 @@
};
// listen for esc or tab keys
- var keyPressEventHandler = function(e){
+ var keyDownEventHandler = function(e){
var key = (window.event) ? event.keyCode : e.keyCode;
//escape key closes
@@ -182,7 +183,7 @@
$.prompt.jqif.click(fadeClicked);
$window.resize({animate:false}, $.prompt.position);
$.prompt.jqi.find('.'+ opts.prefix +'close').click($.prompt.close);
- $.prompt.jqib.on("keydown",keyPressEventHandler)
+ $.prompt.jqib.on("keydown",keyDownEventHandler)
.on('impromptu:loaded', opts.loaded)
.on('impromptu:close', opts.close)
.on('impromptu:statechanging', opts.statechanging)
@@ -458,7 +459,7 @@
state += '" name="' + opts.prefix + '_' + statename + '_button' + v.title.replace(/[^a-z0-9]+/gi,'') + '" id="' + opts.prefix + '_' + statename + '_button' + v.title.replace(/[^a-z0-9]+/gi,'') + '" value="' + v.value + '">' + v.title + '</button>';
} else {
- state += '<button class="'+ $.prompt.currentPrefix + 'button '+ opts.classes.button +' '+ defbtn +'" name="' + opts.prefix + '_' + statename + '_button' + k + '" id="' + opts.prefix + '_' + statename + '_button' + k + '" value="' + v + '">' + k + '</button>';
+ state += '<button class="'+ $.prompt.currentPrefix + 'button '+ opts.classes.button +' '+ defbtn +'" name="' + opts.prefix + '_' + statename + '_button' + k.replace(/[^a-z0-9]+/gi,'') + '" id="' + opts.prefix + '_' + statename + '_button' + k.replace(/[^a-z0-9]+/gi,'') + '" value="' + v + '">' + k + '</button>';
}
i++;
@@ -493,9 +494,9 @@
if($state.length === 0){
return false;
}
-
+
// transition away from it before deleting
- if($state.is(':visible')){
+ if($state.css('display') !== 'none'){
if($state.next().length > 0){
$.prompt.nextState(rm);
}
@@ -618,7 +619,10 @@
*/
$.prompt.nextState = function(callback) {
var $next = $('#'+ $.prompt.currentPrefix +'state_'+ $.prompt.getCurrentStateName()).next();
- return $.prompt.goToState( $next.attr('id').replace($.prompt.currentPrefix +'state_',''), callback );
+ if($next.length > 0){
+ $.prompt.goToState( $next.attr('id').replace($.prompt.currentPrefix +'state_',''), callback );
+ }
+ return $next;
};
/**
@@ -628,7 +632,10 @@
*/
$.prompt.prevState = function(callback) {
var $prev = $('#'+ $.prompt.currentPrefix +'state_'+ $.prompt.getCurrentStateName()).prev();
- $.prompt.goToState( $prev.attr('id').replace($.prompt.currentPrefix +'state_',''), callback );
+ if($prev.length > 0){
+ $.prompt.goToState( $prev.attr('id').replace($.prompt.currentPrefix +'state_',''), callback );
+ }
+ return $prev;
};
/**
@@ -645,15 +652,16 @@
$.prompt.timeout = false;
}
- $.prompt.jqib.fadeOut('fast',function(){
+ if($.prompt.jqib){
+ $.prompt.jqib.fadeOut('fast',function(){
- if(callCallback) {
$.prompt.jqib.trigger('impromptu:close', [clicked,msg,formvals]);
- }
- $.prompt.jqib.remove();
-
- $(window).off('resize',$.prompt.position);
- });
+
+ $.prompt.jqib.remove();
+
+ $(window).off('resize',$.prompt.position);
+ });
+ }
};
/**