active_frontend 13.3.0 → 14.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.fasterer.yml +19 -0
- data/.reek +27 -0
- data/.rubocop.yml +38 -0
- data/.scss-lint.yml +27 -0
- data/Rakefile +1 -1
- data/active_frontend.gemspec +21 -18
- data/app/.DS_Store +0 -0
- data/app/assets/.DS_Store +0 -0
- data/app/assets/fonts/.DS_Store +0 -0
- data/app/assets/fonts/dripicons/.DS_Store +0 -0
- data/app/assets/fonts/dripicons/dripicons.woff +0 -0
- data/app/assets/fonts/fakt-pro/.DS_Store +0 -0
- data/app/assets/fonts/fakt-pro/fakt-pro-bold.woff +0 -0
- data/app/assets/fonts/fakt-pro/fakt-pro-normal.woff +0 -0
- data/app/assets/fonts/fakt-pro/fakt-pro-semibold.woff +0 -0
- data/app/assets/fonts/fakt-pro/fakt-pro-semilight.woff +0 -0
- data/app/assets/fonts/fakt-soft-pro/.DS_Store +0 -0
- data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-bold.woff +0 -0
- data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-normal.woff +0 -0
- data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-semibold.woff +0 -0
- data/app/assets/fonts/fakt-soft-pro/fakt-soft-pro-semilight.woff +0 -0
- data/app/assets/images/.DS_Store +0 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/images/placeholders/.DS_Store +0 -0
- data/app/assets/images/placeholders/camera-large.png +0 -0
- data/app/assets/images/placeholders/camera-small.png +0 -0
- data/app/assets/images/placeholders/camera.png +0 -0
- data/app/assets/images/placeholders/document-large.png +0 -0
- data/app/assets/images/placeholders/document-small.png +0 -0
- data/app/assets/images/placeholders/document.png +0 -0
- data/app/assets/images/placeholders/photo-large.png +0 -0
- data/app/assets/images/placeholders/{picture-small.png → photo-small.png} +0 -0
- data/app/assets/images/placeholders/photo.png +0 -0
- data/app/assets/images/placeholders/store-large.png +0 -0
- data/app/assets/images/placeholders/store-small.png +0 -0
- data/app/assets/images/placeholders/store.png +0 -0
- data/app/assets/images/placeholders/user-large.png +0 -0
- data/app/assets/images/placeholders/user-small.png +0 -0
- data/app/assets/images/placeholders/user.png +0 -0
- data/app/helpers/active_frontend_helper.rb +22 -37
- data/lib/.DS_Store +0 -0
- data/lib/active_frontend.rb +3 -4
- data/lib/active_frontend/.DS_Store +0 -0
- data/lib/active_frontend/version.rb +1 -1
- data/lib/generators/active_frontend/install_generator.rb +3 -3
- data/lib/generators/active_frontend/templates/install.js +35 -30
- data/lib/generators/active_frontend/templates/install.scss +55 -58
- data/vendor/.DS_Store +0 -0
- data/vendor/assets/.DS_Store +0 -0
- data/vendor/assets/javascripts/.DS_Store +0 -0
- data/vendor/assets/javascripts/active_frontend.js +35 -30
- data/vendor/assets/javascripts/base/_affix.js +170 -0
- data/vendor/assets/javascripts/base/_alert.js +80 -0
- data/vendor/assets/javascripts/base/_animation.js +106 -0
- data/vendor/assets/javascripts/base/_button.js +123 -0
- data/vendor/assets/javascripts/base/_carousel.js +237 -0
- data/vendor/assets/javascripts/base/_collapse.js +200 -0
- data/vendor/assets/javascripts/base/_colorpicker.js +147 -0
- data/vendor/assets/javascripts/base/_datepicker.js +1411 -0
- data/vendor/assets/javascripts/base/_dropdown.js +154 -0
- data/vendor/assets/javascripts/base/_filepicker.js +235 -0
- data/vendor/assets/javascripts/base/_hoverdown.js +116 -0
- data/vendor/assets/javascripts/base/_layout.js +126 -0
- data/vendor/assets/javascripts/base/_list.js +103 -0
- data/vendor/assets/javascripts/{_modal.js → base/_modal.js} +170 -167
- data/vendor/assets/javascripts/base/_popover.js +101 -0
- data/vendor/assets/javascripts/base/_scrollspy.js +161 -0
- data/vendor/assets/javascripts/base/_switch.js +160 -0
- data/vendor/assets/javascripts/base/_tab.js +139 -0
- data/vendor/assets/javascripts/base/_table.js +224 -0
- data/vendor/assets/javascripts/base/_timeago.js +270 -0
- data/vendor/assets/javascripts/base/_timepicker.js +541 -0
- data/vendor/assets/javascripts/base/_tooltip.js +525 -0
- data/vendor/assets/javascripts/base/_tour.js +268 -0
- data/vendor/assets/javascripts/base/_transition.js +52 -0
- data/vendor/assets/javascripts/base/_typeahead.js +362 -0
- data/vendor/assets/javascripts/extensions/_calendar.js +4709 -0
- data/vendor/assets/javascripts/extensions/_chart.js +9371 -0
- data/vendor/assets/javascripts/extensions/_map.js +2153 -0
- data/vendor/assets/stylesheets/.DS_Store +0 -0
- data/vendor/assets/stylesheets/{_mixin.scss → _utility.scss} +96 -10
- data/vendor/assets/stylesheets/_variable.scss +201 -19
- data/vendor/assets/stylesheets/active_frontend.scss +55 -58
- data/vendor/assets/stylesheets/blocks/_anchor.scss +15 -0
- data/vendor/assets/stylesheets/blocks/_button.scss +278 -0
- data/vendor/assets/stylesheets/blocks/_code.scss +144 -0
- data/vendor/assets/stylesheets/blocks/_common.scss +127 -0
- data/vendor/assets/stylesheets/blocks/_form.scss +508 -0
- data/vendor/assets/stylesheets/blocks/_icon.scss +359 -0
- data/vendor/assets/stylesheets/blocks/_list.scss +76 -0
- data/vendor/assets/stylesheets/blocks/_multimedia.scss +62 -0
- data/vendor/assets/stylesheets/blocks/_reset.scss +179 -0
- data/vendor/assets/stylesheets/blocks/_table.scss +211 -0
- data/vendor/assets/stylesheets/blocks/_typography.scss +204 -0
- data/vendor/assets/stylesheets/components/_ad.scss +78 -0
- data/vendor/assets/stylesheets/components/_affix.scss +14 -0
- data/vendor/assets/stylesheets/components/_alert.scss +50 -0
- data/vendor/assets/stylesheets/components/_animation.scss +1670 -0
- data/vendor/assets/stylesheets/components/_breadcrumb.scss +17 -0
- data/vendor/assets/stylesheets/components/_calendar.scss +213 -0
- data/vendor/assets/stylesheets/components/_card.scss +30 -0
- data/vendor/assets/stylesheets/components/_carousel.scss +135 -0
- data/vendor/assets/stylesheets/components/_chart.scss +10 -0
- data/vendor/assets/stylesheets/components/_collapse.scss +17 -0
- data/vendor/assets/stylesheets/components/_colorpicker.scss +38 -0
- data/vendor/assets/stylesheets/components/_datepicker.scss +80 -0
- data/vendor/assets/stylesheets/components/_dropmenu.scss +151 -0
- data/vendor/assets/stylesheets/components/_footer.scss +11 -0
- data/vendor/assets/stylesheets/components/_grid.scss +144 -0
- data/vendor/assets/stylesheets/components/_header.scss +99 -0
- data/vendor/assets/stylesheets/components/_label_and_badge.scss +57 -0
- data/vendor/assets/stylesheets/components/_layout.scss +63 -0
- data/vendor/assets/stylesheets/components/_map.scss +14 -0
- data/vendor/assets/stylesheets/components/_milestone.scss +49 -0
- data/vendor/assets/stylesheets/components/_missive.scss +40 -0
- data/vendor/assets/stylesheets/components/_modal.scss +126 -0
- data/vendor/assets/stylesheets/components/_nav_and_tab.scss +202 -0
- data/vendor/assets/stylesheets/components/_navbar.scss +66 -0
- data/vendor/assets/stylesheets/components/_pagination.scss +79 -0
- data/vendor/assets/stylesheets/components/_placeholder.scss +23 -0
- data/vendor/assets/stylesheets/components/_popover.scss +167 -0
- data/vendor/assets/stylesheets/components/_progress.scss +62 -0
- data/vendor/assets/stylesheets/components/_sidebar.scss +74 -0
- data/vendor/assets/stylesheets/components/_spinner.scss +83 -0
- data/vendor/assets/stylesheets/components/_switch.scss +150 -0
- data/vendor/assets/stylesheets/components/_timepicker.scss +30 -0
- data/vendor/assets/stylesheets/components/_tooltip.scss +93 -0
- data/vendor/assets/stylesheets/components/_transition.scss +12 -0
- data/vendor/assets/stylesheets/components/_typeahead.scss +18 -0
- metadata +150 -94
- data/app/assets/fonts/gotham/gotham-bold.woff +0 -0
- data/app/assets/fonts/gotham/gotham-book.woff +0 -0
- data/app/assets/fonts/gotham/gotham-light.woff +0 -0
- data/app/assets/fonts/gotham/gotham-medium.woff +0 -0
- data/app/assets/fonts/gotham/gotham-rounded-bold.woff +0 -0
- data/app/assets/fonts/gotham/gotham-rounded-book.woff +0 -0
- data/app/assets/fonts/gotham/gotham-rounded-light.woff +0 -0
- data/app/assets/fonts/gotham/gotham-rounded-medium.woff +0 -0
- data/app/assets/images/placeholders/archive-large.png +0 -0
- data/app/assets/images/placeholders/archive-small.png +0 -0
- data/app/assets/images/placeholders/archive.png +0 -0
- data/app/assets/images/placeholders/picture-large.png +0 -0
- data/app/assets/images/placeholders/picture.png +0 -0
- data/vendor/assets/javascripts/_affix.js +0 -153
- data/vendor/assets/javascripts/_alert.js +0 -85
- data/vendor/assets/javascripts/_animation.js +0 -103
- data/vendor/assets/javascripts/_button.js +0 -107
- data/vendor/assets/javascripts/_carousel.js +0 -228
- data/vendor/assets/javascripts/_chart.js +0 -3742
- data/vendor/assets/javascripts/_collapse.js +0 -202
- data/vendor/assets/javascripts/_color_picker.js +0 -108
- data/vendor/assets/javascripts/_date_picker.js +0 -1650
- data/vendor/assets/javascripts/_dropdown.js +0 -156
- data/vendor/assets/javascripts/_file_input.js +0 -71
- data/vendor/assets/javascripts/_hoverdown.js +0 -109
- data/vendor/assets/javascripts/_inputmask.js +0 -341
- data/vendor/assets/javascripts/_loader.js +0 -361
- data/vendor/assets/javascripts/_map.js +0 -2401
- data/vendor/assets/javascripts/_popover.js +0 -99
- data/vendor/assets/javascripts/_scrollspy.js +0 -163
- data/vendor/assets/javascripts/_slider.js +0 -1572
- data/vendor/assets/javascripts/_sort.js +0 -1432
- data/vendor/assets/javascripts/_swoggle.js +0 -415
- data/vendor/assets/javascripts/_tab.js +0 -146
- data/vendor/assets/javascripts/_tablespy.js +0 -1883
- data/vendor/assets/javascripts/_time_ago.js +0 -206
- data/vendor/assets/javascripts/_time_picker.js +0 -1088
- data/vendor/assets/javascripts/_tooltip.js +0 -504
- data/vendor/assets/javascripts/_transition.js +0 -50
- data/vendor/assets/javascripts/_typeahead.js +0 -366
- data/vendor/assets/stylesheets/_ad.scss +0 -63
- data/vendor/assets/stylesheets/_affix.scss +0 -14
- data/vendor/assets/stylesheets/_alert.scss +0 -114
- data/vendor/assets/stylesheets/_animation.scss +0 -1370
- data/vendor/assets/stylesheets/_breadcrumb.scss +0 -100
- data/vendor/assets/stylesheets/_button.scss +0 -386
- data/vendor/assets/stylesheets/_canvas.scss +0 -182
- data/vendor/assets/stylesheets/_carousel.scss +0 -158
- data/vendor/assets/stylesheets/_chart.scss +0 -15
- data/vendor/assets/stylesheets/_code.scss +0 -150
- data/vendor/assets/stylesheets/_collapse.scss +0 -14
- data/vendor/assets/stylesheets/_color.scss +0 -55
- data/vendor/assets/stylesheets/_colorpicker.scss +0 -63
- data/vendor/assets/stylesheets/_datepicker.scss +0 -122
- data/vendor/assets/stylesheets/_dropdown.scss +0 -248
- data/vendor/assets/stylesheets/_footer.scss +0 -71
- data/vendor/assets/stylesheets/_form.scss +0 -661
- data/vendor/assets/stylesheets/_grid.scss +0 -184
- data/vendor/assets/stylesheets/_header.scss +0 -156
- data/vendor/assets/stylesheets/_icon.scss +0 -362
- data/vendor/assets/stylesheets/_image.scss +0 -33
- data/vendor/assets/stylesheets/_label_and_badge.scss +0 -104
- data/vendor/assets/stylesheets/_link.scss +0 -55
- data/vendor/assets/stylesheets/_list.scss +0 -122
- data/vendor/assets/stylesheets/_loader.scss +0 -71
- data/vendor/assets/stylesheets/_map.scss +0 -44
- data/vendor/assets/stylesheets/_missive.scss +0 -74
- data/vendor/assets/stylesheets/_modal.scss +0 -204
- data/vendor/assets/stylesheets/_nav_and_tab.scss +0 -230
- data/vendor/assets/stylesheets/_navbar.scss +0 -73
- data/vendor/assets/stylesheets/_pagination.scss +0 -79
- data/vendor/assets/stylesheets/_panel.scss +0 -80
- data/vendor/assets/stylesheets/_placeholder.scss +0 -63
- data/vendor/assets/stylesheets/_popover.scss +0 -128
- data/vendor/assets/stylesheets/_progress.scss +0 -86
- data/vendor/assets/stylesheets/_reset.scss +0 -140
- data/vendor/assets/stylesheets/_sidebar.scss +0 -148
- data/vendor/assets/stylesheets/_slider.scss +0 -151
- data/vendor/assets/stylesheets/_spinner.scss +0 -572
- data/vendor/assets/stylesheets/_subheader.scss +0 -112
- data/vendor/assets/stylesheets/_swoggle.scss +0 -120
- data/vendor/assets/stylesheets/_table.scss +0 -210
- data/vendor/assets/stylesheets/_timepicker.scss +0 -77
- data/vendor/assets/stylesheets/_toolbar.scss +0 -130
- data/vendor/assets/stylesheets/_tooltip.scss +0 -105
- data/vendor/assets/stylesheets/_transition.scss +0 -11
- data/vendor/assets/stylesheets/_trunk.scss +0 -147
- data/vendor/assets/stylesheets/_typeahead.scss +0 -18
- data/vendor/assets/stylesheets/_typography.scss +0 -233
@@ -0,0 +1,101 @@
|
|
1
|
+
+function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// POPOVER PUBLIC CLASS DEFINITION
|
5
|
+
// ===============================
|
6
|
+
|
7
|
+
var Popover = function (element, options) {
|
8
|
+
this.init('popover', element, options);
|
9
|
+
};
|
10
|
+
|
11
|
+
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js');
|
12
|
+
|
13
|
+
Popover.VERSION = '1.0.0';
|
14
|
+
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
|
15
|
+
placement: 'right',
|
16
|
+
trigger: 'click',
|
17
|
+
content: '',
|
18
|
+
template: '<div class="popover" role="tooltip"><div class="arrow"></div><strong class="popover-title"></strong><div class="popover-content"></div></div>'
|
19
|
+
});
|
20
|
+
|
21
|
+
|
22
|
+
// NOTE: POPOVER EXTENDS tooltip.js
|
23
|
+
// ================================
|
24
|
+
|
25
|
+
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype);
|
26
|
+
|
27
|
+
Popover.prototype.constructor = Popover;
|
28
|
+
|
29
|
+
Popover.prototype.getDefaults = function () {
|
30
|
+
return Popover.DEFAULTS;
|
31
|
+
};
|
32
|
+
|
33
|
+
Popover.prototype.setContent = function () {
|
34
|
+
var $tip = this.tip();
|
35
|
+
var title = this.getTitle();
|
36
|
+
var content = this.getContent();
|
37
|
+
|
38
|
+
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title);
|
39
|
+
$tip.find('.popover-content').children().detach().end()[
|
40
|
+
this.options.html ? (typeof content === 'string' ? 'html' : 'append') : 'text'
|
41
|
+
](content);
|
42
|
+
|
43
|
+
$tip.removeClass('fade top bottom left right in');
|
44
|
+
|
45
|
+
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide();
|
46
|
+
};
|
47
|
+
|
48
|
+
Popover.prototype.hasContent = function () {
|
49
|
+
return this.getTitle() || this.getContent();
|
50
|
+
};
|
51
|
+
|
52
|
+
Popover.prototype.getContent = function () {
|
53
|
+
var $e = this.$element;
|
54
|
+
var o = this.options;
|
55
|
+
|
56
|
+
return $e.attr('data-content') ||
|
57
|
+
(typeof o.content === 'function' ? o.content.call($e[0]) : o.content);
|
58
|
+
};
|
59
|
+
|
60
|
+
Popover.prototype.arrow = function () {
|
61
|
+
return (this.$arrow = this.$arrow || this.tip().find('.arrow'));
|
62
|
+
};
|
63
|
+
|
64
|
+
// POPOVER PLUGIN DEFINITION
|
65
|
+
// =========================
|
66
|
+
|
67
|
+
function Plugin(option) {
|
68
|
+
return this.each(function () {
|
69
|
+
var $this = $(this);
|
70
|
+
var data = $this.data('bs.popover');
|
71
|
+
var options = typeof option === 'object' && option;
|
72
|
+
|
73
|
+
if (!data && /destroy|hide/.test(option)) return;
|
74
|
+
if (!data) $this.data('bs.popover', (data = new Popover(this, options)));
|
75
|
+
if (typeof option === 'string') data[option]();
|
76
|
+
});
|
77
|
+
}
|
78
|
+
|
79
|
+
var old = $.fn.popover;
|
80
|
+
|
81
|
+
$.fn.popover = Plugin;
|
82
|
+
$.fn.popover.Constructor = Popover;
|
83
|
+
|
84
|
+
// POPOVER NO CONFLICT
|
85
|
+
// ===================
|
86
|
+
|
87
|
+
$.fn.popover.noConflict = function () {
|
88
|
+
$.fn.popover = old;
|
89
|
+
return this;
|
90
|
+
};
|
91
|
+
|
92
|
+
// POPOVER DATA-API
|
93
|
+
// ================
|
94
|
+
|
95
|
+
$(document).on('click.bs.popover.data-api hover.bs.popover.data-api', '[data-toggle="popover"]', function (e) {
|
96
|
+
var $this = $(this);
|
97
|
+
if ($this.data('popover')) return;
|
98
|
+
Plugin.call($this, $this.data());
|
99
|
+
});
|
100
|
+
|
101
|
+
}(jQuery);
|
@@ -0,0 +1,161 @@
|
|
1
|
+
+function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// SCROLLSPY CLASS DEFINITION
|
5
|
+
// ==========================
|
6
|
+
|
7
|
+
function ScrollSpy(element, options) {
|
8
|
+
this.$body = $(document.body);
|
9
|
+
this.$scrollElement = $(element).is(document.body) ? $(window) : $(element);
|
10
|
+
this.options = $.extend({}, ScrollSpy.DEFAULTS, options);
|
11
|
+
|
12
|
+
this.selector = (this.options.target || '') + ' .scrollspy li > a';
|
13
|
+
this.offsets = [];
|
14
|
+
this.targets = [];
|
15
|
+
this.activeTarget = null;
|
16
|
+
this.scrollHeight = 0;
|
17
|
+
this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this));
|
18
|
+
|
19
|
+
this.refresh();
|
20
|
+
this.process();
|
21
|
+
}
|
22
|
+
|
23
|
+
ScrollSpy.VERSION = '1.0.0';
|
24
|
+
ScrollSpy.DEFAULTS = {
|
25
|
+
offset: 10
|
26
|
+
};
|
27
|
+
|
28
|
+
ScrollSpy.prototype.constructor = ScrollSpy;
|
29
|
+
|
30
|
+
ScrollSpy.prototype.getScrollHeight = function () {
|
31
|
+
return this.$scrollElement[0].scrollHeight ||
|
32
|
+
Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight);
|
33
|
+
};
|
34
|
+
|
35
|
+
ScrollSpy.prototype.refresh = function () {
|
36
|
+
var that = this;
|
37
|
+
var offsetMethod = 'offset';
|
38
|
+
var offsetBase = 0;
|
39
|
+
|
40
|
+
this.offsets = [];
|
41
|
+
this.targets = [];
|
42
|
+
this.scrollHeight = this.getScrollHeight();
|
43
|
+
|
44
|
+
if (!$.isWindow(this.$scrollElement[0])) {
|
45
|
+
offsetMethod = 'position';
|
46
|
+
offsetBase = this.$scrollElement.scrollTop();
|
47
|
+
}
|
48
|
+
|
49
|
+
this.$body
|
50
|
+
.find(this.selector)
|
51
|
+
.map(function () {
|
52
|
+
var $el = $(this);
|
53
|
+
var href = $el.data('target') || $el.attr('href');
|
54
|
+
var $href = /^#./.test(href) && $(href);
|
55
|
+
|
56
|
+
return ($href &&
|
57
|
+
$href.length &&
|
58
|
+
$href.is(':visible') &&
|
59
|
+
[[$href[offsetMethod]().top + offsetBase, href]]) ||
|
60
|
+
null;
|
61
|
+
})
|
62
|
+
.sort(function (a, b) { return a[0] - b[0]; })
|
63
|
+
.each(function () {
|
64
|
+
that.offsets.push(this[0]);
|
65
|
+
that.targets.push(this[1]);
|
66
|
+
});
|
67
|
+
};
|
68
|
+
|
69
|
+
ScrollSpy.prototype.process = function () {
|
70
|
+
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset;
|
71
|
+
var scrollHeight = this.getScrollHeight();
|
72
|
+
var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height();
|
73
|
+
var offsets = this.offsets;
|
74
|
+
var targets = this.targets;
|
75
|
+
var activeTarget = this.activeTarget;
|
76
|
+
var i;
|
77
|
+
|
78
|
+
if (this.scrollHeight !== scrollHeight) this.refresh();
|
79
|
+
|
80
|
+
if (scrollTop >= maxScroll) {
|
81
|
+
return activeTarget !== (i = targets[targets.length - 1]) && this.activate(i);
|
82
|
+
}
|
83
|
+
|
84
|
+
if (activeTarget && scrollTop < offsets[0]) {
|
85
|
+
this.activeTarget = null;
|
86
|
+
return this.clear();
|
87
|
+
}
|
88
|
+
|
89
|
+
for (i = offsets.length; i--;) {
|
90
|
+
activeTarget !== targets[i] &&
|
91
|
+
scrollTop >= offsets[i] &&
|
92
|
+
(offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) &&
|
93
|
+
this.activate(targets[i])
|
94
|
+
}
|
95
|
+
};
|
96
|
+
|
97
|
+
ScrollSpy.prototype.activate = function (target) {
|
98
|
+
this.activeTarget = target;
|
99
|
+
this.clear();
|
100
|
+
|
101
|
+
var selector = this.selector +
|
102
|
+
'[data-target="' + target + '"],' +
|
103
|
+
this.selector + '[href="' + target + '"]';
|
104
|
+
|
105
|
+
var active = $(selector)
|
106
|
+
.parents('li')
|
107
|
+
.addClass('active');
|
108
|
+
|
109
|
+
if (active.parent('.dropmenu').length) {
|
110
|
+
active = active
|
111
|
+
.closest('li.dropdown')
|
112
|
+
.addClass('active');
|
113
|
+
}
|
114
|
+
|
115
|
+
active.trigger('activate.bs.scrollspy');
|
116
|
+
};
|
117
|
+
|
118
|
+
ScrollSpy.prototype.clear = function () {
|
119
|
+
$(this.selector)
|
120
|
+
.parentsUntil(this.options.target, '.active')
|
121
|
+
.removeClass('active');
|
122
|
+
};
|
123
|
+
|
124
|
+
// SCROLLSPY PLUGIN DEFINITION
|
125
|
+
// ===========================
|
126
|
+
|
127
|
+
function Plugin(option) {
|
128
|
+
return this.each(function () {
|
129
|
+
var $this = $(this);
|
130
|
+
var data = $this.data('bs.scrollspy');
|
131
|
+
var options = typeof option === 'object' && option;
|
132
|
+
|
133
|
+
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)));
|
134
|
+
if (typeof option === 'string') data[option]();
|
135
|
+
});
|
136
|
+
}
|
137
|
+
|
138
|
+
var old = $.fn.scrollspy;
|
139
|
+
|
140
|
+
$.fn.scrollspy = Plugin;
|
141
|
+
$.fn.scrollspy.Constructor = ScrollSpy;
|
142
|
+
|
143
|
+
// SCROLLSPY NO CONFLICT
|
144
|
+
// =====================
|
145
|
+
|
146
|
+
$.fn.scrollspy.noConflict = function () {
|
147
|
+
$.fn.scrollspy = old;
|
148
|
+
return this;
|
149
|
+
};
|
150
|
+
|
151
|
+
// SCROLLSPY DATA-API
|
152
|
+
// ==================
|
153
|
+
|
154
|
+
$(document).on('ready.bs.scrollspy.data-api', function () {
|
155
|
+
$('[data-spy="scroll"]').each(function () {
|
156
|
+
var $this = $(this);
|
157
|
+
Plugin.call($this, $this.data());
|
158
|
+
});
|
159
|
+
});
|
160
|
+
|
161
|
+
}(jQuery);
|
@@ -0,0 +1,160 @@
|
|
1
|
+
+function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// SWITCH PUBLIC CLASS DEFINITION
|
5
|
+
// ==============================
|
6
|
+
|
7
|
+
var Switch = function (element, options) {
|
8
|
+
this.$element = $(element);
|
9
|
+
this.settings = {
|
10
|
+
baseClass: this.$element.data('base-class'),
|
11
|
+
offClass: this.$element.data('off-class'),
|
12
|
+
onClass: this.$element.data('on-class')
|
13
|
+
};
|
14
|
+
this.options = $.extend({}, Switch.DEFAULTS, this.settings, options);
|
15
|
+
|
16
|
+
this.init();
|
17
|
+
};
|
18
|
+
|
19
|
+
Switch.VERSION = '1.0.0';
|
20
|
+
Switch.DEFAULTS = {
|
21
|
+
baseClass: 'switch',
|
22
|
+
offClass: 'switch-color-light-haze',
|
23
|
+
onClass: 'switch-color-green',
|
24
|
+
text: {
|
25
|
+
off: '<i class="icon-cross"></i>',
|
26
|
+
on: '<i class="icon-checkmark"></i>'
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
Switch.prototype.constructor = Switch;
|
31
|
+
|
32
|
+
Switch.prototype.init = function () {
|
33
|
+
var $switchHandle = $('<span class="switch-handle">');
|
34
|
+
var $switchOn = $('<label class="switch-on">')
|
35
|
+
.html(this.options.text.on)
|
36
|
+
.addClass(this.options.onClass);
|
37
|
+
var $switchOff = $('<label class="switch-off">')
|
38
|
+
.html(this.options.text.off)
|
39
|
+
.addClass(this.options.offClass);
|
40
|
+
var $switchGroup = $('<div class="switch-group">')
|
41
|
+
.append($switchOn, $switchOff, $switchHandle);
|
42
|
+
var $switch = $('<div class="' + this.options.baseClass + '" data-toggle="switch">')
|
43
|
+
.addClass(this.$element.prop('checked') ? '' : ' off');
|
44
|
+
|
45
|
+
this.$element.wrap($switch);
|
46
|
+
$.extend(this, {
|
47
|
+
$switch: this.$element.parent(),
|
48
|
+
$switchOn: $switchOn,
|
49
|
+
$switchOff: $switchOff,
|
50
|
+
$switchGroup: $switchGroup
|
51
|
+
});
|
52
|
+
this.$switch.append($switchGroup);
|
53
|
+
|
54
|
+
this.update(true);
|
55
|
+
this.trigger(true);
|
56
|
+
};
|
57
|
+
|
58
|
+
Switch.prototype.switch = function () {
|
59
|
+
if (this.$element.prop('checked')) {
|
60
|
+
this.off();
|
61
|
+
} else {
|
62
|
+
this.on();
|
63
|
+
}
|
64
|
+
};
|
65
|
+
|
66
|
+
Switch.prototype.on = function (silent) {
|
67
|
+
if (this.$element.prop('disabled')) return false;
|
68
|
+
|
69
|
+
this.$switch.removeClass('off');
|
70
|
+
this.$element.prop('checked', true);
|
71
|
+
|
72
|
+
if (!silent) this.trigger();
|
73
|
+
};
|
74
|
+
|
75
|
+
Switch.prototype.off = function (silent) {
|
76
|
+
if (this.$element.prop('disabled')) return false;
|
77
|
+
|
78
|
+
this.$switch.addClass('off');
|
79
|
+
this.$element.prop('checked', false);
|
80
|
+
|
81
|
+
if (!silent) this.trigger();
|
82
|
+
};
|
83
|
+
|
84
|
+
Switch.prototype.enable = function () {
|
85
|
+
this.$switch.removeAttr('disabled');
|
86
|
+
this.$element.prop('disabled', false);
|
87
|
+
};
|
88
|
+
|
89
|
+
Switch.prototype.disable = function () {
|
90
|
+
this.$switch.attr('disabled', 'disabled');
|
91
|
+
this.$element.prop('disabled', true);
|
92
|
+
};
|
93
|
+
|
94
|
+
Switch.prototype.update = function (silent) {
|
95
|
+
if (this.$element.prop('disabled')) {
|
96
|
+
this.disable();
|
97
|
+
} else {
|
98
|
+
this.enable();
|
99
|
+
}
|
100
|
+
|
101
|
+
if (this.$element.prop('checked')) {
|
102
|
+
this.on(silent);
|
103
|
+
} else {
|
104
|
+
this.off(silent);
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
Switch.prototype.trigger = function (silent) {
|
109
|
+
this.$element.off('change.bs.switch');
|
110
|
+
|
111
|
+
if (!silent) this.$element.change();
|
112
|
+
|
113
|
+
this.$element.on('change.bs.switch', $.proxy(function () {
|
114
|
+
this.update();
|
115
|
+
}, this));
|
116
|
+
};
|
117
|
+
|
118
|
+
// SWITCH PLUGIN DEFINITION
|
119
|
+
// ========================
|
120
|
+
|
121
|
+
function Plugin(option) {
|
122
|
+
return this.each(function () {
|
123
|
+
var $this = $(this);
|
124
|
+
var data = $this.data('bs.switch');
|
125
|
+
var options = typeof option === 'object' && option;
|
126
|
+
|
127
|
+
if (!data) $this.data('bs.switch', (data = new Switch(this, options)));
|
128
|
+
if (typeof option === 'string') data[option]();
|
129
|
+
});
|
130
|
+
}
|
131
|
+
|
132
|
+
var old = $.fn.switch;
|
133
|
+
|
134
|
+
$.fn.switch = Plugin;
|
135
|
+
$.fn.switch.Constructor = Switch;
|
136
|
+
|
137
|
+
// SWITCH NO CONFLICT
|
138
|
+
// ==================
|
139
|
+
|
140
|
+
$.fn.switch.noConflict = function () {
|
141
|
+
$.fn.switch = old;
|
142
|
+
return this;
|
143
|
+
};
|
144
|
+
|
145
|
+
// SWITCH DATA-API
|
146
|
+
// ===============
|
147
|
+
|
148
|
+
$(document)
|
149
|
+
.on('ready.bs.switch.data-api', function () {
|
150
|
+
var $this = $(this).find('[data-toggle="switch"]');
|
151
|
+
if ($this.data('switch')) return;
|
152
|
+
Plugin.call($this);
|
153
|
+
})
|
154
|
+
.on('click.bs.switch.data-api', '[data-toggle="switch"]', function () {
|
155
|
+
var $this = $(this).find('input[type=checkbox]');
|
156
|
+
if ($this.data('switch')) return;
|
157
|
+
Plugin.call($this, 'switch');
|
158
|
+
});
|
159
|
+
|
160
|
+
}(jQuery);
|
@@ -0,0 +1,139 @@
|
|
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 = '1.0.0';
|
12
|
+
Tab.TRANSITION_DURATION = 150;
|
13
|
+
|
14
|
+
Tab.prototype.constructor = Tab;
|
15
|
+
|
16
|
+
Tab.prototype.show = function () {
|
17
|
+
var $this = this.element;
|
18
|
+
var $ul = $this.closest('ul:not(.dropmenu)');
|
19
|
+
var selector = $this.data('target');
|
20
|
+
|
21
|
+
if (!selector) {
|
22
|
+
selector = $this.attr('href');
|
23
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '');
|
24
|
+
}
|
25
|
+
|
26
|
+
if ($this.parent('li').hasClass('active')) return;
|
27
|
+
|
28
|
+
var $previous = $ul.find('.active:last a');
|
29
|
+
var hideEvent = $.Event('hide.bs.tab', {
|
30
|
+
relatedTarget: $this[0]
|
31
|
+
});
|
32
|
+
var showEvent = $.Event('show.bs.tab', {
|
33
|
+
relatedTarget: $previous[0]
|
34
|
+
});
|
35
|
+
|
36
|
+
$previous.trigger(hideEvent);
|
37
|
+
$this.trigger(showEvent);
|
38
|
+
|
39
|
+
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return;
|
40
|
+
|
41
|
+
var $target = $(selector);
|
42
|
+
|
43
|
+
this.activate($this.closest('li'), $ul);
|
44
|
+
this.activate($target, $target.parent(), function () {
|
45
|
+
$previous.trigger({
|
46
|
+
type: 'hidden.bs.tab',
|
47
|
+
relatedTarget: $this[0]
|
48
|
+
});
|
49
|
+
$this.trigger({
|
50
|
+
type: 'shown.bs.tab',
|
51
|
+
relatedTarget: $previous[0]
|
52
|
+
});
|
53
|
+
});
|
54
|
+
};
|
55
|
+
|
56
|
+
Tab.prototype.activate = function (element, container, callback) {
|
57
|
+
var $active = container.find('> .active');
|
58
|
+
var transition = callback &&
|
59
|
+
$.support.transition &&
|
60
|
+
($active.length && $active.hasClass('fade') || !!container.find('> .fade').length);
|
61
|
+
|
62
|
+
function next() {
|
63
|
+
$active.removeClass('active')
|
64
|
+
.find('> .dropmenu > .active')
|
65
|
+
.removeClass('active')
|
66
|
+
.end()
|
67
|
+
.find('[data-toggle="tab"]')
|
68
|
+
.attr('aria-expanded', false);
|
69
|
+
|
70
|
+
element.addClass('active')
|
71
|
+
.find('[data-toggle="tab"]')
|
72
|
+
.attr('aria-expanded', true);
|
73
|
+
|
74
|
+
if (transition) {
|
75
|
+
element[0].offsetWidth;
|
76
|
+
element.addClass('in');
|
77
|
+
} else {
|
78
|
+
element.removeClass('fade');
|
79
|
+
}
|
80
|
+
|
81
|
+
if (element.parent('.dropmenu').length) {
|
82
|
+
element
|
83
|
+
.closest('li.dropdown')
|
84
|
+
.addClass('active')
|
85
|
+
.end()
|
86
|
+
.find('[data-toggle="tab"]')
|
87
|
+
.attr('aria-expanded', true);
|
88
|
+
}
|
89
|
+
|
90
|
+
callback && callback();
|
91
|
+
}
|
92
|
+
|
93
|
+
$active.length && transition ?
|
94
|
+
$active.one('bsTransitionEnd', next)
|
95
|
+
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
|
96
|
+
next();
|
97
|
+
|
98
|
+
$active.removeClass('in');
|
99
|
+
};
|
100
|
+
|
101
|
+
// TAB PLUGIN DEFINITION
|
102
|
+
// =====================
|
103
|
+
|
104
|
+
function Plugin(option) {
|
105
|
+
return this.each(function () {
|
106
|
+
var $this = $(this);
|
107
|
+
var data = $this.data('bs.tab');
|
108
|
+
|
109
|
+
if (!data) $this.data('bs.tab', (data = new Tab(this)));
|
110
|
+
if (typeof option === 'string') data[option]();
|
111
|
+
});
|
112
|
+
}
|
113
|
+
|
114
|
+
var old = $.fn.tab;
|
115
|
+
|
116
|
+
$.fn.tab = Plugin;
|
117
|
+
$.fn.tab.Constructor = Tab;
|
118
|
+
|
119
|
+
// TAB NO CONFLICT
|
120
|
+
// ===============
|
121
|
+
|
122
|
+
$.fn.tab.noConflict = function () {
|
123
|
+
$.fn.tab = old;
|
124
|
+
return this;
|
125
|
+
};
|
126
|
+
|
127
|
+
// TAB DATA-API
|
128
|
+
// ============
|
129
|
+
|
130
|
+
var clickHandler = function (e) {
|
131
|
+
e.preventDefault();
|
132
|
+
Plugin.call($(this), 'show');
|
133
|
+
};
|
134
|
+
|
135
|
+
$(document)
|
136
|
+
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
|
137
|
+
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler);
|
138
|
+
|
139
|
+
}(jQuery);
|