active_frontend 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +97 -0
- data/Rakefile +1 -0
- data/active_frontend.gemspec +23 -0
- data/app/assets/fonts/gotham/gotham-bold.eot +0 -0
- data/app/assets/fonts/gotham/gotham-bold.svg +2066 -0
- data/app/assets/fonts/gotham/gotham-bold.ttf +0 -0
- data/app/assets/fonts/gotham/gotham-bold.woff +0 -0
- data/app/assets/fonts/gotham/gotham-book.eot +0 -0
- data/app/assets/fonts/gotham/gotham-book.svg +631 -0
- data/app/assets/fonts/gotham/gotham-book.ttf +0 -0
- data/app/assets/fonts/gotham/gotham-book.woff +0 -0
- data/app/assets/fonts/gotham/gotham-light.eot +0 -0
- data/app/assets/fonts/gotham/gotham-light.svg +635 -0
- data/app/assets/fonts/gotham/gotham-light.ttf +0 -0
- data/app/assets/fonts/gotham/gotham-light.woff +0 -0
- data/app/assets/fonts/gotham/gotham-medium.eot +0 -0
- data/app/assets/fonts/gotham/gotham-medium.svg +629 -0
- data/app/assets/fonts/gotham/gotham-medium.ttf +0 -0
- data/app/assets/fonts/gotham/gotham-medium.woff +0 -0
- data/app/assets/fonts/ionicons/ionicons.eot +0 -0
- data/app/assets/fonts/ionicons/ionicons.svg +2232 -0
- data/app/assets/fonts/ionicons/ionicons.ttf +0 -0
- data/app/assets/fonts/ionicons/ionicons.woff +0 -0
- data/lib/active_frontend.rb +6 -0
- data/lib/active_frontend/version.rb +3 -0
- data/vendor/assets/javascripts/.keep +0 -0
- data/vendor/assets/javascripts/affix.js +153 -0
- data/vendor/assets/javascripts/alert.js +85 -0
- data/vendor/assets/javascripts/animation.js +45 -0
- data/vendor/assets/javascripts/button.js +107 -0
- data/vendor/assets/javascripts/carousel.js +228 -0
- data/vendor/assets/javascripts/chart.js +3309 -0
- data/vendor/assets/javascripts/collapse.js +202 -0
- data/vendor/assets/javascripts/date_picker.js +1649 -0
- data/vendor/assets/javascripts/dropdown.js +152 -0
- data/vendor/assets/javascripts/file_input.js +71 -0
- data/vendor/assets/javascripts/hoverdown.js +109 -0
- data/vendor/assets/javascripts/map.js +2174 -0
- data/vendor/assets/javascripts/modal.js +234 -0
- data/vendor/assets/javascripts/popover.js +99 -0
- data/vendor/assets/javascripts/scrollspy.js +163 -0
- data/vendor/assets/javascripts/sort.js +1432 -0
- data/vendor/assets/javascripts/swoggle.js +415 -0
- data/vendor/assets/javascripts/tab.js +144 -0
- data/vendor/assets/javascripts/tablespy.js +1883 -0
- data/vendor/assets/javascripts/time_ago.js +206 -0
- data/vendor/assets/javascripts/time_picker.js +1087 -0
- data/vendor/assets/javascripts/tooltip.js +466 -0
- data/vendor/assets/javascripts/transition.js +50 -0
- data/vendor/assets/javascripts/typeahead.js +368 -0
- data/vendor/assets/stylesheets/.keep +0 -0
- data/vendor/assets/stylesheets/ad.scss +72 -0
- data/vendor/assets/stylesheets/affix.scss +11 -0
- data/vendor/assets/stylesheets/alert.scss +57 -0
- data/vendor/assets/stylesheets/animation.scss +2388 -0
- data/vendor/assets/stylesheets/aside.scss +136 -0
- data/vendor/assets/stylesheets/breadcrumb.scss +23 -0
- data/vendor/assets/stylesheets/button.scss +581 -0
- data/vendor/assets/stylesheets/carousel.scss +152 -0
- data/vendor/assets/stylesheets/chart.scss +11 -0
- data/vendor/assets/stylesheets/code.scss +139 -0
- data/vendor/assets/stylesheets/collapse.scss +15 -0
- data/vendor/assets/stylesheets/datepicker.scss +136 -0
- data/vendor/assets/stylesheets/dropdown.scss +90 -0
- data/vendor/assets/stylesheets/footer.scss +68 -0
- data/vendor/assets/stylesheets/form.scss +346 -0
- data/vendor/assets/stylesheets/grid.scss +287 -0
- data/vendor/assets/stylesheets/header.scss +205 -0
- data/vendor/assets/stylesheets/icon.scss +1538 -0
- data/vendor/assets/stylesheets/image.scss +330 -0
- data/vendor/assets/stylesheets/label_and_badge.scss +110 -0
- data/vendor/assets/stylesheets/link.scss +25 -0
- data/vendor/assets/stylesheets/list.scss +60 -0
- data/vendor/assets/stylesheets/map.scss +13 -0
- data/vendor/assets/stylesheets/modal.scss +137 -0
- data/vendor/assets/stylesheets/nav_and_tab.scss +183 -0
- data/vendor/assets/stylesheets/pagination.scss +41 -0
- data/vendor/assets/stylesheets/panel.scss +62 -0
- data/vendor/assets/stylesheets/placeholder.scss +44 -0
- data/vendor/assets/stylesheets/popover.scss +117 -0
- data/vendor/assets/stylesheets/progress.scss +43 -0
- data/vendor/assets/stylesheets/reset.scss +88 -0
- data/vendor/assets/stylesheets/spinner.scss +767 -0
- data/vendor/assets/stylesheets/swoggle.scss +126 -0
- data/vendor/assets/stylesheets/table.scss +149 -0
- data/vendor/assets/stylesheets/timepicker.scss +75 -0
- data/vendor/assets/stylesheets/tooltip.scss +90 -0
- data/vendor/assets/stylesheets/transition.scss +12 -0
- data/vendor/assets/stylesheets/trunk.scss +116 -0
- data/vendor/assets/stylesheets/typeahead.scss +8 -0
- data/vendor/assets/stylesheets/typography.scss +191 -0
- metadata +167 -0
@@ -0,0 +1,415 @@
|
|
1
|
+
(function() {
|
2
|
+
var __slice = [].slice;
|
3
|
+
|
4
|
+
(function($, window) {
|
5
|
+
"use strict";
|
6
|
+
var swoggle;
|
7
|
+
swoggle = (function() {
|
8
|
+
swoggle.prototype.defaults = {
|
9
|
+
state: true,
|
10
|
+
size: null,
|
11
|
+
animate: true,
|
12
|
+
disabled: false,
|
13
|
+
readonly: false,
|
14
|
+
onColor: null,
|
15
|
+
offColor: null,
|
16
|
+
onText: "",
|
17
|
+
offText: "",
|
18
|
+
labelText: " "
|
19
|
+
};
|
20
|
+
|
21
|
+
swoggle.prototype.name = "swoggle";
|
22
|
+
|
23
|
+
function swoggle(element, options) {
|
24
|
+
if (options == null) {
|
25
|
+
options = {};
|
26
|
+
}
|
27
|
+
this.$element = $(element);
|
28
|
+
this.options = $.extend({}, this.defaults, options, {
|
29
|
+
state: this.$element.is(":checked"),
|
30
|
+
size: this.$element.data("size"),
|
31
|
+
animate: this.$element.data("animate"),
|
32
|
+
disabled: this.$element.is(":disabled"),
|
33
|
+
readonly: this.$element.is("[readonly]"),
|
34
|
+
onColor: this.$element.data("on-color"),
|
35
|
+
offColor: this.$element.data("off-color"),
|
36
|
+
onText: this.$element.data("on-text"),
|
37
|
+
offText: this.$element.data("off-text"),
|
38
|
+
labelText: this.$element.data("label-text")
|
39
|
+
});
|
40
|
+
this.$on = $("<span>", {
|
41
|
+
"class": "" + this.name + "-handle-on " + this.name + "-" + this.options.onColor,
|
42
|
+
html: this.options.onText
|
43
|
+
});
|
44
|
+
this.$off = $("<span>", {
|
45
|
+
"class": "" + this.name + "-handle-off " + this.name + "-" + this.options.offColor,
|
46
|
+
html: this.options.offText
|
47
|
+
});
|
48
|
+
this.$label = $("<label>", {
|
49
|
+
"for": this.$element.attr("id"),
|
50
|
+
html: this.options.labelText
|
51
|
+
});
|
52
|
+
this.$wrapper = $("<div>", {
|
53
|
+
"class": (function(_this) {
|
54
|
+
return function() {
|
55
|
+
var classes;
|
56
|
+
classes = ["" + _this.name];
|
57
|
+
classes.push(_this.options.state ? "" + _this.name + "-on" : "" + _this.name + "-off");
|
58
|
+
if (_this.options.size != null) {
|
59
|
+
classes.push("" + _this.name + "-" + _this.options.size);
|
60
|
+
}
|
61
|
+
if (_this.options.onColor != null) {
|
62
|
+
classes.push("" + _this.name + "-" + _this.options.onColor);
|
63
|
+
}
|
64
|
+
if (_this.options.animate) {
|
65
|
+
classes.push("" + _this.name + "-animate");
|
66
|
+
}
|
67
|
+
if (_this.options.disabled) {
|
68
|
+
classes.push("" + _this.name + "-disabled");
|
69
|
+
}
|
70
|
+
if (_this.options.readonly) {
|
71
|
+
classes.push("" + _this.name + "-readonly");
|
72
|
+
}
|
73
|
+
if (_this.$element.attr("id")) {
|
74
|
+
classes.push("" + _this.name + "-id-" + (_this.$element.attr("id")));
|
75
|
+
}
|
76
|
+
return classes.join(" ");
|
77
|
+
};
|
78
|
+
})(this)
|
79
|
+
});
|
80
|
+
this.$div = this.$element.wrap($("<div>")).parent();
|
81
|
+
this.$wrapper = this.$div.wrap(this.$wrapper).parent();
|
82
|
+
this.$element.before(this.$on).before(this.$label).before(this.$off);
|
83
|
+
this._elementHandlers();
|
84
|
+
this._handleHandlers();
|
85
|
+
this._labelHandlers();
|
86
|
+
this._formHandler();
|
87
|
+
}
|
88
|
+
|
89
|
+
swoggle.prototype._constructor = swoggle;
|
90
|
+
|
91
|
+
swoggle.prototype.state = function(value, skip) {
|
92
|
+
if (typeof value === "undefined") {
|
93
|
+
return this.options.state;
|
94
|
+
}
|
95
|
+
if (this.options.disabled || this.options.readonly) {
|
96
|
+
return this.$element;
|
97
|
+
}
|
98
|
+
value = !!value;
|
99
|
+
this.$element.prop("checked", value).trigger("change.swoggle", skip);
|
100
|
+
return this.$element;
|
101
|
+
};
|
102
|
+
|
103
|
+
swoggle.prototype.toggleState = function(skip) {
|
104
|
+
if (this.options.disabled || this.options.readonly) {
|
105
|
+
return this.$element;
|
106
|
+
}
|
107
|
+
return this.$element.prop("checked", !this.options.state).trigger("change.swoggle", skip);
|
108
|
+
};
|
109
|
+
|
110
|
+
swoggle.prototype.size = function(value) {
|
111
|
+
if (typeof value === "undefined") {
|
112
|
+
return this.options.size;
|
113
|
+
}
|
114
|
+
if (this.options.size != null) {
|
115
|
+
this.$wrapper.removeClass("" + this.name + "-" + this.options.size);
|
116
|
+
}
|
117
|
+
this.$wrapper.addClass("" + this.name + "-" + value);
|
118
|
+
this.options.size = value;
|
119
|
+
return this.$element;
|
120
|
+
};
|
121
|
+
|
122
|
+
swoggle.prototype.animate = function(value) {
|
123
|
+
if (typeof value === "undefined") {
|
124
|
+
return this.options.animate;
|
125
|
+
}
|
126
|
+
value = !!value;
|
127
|
+
this.$wrapper[value ? "addClass" : "removeClass"]("" + this.name + "-animate");
|
128
|
+
this.options.animate = value;
|
129
|
+
return this.$element;
|
130
|
+
};
|
131
|
+
|
132
|
+
swoggle.prototype.disabled = function(value) {
|
133
|
+
if (typeof value === "undefined") {
|
134
|
+
return this.options.disabled;
|
135
|
+
}
|
136
|
+
value = !!value;
|
137
|
+
this.$wrapper[value ? "addClass" : "removeClass"]("" + this.name + "-disabled");
|
138
|
+
this.$element.prop("disabled", value);
|
139
|
+
this.options.disabled = value;
|
140
|
+
return this.$element;
|
141
|
+
};
|
142
|
+
|
143
|
+
swoggle.prototype.toggleDisabled = function() {
|
144
|
+
this.$element.prop("disabled", !this.options.disabled);
|
145
|
+
this.$wrapper.toggleClass("" + this.name + "-disabled");
|
146
|
+
this.options.disabled = !this.options.disabled;
|
147
|
+
return this.$element;
|
148
|
+
};
|
149
|
+
|
150
|
+
swoggle.prototype.readonly = function(value) {
|
151
|
+
if (typeof value === "undefined") {
|
152
|
+
return this.options.readonly;
|
153
|
+
}
|
154
|
+
value = !!value;
|
155
|
+
this.$wrapper[value ? "addClass" : "removeClass"]("" + this.name + "-readonly");
|
156
|
+
this.$element.prop("readonly", value);
|
157
|
+
this.options.readonly = value;
|
158
|
+
return this.$element;
|
159
|
+
};
|
160
|
+
|
161
|
+
swoggle.prototype.toggleReadonly = function() {
|
162
|
+
this.$element.prop("readonly", !this.options.readonly);
|
163
|
+
this.$wrapper.toggleClass("" + this.name + "-readonly");
|
164
|
+
this.options.readonly = !this.options.readonly;
|
165
|
+
return this.$element;
|
166
|
+
};
|
167
|
+
|
168
|
+
swoggle.prototype.onColor = function(value) {
|
169
|
+
var color;
|
170
|
+
color = this.options.onColor;
|
171
|
+
if (typeof value === "undefined") {
|
172
|
+
return color;
|
173
|
+
}
|
174
|
+
if (color != null) {
|
175
|
+
this.$on.removeClass("" + this.name + "-" + color);
|
176
|
+
}
|
177
|
+
this.$on.addClass("" + this.name + "-" + value);
|
178
|
+
this.options.onColor = value;
|
179
|
+
return this.$element;
|
180
|
+
};
|
181
|
+
|
182
|
+
swoggle.prototype.offColor = function(value) {
|
183
|
+
var color;
|
184
|
+
color = this.options.offColor;
|
185
|
+
if (typeof value === "undefined") {
|
186
|
+
return color;
|
187
|
+
}
|
188
|
+
if (color != null) {
|
189
|
+
this.$off.removeClass("" + this.name + "-" + color);
|
190
|
+
}
|
191
|
+
this.$off.addClass("" + this.name + "-" + value);
|
192
|
+
this.options.offColor = value;
|
193
|
+
return this.$element;
|
194
|
+
};
|
195
|
+
|
196
|
+
swoggle.prototype.onText = function(value) {
|
197
|
+
if (typeof value === "undefined") {
|
198
|
+
return this.options.onText;
|
199
|
+
}
|
200
|
+
this.$on.html(value);
|
201
|
+
this.options.onText = value;
|
202
|
+
return this.$element;
|
203
|
+
};
|
204
|
+
|
205
|
+
swoggle.prototype.offText = function(value) {
|
206
|
+
if (typeof value === "undefined") {
|
207
|
+
return this.options.offText;
|
208
|
+
}
|
209
|
+
this.$off.html(value);
|
210
|
+
this.options.offText = value;
|
211
|
+
return this.$element;
|
212
|
+
};
|
213
|
+
|
214
|
+
swoggle.prototype.labelText = function(value) {
|
215
|
+
if (typeof value === "undefined") {
|
216
|
+
return this.options.labelText;
|
217
|
+
}
|
218
|
+
this.$label.html(value);
|
219
|
+
this.options.labelText = value;
|
220
|
+
return this.$element;
|
221
|
+
};
|
222
|
+
|
223
|
+
swoggle.prototype.destroy = function() {
|
224
|
+
var $form;
|
225
|
+
$form = this.$element.closest("form");
|
226
|
+
if ($form.length) {
|
227
|
+
$form.off("reset.swoggle").removeData("swoggle");
|
228
|
+
}
|
229
|
+
this.$div.children().not(this.$element).remove();
|
230
|
+
this.$element.unwrap().unwrap().off(".swoggle").removeData("swoggle");
|
231
|
+
return this.$element;
|
232
|
+
};
|
233
|
+
|
234
|
+
swoggle.prototype._elementHandlers = function() {
|
235
|
+
return this.$element.on({
|
236
|
+
"change.swoggle": (function(_this) {
|
237
|
+
return function(e, skip) {
|
238
|
+
var checked;
|
239
|
+
e.preventDefault();
|
240
|
+
e.stopPropagation();
|
241
|
+
e.stopImmediatePropagation();
|
242
|
+
checked = _this.$element.is(":checked");
|
243
|
+
if (checked === _this.options.state) {
|
244
|
+
return;
|
245
|
+
}
|
246
|
+
_this.options.state = checked;
|
247
|
+
_this.$wrapper.removeClass(checked ? "" + _this.name + "-off" : "" + _this.name + "-on").addClass(checked ? "" + _this.name + "-on" : "" + _this.name + "-off");
|
248
|
+
if (!skip) {
|
249
|
+
if (_this.$element.is(":radio")) {
|
250
|
+
$("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.swoggle", true);
|
251
|
+
}
|
252
|
+
return _this.$element.trigger("switchChange", {
|
253
|
+
el: _this.$element,
|
254
|
+
value: checked
|
255
|
+
});
|
256
|
+
}
|
257
|
+
};
|
258
|
+
})(this),
|
259
|
+
"focus.swoggle": (function(_this) {
|
260
|
+
return function(e) {
|
261
|
+
e.preventDefault();
|
262
|
+
e.stopPropagation();
|
263
|
+
e.stopImmediatePropagation();
|
264
|
+
return _this.$wrapper.addClass("" + _this.name + "-focused");
|
265
|
+
};
|
266
|
+
})(this),
|
267
|
+
"blur.swoggle": (function(_this) {
|
268
|
+
return function(e) {
|
269
|
+
e.preventDefault();
|
270
|
+
e.stopPropagation();
|
271
|
+
e.stopImmediatePropagation();
|
272
|
+
return _this.$wrapper.removeClass("" + _this.name + "-focused");
|
273
|
+
};
|
274
|
+
})(this),
|
275
|
+
"keydown.swoggle": (function(_this) {
|
276
|
+
return function(e) {
|
277
|
+
if (!e.which || _this.options.disabled || _this.options.readonly) {
|
278
|
+
return;
|
279
|
+
}
|
280
|
+
switch (e.which) {
|
281
|
+
case 32:
|
282
|
+
e.preventDefault();
|
283
|
+
e.stopPropagation();
|
284
|
+
e.stopImmediatePropagation();
|
285
|
+
return _this.toggleState();
|
286
|
+
case 37:
|
287
|
+
e.preventDefault();
|
288
|
+
e.stopPropagation();
|
289
|
+
e.stopImmediatePropagation();
|
290
|
+
return _this.state(false);
|
291
|
+
case 39:
|
292
|
+
e.preventDefault();
|
293
|
+
e.stopPropagation();
|
294
|
+
e.stopImmediatePropagation();
|
295
|
+
return _this.state(true);
|
296
|
+
}
|
297
|
+
};
|
298
|
+
})(this)
|
299
|
+
});
|
300
|
+
};
|
301
|
+
|
302
|
+
swoggle.prototype._handleHandlers = function() {
|
303
|
+
this.$on.on("click.swoggle", (function(_this) {
|
304
|
+
return function(e) {
|
305
|
+
_this.state(false);
|
306
|
+
return _this.$element.trigger("focus.swoggle");
|
307
|
+
};
|
308
|
+
})(this));
|
309
|
+
return this.$off.on("click.swoggle", (function(_this) {
|
310
|
+
return function(e) {
|
311
|
+
_this.state(true);
|
312
|
+
return _this.$element.trigger("focus.swoggle");
|
313
|
+
};
|
314
|
+
})(this));
|
315
|
+
};
|
316
|
+
|
317
|
+
swoggle.prototype._labelHandlers = function() {
|
318
|
+
return this.$label.on({
|
319
|
+
"mousemove.swoggle": (function(_this) {
|
320
|
+
return function(e) {
|
321
|
+
var left, percent, right;
|
322
|
+
if (!_this.drag) {
|
323
|
+
return;
|
324
|
+
}
|
325
|
+
percent = ((e.pageX - _this.$wrapper.offset().left) / _this.$wrapper.width()) * 100;
|
326
|
+
left = 25;
|
327
|
+
right = 75;
|
328
|
+
if (percent < left) {
|
329
|
+
percent = left;
|
330
|
+
} else if (percent > right) {
|
331
|
+
percent = right;
|
332
|
+
}
|
333
|
+
_this.$div.css("margin-left", "" + (percent - right) + "%");
|
334
|
+
return _this.$element.trigger("focus.swoggle");
|
335
|
+
};
|
336
|
+
})(this),
|
337
|
+
"mousedown.swoggle": (function(_this) {
|
338
|
+
return function(e) {
|
339
|
+
if (_this.drag || _this.options.disabled || _this.options.readonly) {
|
340
|
+
return;
|
341
|
+
}
|
342
|
+
_this.drag = true;
|
343
|
+
if (_this.options.animate) {
|
344
|
+
_this.$wrapper.removeClass("" + _this.name + "-animate");
|
345
|
+
}
|
346
|
+
return _this.$element.trigger("focus.swoggle");
|
347
|
+
};
|
348
|
+
})(this),
|
349
|
+
"mouseup.swoggle": (function(_this) {
|
350
|
+
return function(e) {
|
351
|
+
if (!_this.drag) {
|
352
|
+
return;
|
353
|
+
}
|
354
|
+
_this.drag = false;
|
355
|
+
_this.$element.prop("checked", parseInt(_this.$div.css("margin-left"), 10) > -25).trigger("change.swoggle");
|
356
|
+
_this.$div.css("margin-left", "");
|
357
|
+
if (_this.options.animate) {
|
358
|
+
return _this.$wrapper.addClass("" + _this.name + "-animate");
|
359
|
+
}
|
360
|
+
};
|
361
|
+
})(this),
|
362
|
+
"click.swoggle": (function(_this) {
|
363
|
+
return function(e) {
|
364
|
+
e.preventDefault();
|
365
|
+
e.stopImmediatePropagation();
|
366
|
+
_this.toggleState();
|
367
|
+
return _this.$element.trigger("focus.swoggle");
|
368
|
+
};
|
369
|
+
})(this)
|
370
|
+
});
|
371
|
+
};
|
372
|
+
|
373
|
+
swoggle.prototype._formHandler = function() {
|
374
|
+
var $form;
|
375
|
+
$form = this.$element.closest("form");
|
376
|
+
if ($form.data("swoggle")) {
|
377
|
+
return;
|
378
|
+
}
|
379
|
+
return $form.on("reset.swoggle", function() {
|
380
|
+
return window.setTimeout(function() {
|
381
|
+
return $form.find("input").filter(function() {
|
382
|
+
return $(this).data("swoggle");
|
383
|
+
}).each(function() {
|
384
|
+
return $(this).swoggle("state", false);
|
385
|
+
});
|
386
|
+
}, 1);
|
387
|
+
}).data("swoggle", true);
|
388
|
+
};
|
389
|
+
|
390
|
+
return swoggle;
|
391
|
+
|
392
|
+
})();
|
393
|
+
$.fn.extend({
|
394
|
+
swoggle: function() {
|
395
|
+
var args, option, ret;
|
396
|
+
option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
397
|
+
ret = this;
|
398
|
+
this.each(function() {
|
399
|
+
var $this, data;
|
400
|
+
$this = $(this);
|
401
|
+
data = $this.data("swoggle");
|
402
|
+
if (!data) {
|
403
|
+
$this.data("swoggle", data = new swoggle(this, option));
|
404
|
+
}
|
405
|
+
if (typeof option === "string") {
|
406
|
+
return ret = data[option].apply(data, args);
|
407
|
+
}
|
408
|
+
});
|
409
|
+
return ret;
|
410
|
+
}
|
411
|
+
});
|
412
|
+
return $.fn.swoggle.Constructor = swoggle;
|
413
|
+
})(window.jQuery, window);
|
414
|
+
|
415
|
+
}).call(this);
|
@@ -0,0 +1,144 @@
|
|
1
|
+
+function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// TAB CLASS DEFINITION
|
5
|
+
// ====================
|
6
|
+
|
7
|
+
var Tab = function (element) {
|
8
|
+
this.element = $(element)
|
9
|
+
}
|
10
|
+
|
11
|
+
Tab.VERSION = '3.3.2'
|
12
|
+
|
13
|
+
Tab.TRANSITION_DURATION = 150
|
14
|
+
|
15
|
+
Tab.prototype.show = function () {
|
16
|
+
var $this = this.element
|
17
|
+
var $ul = $this.closest('ul:not(.dropdown-menu)')
|
18
|
+
var selector = $this.data('target')
|
19
|
+
|
20
|
+
if (!selector) {
|
21
|
+
selector = $this.attr('href')
|
22
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
|
23
|
+
}
|
24
|
+
|
25
|
+
if ($this.parent('li').hasClass('active')) return
|
26
|
+
|
27
|
+
var $previous = $ul.find('.active:last a')
|
28
|
+
var hideEvent = $.Event('hide.bs.tab', {
|
29
|
+
relatedTarget: $this[0]
|
30
|
+
})
|
31
|
+
var showEvent = $.Event('show.bs.tab', {
|
32
|
+
relatedTarget: $previous[0]
|
33
|
+
})
|
34
|
+
|
35
|
+
$previous.trigger(hideEvent)
|
36
|
+
$this.trigger(showEvent)
|
37
|
+
|
38
|
+
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
|
39
|
+
|
40
|
+
var $target = $(selector)
|
41
|
+
|
42
|
+
this.activate($this.closest('li'), $ul)
|
43
|
+
this.activate($target, $target.parent(), function () {
|
44
|
+
$previous.trigger({
|
45
|
+
type: 'hidden.bs.tab',
|
46
|
+
relatedTarget: $this[0]
|
47
|
+
})
|
48
|
+
$this.trigger({
|
49
|
+
type: 'shown.bs.tab',
|
50
|
+
relatedTarget: $previous[0]
|
51
|
+
})
|
52
|
+
})
|
53
|
+
}
|
54
|
+
|
55
|
+
Tab.prototype.activate = function (element, container, callback) {
|
56
|
+
var $active = container.find('> .active')
|
57
|
+
var transition = callback
|
58
|
+
&& $.support.transition
|
59
|
+
&& (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length)
|
60
|
+
|
61
|
+
function next() {
|
62
|
+
$active
|
63
|
+
.removeClass('active')
|
64
|
+
.find('> .dropdown-menu > .active')
|
65
|
+
.removeClass('active')
|
66
|
+
.end()
|
67
|
+
.find('[data-toggle="tab"]')
|
68
|
+
.attr('aria-expanded', false)
|
69
|
+
|
70
|
+
element
|
71
|
+
.addClass('active')
|
72
|
+
.find('[data-toggle="tab"]')
|
73
|
+
.attr('aria-expanded', true)
|
74
|
+
|
75
|
+
if (transition) {
|
76
|
+
element[0].offsetWidth // reflow for transition
|
77
|
+
element.addClass('in')
|
78
|
+
} else {
|
79
|
+
element.removeClass('fade')
|
80
|
+
}
|
81
|
+
|
82
|
+
if (element.parent('.dropdown-menu').length) {
|
83
|
+
element
|
84
|
+
.closest('li.dropdown')
|
85
|
+
.addClass('active')
|
86
|
+
.end()
|
87
|
+
.find('[data-toggle="tab"]')
|
88
|
+
.attr('aria-expanded', true)
|
89
|
+
}
|
90
|
+
|
91
|
+
callback && callback()
|
92
|
+
}
|
93
|
+
|
94
|
+
$active.length && transition ?
|
95
|
+
$active
|
96
|
+
.one('bsTransitionEnd', next)
|
97
|
+
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
|
98
|
+
next()
|
99
|
+
|
100
|
+
$active.removeClass('in')
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
// TAB PLUGIN DEFINITION
|
105
|
+
// =====================
|
106
|
+
|
107
|
+
function Plugin(option) {
|
108
|
+
return this.each(function () {
|
109
|
+
var $this = $(this)
|
110
|
+
var data = $this.data('bs.tab')
|
111
|
+
|
112
|
+
if (!data) $this.data('bs.tab', (data = new Tab(this)))
|
113
|
+
if (typeof option == 'string') data[option]()
|
114
|
+
})
|
115
|
+
}
|
116
|
+
|
117
|
+
var old = $.fn.tab
|
118
|
+
|
119
|
+
$.fn.tab = Plugin
|
120
|
+
$.fn.tab.Constructor = Tab
|
121
|
+
|
122
|
+
|
123
|
+
// TAB NO CONFLICT
|
124
|
+
// ===============
|
125
|
+
|
126
|
+
$.fn.tab.noConflict = function () {
|
127
|
+
$.fn.tab = old
|
128
|
+
return this
|
129
|
+
}
|
130
|
+
|
131
|
+
|
132
|
+
// TAB DATA-API
|
133
|
+
// ============
|
134
|
+
|
135
|
+
var clickHandler = function (e) {
|
136
|
+
e.preventDefault()
|
137
|
+
Plugin.call($(this), 'show')
|
138
|
+
}
|
139
|
+
|
140
|
+
$(document)
|
141
|
+
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
|
142
|
+
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
|
143
|
+
|
144
|
+
}(jQuery);
|