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,237 @@
|
|
1
|
+
+function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// CAROUSEL CLASS DEFINITION
|
5
|
+
// =========================
|
6
|
+
|
7
|
+
var Carousel = function (element, options) {
|
8
|
+
this.$element = $(element);
|
9
|
+
this.$indicators = this.$element.find('.carousel-indicators');
|
10
|
+
this.options = options;
|
11
|
+
this.paused = null;
|
12
|
+
this.sliding = null;
|
13
|
+
this.interval = null;
|
14
|
+
this.$active = null;
|
15
|
+
this.$items = null;
|
16
|
+
|
17
|
+
this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this));
|
18
|
+
|
19
|
+
this.options.pause === 'hover' && !('ontouchstart' in document.documentElement) && this.$element
|
20
|
+
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
|
21
|
+
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this));
|
22
|
+
};
|
23
|
+
|
24
|
+
Carousel.VERSION = '1.0.0';
|
25
|
+
Carousel.TRANSITION_DURATION = 600;
|
26
|
+
Carousel.DEFAULTS = {
|
27
|
+
interval: 5000,
|
28
|
+
pause: 'hover',
|
29
|
+
wrap: true,
|
30
|
+
keyboard: true
|
31
|
+
};
|
32
|
+
|
33
|
+
Carousel.prototype.constructor = Carousel;
|
34
|
+
|
35
|
+
Carousel.prototype.keydown = function (e) {
|
36
|
+
if (/input|textarea/i.test(e.target.tagName)) return;
|
37
|
+
switch (e.which) {
|
38
|
+
case 37: this.prev(); break;
|
39
|
+
case 39: this.next(); break;
|
40
|
+
default: return;
|
41
|
+
}
|
42
|
+
|
43
|
+
e.preventDefault();
|
44
|
+
};
|
45
|
+
|
46
|
+
Carousel.prototype.cycle = function (e) {
|
47
|
+
e || (this.paused = false);
|
48
|
+
|
49
|
+
this.interval && clearInterval(this.interval);
|
50
|
+
|
51
|
+
this.options.interval &&
|
52
|
+
!this.paused &&
|
53
|
+
(this.interval = setInterval($.proxy(this.next, this), this.options.interval));
|
54
|
+
|
55
|
+
return this;
|
56
|
+
};
|
57
|
+
|
58
|
+
Carousel.prototype.getItemIndex = function (item) {
|
59
|
+
this.$items = item.parent().children('.item');
|
60
|
+
return this.$items.index(item || this.$active);
|
61
|
+
};
|
62
|
+
|
63
|
+
Carousel.prototype.getItemForDirection = function (direction, active) {
|
64
|
+
var activeIndex = this.getItemIndex(active);
|
65
|
+
var willWrap = (direction === 'prev' && activeIndex === 0) ||
|
66
|
+
(direction === 'next' && activeIndex === (this.$items.length - 1));
|
67
|
+
|
68
|
+
if (willWrap && !this.options.wrap) return active;
|
69
|
+
|
70
|
+
var delta = direction === 'prev' ? -1 : 1;
|
71
|
+
var itemIndex = (activeIndex + delta) % this.$items.length;
|
72
|
+
|
73
|
+
return this.$items.eq(itemIndex);
|
74
|
+
};
|
75
|
+
|
76
|
+
Carousel.prototype.to = function (pos) {
|
77
|
+
var that = this;
|
78
|
+
var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'));
|
79
|
+
|
80
|
+
if (pos > (this.$items.length - 1) || pos < 0) return;
|
81
|
+
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos); });
|
82
|
+
if (activeIndex === pos) return this.pause().cycle();
|
83
|
+
|
84
|
+
return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos));
|
85
|
+
};
|
86
|
+
|
87
|
+
Carousel.prototype.pause = function (e) {
|
88
|
+
e || (this.paused = true);
|
89
|
+
|
90
|
+
if (this.$element.find('.next, .prev').length && $.support.transition) {
|
91
|
+
this.$element.trigger($.support.transition.end);
|
92
|
+
this.cycle(true);
|
93
|
+
}
|
94
|
+
|
95
|
+
this.interval = clearInterval(this.interval);
|
96
|
+
|
97
|
+
return this;
|
98
|
+
};
|
99
|
+
|
100
|
+
Carousel.prototype.next = function () {
|
101
|
+
if (this.sliding) return;
|
102
|
+
return this.slide('next');
|
103
|
+
};
|
104
|
+
|
105
|
+
Carousel.prototype.prev = function () {
|
106
|
+
if (this.sliding) return;
|
107
|
+
return this.slide('prev');
|
108
|
+
};
|
109
|
+
|
110
|
+
Carousel.prototype.slide = function (type, next) {
|
111
|
+
var $active = this.$element.find('.item.active');
|
112
|
+
var $next = next || this.getItemForDirection(type, $active);
|
113
|
+
var isCycling = this.interval;
|
114
|
+
var direction = type === 'next' ? 'left' : 'right';
|
115
|
+
var that = this;
|
116
|
+
|
117
|
+
if ($next.hasClass('active')) return (this.sliding = false);
|
118
|
+
|
119
|
+
var relatedTarget = $next[0];
|
120
|
+
var slideEvent = $.Event('slide.bs.carousel', {
|
121
|
+
relatedTarget: relatedTarget,
|
122
|
+
direction: direction
|
123
|
+
});
|
124
|
+
|
125
|
+
this.$element.trigger(slideEvent);
|
126
|
+
if (slideEvent.isDefaultPrevented()) return;
|
127
|
+
|
128
|
+
this.sliding = true;
|
129
|
+
|
130
|
+
isCycling && this.pause();
|
131
|
+
|
132
|
+
if (this.$indicators.length) {
|
133
|
+
this.$indicators.find('.active').removeClass('active');
|
134
|
+
|
135
|
+
var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]);
|
136
|
+
|
137
|
+
$nextIndicator && $nextIndicator.addClass('active');
|
138
|
+
}
|
139
|
+
|
140
|
+
var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }); // yes, "slid"
|
141
|
+
|
142
|
+
if ($.support.transition && this.$element.hasClass('slide')) {
|
143
|
+
$next.addClass(type);
|
144
|
+
$next[0].offsetWidth;
|
145
|
+
$active.addClass(direction);
|
146
|
+
$next.addClass(direction);
|
147
|
+
$active
|
148
|
+
.one('bsTransitionEnd', function () {
|
149
|
+
$next.removeClass([type, direction].join(' ')).addClass('active');
|
150
|
+
$active.removeClass(['active', direction].join(' '));
|
151
|
+
that.sliding = false;
|
152
|
+
setTimeout(function () {
|
153
|
+
that.$element.trigger(slidEvent);
|
154
|
+
}, 0);
|
155
|
+
})
|
156
|
+
.emulateTransitionEnd(Carousel.TRANSITION_DURATION);
|
157
|
+
} else {
|
158
|
+
$active.removeClass('active');
|
159
|
+
$next.addClass('active');
|
160
|
+
this.sliding = false;
|
161
|
+
this.$element.trigger(slidEvent);
|
162
|
+
}
|
163
|
+
|
164
|
+
isCycling && this.cycle();
|
165
|
+
|
166
|
+
return this;
|
167
|
+
};
|
168
|
+
|
169
|
+
// CAROUSEL PLUGIN DEFINITION
|
170
|
+
// ==========================
|
171
|
+
|
172
|
+
function Plugin(option) {
|
173
|
+
return this.each(function () {
|
174
|
+
var $this = $(this);
|
175
|
+
var data = $this.data('bs.carousel');
|
176
|
+
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option === 'object' && option);
|
177
|
+
var action = typeof option === 'string' ? option : options.slide;
|
178
|
+
|
179
|
+
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)));
|
180
|
+
|
181
|
+
if (typeof option === 'number') {
|
182
|
+
data.to(option);
|
183
|
+
} else if (action) {
|
184
|
+
data[action]();
|
185
|
+
} else if (options.interval) {
|
186
|
+
data.pause().cycle();
|
187
|
+
}
|
188
|
+
});
|
189
|
+
}
|
190
|
+
|
191
|
+
var old = $.fn.carousel;
|
192
|
+
|
193
|
+
$.fn.carousel = Plugin;
|
194
|
+
$.fn.carousel.Constructor = Carousel;
|
195
|
+
|
196
|
+
// CAROUSEL NO CONFLICT
|
197
|
+
// ====================
|
198
|
+
|
199
|
+
$.fn.carousel.noConflict = function () {
|
200
|
+
$.fn.carousel = old;
|
201
|
+
return this;
|
202
|
+
};
|
203
|
+
|
204
|
+
// CAROUSEL DATA-API
|
205
|
+
// =================
|
206
|
+
|
207
|
+
var clickHandler = function (e) {
|
208
|
+
var href;
|
209
|
+
var $this = $(this);
|
210
|
+
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, ''));
|
211
|
+
|
212
|
+
if (!$target.hasClass('carousel')) return;
|
213
|
+
|
214
|
+
var options = $.extend({}, $target.data(), $this.data());
|
215
|
+
var slideIndex = $this.attr('data-slide-to');
|
216
|
+
|
217
|
+
if (slideIndex) options.interval = false;
|
218
|
+
|
219
|
+
Plugin.call($target, options);
|
220
|
+
|
221
|
+
if (slideIndex) $target.data('bs.carousel').to(slideIndex);
|
222
|
+
|
223
|
+
e.preventDefault();
|
224
|
+
};
|
225
|
+
|
226
|
+
$(document)
|
227
|
+
.on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
|
228
|
+
.on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)
|
229
|
+
.on('ready.bs.carousel.data-api', function () {
|
230
|
+
$('[data-ride="carousel"]').each(function () {
|
231
|
+
var $this = $(this);
|
232
|
+
if ($this.data('carousel')) return;
|
233
|
+
Plugin.call($this, $this.data());
|
234
|
+
});
|
235
|
+
});
|
236
|
+
|
237
|
+
}(jQuery);
|
@@ -0,0 +1,200 @@
|
|
1
|
+
+function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// COLLAPSE PUBLIC CLASS DEFINITION
|
5
|
+
// ================================
|
6
|
+
|
7
|
+
var Collapse = function (element, options) {
|
8
|
+
this.$element = $(element);
|
9
|
+
this.options = $.extend({}, Collapse.DEFAULTS, options);
|
10
|
+
|
11
|
+
this.transitioning = null;
|
12
|
+
this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
|
13
|
+
'[data-toggle="collapse"][data-target="#' + element.id + '"]');
|
14
|
+
|
15
|
+
if (this.options.parent) {
|
16
|
+
this.$parent = this.getParent();
|
17
|
+
} else {
|
18
|
+
this.addAriaAndCollapsedClass(this.$element, this.$trigger);
|
19
|
+
}
|
20
|
+
|
21
|
+
if (this.options.toggle) this.toggle();
|
22
|
+
};
|
23
|
+
|
24
|
+
Collapse.VERSION = '1.0.0';
|
25
|
+
Collapse.TRANSITION_DURATION = 350;
|
26
|
+
Collapse.DEFAULTS = {
|
27
|
+
toggle: true
|
28
|
+
};
|
29
|
+
|
30
|
+
Collapse.prototype.constructor = Collapse;
|
31
|
+
|
32
|
+
Collapse.prototype.dimension = function () {
|
33
|
+
var hasWidth = this.$element.hasClass('width');
|
34
|
+
return hasWidth ? 'width' : 'height';
|
35
|
+
};
|
36
|
+
|
37
|
+
Collapse.prototype.show = function () {
|
38
|
+
if (this.transitioning || this.$element.hasClass('in')) return;
|
39
|
+
|
40
|
+
var activesData;
|
41
|
+
var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing');
|
42
|
+
|
43
|
+
if (actives && actives.length) {
|
44
|
+
activesData = actives.data('bs.collapse');
|
45
|
+
if (activesData && activesData.transitioning) return;
|
46
|
+
}
|
47
|
+
|
48
|
+
var startEvent = $.Event('show.bs.collapse');
|
49
|
+
this.$element.trigger(startEvent);
|
50
|
+
|
51
|
+
if (startEvent.isDefaultPrevented()) return;
|
52
|
+
if (actives && actives.length) {
|
53
|
+
Plugin.call(actives, 'hide');
|
54
|
+
activesData || actives.data('bs.collapse', null);
|
55
|
+
}
|
56
|
+
|
57
|
+
var dimension = this.dimension();
|
58
|
+
|
59
|
+
this.$element
|
60
|
+
.removeClass('collapse')
|
61
|
+
.addClass('collapsing')[dimension](0)
|
62
|
+
.attr('aria-expanded', true);
|
63
|
+
|
64
|
+
this.$trigger
|
65
|
+
.removeClass('collapsed')
|
66
|
+
.attr('aria-expanded', true);
|
67
|
+
|
68
|
+
this.transitioning = 1;
|
69
|
+
|
70
|
+
var complete = function () {
|
71
|
+
this.$element
|
72
|
+
.removeClass('collapsing')
|
73
|
+
.addClass('collapse in')[dimension]('');
|
74
|
+
this.transitioning = 0;
|
75
|
+
this.$element
|
76
|
+
.trigger('shown.bs.collapse');
|
77
|
+
};
|
78
|
+
|
79
|
+
if (!$.support.transition) return complete.call(this);
|
80
|
+
|
81
|
+
var scrollSize = $.camelCase(['scroll', dimension].join('-'));
|
82
|
+
|
83
|
+
this.$element
|
84
|
+
.one('bsTransitionEnd', $.proxy(complete, this))
|
85
|
+
.emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]);
|
86
|
+
};
|
87
|
+
|
88
|
+
Collapse.prototype.hide = function () {
|
89
|
+
if (this.transitioning || !this.$element.hasClass('in')) return;
|
90
|
+
|
91
|
+
var startEvent = $.Event('hide.bs.collapse');
|
92
|
+
this.$element.trigger(startEvent);
|
93
|
+
if (startEvent.isDefaultPrevented()) return;
|
94
|
+
|
95
|
+
var dimension = this.dimension();
|
96
|
+
|
97
|
+
this.$element[dimension](this.$element[dimension]())[0].offsetHeight;
|
98
|
+
|
99
|
+
this.$element
|
100
|
+
.addClass('collapsing')
|
101
|
+
.removeClass('collapse in')
|
102
|
+
.attr('aria-expanded', false);
|
103
|
+
|
104
|
+
this.$trigger
|
105
|
+
.addClass('collapsed')
|
106
|
+
.attr('aria-expanded', false);
|
107
|
+
|
108
|
+
this.transitioning = 1;
|
109
|
+
|
110
|
+
var complete = function () {
|
111
|
+
this.transitioning = 0;
|
112
|
+
this.$element
|
113
|
+
.removeClass('collapsing')
|
114
|
+
.addClass('collapse')
|
115
|
+
.trigger('hidden.bs.collapse');
|
116
|
+
};
|
117
|
+
|
118
|
+
if (!$.support.transition) return complete.call(this);
|
119
|
+
|
120
|
+
this.$element
|
121
|
+
[dimension](0)
|
122
|
+
.one('bsTransitionEnd', $.proxy(complete, this))
|
123
|
+
.emulateTransitionEnd(Collapse.TRANSITION_DURATION);
|
124
|
+
};
|
125
|
+
|
126
|
+
Collapse.prototype.toggle = function () {
|
127
|
+
this[this.$element.hasClass('in') ? 'hide' : 'show']();
|
128
|
+
};
|
129
|
+
|
130
|
+
Collapse.prototype.getParent = function () {
|
131
|
+
return $(this.options.parent)
|
132
|
+
.find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
|
133
|
+
.each($.proxy(function (i, element) {
|
134
|
+
var $element = $(element);
|
135
|
+
this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element);
|
136
|
+
}, this))
|
137
|
+
.end();
|
138
|
+
};
|
139
|
+
|
140
|
+
Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
|
141
|
+
var isOpen = $element.hasClass('in');
|
142
|
+
|
143
|
+
$element.attr('aria-expanded', isOpen);
|
144
|
+
$trigger
|
145
|
+
.toggleClass('collapsed', !isOpen)
|
146
|
+
.attr('aria-expanded', isOpen);
|
147
|
+
};
|
148
|
+
|
149
|
+
function getTargetFromTrigger($trigger) {
|
150
|
+
var href;
|
151
|
+
var target = $trigger.attr('data-target') ||
|
152
|
+
(href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '');
|
153
|
+
|
154
|
+
return $(target);
|
155
|
+
}
|
156
|
+
|
157
|
+
// COLLAPSE PLUGIN DEFINITION
|
158
|
+
// ==========================
|
159
|
+
|
160
|
+
function Plugin(option) {
|
161
|
+
return this.each(function () {
|
162
|
+
var $this = $(this);
|
163
|
+
var data = $this.data('bs.collapse');
|
164
|
+
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option === 'object' && option);
|
165
|
+
|
166
|
+
if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false;
|
167
|
+
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)));
|
168
|
+
if (typeof option === 'string') data[option]();
|
169
|
+
});
|
170
|
+
}
|
171
|
+
|
172
|
+
var old = $.fn.collapse;
|
173
|
+
|
174
|
+
$.fn.collapse = Plugin;
|
175
|
+
$.fn.collapse.Constructor = Collapse;
|
176
|
+
|
177
|
+
// COLLAPSE NO CONFLICT
|
178
|
+
// ====================
|
179
|
+
|
180
|
+
$.fn.collapse.noConflict = function () {
|
181
|
+
$.fn.collapse = old;
|
182
|
+
return this;
|
183
|
+
};
|
184
|
+
|
185
|
+
// COLLAPSE DATA-API
|
186
|
+
// =================
|
187
|
+
|
188
|
+
$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
|
189
|
+
var $this = $(this);
|
190
|
+
|
191
|
+
if (!$this.attr('data-target')) e.preventDefault();
|
192
|
+
|
193
|
+
var $target = getTargetFromTrigger($this);
|
194
|
+
var data = $target.data('bs.collapse');
|
195
|
+
var option = data ? 'toggle' : $this.data();
|
196
|
+
|
197
|
+
Plugin.call($target, option);
|
198
|
+
});
|
199
|
+
|
200
|
+
}(jQuery);
|
@@ -0,0 +1,147 @@
|
|
1
|
+
+function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// COLORPICKER PUBLIC CLASS DEFINITION
|
5
|
+
// ===================================
|
6
|
+
|
7
|
+
var Colorpicker = function (element, options) {
|
8
|
+
this.$element = $(element);
|
9
|
+
this.options = $.extend({}, Colorpicker.DEFAULTS, options);
|
10
|
+
|
11
|
+
this.$active = false;
|
12
|
+
this.$widget = $(this.initWidget()).on('click', $.proxy(this.clickWidget, this));
|
13
|
+
|
14
|
+
this.init();
|
15
|
+
};
|
16
|
+
|
17
|
+
Colorpicker.VERSION = '1.0.0';
|
18
|
+
Colorpicker.DEFAULTS = {
|
19
|
+
callback: function (color) {},
|
20
|
+
colors: [
|
21
|
+
'#ABD026', '#72C914', '#32C9EA', '#007CFF', '#5C5CEB',
|
22
|
+
'#8C4BFB', '#FF5F84', '#F52F2E', '#FE921A', '#FFD613',
|
23
|
+
'#273448', '#8492A6', '#ECEFF5', '#FFFFFF'
|
24
|
+
],
|
25
|
+
item: '<li><button type="button"></button></li>',
|
26
|
+
menu: '<ul class="colorpicker dropmenu caret"></ul>'
|
27
|
+
};
|
28
|
+
|
29
|
+
Colorpicker.prototype.constructor = Colorpicker;
|
30
|
+
|
31
|
+
Colorpicker.prototype.init = function () {
|
32
|
+
this.$element.on({
|
33
|
+
'focus.bs.timepicker': $.proxy(this.showWidget, this),
|
34
|
+
'click.bs.timepicker': $.proxy(this.showWidget, this),
|
35
|
+
'blur.bs.timepicker': $.proxy(this.setVal, this)
|
36
|
+
});
|
37
|
+
};
|
38
|
+
|
39
|
+
Colorpicker.prototype.clickWidget = function (e) {
|
40
|
+
e.stopPropagation();
|
41
|
+
e.preventDefault();
|
42
|
+
|
43
|
+
var color = $(e.target).data('color');
|
44
|
+
|
45
|
+
this.setVal(color);
|
46
|
+
};
|
47
|
+
|
48
|
+
Colorpicker.prototype.initWidget = function () {
|
49
|
+
var _self = this;
|
50
|
+
var menu = $(this.options.menu);
|
51
|
+
|
52
|
+
$.each(this.options.colors, function (index, value) {
|
53
|
+
var item = $(_self.options.item);
|
54
|
+
|
55
|
+
item.find('button')
|
56
|
+
.addClass('swatch bsColor')
|
57
|
+
.css({ background: value })
|
58
|
+
.data('color', value);
|
59
|
+
|
60
|
+
menu.append(item);
|
61
|
+
});
|
62
|
+
|
63
|
+
return menu;
|
64
|
+
};
|
65
|
+
|
66
|
+
Colorpicker.prototype.showWidget = function () {
|
67
|
+
if (this.$active) return;
|
68
|
+
if (this.$element.prop('disabled') || this.$element.prop('readonly')) return;
|
69
|
+
if (this.$widget.is(':visible')) return;
|
70
|
+
|
71
|
+
this.$container = $('<span>')
|
72
|
+
.addClass('btn-group dropdown open bsColorpicker')
|
73
|
+
.css({
|
74
|
+
height: 0,
|
75
|
+
position: 'absolute',
|
76
|
+
width: 0
|
77
|
+
});
|
78
|
+
|
79
|
+
this.$container.append(this.$widget);
|
80
|
+
this.$element.after(this.$container);
|
81
|
+
this.$active = true;
|
82
|
+
|
83
|
+
var _self = this;
|
84
|
+
$(document).on('mousedown.bs.colorpicker, touchend.bs.colorpicker', function (e) {
|
85
|
+
if (!(_self.$element.parent().find(e.target).length ||
|
86
|
+
_self.$widget.is(e.target) ||
|
87
|
+
_self.$widget.find(e.target).length)) {
|
88
|
+
_self.hideWidget();
|
89
|
+
}
|
90
|
+
});
|
91
|
+
};
|
92
|
+
|
93
|
+
Colorpicker.prototype.hideWidget = function () {
|
94
|
+
if (!this.$active) return;
|
95
|
+
if (!this.$widget.is(':visible')) return;
|
96
|
+
|
97
|
+
$(document).off('mousedown.bs.colorpicker, touchend.bs.colorpicker');
|
98
|
+
this.$widget.detach();
|
99
|
+
this.$container.remove();
|
100
|
+
this.$active = false;
|
101
|
+
};
|
102
|
+
|
103
|
+
Colorpicker.prototype.setVal = function (color) {
|
104
|
+
if (color == '[object Object]') return;
|
105
|
+
if (!this.$active) return;
|
106
|
+
|
107
|
+
this.$element.val(color);
|
108
|
+
this.options.callback(color);
|
109
|
+
};
|
110
|
+
|
111
|
+
// COLORPICKER PLUGIN DEFINITION
|
112
|
+
// =============================
|
113
|
+
|
114
|
+
function Plugin(option) {
|
115
|
+
return this.each(function () {
|
116
|
+
var $this = $(this);
|
117
|
+
var data = $this.data('bs.colorpicker');
|
118
|
+
var options = typeof option === 'object' && option;
|
119
|
+
|
120
|
+
if (!data) $this.data('bs.colorpicker', (data = new Colorpicker(this, options)));
|
121
|
+
if (typeof option === 'string') data[option]();
|
122
|
+
});
|
123
|
+
}
|
124
|
+
|
125
|
+
var old = $.fn.colorpicker;
|
126
|
+
|
127
|
+
$.fn.colorpicker = Plugin;
|
128
|
+
$.fn.colorpicker.Constructor = Colorpicker;
|
129
|
+
|
130
|
+
// COLORPICKER NO CONFLICT
|
131
|
+
// =======================
|
132
|
+
|
133
|
+
$.fn.colorpicker.noConflict = function () {
|
134
|
+
$.fn.colorpicker = old;
|
135
|
+
return this;
|
136
|
+
};
|
137
|
+
|
138
|
+
// COLORPICKER DATA-API
|
139
|
+
// ====================
|
140
|
+
|
141
|
+
$(document).on('focus.bs.colorpicker.data-api click.bs.colorpicker.data-api', '[data-toggle="colorpicker"]', function (e) {
|
142
|
+
var $this = $(this);
|
143
|
+
if ($this.data('colorpicker')) return;
|
144
|
+
Plugin.call($this, $this.data());
|
145
|
+
});
|
146
|
+
|
147
|
+
}(jQuery);
|