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
data/vendor/.DS_Store
ADDED
Binary file
|
Binary file
|
Binary file
|
@@ -1,34 +1,39 @@
|
|
1
1
|
// Table of Contents
|
2
2
|
// ==================================================
|
3
|
-
//
|
3
|
+
// Base Imports
|
4
|
+
// Extension Imports
|
4
5
|
//
|
5
|
-
//
|
6
|
+
// Base Imports
|
6
7
|
// ==================================================
|
7
|
-
//= require
|
8
|
-
//= require
|
9
|
-
//= require
|
10
|
-
//= require
|
11
|
-
//= require
|
12
|
-
//= require
|
13
|
-
//= require
|
14
|
-
//= require
|
15
|
-
//= require
|
16
|
-
//= require
|
17
|
-
//= require
|
18
|
-
//= require
|
19
|
-
//= require
|
20
|
-
//= require
|
21
|
-
//= require
|
22
|
-
//= require
|
23
|
-
//= require
|
24
|
-
//= require
|
25
|
-
//= require
|
26
|
-
//= require
|
27
|
-
//= require
|
28
|
-
//= require
|
29
|
-
//= require
|
30
|
-
//= require
|
31
|
-
//= require
|
32
|
-
|
33
|
-
|
34
|
-
|
8
|
+
//= require base/_animation
|
9
|
+
//= require base/_transition
|
10
|
+
//= require base/_layout
|
11
|
+
//= require base/_affix
|
12
|
+
//= require base/_modal
|
13
|
+
//= require base/_alert
|
14
|
+
//= require base/_tab
|
15
|
+
//= require base/_scrollspy
|
16
|
+
//= require base/_list
|
17
|
+
//= require base/_table
|
18
|
+
//= require base/_collapse
|
19
|
+
//= require base/_tooltip
|
20
|
+
//= require base/_popover
|
21
|
+
//= require base/_carousel
|
22
|
+
//= require base/_button
|
23
|
+
//= require base/_dropdown
|
24
|
+
//= require base/_hoverdown
|
25
|
+
//= require base/_colorpicker
|
26
|
+
//= require base/_datepicker
|
27
|
+
//= require base/_filepicker
|
28
|
+
//= require base/_timepicker
|
29
|
+
//= require base/_typeahead
|
30
|
+
//= require base/_timeago
|
31
|
+
//= require base/_switch
|
32
|
+
//= require base/_tour
|
33
|
+
//
|
34
|
+
// Extensions Imports
|
35
|
+
// ==================================================
|
36
|
+
//= require extensions/_calendar
|
37
|
+
//= require extensions/_chart
|
38
|
+
//= require extensions/_map
|
39
|
+
//
|
@@ -0,0 +1,170 @@
|
|
1
|
+
+function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// AFFIX CLASS DEFINITION
|
5
|
+
// ======================
|
6
|
+
|
7
|
+
var Affix = function (element, options) {
|
8
|
+
this.options = $.extend({}, Affix.DEFAULTS, options);
|
9
|
+
|
10
|
+
this.$target = $(this.options.target)
|
11
|
+
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
|
12
|
+
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this));
|
13
|
+
|
14
|
+
this.$element = $(element);
|
15
|
+
this.affixed = null;
|
16
|
+
this.unpin = null;
|
17
|
+
this.pinnedOffset = null;
|
18
|
+
|
19
|
+
this.checkPosition();
|
20
|
+
};
|
21
|
+
|
22
|
+
Affix.VERSION = '1.0.0';
|
23
|
+
Affix.RESET = 'affix affix-top affix-bottom';
|
24
|
+
Affix.DEFAULTS = {
|
25
|
+
offset: 0,
|
26
|
+
target: window
|
27
|
+
};
|
28
|
+
|
29
|
+
Affix.prototype.constructor = Affix;
|
30
|
+
|
31
|
+
Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
|
32
|
+
var scrollTop = this.$target.scrollTop();
|
33
|
+
var position = this.$element.offset();
|
34
|
+
var targetHeight = this.$target.height();
|
35
|
+
|
36
|
+
if (offsetTop !== null && this.affixed === 'top') {
|
37
|
+
return scrollTop < offsetTop ? 'top' : false;
|
38
|
+
}
|
39
|
+
|
40
|
+
if (this.affixed === 'bottom') {
|
41
|
+
if (offsetTop !== null) {
|
42
|
+
return (scrollTop + this.unpin <= position.top) ? false : 'bottom';
|
43
|
+
}
|
44
|
+
|
45
|
+
return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom';
|
46
|
+
}
|
47
|
+
|
48
|
+
var initializing = this.affixed === null;
|
49
|
+
var colliderTop = initializing ? scrollTop : position.top;
|
50
|
+
var colliderHeight = initializing ? targetHeight : height;
|
51
|
+
|
52
|
+
if (offsetTop !== null && scrollTop <= offsetTop) return 'top';
|
53
|
+
if (offsetBottom !== null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom';
|
54
|
+
|
55
|
+
return false;
|
56
|
+
};
|
57
|
+
|
58
|
+
Affix.prototype.getPinnedOffset = function () {
|
59
|
+
if (this.pinnedOffset) return this.pinnedOffset;
|
60
|
+
|
61
|
+
this.$element
|
62
|
+
.removeClass(Affix.RESET)
|
63
|
+
.addClass('affix');
|
64
|
+
|
65
|
+
var scrollTop = this.$target.scrollTop();
|
66
|
+
var position = this.$element.offset();
|
67
|
+
|
68
|
+
return (this.pinnedOffset = position.top - scrollTop);
|
69
|
+
};
|
70
|
+
|
71
|
+
Affix.prototype.checkPositionWithEventLoop = function () {
|
72
|
+
setTimeout($.proxy(this.checkPosition, this), 1);
|
73
|
+
};
|
74
|
+
|
75
|
+
Affix.prototype.checkPosition = function () {
|
76
|
+
if (!this.$element.is(':visible')) return;
|
77
|
+
|
78
|
+
var height = this.$element.height();
|
79
|
+
var offset = this.options.offset;
|
80
|
+
var offsetTop = offset.top;
|
81
|
+
var offsetBottom = offset.bottom;
|
82
|
+
var scrollHeight = Math.max($(document).height(), $(document.body).height());
|
83
|
+
|
84
|
+
if (typeof offset != 'object') {
|
85
|
+
offsetBottom = offsetTop = offset;
|
86
|
+
}
|
87
|
+
if (typeof offsetTop === 'function') {
|
88
|
+
offsetTop = offset.top(this.$element);
|
89
|
+
}
|
90
|
+
if (typeof offsetBottom === 'function') {
|
91
|
+
offsetBottom = offset.bottom(this.$element);
|
92
|
+
}
|
93
|
+
|
94
|
+
var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom);
|
95
|
+
|
96
|
+
if (this.affixed != affix) {
|
97
|
+
if (this.unpin !== null) this.$element.css('top', '');
|
98
|
+
|
99
|
+
var affixType = 'affix' + (affix ? '-' + affix : '');
|
100
|
+
var e = $.Event(affixType + '.bs.affix');
|
101
|
+
|
102
|
+
this.$element.trigger(e);
|
103
|
+
|
104
|
+
if (e.isDefaultPrevented()) return;
|
105
|
+
|
106
|
+
this.affixed = affix;
|
107
|
+
this.unpin = affix === 'bottom' ? this.getPinnedOffset() : null;
|
108
|
+
|
109
|
+
this.$element
|
110
|
+
.removeClass(Affix.RESET)
|
111
|
+
.addClass(affixType)
|
112
|
+
.trigger(affixType.replace('affix', 'affixed') + '.bs.affix');
|
113
|
+
}
|
114
|
+
|
115
|
+
if (affix === 'bottom') {
|
116
|
+
this.$element.offset({
|
117
|
+
top: scrollHeight - height - offsetBottom
|
118
|
+
});
|
119
|
+
}
|
120
|
+
};
|
121
|
+
|
122
|
+
// AFFIX PLUGIN DEFINITION
|
123
|
+
// =======================
|
124
|
+
|
125
|
+
function Plugin(option) {
|
126
|
+
return this.each(function () {
|
127
|
+
var $this = $(this);
|
128
|
+
var data = $this.data('bs.affix');
|
129
|
+
var options = typeof option === 'object' && option;
|
130
|
+
|
131
|
+
if (!data) $this.data('bs.affix', (data = new Affix(this, options)));
|
132
|
+
if (typeof option === 'string') data[option]();
|
133
|
+
});
|
134
|
+
}
|
135
|
+
|
136
|
+
var old = $.fn.affix;
|
137
|
+
|
138
|
+
$.fn.affix = Plugin;
|
139
|
+
$.fn.affix.Constructor = Affix;
|
140
|
+
|
141
|
+
// AFFIX NO CONFLICT
|
142
|
+
// =================
|
143
|
+
|
144
|
+
$.fn.affix.noConflict = function () {
|
145
|
+
$.fn.affix = old;
|
146
|
+
return this;
|
147
|
+
};
|
148
|
+
|
149
|
+
// AFFIX DATA-API
|
150
|
+
// ==============
|
151
|
+
|
152
|
+
$(document).on('ready.bs.affix.data-api', function () {
|
153
|
+
$('[data-spy="affix"]').each(function () {
|
154
|
+
var $this = $(this);
|
155
|
+
var data = $this.data();
|
156
|
+
|
157
|
+
data.offset = data.offset || {};
|
158
|
+
|
159
|
+
if (data.offsetBottom !== null) {
|
160
|
+
data.offset.bottom = data.offsetBottom;
|
161
|
+
}
|
162
|
+
if (data.offsetTop !== null) {
|
163
|
+
data.offset.top = data.offsetTop;
|
164
|
+
}
|
165
|
+
|
166
|
+
Plugin.call($this, data);
|
167
|
+
});
|
168
|
+
});
|
169
|
+
|
170
|
+
}(jQuery);
|
@@ -0,0 +1,80 @@
|
|
1
|
+
+function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// ALERT CLASS DEFINITION
|
5
|
+
// ======================
|
6
|
+
|
7
|
+
var dismiss = '[data-dismiss="alert"]';
|
8
|
+
var Alert = function (el) {
|
9
|
+
$(el).on('click', dismiss, this.close);
|
10
|
+
};
|
11
|
+
|
12
|
+
Alert.VERSION = '1.0.0';
|
13
|
+
Alert.TRANSITION_DURATION = 150;
|
14
|
+
|
15
|
+
Alert.prototype.constructor = Alert;
|
16
|
+
|
17
|
+
Alert.prototype.close = function (e) {
|
18
|
+
var $this = $(this);
|
19
|
+
var selector = $this.attr('data-target');
|
20
|
+
|
21
|
+
if (!selector) {
|
22
|
+
selector = $this.attr('href');
|
23
|
+
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '');
|
24
|
+
}
|
25
|
+
|
26
|
+
var $parent = $(selector);
|
27
|
+
|
28
|
+
if (e) e.preventDefault();
|
29
|
+
if (!$parent.length) {
|
30
|
+
$parent = $this.closest('.alert');
|
31
|
+
}
|
32
|
+
|
33
|
+
$parent.trigger(e = $.Event('close.bs.alert'));
|
34
|
+
|
35
|
+
if (e.isDefaultPrevented()) return;
|
36
|
+
|
37
|
+
$parent.removeClass('in');
|
38
|
+
|
39
|
+
function removeElement() {
|
40
|
+
$parent.detach().trigger('closed.bs.alert').remove();
|
41
|
+
}
|
42
|
+
|
43
|
+
$.support.transition && $parent.hasClass('fade') ?
|
44
|
+
$parent.one('bsTransitionEnd', removeElement)
|
45
|
+
.emulateTransitionEnd(Alert.TRANSITION_DURATION) :
|
46
|
+
removeElement();
|
47
|
+
};
|
48
|
+
|
49
|
+
// ALERT PLUGIN DEFINITION
|
50
|
+
// =======================
|
51
|
+
|
52
|
+
function Plugin(option) {
|
53
|
+
return this.each(function () {
|
54
|
+
var $this = $(this);
|
55
|
+
var data = $this.data('bs.alert');
|
56
|
+
|
57
|
+
if (!data) $this.data('bs.alert', (data = new Alert(this)));
|
58
|
+
if (typeof option === 'string') data[option]();
|
59
|
+
});
|
60
|
+
}
|
61
|
+
|
62
|
+
var old = $.fn.alert;
|
63
|
+
|
64
|
+
$.fn.alert = Plugin;
|
65
|
+
$.fn.alert.Constructor = Alert;
|
66
|
+
|
67
|
+
// ALERT NO CONFLICT
|
68
|
+
// =================
|
69
|
+
|
70
|
+
$.fn.alert.noConflict = function () {
|
71
|
+
$.fn.alert = old;
|
72
|
+
return this;
|
73
|
+
};
|
74
|
+
|
75
|
+
// ALERT DATA-API
|
76
|
+
// ==============
|
77
|
+
|
78
|
+
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close);
|
79
|
+
|
80
|
+
}(jQuery);
|
@@ -0,0 +1,106 @@
|
|
1
|
+
+function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// ANIMATION PUBLIC CLASS DEFINITION
|
5
|
+
// =================================
|
6
|
+
|
7
|
+
var Animation = function (element, options) {
|
8
|
+
this.$element = $(element);
|
9
|
+
|
10
|
+
this.settings = {
|
11
|
+
delay: this.$element.data('delay'),
|
12
|
+
duration: this.$element.data('duration'),
|
13
|
+
effect: this.$element.data('effect'),
|
14
|
+
hide: this.$element.data('hide'),
|
15
|
+
infinite: this.$element.data('infinite')
|
16
|
+
};
|
17
|
+
this.options = $.extend({}, Animation.DEFAULTS, this.settings, options);
|
18
|
+
|
19
|
+
this.init(this.$element);
|
20
|
+
};
|
21
|
+
|
22
|
+
Animation.VERSION = '1.0.0';
|
23
|
+
Animation.TRANSITION_END = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
|
24
|
+
Animation.DEFAULTS = {
|
25
|
+
delay: 'n',
|
26
|
+
duration: 'b',
|
27
|
+
effect: 'bounce',
|
28
|
+
hide: false,
|
29
|
+
infinite: false
|
30
|
+
};
|
31
|
+
|
32
|
+
Animation.prototype.constructor = Animation;
|
33
|
+
|
34
|
+
Animation.prototype.init = function () {
|
35
|
+
var element = this.reset();
|
36
|
+
var hide = this.options.hide;
|
37
|
+
var infinite = this.options.infinite;
|
38
|
+
var animation = 'animation' +
|
39
|
+
' animation-effect-' + this.options.effect +
|
40
|
+
' animation-delay-' + this.options.delay +
|
41
|
+
' animation-duration-' + this.options.duration +
|
42
|
+
(infinite === true ? ' infinite' : '');
|
43
|
+
|
44
|
+
if (element.hasClass('hidden') || element.is(':hidden')) {
|
45
|
+
element.removeClass('hidden');
|
46
|
+
element.show();
|
47
|
+
}
|
48
|
+
if (element.css('visibility') === 'hidden') element.css('visibility', 'visible');
|
49
|
+
|
50
|
+
element.removeClass(animation)
|
51
|
+
.addClass(animation)
|
52
|
+
.on(Animation.TRANSITION_END, function (event) {
|
53
|
+
event.stopPropagation();
|
54
|
+
event.preventDefault();
|
55
|
+
|
56
|
+
if (infinite !== true) element.removeClass(animation);
|
57
|
+
if (hide === true) element.addClass('hidden');
|
58
|
+
});
|
59
|
+
};
|
60
|
+
|
61
|
+
Animation.prototype.reset = function () {
|
62
|
+
this.$element.before(this.$element.clone(true));
|
63
|
+
|
64
|
+
var clone = this.$element.prev();
|
65
|
+
this.$element.remove();
|
66
|
+
|
67
|
+
return clone;
|
68
|
+
};
|
69
|
+
|
70
|
+
// ANIMATION PLUGIN DEFINITION
|
71
|
+
// ===========================
|
72
|
+
|
73
|
+
function Plugin(option) {
|
74
|
+
return this.each(function () {
|
75
|
+
var $this = $(this);
|
76
|
+
var data = $this.data('bs.animation');
|
77
|
+
var options = typeof option === 'object' && option;
|
78
|
+
|
79
|
+
if (!data) $this.data('bs.animation', (data = new Animation(this, options)));
|
80
|
+
if (typeof option === 'string') data[option]();
|
81
|
+
});
|
82
|
+
}
|
83
|
+
|
84
|
+
var old = $.fn.animation;
|
85
|
+
|
86
|
+
$.fn.animation = Plugin;
|
87
|
+
$.fn.animation.Constructor = Animation;
|
88
|
+
|
89
|
+
// ANIMATION NO CONFLICT
|
90
|
+
// =====================
|
91
|
+
|
92
|
+
$.fn.animation.noConflict = function () {
|
93
|
+
$.fn.animation = old;
|
94
|
+
return this;
|
95
|
+
};
|
96
|
+
|
97
|
+
// ANIMATION DATA-API
|
98
|
+
// ==================
|
99
|
+
|
100
|
+
$(document).on('[data-toggle="animation"]', function (e) {
|
101
|
+
var $this = $(this);
|
102
|
+
if ($this.data('animation')) return;
|
103
|
+
Plugin.call($this, $this.data());
|
104
|
+
});
|
105
|
+
|
106
|
+
}(jQuery);
|
@@ -0,0 +1,123 @@
|
|
1
|
+
+function ($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// BUTTON PUBLIC CLASS DEFINITION
|
5
|
+
// ==============================
|
6
|
+
|
7
|
+
var Button = function (element, options) {
|
8
|
+
this.$element = $(element);
|
9
|
+
this.options = $.extend({}, Button.DEFAULTS, options);
|
10
|
+
|
11
|
+
this.$isLoading = false;
|
12
|
+
};
|
13
|
+
|
14
|
+
Button.VERSION = '1.0.0';
|
15
|
+
Button.DEFAULTS = {
|
16
|
+
loadingText: 'Loading...'
|
17
|
+
};
|
18
|
+
|
19
|
+
Button.prototype.constructor = Button;
|
20
|
+
|
21
|
+
Button.prototype.setState = function (state) {
|
22
|
+
var d = 'disabled';
|
23
|
+
var $el = this.$element;
|
24
|
+
var val = $el.is('input') ? 'val' : 'html';
|
25
|
+
var data = $el.data();
|
26
|
+
|
27
|
+
state = state + 'Text';
|
28
|
+
|
29
|
+
if (data.resetText === null) $el.data('resetText', $el[val]());
|
30
|
+
|
31
|
+
setTimeout($.proxy(function () {
|
32
|
+
$el[val](data[state] === null ? this.options[state] : data[state]);
|
33
|
+
|
34
|
+
if (state === 'loadingText') {
|
35
|
+
this.$isLoading = true;
|
36
|
+
$el.addClass(d)
|
37
|
+
.attr(d, d);
|
38
|
+
} else if (this.$isLoading) {
|
39
|
+
this.$isLoading = false;
|
40
|
+
$el.removeClass(d)
|
41
|
+
.removeAttr(d);
|
42
|
+
}
|
43
|
+
}, this), 0);
|
44
|
+
};
|
45
|
+
|
46
|
+
Button.prototype.toggle = function () {
|
47
|
+
var changed = true;
|
48
|
+
var $parent = this.$element.closest('[data-toggle="buttons"]');
|
49
|
+
|
50
|
+
if ($parent.length) {
|
51
|
+
var $input = this.$element.find('input');
|
52
|
+
|
53
|
+
if ($input.prop('type') === 'radio') {
|
54
|
+
if ($input.prop('checked') && this.$element.hasClass('active')) {
|
55
|
+
changed = false;
|
56
|
+
} else {
|
57
|
+
$parent.find('.active').removeClass('active');
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
if (changed) {
|
62
|
+
$input.prop('checked', !this.$element.hasClass('active'))
|
63
|
+
.trigger('change');
|
64
|
+
}
|
65
|
+
} else {
|
66
|
+
this.$element.attr('aria-pressed', !this.$element.hasClass('active'));
|
67
|
+
}
|
68
|
+
|
69
|
+
if (changed) this.$element.toggleClass('active');
|
70
|
+
};
|
71
|
+
|
72
|
+
// BUTTON PLUGIN DEFINITION
|
73
|
+
// ========================
|
74
|
+
|
75
|
+
function Plugin(option) {
|
76
|
+
return this.each(function () {
|
77
|
+
var $this = $(this);
|
78
|
+
var data = $this.data('bs.button');
|
79
|
+
var options = typeof option === 'object' && option;
|
80
|
+
|
81
|
+
if (!data) $this.data('bs.button', (data = new Button(this, options)));
|
82
|
+
|
83
|
+
if (option === 'toggle') {
|
84
|
+
data.toggle();
|
85
|
+
} else if (option) {
|
86
|
+
data.setState(option);
|
87
|
+
}
|
88
|
+
});
|
89
|
+
}
|
90
|
+
|
91
|
+
var old = $.fn.button;
|
92
|
+
|
93
|
+
$.fn.button = Plugin;
|
94
|
+
$.fn.button.Constructor = Button;
|
95
|
+
|
96
|
+
// BUTTON NO CONFLICT
|
97
|
+
// ==================
|
98
|
+
|
99
|
+
$.fn.button.noConflict = function () {
|
100
|
+
$.fn.button = old;
|
101
|
+
return this;
|
102
|
+
};
|
103
|
+
|
104
|
+
// BUTTON DATA-API
|
105
|
+
// ===============
|
106
|
+
|
107
|
+
$(document)
|
108
|
+
.on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
|
109
|
+
var $btn = $(e.target);
|
110
|
+
|
111
|
+
if (!$btn.hasClass('btn')) {
|
112
|
+
$btn = $btn.closest('.btn');
|
113
|
+
}
|
114
|
+
|
115
|
+
Plugin.call($btn, 'toggle');
|
116
|
+
e.preventDefault();
|
117
|
+
})
|
118
|
+
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
|
119
|
+
$(e.target).closest('.btn')
|
120
|
+
.toggleClass('focus', /^focus(in)?$/.test(e.type));
|
121
|
+
});
|
122
|
+
|
123
|
+
}(jQuery);
|