bootstrap-tour-rails 0.0.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
# bootstrap-tour.js v0.1
|
5
|
-
# http://pushly.github.com/bootstrap-tour/
|
1
|
+
/* ===========================================================
|
2
|
+
# bootstrap-tour - v0.4.0
|
3
|
+
# http://bootstraptour.com
|
6
4
|
# ==============================================================
|
7
|
-
# Copyright 2012
|
5
|
+
# Copyright 2012-2013 Ulrich Sossou
|
8
6
|
#
|
9
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
8
|
# you may not use this file except in compliance with the License.
|
@@ -18,17 +16,12 @@
|
|
18
16
|
# See the License for the specific language governing permissions and
|
19
17
|
# limitations under the License.
|
20
18
|
*/
|
21
|
-
|
22
|
-
|
23
19
|
(function() {
|
24
|
-
|
25
20
|
(function($, window) {
|
26
21
|
var Tour, document;
|
27
22
|
document = window.document;
|
28
23
|
Tour = (function() {
|
29
|
-
|
30
24
|
function Tour(options) {
|
31
|
-
var _this = this;
|
32
25
|
this._options = $.extend({
|
33
26
|
name: 'tour',
|
34
27
|
labels: {
|
@@ -36,30 +29,44 @@
|
|
36
29
|
next: 'Next »',
|
37
30
|
prev: '« Prev'
|
38
31
|
},
|
32
|
+
template: "<div class='popover tour'> <div class='arrow'></div> <h3 class='popover-title'></h3> <div class='popover-content'></div> </div>",
|
33
|
+
container: 'body',
|
39
34
|
keyboard: true,
|
40
35
|
useLocalStorage: false,
|
36
|
+
debug: false,
|
37
|
+
backdrop: false,
|
38
|
+
redirect: true,
|
39
|
+
basePath: '',
|
41
40
|
afterSetState: function(key, value) {},
|
42
41
|
afterGetState: function(key, value) {},
|
42
|
+
afterRemoveState: function(key) {},
|
43
43
|
onStart: function(tour) {},
|
44
44
|
onEnd: function(tour) {},
|
45
45
|
onShow: function(tour) {},
|
46
|
+
onShown: function(tour) {},
|
46
47
|
onHide: function(tour) {},
|
47
|
-
|
48
|
+
onHidden: function(tour) {},
|
49
|
+
onNext: function(tour) {},
|
50
|
+
onPrev: function(tour) {}
|
48
51
|
}, options);
|
52
|
+
if (!this._options.useLocalStorage && !$.cookie) {
|
53
|
+
this._debug("jQuery.cookie is not loaded.");
|
54
|
+
}
|
49
55
|
this._steps = [];
|
50
56
|
this.setCurrentStep();
|
51
|
-
this.
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
57
|
+
this.backdrop = {
|
58
|
+
overlay: null,
|
59
|
+
step: null,
|
60
|
+
background: null
|
61
|
+
};
|
56
62
|
}
|
57
63
|
|
58
64
|
Tour.prototype.setState = function(key, value) {
|
65
|
+
key = "" + this._options.name + "_" + key;
|
59
66
|
if (this._options.useLocalStorage) {
|
60
|
-
window.localStorage.setItem(
|
67
|
+
window.localStorage.setItem(key, value);
|
61
68
|
} else {
|
62
|
-
$.cookie(
|
69
|
+
$.cookie(key, value, {
|
63
70
|
expires: 36500,
|
64
71
|
path: '/'
|
65
72
|
});
|
@@ -67,6 +74,18 @@
|
|
67
74
|
return this._options.afterSetState(key, value);
|
68
75
|
};
|
69
76
|
|
77
|
+
Tour.prototype.removeState = function(key) {
|
78
|
+
key = "" + this._options.name + "_" + key;
|
79
|
+
if (this._options.useLocalStorage) {
|
80
|
+
window.localStorage.removeItem(key);
|
81
|
+
} else {
|
82
|
+
$.removeCookie(key, {
|
83
|
+
path: '/'
|
84
|
+
});
|
85
|
+
}
|
86
|
+
return this._options.afterRemoveState(key);
|
87
|
+
};
|
88
|
+
|
70
89
|
Tour.prototype.getState = function(key) {
|
71
90
|
var value;
|
72
91
|
if (this._options.useLocalStorage) {
|
@@ -74,10 +93,23 @@
|
|
74
93
|
} else {
|
75
94
|
value = $.cookie("" + this._options.name + "_" + key);
|
76
95
|
}
|
96
|
+
if (value === void 0 || value === "null") {
|
97
|
+
value = null;
|
98
|
+
}
|
77
99
|
this._options.afterGetState(key, value);
|
78
100
|
return value;
|
79
101
|
};
|
80
102
|
|
103
|
+
Tour.prototype.addSteps = function(steps) {
|
104
|
+
var step, _i, _len, _results;
|
105
|
+
_results = [];
|
106
|
+
for (_i = 0, _len = steps.length; _i < _len; _i++) {
|
107
|
+
step = steps[_i];
|
108
|
+
_results.push(this.addStep(step));
|
109
|
+
}
|
110
|
+
return _results;
|
111
|
+
};
|
112
|
+
|
81
113
|
Tour.prototype.addStep = function(step) {
|
82
114
|
return this._steps.push(step);
|
83
115
|
};
|
@@ -89,23 +121,32 @@
|
|
89
121
|
placement: "right",
|
90
122
|
title: "",
|
91
123
|
content: "",
|
124
|
+
id: "step-" + i,
|
92
125
|
next: i === this._steps.length - 1 ? -1 : i + 1,
|
93
126
|
prev: i - 1,
|
94
127
|
animation: true,
|
128
|
+
backdrop: this._options.backdrop,
|
129
|
+
redirect: this._options.redirect,
|
95
130
|
onShow: this._options.onShow,
|
131
|
+
onShown: this._options.onShown,
|
96
132
|
onHide: this._options.onHide,
|
97
|
-
|
133
|
+
onHidden: this._options.onHidden,
|
134
|
+
onNext: this._options.onNext,
|
135
|
+
onPrev: this._options.onPrev,
|
136
|
+
template: this._options.template,
|
137
|
+
container: this._options.container
|
98
138
|
}, this._steps[i]);
|
99
139
|
}
|
100
140
|
};
|
101
141
|
|
102
142
|
Tour.prototype.start = function(force) {
|
103
|
-
var
|
143
|
+
var promise,
|
144
|
+
_this = this;
|
104
145
|
if (force == null) {
|
105
146
|
force = false;
|
106
147
|
}
|
107
148
|
if (this.ended() && !force) {
|
108
|
-
return;
|
149
|
+
return this._debug("Tour ended, start prevented.");
|
109
150
|
}
|
110
151
|
$(document).off("click.bootstrap-tour", ".popover .next").on("click.bootstrap-tour", ".popover .next", function(e) {
|
111
152
|
e.preventDefault();
|
@@ -119,30 +160,41 @@
|
|
119
160
|
e.preventDefault();
|
120
161
|
return _this.end();
|
121
162
|
});
|
163
|
+
this._onresize(function() {
|
164
|
+
return _this.showStep(_this._current);
|
165
|
+
});
|
122
166
|
this._setupKeyboardNavigation();
|
123
|
-
|
124
|
-
|
125
|
-
}
|
126
|
-
return this.showStep(this._current);
|
167
|
+
promise = this._makePromise(this._options.onStart != null ? this._options.onStart(this) : void 0);
|
168
|
+
return this._callOnPromiseDone(promise, this.showStep, this._current);
|
127
169
|
};
|
128
170
|
|
129
171
|
Tour.prototype.next = function() {
|
130
|
-
|
131
|
-
|
172
|
+
var promise;
|
173
|
+
promise = this.hideStep(this._current);
|
174
|
+
return this._callOnPromiseDone(promise, this.showNextStep);
|
132
175
|
};
|
133
176
|
|
134
177
|
Tour.prototype.prev = function() {
|
135
|
-
|
136
|
-
|
178
|
+
var promise;
|
179
|
+
promise = this.hideStep(this._current);
|
180
|
+
return this._callOnPromiseDone(promise, this.showPrevStep);
|
137
181
|
};
|
138
182
|
|
139
183
|
Tour.prototype.end = function() {
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
184
|
+
var endHelper, hidePromise,
|
185
|
+
_this = this;
|
186
|
+
endHelper = function(e) {
|
187
|
+
$(document).off("click.bootstrap-tour");
|
188
|
+
$(document).off("keyup.bootstrap-tour");
|
189
|
+
$(window).off("resize.bootstrap-tour");
|
190
|
+
_this.setState("end", "yes");
|
191
|
+
_this._hideBackdrop();
|
192
|
+
if (_this._options.onEnd != null) {
|
193
|
+
return _this._options.onEnd(_this);
|
194
|
+
}
|
195
|
+
};
|
196
|
+
hidePromise = this.hideStep(this._current);
|
197
|
+
return this._callOnPromiseDone(hidePromise, endHelper);
|
146
198
|
};
|
147
199
|
|
148
200
|
Tour.prototype.ended = function() {
|
@@ -150,43 +202,66 @@
|
|
150
202
|
};
|
151
203
|
|
152
204
|
Tour.prototype.restart = function() {
|
153
|
-
this.
|
154
|
-
this.
|
205
|
+
this.removeState("current_step");
|
206
|
+
this.removeState("end");
|
155
207
|
this.setCurrentStep(0);
|
156
208
|
return this.start();
|
157
209
|
};
|
158
210
|
|
159
211
|
Tour.prototype.hideStep = function(i) {
|
160
|
-
var step
|
212
|
+
var hideStepHelper, promise, step,
|
213
|
+
_this = this;
|
161
214
|
step = this.getStep(i);
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
215
|
+
promise = this._makePromise((step.onHide != null ? step.onHide(this) : void 0));
|
216
|
+
hideStepHelper = function(e) {
|
217
|
+
var $element;
|
218
|
+
$element = $(step.element).popover("hide");
|
219
|
+
if (step.reflex) {
|
220
|
+
$element.css("cursor", "").off("click.boostrap-tour");
|
221
|
+
}
|
222
|
+
if (step.backdrop) {
|
223
|
+
_this._hideBackdrop();
|
224
|
+
}
|
225
|
+
if (step.onHidden != null) {
|
226
|
+
return step.onHidden(_this);
|
227
|
+
}
|
228
|
+
};
|
229
|
+
this._callOnPromiseDone(promise, hideStepHelper);
|
230
|
+
return promise;
|
166
231
|
};
|
167
232
|
|
168
233
|
Tour.prototype.showStep = function(i) {
|
169
|
-
var step
|
234
|
+
var promise, showStepHelper, step,
|
235
|
+
_this = this;
|
170
236
|
step = this.getStep(i);
|
171
237
|
if (!step) {
|
172
238
|
return;
|
173
239
|
}
|
174
|
-
this.
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
240
|
+
promise = this._makePromise((step.onShow != null ? step.onShow(this) : void 0));
|
241
|
+
showStepHelper = function(e) {
|
242
|
+
var current_path, path;
|
243
|
+
_this.setCurrentStep(i);
|
244
|
+
path = typeof step.path === "function" ? step.path.call() : _this._options.basePath + step.path;
|
245
|
+
current_path = [document.location.pathname, document.location.hash].join('');
|
246
|
+
if (_this._isRedirect(path, current_path)) {
|
247
|
+
_this._redirect(step, path);
|
248
|
+
return;
|
249
|
+
}
|
250
|
+
if (!((step.element != null) && $(step.element).length !== 0 && $(step.element).is(":visible"))) {
|
251
|
+
_this._debug("Skip the step " + (_this._current + 1) + ". The element does not exist or is not visible.");
|
252
|
+
_this.showNextStep();
|
253
|
+
return;
|
254
|
+
}
|
255
|
+
if (step.backdrop) {
|
256
|
+
_this._showBackdrop(step.element);
|
257
|
+
}
|
258
|
+
_this._showPopover(step, i);
|
259
|
+
if (step.onShown != null) {
|
260
|
+
step.onShown(_this);
|
261
|
+
}
|
262
|
+
return _this._debug("Step " + (_this._current + 1) + " of " + _this._steps.length);
|
263
|
+
};
|
264
|
+
return this._callOnPromiseDone(promise, showStepHelper);
|
190
265
|
};
|
191
266
|
|
192
267
|
Tour.prototype.setCurrentStep = function(value) {
|
@@ -195,7 +270,7 @@
|
|
195
270
|
return this.setState("current_step", value);
|
196
271
|
} else {
|
197
272
|
this._current = this.getState("current_step");
|
198
|
-
if (this._current === null
|
273
|
+
if (this._current === null) {
|
199
274
|
return this._current = 0;
|
200
275
|
} else {
|
201
276
|
return this._current = parseInt(this._current);
|
@@ -204,19 +279,61 @@
|
|
204
279
|
};
|
205
280
|
|
206
281
|
Tour.prototype.showNextStep = function() {
|
207
|
-
var step
|
282
|
+
var promise, showNextStepHelper, step,
|
283
|
+
_this = this;
|
208
284
|
step = this.getStep(this._current);
|
209
|
-
|
285
|
+
showNextStepHelper = function(e) {
|
286
|
+
return _this.showStep(step.next);
|
287
|
+
};
|
288
|
+
promise = this._makePromise((step.onNext != null ? step.onNext(this) : void 0));
|
289
|
+
return this._callOnPromiseDone(promise, showNextStepHelper);
|
210
290
|
};
|
211
291
|
|
212
292
|
Tour.prototype.showPrevStep = function() {
|
213
|
-
var step
|
293
|
+
var promise, showPrevStepHelper, step,
|
294
|
+
_this = this;
|
214
295
|
step = this.getStep(this._current);
|
215
|
-
|
296
|
+
showPrevStepHelper = function(e) {
|
297
|
+
return _this.showStep(step.prev);
|
298
|
+
};
|
299
|
+
promise = this._makePromise((step.onPrev != null ? step.onPrev(this) : void 0));
|
300
|
+
return this._callOnPromiseDone(promise, showPrevStepHelper);
|
301
|
+
};
|
302
|
+
|
303
|
+
Tour.prototype._debug = function(text) {
|
304
|
+
if (this._options.debug) {
|
305
|
+
return window.console.log("Bootstrap Tour '" + this._options.name + "' | " + text);
|
306
|
+
}
|
307
|
+
};
|
308
|
+
|
309
|
+
Tour.prototype._isRedirect = function(path, currentPath) {
|
310
|
+
return (path != null) && path !== "" && path.replace(/\?.*$/, "").replace(/\/?$/, "") !== currentPath.replace(/\/?$/, "");
|
311
|
+
};
|
312
|
+
|
313
|
+
Tour.prototype._redirect = function(step, path) {
|
314
|
+
if (typeof step.redirect === 'function') {
|
315
|
+
return step.redirect.call(this, path);
|
316
|
+
} else if (step.redirect === true) {
|
317
|
+
this._debug("Redirect to " + path);
|
318
|
+
return document.location.href = path;
|
319
|
+
}
|
320
|
+
};
|
321
|
+
|
322
|
+
Tour.prototype._renderNavigation = function(step, options) {
|
323
|
+
var content, nav;
|
324
|
+
nav = [];
|
325
|
+
if (step.prev >= 0) {
|
326
|
+
nav.push("<a href='#" + step.prev + "' class='prev'>" + options.labels.prev + "</a>");
|
327
|
+
}
|
328
|
+
if (step.next >= 0) {
|
329
|
+
nav.push("<a href='#" + step.next + "' class='next'>" + options.labels.next + "</a>");
|
330
|
+
}
|
331
|
+
content = nav.join(" | ");
|
332
|
+
return content += "<a href='#' class='pull-right end'>" + options.labels.end + "</a>";
|
216
333
|
};
|
217
334
|
|
218
335
|
Tour.prototype._showPopover = function(step, i) {
|
219
|
-
var
|
336
|
+
var $tip, content, options,
|
220
337
|
_this = this;
|
221
338
|
content = "" + step.content + "<br /><p>";
|
222
339
|
options = $.extend({}, this._options);
|
@@ -224,42 +341,39 @@
|
|
224
341
|
$.extend(options, step.options);
|
225
342
|
}
|
226
343
|
if (step.reflex) {
|
227
|
-
$(step.element).css("cursor", "pointer")
|
228
|
-
$(step.element).on("click", function(e) {
|
229
|
-
$(step.element).css("cursor", "auto");
|
344
|
+
$(step.element).css("cursor", "pointer").on("click.bootstrap-tour", function(e) {
|
230
345
|
return _this.next();
|
231
346
|
});
|
232
347
|
}
|
233
|
-
|
234
|
-
if (step.prev >= 0) {
|
235
|
-
nav.push("<a href='#" + step.prev + "' class='prev'>" + options.labels.prev + "</a>");
|
236
|
-
}
|
237
|
-
if (step.next >= 0) {
|
238
|
-
nav.push("<a href='#" + step.next + "' class='next'>" + options.labels.next + "</a>");
|
239
|
-
}
|
240
|
-
content += nav.join(" | ");
|
241
|
-
content += "<a href='#' class='pull-right end'>" + options.labels.end + "</a>";
|
348
|
+
content += this._renderNavigation(step, options);
|
242
349
|
$(step.element).popover('destroy').popover({
|
243
350
|
placement: step.placement,
|
244
351
|
trigger: "manual",
|
245
352
|
title: step.title,
|
246
353
|
content: content,
|
247
354
|
html: true,
|
248
|
-
animation: step.animation
|
355
|
+
animation: step.animation,
|
356
|
+
container: step.container,
|
357
|
+
template: step.template
|
249
358
|
}).popover("show");
|
250
|
-
tip = $(step.element).data("popover").tip();
|
251
|
-
|
252
|
-
|
359
|
+
$tip = $(step.element).data("popover").tip();
|
360
|
+
$tip.attr("id", step.id);
|
361
|
+
this._reposition($tip, step);
|
362
|
+
return this._scrollIntoView($tip);
|
253
363
|
};
|
254
364
|
|
255
|
-
Tour.prototype._reposition = function(tip) {
|
256
|
-
var offsetBottom, offsetRight, tipOffset;
|
365
|
+
Tour.prototype._reposition = function(tip, step) {
|
366
|
+
var offsetBottom, offsetRight, original_left, original_offsetHeight, original_offsetWidth, original_top, tipOffset;
|
367
|
+
original_offsetWidth = tip[0].offsetWidth;
|
368
|
+
original_offsetHeight = tip[0].offsetHeight;
|
257
369
|
tipOffset = tip.offset();
|
370
|
+
original_left = tipOffset.left;
|
371
|
+
original_top = tipOffset.top;
|
258
372
|
offsetBottom = $(document).outerHeight() - tipOffset.top - $(tip).outerHeight();
|
259
373
|
if (offsetBottom < 0) {
|
260
374
|
tipOffset.top = tipOffset.top + offsetBottom;
|
261
375
|
}
|
262
|
-
offsetRight = $(
|
376
|
+
offsetRight = $("html").outerWidth() - tipOffset.left - $(tip).outerWidth();
|
263
377
|
if (offsetRight < 0) {
|
264
378
|
tipOffset.left = tipOffset.left + offsetRight;
|
265
379
|
}
|
@@ -269,19 +383,32 @@
|
|
269
383
|
if (tipOffset.left < 0) {
|
270
384
|
tipOffset.left = 0;
|
271
385
|
}
|
272
|
-
|
386
|
+
tip.offset(tipOffset);
|
387
|
+
if (step.placement === 'bottom' || step.placement === 'top') {
|
388
|
+
if (original_left !== tipOffset.left) {
|
389
|
+
return this._replaceArrow(tip, (tipOffset.left - original_left) * 2, original_offsetWidth, 'left');
|
390
|
+
}
|
391
|
+
} else {
|
392
|
+
if (original_top !== tipOffset.top) {
|
393
|
+
return this._replaceArrow(tip, (tipOffset.top - original_top) * 2, original_offsetHeight, 'top');
|
394
|
+
}
|
395
|
+
}
|
396
|
+
};
|
397
|
+
|
398
|
+
Tour.prototype._replaceArrow = function(tip, delta, dimension, position) {
|
399
|
+
return tip.find(".arrow").css(position, delta ? 50 * (1 - delta / dimension) + "%" : '');
|
273
400
|
};
|
274
401
|
|
275
402
|
Tour.prototype._scrollIntoView = function(tip) {
|
276
403
|
var tipRect;
|
277
404
|
tipRect = tip.get(0).getBoundingClientRect();
|
278
|
-
if (!(tipRect.top
|
405
|
+
if (!(tipRect.top >= 0 && tipRect.bottom < $(window).height() && tipRect.left >= 0 && tipRect.right < $(window).width())) {
|
279
406
|
return tip.get(0).scrollIntoView(true);
|
280
407
|
}
|
281
408
|
};
|
282
409
|
|
283
410
|
Tour.prototype._onresize = function(cb, timeout) {
|
284
|
-
return $(window).resize
|
411
|
+
return $(window).on("resize.bootstrap-tour", function() {
|
285
412
|
clearTimeout(timeout);
|
286
413
|
return timeout = setTimeout(cb, 100);
|
287
414
|
});
|
@@ -299,6 +426,8 @@
|
|
299
426
|
e.preventDefault();
|
300
427
|
if (_this._current < _this._steps.length - 1) {
|
301
428
|
return _this.next();
|
429
|
+
} else {
|
430
|
+
return _this.end();
|
302
431
|
}
|
303
432
|
break;
|
304
433
|
case 37:
|
@@ -306,11 +435,84 @@
|
|
306
435
|
if (_this._current > 0) {
|
307
436
|
return _this.prev();
|
308
437
|
}
|
438
|
+
break;
|
439
|
+
case 27:
|
440
|
+
e.preventDefault();
|
441
|
+
return _this.end();
|
309
442
|
}
|
310
443
|
});
|
311
444
|
}
|
312
445
|
};
|
313
446
|
|
447
|
+
Tour.prototype._makePromise = function(result) {
|
448
|
+
if (result && $.isFunction(result.then)) {
|
449
|
+
return result;
|
450
|
+
} else {
|
451
|
+
return null;
|
452
|
+
}
|
453
|
+
};
|
454
|
+
|
455
|
+
Tour.prototype._callOnPromiseDone = function(promise, cb, arg) {
|
456
|
+
var _this = this;
|
457
|
+
if (promise) {
|
458
|
+
return promise.then(function(e) {
|
459
|
+
return cb.call(_this, arg);
|
460
|
+
});
|
461
|
+
} else {
|
462
|
+
return cb.call(this, arg);
|
463
|
+
}
|
464
|
+
};
|
465
|
+
|
466
|
+
Tour.prototype._showBackdrop = function(el) {
|
467
|
+
if (this.backdrop.overlay !== null) {
|
468
|
+
return;
|
469
|
+
}
|
470
|
+
this._showOverlay();
|
471
|
+
return this._showOverlayElement(el);
|
472
|
+
};
|
473
|
+
|
474
|
+
Tour.prototype._hideBackdrop = function() {
|
475
|
+
if (this.backdrop.overlay === null) {
|
476
|
+
return;
|
477
|
+
}
|
478
|
+
this._hideOverlayElement();
|
479
|
+
return this._hideOverlay();
|
480
|
+
};
|
481
|
+
|
482
|
+
Tour.prototype._showOverlay = function() {
|
483
|
+
this.backdrop = $('<div/>');
|
484
|
+
this.backdrop.addClass('tour-backdrop');
|
485
|
+
this.backdrop.height($(document).innerHeight());
|
486
|
+
return $('body').append(this.backdrop);
|
487
|
+
};
|
488
|
+
|
489
|
+
Tour.prototype._hideOverlay = function() {
|
490
|
+
this.backdrop.remove();
|
491
|
+
return this.backdrop.overlay = null;
|
492
|
+
};
|
493
|
+
|
494
|
+
Tour.prototype._showOverlayElement = function(el) {
|
495
|
+
var background, offset, padding, step;
|
496
|
+
step = $(el);
|
497
|
+
padding = 5;
|
498
|
+
offset = step.offset();
|
499
|
+
offset.top = offset.top - padding;
|
500
|
+
offset.left = offset.left - padding;
|
501
|
+
background = $('<div/>');
|
502
|
+
background.width(step.innerWidth() + padding).height(step.innerHeight() + padding).addClass('tour-step-background').offset(offset);
|
503
|
+
step.addClass('tour-step-backdrop');
|
504
|
+
$('body').append(background);
|
505
|
+
this.backdrop.step = step;
|
506
|
+
return this.backdrop.background = background;
|
507
|
+
};
|
508
|
+
|
509
|
+
Tour.prototype._hideOverlayElement = function() {
|
510
|
+
this.backdrop.step.removeClass('tour-step-backdrop');
|
511
|
+
this.backdrop.background.remove();
|
512
|
+
this.backdrop.step = null;
|
513
|
+
return this.backdrop.background = null;
|
514
|
+
};
|
515
|
+
|
314
516
|
return Tour;
|
315
517
|
|
316
518
|
})();
|
@@ -0,0 +1,19 @@
|
|
1
|
+
.tour-backdrop {
|
2
|
+
position: absolute;
|
3
|
+
z-index: 1009;
|
4
|
+
background: #000;
|
5
|
+
opacity: 0.8;
|
6
|
+
top: 0;
|
7
|
+
left: 0;
|
8
|
+
width: 100%;
|
9
|
+
}
|
10
|
+
.tour-step-backdrop {
|
11
|
+
position: relative;
|
12
|
+
z-index: 1011;
|
13
|
+
}
|
14
|
+
.tour-step-background {
|
15
|
+
position: absolute;
|
16
|
+
z-index: 1010;
|
17
|
+
background: #fff;
|
18
|
+
border-radius: 6px;
|
19
|
+
}
|
metadata
CHANGED
@@ -1,23 +1,33 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-tour-rails
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
version: 0.4.0
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Tien Le
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
16
|
+
|
17
|
+
date: 2013-06-27 00:00:00 +07:00
|
18
|
+
default_executable:
|
13
19
|
dependencies: []
|
20
|
+
|
14
21
|
description: Quick and easy product tours with Twitter Bootstrap Popovers.
|
15
|
-
email:
|
22
|
+
email:
|
16
23
|
- tienlx@gmail.com
|
17
24
|
executables: []
|
25
|
+
|
18
26
|
extensions: []
|
27
|
+
|
19
28
|
extra_rdoc_files: []
|
20
|
-
|
29
|
+
|
30
|
+
files:
|
21
31
|
- .gitignore
|
22
32
|
- Gemfile
|
23
33
|
- LICENSE
|
@@ -29,29 +39,36 @@ files:
|
|
29
39
|
- vendor/assets/javascripts/bootstrap-tour/bootstrap-tour.js
|
30
40
|
- vendor/assets/javascripts/bootstrap-tour/index.js
|
31
41
|
- vendor/assets/javascripts/bootstrap-tour/jquery.cookie.js
|
42
|
+
- vendor/assets/stylesheets/bootstrap-tour/bootstrap-tour.css
|
43
|
+
has_rdoc: true
|
32
44
|
homepage: https://github.com/tienle/bootstrap-tour-rails
|
33
45
|
licenses: []
|
46
|
+
|
34
47
|
post_install_message:
|
35
48
|
rdoc_options: []
|
36
|
-
|
49
|
+
|
50
|
+
require_paths:
|
37
51
|
- lib
|
38
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
requirements:
|
47
|
-
- -
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
version: "0"
|
50
66
|
requirements: []
|
67
|
+
|
51
68
|
rubyforge_project:
|
52
|
-
rubygems_version: 1.
|
69
|
+
rubygems_version: 1.3.6
|
53
70
|
signing_key:
|
54
71
|
specification_version: 3
|
55
|
-
summary: Bootstrap tour is a plugin for Bootstrap. It provides quick and easy product
|
56
|
-
tours with Twitter Bootstrap Popovers.
|
72
|
+
summary: Bootstrap tour is a plugin for Bootstrap. It provides quick and easy product tours with Twitter Bootstrap Popovers.
|
57
73
|
test_files: []
|
74
|
+
|