Skip to content

Commit 884a6b3

Browse files
Merge branch 'release/1.1.0'
2 parents dd35d79 + 01f441a commit 884a6b3

File tree

6 files changed

+43
-22
lines changed

6 files changed

+43
-22
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: 10 additions & 5 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;
@@ -59,7 +59,12 @@
5959
<div class="container">
6060
<form class="form-horizontal js-input-form">
6161
<label for="input">Expression to parse</label>
62-
<textarea class="form-control js-tutorial-input" id="input" placeholder="Enter your expression"></textarea>
62+
<div class="input-group">
63+
<textarea class="form-control js-tutorial-input" id="input" placeholder="Enter your expression"></textarea>
64+
<span class="input-group-btn">
65+
<button type="button" class="btn btn-primary btn-lg js-submit">Submit</button>
66+
</span>
67+
</div>
6368
</form>
6469
</div>
6570
</div>
@@ -70,7 +75,7 @@
7075

7176
<div class="alert alert-info js-intro-text">
7277
<button type="button" class="close" data-dismiss="alert">×</button>
73-
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>.
7479
</div>
7580

7681
<div class="alert alert-danger hidden js-alert-mixed-operators">
@@ -115,8 +120,8 @@
115120
'vendor/lodash-2.4.1.min'
116121
],
117122
'bootstrap': [
118-
'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/js/bootstrap.min',
119-
'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'
120125
],
121126
'tour': [
122127
'https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tour/0.10.1/js/bootstrap-tour.min',

js/main.js

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

132132
$(function() {
133133
var $input = $('#input'),
134+
$submit = $('.js-submit'),
134135
$inputForm = $('.js-input-form'),
135136
$introText = $('.js-intro-text'),
136137
$alertMixedOperators = $('.js-alert-mixed-operators'),
137138
$truthTable = $('.js-truth-table'),
138139
$startTutorial = $('.js-tutorial-start'),
139140
lastTutorialStepNum = null;
140141

141-
$input.change(function() {
142+
function processInput(trackEvents) {
142143
var input = $input.val(),
143144
expression, columnClasses;
144145

@@ -157,7 +158,8 @@ define(function(require, exports, module) {
157158
if(expression.hasMixedOperatorsDeep()) {
158159
$inputForm.addClass('has-error');
159160
$alertMixedOperators.removeClass('hidden');
160-
trackEventInputMixedOperators();
161+
162+
if(trackEvents) { trackEventInputMixedOperators(); }
161163
} else {
162164

163165
$truthTable.removeClass('hidden');
@@ -168,26 +170,32 @@ define(function(require, exports, module) {
168170
printCells(expression, columnClasses)
169171
);
170172

171-
trackEventInputParse();
173+
if(trackEvents) { trackEventInputParse(); }
172174

173175
}
174176

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

178188
$startTutorial.click(function() {
179189
var thisStepNum = function(tour) { return tour.getCurrentStep() + 1; },
180190
userInput;
181191

182192
var tutorial = new Tutorial.Tutorial({
183-
debug: true,
184-
//template: tutorialTemplate,
185193
onShow: function() {
186194
// onStart does not fire if the user has previously seen the tutorial,
187195
// so detect the start using onShow
188196
if(lastTutorialStepNum === null) {
189197
userInput = $input.val();
190-
$input.val('').change();
198+
$input.val('').trigger('tutorial.change');
191199
}
192200
},
193201
onShown: function(tour) {
@@ -206,7 +214,7 @@ define(function(require, exports, module) {
206214
},
207215
onEnd: function(tour) {
208216
lastTutorialStepNum = null;
209-
$input.val(userInput).change();
217+
$input.val(userInput).trigger('tutorial.change');
210218
trackEventTutorialEnd(thisStepNum(tour));
211219
}
212220
});

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)