summaryrefslogtreecommitdiffstats
path: root/jquery-impromptu.js
diff options
context:
space:
mode:
authorTrent Richardson <trentdrichardson@gmail.com>2012-03-15 10:57:45 -0400
committerTrent Richardson <trentdrichardson@gmail.com>2012-03-15 10:57:45 -0400
commitb20359d1b1b593c96116336f24bb548956ed40f4 (patch)
tree0c8b5e5d16ee0f723eddb35aac8c44a6e42fc580 /jquery-impromptu.js
parent9ddc850cb329e3d783e201d13a6135502c2712b2 (diff)
downloadjQuery-Impromptu-b20359d1b1b593c96116336f24bb548956ed40f4.zip
jQuery-Impromptu-b20359d1b1b593c96116336f24bb548956ed40f4.tar.gz
jQuery-Impromptu-b20359d1b1b593c96116336f24bb548956ed40f4.tar.bz2
Add to new button classes option
Diffstat (limited to 'jquery-impromptu.js')
-rw-r--r--jquery-impromptu.js56
1 files changed, 26 insertions, 30 deletions
diff --git a/jquery-impromptu.js b/jquery-impromptu.js
index 5d79aa7..c52597b 100644
--- a/jquery-impromptu.js
+++ b/jquery-impromptu.js
@@ -59,36 +59,32 @@
var states = "";
$.each(message,function(statename,stateobj){
- stateobj = $.extend({},$.prompt.defaults.state,stateobj);
- message[statename] = stateobj;
-
- var arrow = "";
- if(stateobj.position.arrow !== null)
- arrow = '<div class="'+ $.prompt.options.prefix + 'arrow '+ $.prompt.options.prefix + 'arrow'+ stateobj.position.arrow +'"></div>';
-
- states += '<div id="'+ $.prompt.options.prefix +'_state_'+ statename +'" class="'+ $.prompt.options.prefix + '_state" style="display:none;">'+ arrow +'<div class="'+ $.prompt.options.prefix +'message">' + stateobj.html +'</div><div class="'+ $.prompt.options.prefix +'buttons">';
-
- $.each(stateobj.buttons, function(k, v){
- if(typeof v == 'object'){
-
- states += '<button ';
- if(typeof v.classes !== "undefined"){
- states += 'class="'
- $.each(v.classes, function(k, v){
- states += ' ' + v
- })
- states += '" ';
- }
-
- states += ' name="' + $.prompt.options.prefix + '_' + statename + '_button' + v.title.replace(/[^a-z0-9]+/gi,'') + '" id="' + $.prompt.options.prefix + '_' + statename + '_button' + v.title.replace(/[^a-z0-9]+/gi,'') + '" value="' + v.value + '">' + v.title + '</button>';
-
- } else {
- states += '<button name="' + $.prompt.options.prefix + '_' + statename + '_button' + k + '" id="' + $.prompt.options.prefix + '_' + statename + '_button' + k + '" value="' + v + '">' + k + '</button>';
-
- }
- });
- states += '</div></div>';
- });
+ stateobj = $.extend({},$.prompt.defaults.state,stateobj);
+ message[statename] = stateobj;
+
+ var arrow = "";
+ if(stateobj.position.arrow !== null)
+ arrow = '<div class="'+ $.prompt.options.prefix + 'arrow '+ $.prompt.options.prefix + 'arrow'+ stateobj.position.arrow +'"></div>';
+
+ states += '<div id="'+ $.prompt.options.prefix +'_state_'+ statename +'" class="'+ $.prompt.options.prefix + '_state" style="display:none;">'+ arrow +'<div class="'+ $.prompt.options.prefix +'message">' + stateobj.html +'</div><div class="'+ $.prompt.options.prefix +'buttons">';
+
+ $.each(stateobj.buttons, function(k, v){
+ if(typeof v == 'object'){
+ states += '<button ';
+
+ if(typeof v.classes !== "undefined"){
+ states += 'class="' + ($.isArray(v.classes)? v.classes.join(' ') : v.classes) + '" ';
+ }
+
+ states += ' name="' + $.prompt.options.prefix + '_' + statename + '_button' + v.title.replace(/[^a-z0-9]+/gi,'') + '" id="' + $.prompt.options.prefix + '_' + statename + '_button' + v.title.replace(/[^a-z0-9]+/gi,'') + '" value="' + v.value + '">' + v.title + '</button>';
+
+ } else {
+ states += '<button name="' + $.prompt.options.prefix + '_' + statename + '_button' + k + '" id="' + $.prompt.options.prefix + '_' + statename + '_button' + k + '" value="' + v + '">' + k + '</button>';
+
+ }
+ });
+ states += '</div></div>';
+ });
//insert the states...
$.prompt.states = message;