dr-jekylls-materials 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/assets/css/materialize.scss +42 -0
- data/assets/css/site.css +10 -0
- data/assets/fonts/roboto/Roboto-Bold.eot +0 -0
- data/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
- data/assets/fonts/roboto/Roboto-Bold.woff +0 -0
- data/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
- data/assets/fonts/roboto/Roboto-Light.eot +0 -0
- data/assets/fonts/roboto/Roboto-Light.ttf +0 -0
- data/assets/fonts/roboto/Roboto-Light.woff +0 -0
- data/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
- data/assets/fonts/roboto/Roboto-Medium.eot +0 -0
- data/assets/fonts/roboto/Roboto-Medium.ttf +0 -0
- data/assets/fonts/roboto/Roboto-Medium.woff +0 -0
- data/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
- data/assets/fonts/roboto/Roboto-Regular.eot +0 -0
- data/assets/fonts/roboto/Roboto-Regular.ttf +0 -0
- data/assets/fonts/roboto/Roboto-Regular.woff +0 -0
- data/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
- data/assets/fonts/roboto/Roboto-Thin.eot +0 -0
- data/assets/fonts/roboto/Roboto-Thin.ttf +0 -0
- data/assets/fonts/roboto/Roboto-Thin.woff +0 -0
- data/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
- data/assets/js/animation.js +9 -0
- data/assets/js/bin/materialize.js +7778 -0
- data/assets/js/bin/materialize.min.js +10 -0
- data/assets/js/buttons.js +267 -0
- data/assets/js/cards.js +26 -0
- data/assets/js/carousel.js +454 -0
- data/assets/js/character_counter.js +72 -0
- data/assets/js/chips.js +289 -0
- data/assets/js/collapsible.js +160 -0
- data/assets/js/date_picker/picker.date.js +1430 -0
- data/assets/js/date_picker/picker.js +1123 -0
- data/assets/js/dropdown.js +265 -0
- data/assets/js/forms.js +682 -0
- data/assets/js/global.js +98 -0
- data/assets/js/hammer.min.js +1 -0
- data/assets/js/initial.js +11 -0
- data/assets/js/jquery.easing.1.3.js +205 -0
- data/assets/js/jquery.hammer.js +33 -0
- data/assets/js/materialbox.js +269 -0
- data/assets/js/materialize-readies.js +14 -0
- data/assets/js/materialize.js +7779 -0
- data/assets/js/materialize.min.js +10 -0
- data/assets/js/modal.js +184 -0
- data/assets/js/parallax.js +58 -0
- data/assets/js/pushpin.js +71 -0
- data/assets/js/scrollFire.js +48 -0
- data/assets/js/scrollspy.js +284 -0
- data/assets/js/sideNav.js +370 -0
- data/assets/js/slider.js +321 -0
- data/assets/js/tabs.js +164 -0
- data/assets/js/toasts.js +137 -0
- data/assets/js/tooltip.js +236 -0
- data/assets/js/transitions.js +169 -0
- data/assets/js/velocity.min.js +5 -0
- data/assets/js/waves.js +338 -0
- data/assets/materialize-LICENSE +21 -0
- data/assets/materialize-README.md +48 -0
- data/assets/site.css +2 -0
- metadata +61 -1
@@ -0,0 +1,72 @@
|
|
1
|
+
(function ($) {
|
2
|
+
|
3
|
+
$.fn.characterCounter = function(){
|
4
|
+
return this.each(function(){
|
5
|
+
var $input = $(this);
|
6
|
+
var $counterElement = $input.parent().find('span[class="character-counter"]');
|
7
|
+
|
8
|
+
// character counter has already been added appended to the parent container
|
9
|
+
if ($counterElement.length) {
|
10
|
+
return;
|
11
|
+
}
|
12
|
+
|
13
|
+
var itHasLengthAttribute = $input.attr('length') !== undefined;
|
14
|
+
|
15
|
+
if(itHasLengthAttribute){
|
16
|
+
$input.on('input', updateCounter);
|
17
|
+
$input.on('focus', updateCounter);
|
18
|
+
$input.on('blur', removeCounterElement);
|
19
|
+
|
20
|
+
addCounterElement($input);
|
21
|
+
}
|
22
|
+
|
23
|
+
});
|
24
|
+
};
|
25
|
+
|
26
|
+
function updateCounter(){
|
27
|
+
var maxLength = +$(this).attr('length'),
|
28
|
+
actualLength = +$(this).val().length,
|
29
|
+
isValidLength = actualLength <= maxLength;
|
30
|
+
|
31
|
+
$(this).parent().find('span[class="character-counter"]')
|
32
|
+
.html( actualLength + '/' + maxLength);
|
33
|
+
|
34
|
+
addInputStyle(isValidLength, $(this));
|
35
|
+
}
|
36
|
+
|
37
|
+
function addCounterElement($input) {
|
38
|
+
var $counterElement = $input.parent().find('span[class="character-counter"]');
|
39
|
+
|
40
|
+
if ($counterElement.length) {
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
|
44
|
+
$counterElement = $('<span/>')
|
45
|
+
.addClass('character-counter')
|
46
|
+
.css('float','right')
|
47
|
+
.css('font-size','12px')
|
48
|
+
.css('height', 1);
|
49
|
+
|
50
|
+
$input.parent().append($counterElement);
|
51
|
+
}
|
52
|
+
|
53
|
+
function removeCounterElement(){
|
54
|
+
$(this).parent().find('span[class="character-counter"]').html('');
|
55
|
+
}
|
56
|
+
|
57
|
+
function addInputStyle(isValidLength, $input){
|
58
|
+
var inputHasInvalidClass = $input.hasClass('invalid');
|
59
|
+
if (isValidLength && inputHasInvalidClass) {
|
60
|
+
$input.removeClass('invalid');
|
61
|
+
}
|
62
|
+
else if(!isValidLength && !inputHasInvalidClass){
|
63
|
+
$input.removeClass('valid');
|
64
|
+
$input.addClass('invalid');
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
$(document).ready(function(){
|
69
|
+
$('input, textarea').characterCounter();
|
70
|
+
});
|
71
|
+
|
72
|
+
}( jQuery ));
|
data/assets/js/chips.js
ADDED
@@ -0,0 +1,289 @@
|
|
1
|
+
(function ($) {
|
2
|
+
var chipsHandleEvents = false;
|
3
|
+
var materialChipsDefaults = {
|
4
|
+
data: [],
|
5
|
+
placeholder: '',
|
6
|
+
secondaryPlaceholder: '',
|
7
|
+
};
|
8
|
+
|
9
|
+
$(document).ready(function() {
|
10
|
+
// Handle removal of static chips.
|
11
|
+
$(document).on('click', '.chip .close', function(e){
|
12
|
+
var $chips = $(this).closest('.chips');
|
13
|
+
if ($chips.attr('data-initialized')) {
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
$(this).closest('.chip').remove();
|
17
|
+
});
|
18
|
+
});
|
19
|
+
|
20
|
+
$.fn.material_chip = function (options) {
|
21
|
+
var self = this;
|
22
|
+
this.$el = $(this);
|
23
|
+
this.$document = $(document);
|
24
|
+
this.SELS = {
|
25
|
+
CHIPS: '.chips',
|
26
|
+
CHIP: '.chip',
|
27
|
+
INPUT: 'input',
|
28
|
+
DELETE: '.material-icons',
|
29
|
+
SELECTED_CHIP: '.selected',
|
30
|
+
};
|
31
|
+
|
32
|
+
if ('data' === options) {
|
33
|
+
return this.$el.data('chips');
|
34
|
+
}
|
35
|
+
|
36
|
+
var curr_options = $.extend({}, materialChipsDefaults, options);
|
37
|
+
|
38
|
+
|
39
|
+
// Initialize
|
40
|
+
this.init = function() {
|
41
|
+
var i = 0;
|
42
|
+
var chips;
|
43
|
+
self.$el.each(function(){
|
44
|
+
var $chips = $(this);
|
45
|
+
var chipId = Materialize.guid();
|
46
|
+
|
47
|
+
if (!curr_options.data || !(curr_options.data instanceof Array)) {
|
48
|
+
curr_options.data = [];
|
49
|
+
}
|
50
|
+
$chips.data('chips', curr_options.data);
|
51
|
+
$chips.attr('data-index', i);
|
52
|
+
$chips.attr('data-initialized', true);
|
53
|
+
|
54
|
+
if (!$chips.hasClass(self.SELS.CHIPS)) {
|
55
|
+
$chips.addClass('chips');
|
56
|
+
}
|
57
|
+
|
58
|
+
self.chips($chips, chipId);
|
59
|
+
i++;
|
60
|
+
});
|
61
|
+
};
|
62
|
+
|
63
|
+
this.handleEvents = function(){
|
64
|
+
var SELS = self.SELS;
|
65
|
+
|
66
|
+
self.$document.off('click.chips-focus', SELS.CHIPS).on('click.chips-focus', SELS.CHIPS, function(e){
|
67
|
+
$(e.target).find(SELS.INPUT).focus();
|
68
|
+
});
|
69
|
+
|
70
|
+
self.$document.off('click.chips-select', SELS.CHIP).on('click.chips-select', SELS.CHIP, function(e){
|
71
|
+
$(SELS.CHIP).removeClass('selected');
|
72
|
+
$(this).toggleClass('selected');
|
73
|
+
});
|
74
|
+
|
75
|
+
self.$document.off('keydown.chips').on('keydown.chips', function(e){
|
76
|
+
if ($(e.target).is('input, textarea')) {
|
77
|
+
return;
|
78
|
+
}
|
79
|
+
|
80
|
+
// delete
|
81
|
+
var $chip = self.$document.find(SELS.CHIP + SELS.SELECTED_CHIP);
|
82
|
+
var $chips = $chip.closest(SELS.CHIPS);
|
83
|
+
var length = $chip.siblings(SELS.CHIP).length;
|
84
|
+
var index;
|
85
|
+
|
86
|
+
if (!$chip.length) {
|
87
|
+
return;
|
88
|
+
}
|
89
|
+
|
90
|
+
if (e.which === 8 || e.which === 46) {
|
91
|
+
e.preventDefault();
|
92
|
+
|
93
|
+
index = $chip.index();
|
94
|
+
self.deleteChip(index, $chips);
|
95
|
+
|
96
|
+
var selectIndex = null;
|
97
|
+
if ((index + 1) < length) {
|
98
|
+
selectIndex = index;
|
99
|
+
} else if (index === length || (index + 1) === length) {
|
100
|
+
selectIndex = length - 1;
|
101
|
+
}
|
102
|
+
|
103
|
+
if (selectIndex < 0) selectIndex = null;
|
104
|
+
|
105
|
+
if (null !== selectIndex) {
|
106
|
+
self.selectChip(selectIndex, $chips);
|
107
|
+
}
|
108
|
+
if (!length) $chips.find('input').focus();
|
109
|
+
|
110
|
+
// left
|
111
|
+
} else if (e.which === 37) {
|
112
|
+
index = $chip.index() - 1;
|
113
|
+
if (index < 0) {
|
114
|
+
return;
|
115
|
+
}
|
116
|
+
$(SELS.CHIP).removeClass('selected');
|
117
|
+
self.selectChip(index, $chips);
|
118
|
+
|
119
|
+
// right
|
120
|
+
} else if (e.which === 39) {
|
121
|
+
index = $chip.index() + 1;
|
122
|
+
$(SELS.CHIP).removeClass('selected');
|
123
|
+
if (index > length) {
|
124
|
+
$chips.find('input').focus();
|
125
|
+
return;
|
126
|
+
}
|
127
|
+
self.selectChip(index, $chips);
|
128
|
+
}
|
129
|
+
});
|
130
|
+
|
131
|
+
self.$document.off('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
|
132
|
+
var $currChips = $(e.target).closest(SELS.CHIPS);
|
133
|
+
$currChips.addClass('focus');
|
134
|
+
$currChips.siblings('label, .prefix').addClass('active');
|
135
|
+
$(SELS.CHIP).removeClass('selected');
|
136
|
+
});
|
137
|
+
|
138
|
+
self.$document.off('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
|
139
|
+
var $currChips = $(e.target).closest(SELS.CHIPS);
|
140
|
+
$currChips.removeClass('focus');
|
141
|
+
|
142
|
+
// Remove active if empty
|
143
|
+
if (!$currChips.data('chips').length) {
|
144
|
+
$currChips.siblings('label').removeClass('active');
|
145
|
+
}
|
146
|
+
$currChips.siblings('.prefix').removeClass('active');
|
147
|
+
});
|
148
|
+
|
149
|
+
self.$document.off('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT).on('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
|
150
|
+
var $target = $(e.target);
|
151
|
+
var $chips = $target.closest(SELS.CHIPS);
|
152
|
+
var chipsLength = $chips.children(SELS.CHIP).length;
|
153
|
+
|
154
|
+
// enter
|
155
|
+
if (13 === e.which) {
|
156
|
+
e.preventDefault();
|
157
|
+
self.addChip({tag: $target.val()}, $chips);
|
158
|
+
$target.val('');
|
159
|
+
return;
|
160
|
+
}
|
161
|
+
|
162
|
+
// delete or left
|
163
|
+
if ((8 === e.keyCode || 37 === e.keyCode) && '' === $target.val() && chipsLength) {
|
164
|
+
self.selectChip(chipsLength - 1, $chips);
|
165
|
+
$target.blur();
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
});
|
169
|
+
|
170
|
+
// Click on delete icon in chip.
|
171
|
+
self.$document.off('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE).on('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE, function(e) {
|
172
|
+
var $target = $(e.target);
|
173
|
+
var $chips = $target.closest(SELS.CHIPS);
|
174
|
+
var $chip = $target.closest(SELS.CHIP);
|
175
|
+
e.stopPropagation();
|
176
|
+
self.deleteChip($chip.index(), $chips);
|
177
|
+
$chips.find('input').focus();
|
178
|
+
});
|
179
|
+
};
|
180
|
+
|
181
|
+
this.chips = function($chips, chipId) {
|
182
|
+
var html = '';
|
183
|
+
$chips.data('chips').forEach(function(elem){
|
184
|
+
html += self.renderChip(elem);
|
185
|
+
});
|
186
|
+
html += '<input id="' + chipId +'" class="input" placeholder="">';
|
187
|
+
$chips.html(html);
|
188
|
+
self.setPlaceholder($chips);
|
189
|
+
|
190
|
+
// Set for attribute for label
|
191
|
+
var label = $chips.next('label');
|
192
|
+
if (label.length) {
|
193
|
+
label.attr('for', chipId);
|
194
|
+
|
195
|
+
if ($chips.data('chips').length) {
|
196
|
+
label.addClass('active');
|
197
|
+
}
|
198
|
+
}
|
199
|
+
};
|
200
|
+
|
201
|
+
this.renderChip = function(elem) {
|
202
|
+
if (!elem.tag) return;
|
203
|
+
|
204
|
+
var html = '<div class="chip">' + elem.tag;
|
205
|
+
if (elem.image) {
|
206
|
+
html += ' <img src="' + elem.image + '"> ';
|
207
|
+
}
|
208
|
+
html += '<i class="material-icons close">close</i>';
|
209
|
+
html += '</div>';
|
210
|
+
return html;
|
211
|
+
};
|
212
|
+
|
213
|
+
this.setPlaceholder = function($chips) {
|
214
|
+
if ($chips.data('chips').length && curr_options.placeholder) {
|
215
|
+
$chips.find('input').prop('placeholder', curr_options.placeholder);
|
216
|
+
|
217
|
+
} else if (!$chips.data('chips').length && curr_options.secondaryPlaceholder) {
|
218
|
+
$chips.find('input').prop('placeholder', curr_options.secondaryPlaceholder);
|
219
|
+
}
|
220
|
+
};
|
221
|
+
|
222
|
+
this.isValid = function($chips, elem) {
|
223
|
+
var chips = $chips.data('chips');
|
224
|
+
var exists = false;
|
225
|
+
for (var i=0; i < chips.length; i++) {
|
226
|
+
if (chips[i].tag === elem.tag) {
|
227
|
+
exists = true;
|
228
|
+
return;
|
229
|
+
}
|
230
|
+
}
|
231
|
+
return '' !== elem.tag && !exists;
|
232
|
+
};
|
233
|
+
|
234
|
+
this.addChip = function(elem, $chips) {
|
235
|
+
if (!self.isValid($chips, elem)) {
|
236
|
+
return;
|
237
|
+
}
|
238
|
+
var chipHtml = self.renderChip(elem);
|
239
|
+
var newData = [];
|
240
|
+
var oldData = $chips.data('chips');
|
241
|
+
for (var i = 0; i < oldData.length; i++) {
|
242
|
+
newData.push(oldData[i]);
|
243
|
+
}
|
244
|
+
newData.push(elem);
|
245
|
+
|
246
|
+
$chips.data('chips', newData);
|
247
|
+
$(chipHtml).insertBefore($chips.find('input'));
|
248
|
+
$chips.trigger('chip.add', elem);
|
249
|
+
self.setPlaceholder($chips);
|
250
|
+
};
|
251
|
+
|
252
|
+
this.deleteChip = function(chipIndex, $chips) {
|
253
|
+
var chip = $chips.data('chips')[chipIndex];
|
254
|
+
$chips.find('.chip').eq(chipIndex).remove();
|
255
|
+
|
256
|
+
var newData = [];
|
257
|
+
var oldData = $chips.data('chips');
|
258
|
+
for (var i = 0; i < oldData.length; i++) {
|
259
|
+
if (i !== chipIndex) {
|
260
|
+
newData.push(oldData[i]);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
264
|
+
$chips.data('chips', newData);
|
265
|
+
$chips.trigger('chip.delete', chip);
|
266
|
+
self.setPlaceholder($chips);
|
267
|
+
};
|
268
|
+
|
269
|
+
this.selectChip = function(chipIndex, $chips) {
|
270
|
+
var $chip = $chips.find('.chip').eq(chipIndex);
|
271
|
+
if ($chip && false === $chip.hasClass('selected')) {
|
272
|
+
$chip.addClass('selected');
|
273
|
+
$chips.trigger('chip.select', $chips.data('chips')[chipIndex]);
|
274
|
+
}
|
275
|
+
};
|
276
|
+
|
277
|
+
this.getChipsElement = function(index, $chips) {
|
278
|
+
return $chips.eq(index);
|
279
|
+
};
|
280
|
+
|
281
|
+
// init
|
282
|
+
this.init();
|
283
|
+
|
284
|
+
if (!chipsHandleEvents) {
|
285
|
+
this.handleEvents();
|
286
|
+
chipsHandleEvents = true;
|
287
|
+
}
|
288
|
+
};
|
289
|
+
}( jQuery ));
|
@@ -0,0 +1,160 @@
|
|
1
|
+
(function ($) {
|
2
|
+
$.fn.collapsible = function(options) {
|
3
|
+
var defaults = {
|
4
|
+
accordion: undefined,
|
5
|
+
onOpen: undefined,
|
6
|
+
onClose: undefined
|
7
|
+
};
|
8
|
+
|
9
|
+
options = $.extend(defaults, options);
|
10
|
+
|
11
|
+
|
12
|
+
return this.each(function() {
|
13
|
+
|
14
|
+
var $this = $(this);
|
15
|
+
|
16
|
+
var $panel_headers = $(this).find('> li > .collapsible-header');
|
17
|
+
|
18
|
+
var collapsible_type = $this.data("collapsible");
|
19
|
+
|
20
|
+
// Turn off any existing event handlers
|
21
|
+
$this.off('click.collapse', '> li > .collapsible-header');
|
22
|
+
$panel_headers.off('click.collapse');
|
23
|
+
|
24
|
+
|
25
|
+
/****************
|
26
|
+
Helper Functions
|
27
|
+
****************/
|
28
|
+
|
29
|
+
// Accordion Open
|
30
|
+
function accordionOpen(object) {
|
31
|
+
$panel_headers = $this.find('> li > .collapsible-header');
|
32
|
+
if (object.hasClass('active')) {
|
33
|
+
object.parent().addClass('active');
|
34
|
+
}
|
35
|
+
else {
|
36
|
+
object.parent().removeClass('active');
|
37
|
+
}
|
38
|
+
if (object.parent().hasClass('active')){
|
39
|
+
object.siblings('.collapsible-body').stop(true,false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function() {$(this).css('height', '');}});
|
40
|
+
}
|
41
|
+
else{
|
42
|
+
object.siblings('.collapsible-body').stop(true,false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function() {$(this).css('height', '');}});
|
43
|
+
}
|
44
|
+
|
45
|
+
$panel_headers.not(object).removeClass('active').parent().removeClass('active');
|
46
|
+
|
47
|
+
// Close previously open accordion elements.
|
48
|
+
$panel_headers.not(object).parent().children('.collapsible-body').stop(true,false).each(function() {
|
49
|
+
if ($(this).is(':visible')) {
|
50
|
+
$(this).slideUp({
|
51
|
+
duration: 350,
|
52
|
+
easing: "easeOutQuart",
|
53
|
+
queue: false,
|
54
|
+
complete:
|
55
|
+
function() {
|
56
|
+
$(this).css('height', '');
|
57
|
+
execCallbacks($(this).siblings('.collapsible-header'));
|
58
|
+
}
|
59
|
+
});
|
60
|
+
}
|
61
|
+
});
|
62
|
+
}
|
63
|
+
|
64
|
+
// Expandable Open
|
65
|
+
function expandableOpen(object) {
|
66
|
+
if (object.hasClass('active')) {
|
67
|
+
object.parent().addClass('active');
|
68
|
+
}
|
69
|
+
else {
|
70
|
+
object.parent().removeClass('active');
|
71
|
+
}
|
72
|
+
if (object.parent().hasClass('active')){
|
73
|
+
object.siblings('.collapsible-body').stop(true,false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function() {$(this).css('height', '');}});
|
74
|
+
}
|
75
|
+
else {
|
76
|
+
object.siblings('.collapsible-body').stop(true,false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function() {$(this).css('height', '');}});
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
// Open collapsible. object: .collapsible-header
|
81
|
+
function collapsibleOpen(object) {
|
82
|
+
if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) { // Handle Accordion
|
83
|
+
accordionOpen(object);
|
84
|
+
} else { // Handle Expandables
|
85
|
+
expandableOpen(object);
|
86
|
+
}
|
87
|
+
|
88
|
+
execCallbacks(object);
|
89
|
+
}
|
90
|
+
|
91
|
+
// Handle callbacks
|
92
|
+
function execCallbacks(object) {
|
93
|
+
if (object.hasClass('active')) {
|
94
|
+
if (typeof(options.onOpen) === "function") {
|
95
|
+
options.onOpen.call(this, object.parent());
|
96
|
+
}
|
97
|
+
} else {
|
98
|
+
if (typeof(options.onClose) === "function") {
|
99
|
+
options.onClose.call(this, object.parent());
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Check if object is children of panel header
|
106
|
+
* @param {Object} object Jquery object
|
107
|
+
* @return {Boolean} true if it is children
|
108
|
+
*/
|
109
|
+
function isChildrenOfPanelHeader(object) {
|
110
|
+
|
111
|
+
var panelHeader = getPanelHeader(object);
|
112
|
+
|
113
|
+
return panelHeader.length > 0;
|
114
|
+
}
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Get panel header from a children element
|
118
|
+
* @param {Object} object Jquery object
|
119
|
+
* @return {Object} panel header object
|
120
|
+
*/
|
121
|
+
function getPanelHeader(object) {
|
122
|
+
|
123
|
+
return object.closest('li > .collapsible-header');
|
124
|
+
}
|
125
|
+
|
126
|
+
/***** End Helper Functions *****/
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
// Add click handler to only direct collapsible header children
|
131
|
+
$this.on('click.collapse', '> li > .collapsible-header', function(e) {
|
132
|
+
var element = $(e.target);
|
133
|
+
|
134
|
+
if (isChildrenOfPanelHeader(element)) {
|
135
|
+
element = getPanelHeader(element);
|
136
|
+
}
|
137
|
+
|
138
|
+
element.toggleClass('active');
|
139
|
+
|
140
|
+
collapsibleOpen(element);
|
141
|
+
});
|
142
|
+
|
143
|
+
|
144
|
+
// Open first active
|
145
|
+
if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) { // Handle Accordion
|
146
|
+
collapsibleOpen($panel_headers.filter('.active').first());
|
147
|
+
|
148
|
+
} else { // Handle Expandables
|
149
|
+
$panel_headers.filter('.active').each(function() {
|
150
|
+
collapsibleOpen($(this));
|
151
|
+
});
|
152
|
+
}
|
153
|
+
|
154
|
+
});
|
155
|
+
};
|
156
|
+
|
157
|
+
$(document).ready(function(){
|
158
|
+
$('.collapsible').collapsible();
|
159
|
+
});
|
160
|
+
}( jQuery ));
|