Skip to content

Commit 7b91e3a

Browse files
committed
Merge pull request #42 from netsstea/master
dynamic config bootstrap version 2 and 3. Default value is 2
2 parents fd46980 + be47539 commit 7b91e3a

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

Diff for: bootstro.js

+16-11
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ $(document).ready(function(){
2121

2222
var defaults = {
2323
nextButtonText : 'Next »', //will be wrapped with button as below
24-
//nextButton : '<button class="btn btn-primary btn-mini bootstro-next-btn">Next &raquo;</button>',
24+
//nextButton : '<button class="btn btn-primary btn-xs bootstro-next-btn">Next &raquo;</button>',
2525
prevButtonText : '&laquo; Prev',
26-
//prevButton : '<button class="btn btn-primary btn-mini bootstro-prev-btn">&laquo; Prev</button>',
26+
//prevButton : '<button class="btn btn-primary btn-xs bootstro-prev-btn">&laquo; Prev</button>',
2727
finishButtonText : '<i class="icon-ok"></i> Ok I got it, get back to the site',
28-
//finishButton : '<button class="btn btn-mini btn-success bootstro-finish-btn"><i class="icon-ok"></i> Ok I got it, get back to the site</button>',
28+
//finishButton : '<button class="btn btn-xs btn-success bootstro-finish-btn"><i class="icon-ok"></i> Ok I got it, get back to the site</button>',
2929
stopOnBackdropClick : true,
3030
stopOnEsc : true,
3131

@@ -37,6 +37,8 @@ $(document).ready(function(){
3737
margin : 100, //if the currently shown element's margin is less than this value
3838
// the element should be scrolled so that i can be viewed properly. This is useful
3939
// for sites which have fixed top/bottom nav bar
40+
41+
//bootstrapVersion : 3
4042
};
4143
var settings;
4244

@@ -60,23 +62,26 @@ $(document).ready(function(){
6062
function add_nav_btn(content, i)
6163
{
6264
var $el = get_element(i);
63-
var nextButton, prevButton, finishButton;
64-
65+
var nextButton, prevButton, finishButton, defaultBtnClass;
66+
if (settings.bootstrapVersion && settings.bootstrapVersion == 2)
67+
defaultBtnClass = "btn btn-primary btn-mini";
68+
else
69+
defaultBtnClass = "btn btn-primary btn-xs"; //default bootstrap version 3
6570
content = content + "<div class='bootstro-nav-wrapper'>";
6671
if ($el.attr('data-bootstro-nextButton'))
6772
{
6873
nextButton = $el.attr('data-bootstro-nextButton');
6974
}
7075
else if ( $el.attr('data-bootstro-nextButtonText') )
7176
{
72-
nextButton = '<button class="btn btn-primary btn-mini bootstro-next-btn">' + $el.attr('data-bootstro-nextButtonText') + '</button>';
77+
nextButton = '<button class="' + defaultBtnClass + ' bootstro-next-btn">' + $el.attr('data-bootstro-nextButtonText') + '</button>';
7378
}
7479
else
7580
{
7681
if (typeof settings.nextButton != 'undefined' /*&& settings.nextButton != ''*/)
7782
nextButton = settings.nextButton;
7883
else
79-
nextButton = '<button class="btn btn-primary btn-mini bootstro-next-btn">' + settings.nextButtonText + '</button>';
84+
nextButton = '<button class="' + defaultBtnClass + ' bootstro-next-btn">' + settings.nextButtonText + '</button>';
8085
}
8186

8287
if ($el.attr('data-bootstro-prevButton'))
@@ -85,14 +90,14 @@ $(document).ready(function(){
8590
}
8691
else if ( $el.attr('data-bootstro-prevButtonText') )
8792
{
88-
prevButton = '<button class="btn btn-primary btn-mini bootstro-prev-btn">' + $el.attr('data-bootstro-prevButtonText') + '</button>';
93+
prevButton = '<button class="' + defaultBtnClass + ' bootstro-prev-btn">' + $el.attr('data-bootstro-prevButtonText') + '</button>';
8994
}
9095
else
9196
{
9297
if (typeof settings.prevButton != 'undefined' /*&& settings.prevButton != ''*/)
9398
prevButton = settings.prevButton;
9499
else
95-
prevButton = '<button class="btn btn-primary btn-mini bootstro-prev-btn">' + settings.prevButtonText + '</button>';
100+
prevButton = '<button class="' + defaultBtnClass + ' bootstro-prev-btn">' + settings.prevButtonText + '</button>';
96101
}
97102

98103
if ($el.attr('data-bootstro-finishButton'))
@@ -101,14 +106,14 @@ $(document).ready(function(){
101106
}
102107
else if ( $el.attr('data-bootstro-finishButtonText') )
103108
{
104-
finishButton = '<button class="btn btn-primary btn-mini bootstro-finish-btn">' + $el.attr('data-bootstro-finishButtonText') + '</button>';
109+
finishButton = '<button class="' + defaultBtnClass +' bootstro-finish-btn">' + $el.attr('data-bootstro-finishButtonText') + '</button>';
105110
}
106111
else
107112
{
108113
if (typeof settings.finishButton != 'undefined' /*&& settings.finishButton != ''*/)
109114
finishButton = settings.finishButton;
110115
else
111-
finishButton = '<button class="btn btn-primary btn-mini bootstro-finish-btn">' + settings.finishButtonText + '</button>';
116+
finishButton = '<button class="' + defaultBtnClass +' bootstro-finish-btn">' + settings.finishButtonText + '</button>';
112117
}
113118

114119

0 commit comments

Comments
 (0)