Skip to content

Commit 01f441a

Browse files
Merge branch 'feature/tutorial-cleanup' into develop
2 parents 0c63b88 + 3f38397 commit 01f441a

File tree

6 files changed

+36
-21
lines changed

6 files changed

+36
-21
lines changed

css/main.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#input {
22
height: 5em;
33
}
4+
.alert-info a {
5+
color: #FFF;
6+
}
47
TH, TD {
58
text-align: center;
69
}
@@ -32,4 +35,8 @@ TH, TD {
3235
}
3336
.table-bordered .end-expression {
3437
border-right: 3px solid black;
38+
}
39+
/* The specificity of Bootstrap Tour is less than Bootstrap Flatly, causing z-index issues */
40+
.tour-step-backdrop {
41+
z-index: 1101 !important;
3542
}

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<meta name="description" content="">
1111
<meta name="viewport" content="width=device-width, initial-scale=1">
1212

13-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css">
13+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.min.css">
1414
<style>
1515
body {
1616
padding-top: 50px;
@@ -75,7 +75,7 @@
7575

7676
<div class="alert alert-info js-intro-text">
7777
<button type="button" class="close" data-dismiss="alert">×</button>
78-
Enter the conditional expression you want to parse in the box above<span class="hidden-xs">, or click "View Tutorial" for a walkthrough</span>.
78+
Enter the conditional expression you want to parse in the box above<span class="hidden-xs">, or click <a href="javascript:void(0)" class="js-tutorial-start" role="button">"View Tutorial"</a> for a walkthrough</span>.
7979
</div>
8080

8181
<div class="alert alert-danger hidden js-alert-mixed-operators">
@@ -120,8 +120,8 @@
120120
'vendor/lodash-2.4.1.min'
121121
],
122122
'bootstrap': [
123-
'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/js/bootstrap.min',
124-
'vendor/bootstrap-3.1.1.min'
123+
'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min',
124+
'vendor/bootstrap-3.3.2.min'
125125
],
126126
'tour': [
127127
'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tour/0.10.1/js/bootstrap-tour.min',

js/main.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ define(function(require, exports, module) {
139139
$startTutorial = $('.js-tutorial-start'),
140140
lastTutorialStepNum = null;
141141

142-
$submit.on('click keypress', function() {
142+
function processInput(trackEvents) {
143143
var input = $input.val(),
144144
expression, columnClasses;
145145

@@ -158,7 +158,8 @@ define(function(require, exports, module) {
158158
if(expression.hasMixedOperatorsDeep()) {
159159
$inputForm.addClass('has-error');
160160
$alertMixedOperators.removeClass('hidden');
161-
trackEventInputMixedOperators();
161+
162+
if(trackEvents) { trackEventInputMixedOperators(); }
162163
} else {
163164

164165
$truthTable.removeClass('hidden');
@@ -169,26 +170,32 @@ define(function(require, exports, module) {
169170
printCells(expression, columnClasses)
170171
);
171172

172-
trackEventInputParse();
173+
if(trackEvents) { trackEventInputParse(); }
173174

174175
}
175176

176177
}
178+
}
179+
180+
$submit.on('click keypress', function() {
181+
processInput(true);
182+
});
183+
184+
$input.on('tutorial.change', function() {
185+
processInput(false);
177186
});
178187

179188
$startTutorial.click(function() {
180189
var thisStepNum = function(tour) { return tour.getCurrentStep() + 1; },
181190
userInput;
182191

183192
var tutorial = new Tutorial.Tutorial({
184-
debug: true,
185-
//template: tutorialTemplate,
186193
onShow: function() {
187194
// onStart does not fire if the user has previously seen the tutorial,
188195
// so detect the start using onShow
189196
if(lastTutorialStepNum === null) {
190197
userInput = $input.val();
191-
$input.val('').change();
198+
$input.val('').trigger('tutorial.change');
192199
}
193200
},
194201
onShown: function(tour) {
@@ -207,7 +214,7 @@ define(function(require, exports, module) {
207214
},
208215
onEnd: function(tour) {
209216
lastTutorialStepNum = null;
210-
$input.val(userInput).change();
217+
$input.val(userInput).trigger('tutorial.change');
211218
trackEventTutorialEnd(thisStepNum(tour));
212219
}
213220
});

js/tutorial.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ define(function(require, exports, module) {
77

88
function Tutorial(_options) {
99
var resetInput = function() {
10-
return $input.val('').change();
10+
return $input.val('').trigger('tutorial.change');
1111
};
1212

1313
var example1 = 'if( A || B ) {',
@@ -41,7 +41,7 @@ define(function(require, exports, module) {
4141
},{
4242
onShow: function(tour) {
4343
if(_options.onShow) { _options.onShow(tour); }
44-
resetInput().val(example1).change();
44+
resetInput().val(example1).trigger('tutorial.change');
4545
},
4646
element: '.js-truth-table',
4747
placement: 'bottom',
@@ -59,7 +59,7 @@ define(function(require, exports, module) {
5959
},{
6060
onShow: function(tour) {
6161
if(_options.onShow) { _options.onShow(tour); }
62-
resetInput().val(example2).change();
62+
resetInput().val(example2).trigger('tutorial.change');
6363
},
6464
element: '.js-truth-table',
6565
placement: 'bottom',
@@ -77,7 +77,7 @@ define(function(require, exports, module) {
7777
},{
7878
onShow: function(tour) {
7979
if(_options.onShow) { _options.onShow(tour); }
80-
resetInput().val(example3).change();
80+
resetInput().val(example3).trigger('tutorial.change');
8181
},
8282
element: '.js-truth-table',
8383
placement: 'bottom',

js/vendor/bootstrap-3.1.1.min.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

js/vendor/bootstrap-3.3.2.min.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)