materialize-sass 0.97.6 → 0.97.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/app/assets/javascripts/materialize-sprockets.js +1 -4
- data/app/assets/javascripts/materialize.js +887 -338
- data/app/assets/javascripts/materialize.min.js +5 -5
- data/app/assets/javascripts/materialize/animation.js +0 -0
- data/app/assets/javascripts/materialize/buttons.js +0 -0
- data/app/assets/javascripts/materialize/cards.js +0 -3
- data/app/assets/javascripts/materialize/carousel.js +150 -46
- data/app/assets/javascripts/materialize/character_counter.js +0 -0
- data/app/assets/javascripts/materialize/chips.js +262 -4
- data/app/assets/javascripts/materialize/collapsible.js +0 -0
- data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -0
- data/app/assets/javascripts/materialize/date_picker/picker.js +0 -0
- data/app/assets/javascripts/materialize/dropdown.js +206 -178
- data/app/assets/javascripts/materialize/extras/nouislider.js +0 -0
- data/app/assets/javascripts/materialize/extras/nouislider.min.js +0 -0
- data/app/assets/javascripts/materialize/forms.js +94 -9
- data/app/assets/javascripts/materialize/global.js +0 -0
- data/app/assets/javascripts/materialize/hammer.min.js +0 -0
- data/app/assets/javascripts/materialize/init.js +21 -3
- data/app/assets/javascripts/materialize/initial.js +0 -0
- data/app/assets/javascripts/materialize/jquery.easing.1.3.js +0 -0
- data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -0
- data/app/assets/javascripts/materialize/leanModal.js +11 -10
- data/app/assets/javascripts/materialize/materialbox.js +0 -0
- data/app/assets/javascripts/materialize/parallax.js +0 -0
- data/app/assets/javascripts/materialize/prism.js +0 -0
- data/app/assets/javascripts/materialize/pushpin.js +15 -1
- data/app/assets/javascripts/materialize/scrollFire.js +2 -2
- data/app/assets/javascripts/materialize/scrollspy.js +7 -8
- data/app/assets/javascripts/materialize/sideNav.js +15 -7
- data/app/assets/javascripts/materialize/slider.js +1 -1
- data/app/assets/javascripts/materialize/tabs.js +15 -2
- data/app/assets/javascripts/materialize/toasts.js +0 -0
- data/app/assets/javascripts/materialize/tooltip.js +86 -59
- data/app/assets/javascripts/materialize/transitions.js +20 -5
- data/app/assets/javascripts/materialize/velocity.min.js +0 -0
- data/app/assets/javascripts/materialize/waves.js +0 -0
- data/app/assets/stylesheets/materialize/components/_buttons.scss +15 -1
- data/app/assets/stylesheets/materialize/components/_cards.scss +54 -7
- data/app/assets/stylesheets/materialize/components/_carousel.scss +60 -9
- data/app/assets/stylesheets/materialize/components/_chips.scss +49 -2
- data/app/assets/stylesheets/materialize/components/_collapsible.scss +3 -3
- data/app/assets/stylesheets/materialize/components/_color.scss +1 -1
- data/app/assets/stylesheets/materialize/components/_global.scss +7 -8
- data/app/assets/stylesheets/materialize/components/_grid.scss +1 -0
- data/app/assets/stylesheets/materialize/components/_navbar.scss +15 -4
- data/app/assets/stylesheets/materialize/components/_sideNav.scss +93 -8
- data/app/assets/stylesheets/materialize/components/_tooltip.scss +20 -22
- data/app/assets/stylesheets/materialize/components/_variables.scss +11 -7
- data/app/assets/stylesheets/materialize/components/_waves.scss +5 -1
- data/app/assets/stylesheets/materialize/components/forms/_checkboxes.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_file-input.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_forms.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_input-fields.scss +23 -4
- data/app/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_range.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_select.scss +0 -0
- data/app/assets/stylesheets/materialize/components/forms/_switches.scss +0 -0
- data/app/assets/stylesheets/materialize/extras/nouislider.css +0 -0
- data/lib/materialize-sass/version.rb +1 -1
- metadata +3 -3
File without changes
|
File without changes
|
File without changes
|
@@ -7,7 +7,7 @@
|
|
7
7
|
return this;
|
8
8
|
};
|
9
9
|
|
10
|
-
$.fn.dropdown = function (
|
10
|
+
$.fn.dropdown = function (options) {
|
11
11
|
var defaults = {
|
12
12
|
inDuration: 300,
|
13
13
|
outDuration: 225,
|
@@ -15,220 +15,248 @@
|
|
15
15
|
hover: false,
|
16
16
|
gutter: 0, // Spacing from edge
|
17
17
|
belowOrigin: false,
|
18
|
-
alignment: 'left'
|
18
|
+
alignment: 'left',
|
19
|
+
stopPropagation: false
|
19
20
|
};
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
options.constrain_width = origin.data('constrainwidth');
|
36
|
-
if (origin.data('hover') !== undefined)
|
37
|
-
options.hover = origin.data('hover');
|
38
|
-
if (origin.data('gutter') !== undefined)
|
39
|
-
options.gutter = origin.data('gutter');
|
40
|
-
if (origin.data('beloworigin') !== undefined)
|
41
|
-
options.belowOrigin = origin.data('beloworigin');
|
42
|
-
if (origin.data('alignment') !== undefined)
|
43
|
-
options.alignment = origin.data('alignment');
|
22
|
+
// Open dropdown.
|
23
|
+
if (options === "open") {
|
24
|
+
this.each(function() {
|
25
|
+
$(this).trigger('open');
|
26
|
+
});
|
27
|
+
return false;
|
28
|
+
}
|
29
|
+
|
30
|
+
// Close dropdown.
|
31
|
+
if (options === "close") {
|
32
|
+
this.each(function() {
|
33
|
+
$(this).trigger('close');
|
34
|
+
});
|
35
|
+
return false;
|
44
36
|
}
|
45
37
|
|
46
|
-
|
38
|
+
this.each(function(){
|
39
|
+
var origin = $(this);
|
40
|
+
var options = $.extend({}, defaults, options);
|
41
|
+
var isFocused = false;
|
47
42
|
|
48
|
-
|
49
|
-
|
43
|
+
// Dropdown menu
|
44
|
+
var activates = $("#"+ origin.attr('data-activates'));
|
50
45
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
46
|
+
function updateOptions() {
|
47
|
+
if (origin.data('induration') !== undefined)
|
48
|
+
options.inDuration = origin.data('induration');
|
49
|
+
if (origin.data('outduration') !== undefined)
|
50
|
+
options.outDuration = origin.data('outduration');
|
51
|
+
if (origin.data('constrainwidth') !== undefined)
|
52
|
+
options.constrain_width = origin.data('constrainwidth');
|
53
|
+
if (origin.data('hover') !== undefined)
|
54
|
+
options.hover = origin.data('hover');
|
55
|
+
if (origin.data('gutter') !== undefined)
|
56
|
+
options.gutter = origin.data('gutter');
|
57
|
+
if (origin.data('beloworigin') !== undefined)
|
58
|
+
options.belowOrigin = origin.data('beloworigin');
|
59
|
+
if (origin.data('alignment') !== undefined)
|
60
|
+
options.alignment = origin.data('alignment');
|
61
|
+
if (origin.data('stoppropagation') !== undefined)
|
62
|
+
options.stopPropagation = origin.data('stoppropagation');
|
59
63
|
}
|
60
64
|
|
61
|
-
// Check html data attributes
|
62
65
|
updateOptions();
|
63
66
|
|
64
|
-
//
|
65
|
-
|
66
|
-
origin.addClass('active');
|
67
|
+
// Attach dropdown to its activator
|
68
|
+
origin.after(activates);
|
67
69
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
var windowHeight = window.innerHeight;
|
78
|
-
var originHeight = origin.innerHeight();
|
79
|
-
var offsetLeft = origin.offset().left;
|
80
|
-
var offsetTop = origin.offset().top - $(window).scrollTop();
|
81
|
-
var currAlignment = options.alignment;
|
82
|
-
var gutterSpacing = 0;
|
83
|
-
var leftPosition = 0;
|
84
|
-
|
85
|
-
// Below Origin
|
86
|
-
var verticalOffset = 0;
|
87
|
-
if (options.belowOrigin === true) {
|
88
|
-
verticalOffset = originHeight;
|
89
|
-
}
|
70
|
+
/*
|
71
|
+
Helper function to position and resize dropdown.
|
72
|
+
Used in hover and click handler.
|
73
|
+
*/
|
74
|
+
function placeDropdown(eventType) {
|
75
|
+
// Check for simultaneous focus and click events.
|
76
|
+
if (eventType === 'focus') {
|
77
|
+
isFocused = true;
|
78
|
+
}
|
90
79
|
|
91
|
-
|
92
|
-
|
93
|
-
var wrapper = origin.parent();
|
94
|
-
if (!wrapper.is('body') && wrapper[0].scrollHeight > wrapper[0].clientHeight) {
|
95
|
-
scrollOffset = wrapper[0].scrollTop;
|
96
|
-
}
|
80
|
+
// Check html data attributes
|
81
|
+
updateOptions();
|
97
82
|
|
83
|
+
// Set Dropdown state
|
84
|
+
activates.addClass('active');
|
85
|
+
origin.addClass('active');
|
98
86
|
|
99
|
-
|
100
|
-
|
101
|
-
|
87
|
+
// Constrain width
|
88
|
+
if (options.constrain_width === true) {
|
89
|
+
activates.css('width', origin.outerWidth());
|
102
90
|
|
103
|
-
} else if (offsetLeft - activates.innerWidth() + origin.innerWidth() < 0) {
|
104
|
-
// Dropdown goes past screen on left, force left alignment
|
105
|
-
currAlignment = 'left';
|
106
|
-
}
|
107
|
-
// Vertical bottom offscreen detection
|
108
|
-
if (offsetTop + activates.innerHeight() > windowHeight) {
|
109
|
-
// If going upwards still goes offscreen, just crop height of dropdown.
|
110
|
-
if (offsetTop + originHeight - activates.innerHeight() < 0) {
|
111
|
-
var adjustedHeight = windowHeight - offsetTop - verticalOffset;
|
112
|
-
activates.css('max-height', adjustedHeight);
|
113
91
|
} else {
|
114
|
-
|
115
|
-
if (!verticalOffset) {
|
116
|
-
verticalOffset += originHeight;
|
117
|
-
}
|
118
|
-
verticalOffset -= activates.innerHeight();
|
92
|
+
activates.css('white-space', 'nowrap');
|
119
93
|
}
|
120
|
-
}
|
121
|
-
|
122
|
-
// Handle edge alignment
|
123
|
-
if (currAlignment === 'left') {
|
124
|
-
gutterSpacing = options.gutter;
|
125
|
-
leftPosition = origin.position().left + gutterSpacing;
|
126
|
-
}
|
127
|
-
else if (currAlignment === 'right') {
|
128
|
-
var offsetRight = origin.position().left + origin.outerWidth() - activates.outerWidth();
|
129
|
-
gutterSpacing = -options.gutter;
|
130
|
-
leftPosition = offsetRight + gutterSpacing;
|
131
|
-
}
|
132
94
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
95
|
+
// Offscreen detection
|
96
|
+
var windowHeight = window.innerHeight;
|
97
|
+
var originHeight = origin.innerHeight();
|
98
|
+
var offsetLeft = origin.offset().left;
|
99
|
+
var offsetTop = origin.offset().top - $(window).scrollTop();
|
100
|
+
var currAlignment = options.alignment;
|
101
|
+
var gutterSpacing = 0;
|
102
|
+
var leftPosition = 0;
|
139
103
|
|
104
|
+
// Below Origin
|
105
|
+
var verticalOffset = 0;
|
106
|
+
if (options.belowOrigin === true) {
|
107
|
+
verticalOffset = originHeight;
|
108
|
+
}
|
140
109
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
110
|
+
// Check for scrolling positioned container.
|
111
|
+
var scrollYOffset = 0;
|
112
|
+
var scrollXOffset = 0;
|
113
|
+
var wrapper = origin.parent();
|
114
|
+
if (!wrapper.is('body')) {
|
115
|
+
if (wrapper[0].scrollHeight > wrapper[0].clientHeight) {
|
116
|
+
scrollYOffset = wrapper[0].scrollTop;
|
117
|
+
}
|
118
|
+
if (wrapper[0].scrollWidth > wrapper[0].clientWidth) {
|
119
|
+
scrollXOffset = wrapper[0].scrollLeft;
|
120
|
+
}
|
149
121
|
}
|
150
|
-
})
|
151
|
-
.animate( {opacity: 1}, {queue: false, duration: options.inDuration, easing: 'easeOutSine'});
|
152
|
-
}
|
153
122
|
|
154
|
-
function hideDropdown() {
|
155
|
-
// Check for simultaneous focus and click events.
|
156
|
-
isFocused = false;
|
157
|
-
activates.fadeOut(options.outDuration);
|
158
|
-
activates.removeClass('active');
|
159
|
-
origin.removeClass('active');
|
160
|
-
setTimeout(function() { activates.css('max-height', ''); }, options.outDuration);
|
161
|
-
}
|
162
123
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
placeDropdown();
|
171
|
-
open = true;
|
124
|
+
if (offsetLeft + activates.innerWidth() > $(window).width()) {
|
125
|
+
// Dropdown goes past screen on right, force right alignment
|
126
|
+
currAlignment = 'right';
|
127
|
+
|
128
|
+
} else if (offsetLeft - activates.innerWidth() + origin.innerWidth() < 0) {
|
129
|
+
// Dropdown goes past screen on left, force left alignment
|
130
|
+
currAlignment = 'left';
|
172
131
|
}
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
132
|
+
// Vertical bottom offscreen detection
|
133
|
+
if (offsetTop + activates.innerHeight() > windowHeight) {
|
134
|
+
// If going upwards still goes offscreen, just crop height of dropdown.
|
135
|
+
if (offsetTop + originHeight - activates.innerHeight() < 0) {
|
136
|
+
var adjustedHeight = windowHeight - offsetTop - verticalOffset;
|
137
|
+
activates.css('max-height', adjustedHeight);
|
138
|
+
} else {
|
139
|
+
// Flow upwards.
|
140
|
+
if (!verticalOffset) {
|
141
|
+
verticalOffset += originHeight;
|
142
|
+
}
|
143
|
+
verticalOffset -= activates.innerHeight();
|
144
|
+
}
|
181
145
|
}
|
182
|
-
});
|
183
146
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
hideDropdown();
|
189
|
-
open = false;
|
147
|
+
// Handle edge alignment
|
148
|
+
if (currAlignment === 'left') {
|
149
|
+
gutterSpacing = options.gutter;
|
150
|
+
leftPosition = origin.position().left + gutterSpacing;
|
190
151
|
}
|
191
|
-
|
152
|
+
else if (currAlignment === 'right') {
|
153
|
+
var offsetRight = origin.position().left + origin.outerWidth() - activates.outerWidth();
|
154
|
+
gutterSpacing = -options.gutter;
|
155
|
+
leftPosition = offsetRight + gutterSpacing;
|
156
|
+
}
|
157
|
+
|
158
|
+
// Position dropdown
|
159
|
+
activates.css({
|
160
|
+
position: 'absolute',
|
161
|
+
top: origin.position().top + verticalOffset + scrollYOffset,
|
162
|
+
left: leftPosition + scrollXOffset
|
163
|
+
});
|
164
|
+
|
192
165
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
166
|
+
// Show dropdown
|
167
|
+
activates.stop(true, true).css('opacity', 0)
|
168
|
+
.slideDown({
|
169
|
+
queue: false,
|
170
|
+
duration: options.inDuration,
|
171
|
+
easing: 'easeOutCubic',
|
172
|
+
complete: function() {
|
173
|
+
$(this).css('height', '');
|
174
|
+
}
|
175
|
+
})
|
176
|
+
.animate( {opacity: 1}, {queue: false, duration: options.inDuration, easing: 'easeOutSine'});
|
177
|
+
}
|
178
|
+
|
179
|
+
function hideDropdown() {
|
180
|
+
// Check for simultaneous focus and click events.
|
181
|
+
isFocused = false;
|
182
|
+
activates.fadeOut(options.outDuration);
|
183
|
+
activates.removeClass('active');
|
184
|
+
origin.removeClass('active');
|
185
|
+
setTimeout(function() { activates.css('max-height', ''); }, options.outDuration);
|
186
|
+
}
|
187
|
+
|
188
|
+
// Hover
|
189
|
+
if (options.hover) {
|
190
|
+
var open = false;
|
191
|
+
origin.unbind('click.' + origin.attr('id'));
|
192
|
+
// Hover handler to show dropdown
|
193
|
+
origin.on('mouseenter', function(e){ // Mouse over
|
194
|
+
if (open === false) {
|
195
|
+
placeDropdown();
|
196
|
+
open = true;
|
197
|
+
}
|
198
|
+
});
|
199
|
+
origin.on('mouseleave', function(e){
|
200
|
+
// If hover on origin then to something other than dropdown content, then close
|
201
|
+
var toEl = e.toElement || e.relatedTarget; // added browser compatibility for target element
|
202
|
+
if(!$(toEl).closest('.dropdown-content').is(activates)) {
|
203
|
+
activates.stop(true, true);
|
204
|
+
hideDropdown();
|
205
|
+
open = false;
|
204
206
|
}
|
205
|
-
|
206
|
-
|
207
|
+
});
|
208
|
+
|
209
|
+
activates.on('mouseleave', function(e){ // Mouse out
|
210
|
+
var toEl = e.toElement || e.relatedTarget;
|
211
|
+
if(!$(toEl).closest('.dropdown-button').is(origin)) {
|
212
|
+
activates.stop(true, true);
|
207
213
|
hideDropdown();
|
208
|
-
|
214
|
+
open = false;
|
209
215
|
}
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
+
});
|
217
|
+
|
218
|
+
// Click
|
219
|
+
} else {
|
220
|
+
// Click handler to show dropdown
|
221
|
+
origin.unbind('click.' + origin.attr('id'));
|
222
|
+
origin.bind('click.'+origin.attr('id'), function(e){
|
223
|
+
if (!isFocused) {
|
224
|
+
if ( origin[0] == e.currentTarget &&
|
225
|
+
!origin.hasClass('active') &&
|
226
|
+
($(e.target).closest('.dropdown-content').length === 0)) {
|
227
|
+
e.preventDefault(); // Prevents button click from moving window
|
228
|
+
if (options.stopPropagation) {
|
229
|
+
e.stopPropagation();
|
216
230
|
}
|
217
|
-
|
231
|
+
placeDropdown('click');
|
232
|
+
}
|
233
|
+
// If origin is clicked and menu is open, close menu
|
234
|
+
else if (origin.hasClass('active')) {
|
235
|
+
hideDropdown();
|
236
|
+
$(document).unbind('click.'+ activates.attr('id') + ' touchstart.' + activates.attr('id'));
|
237
|
+
}
|
238
|
+
// If menu open, add click close handler to document
|
239
|
+
if (activates.hasClass('active')) {
|
240
|
+
$(document).bind('click.'+ activates.attr('id') + ' touchstart.' + activates.attr('id'), function (e) {
|
241
|
+
if (!activates.is(e.target) && !origin.is(e.target) && (!origin.find(e.target).length) ) {
|
242
|
+
hideDropdown();
|
243
|
+
$(document).unbind('click.'+ activates.attr('id') + ' touchstart.' + activates.attr('id'));
|
244
|
+
}
|
245
|
+
});
|
246
|
+
}
|
218
247
|
}
|
219
|
-
}
|
220
|
-
});
|
248
|
+
});
|
221
249
|
|
222
|
-
|
250
|
+
} // End else
|
223
251
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
252
|
+
// Listen to open and close event - useful for select component
|
253
|
+
origin.on('open', function(e, eventType) {
|
254
|
+
placeDropdown(eventType);
|
255
|
+
});
|
256
|
+
origin.on('close', hideDropdown);
|
229
257
|
|
230
258
|
|
231
|
-
|
259
|
+
});
|
232
260
|
}; // End dropdown plugin
|
233
261
|
|
234
262
|
$(document).ready(function(){
|
File without changes
|
File without changes
|
@@ -6,10 +6,10 @@
|
|
6
6
|
var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
|
7
7
|
$(input_selector).each(function(index, element) {
|
8
8
|
if ($(element).val().length > 0 || element.autofocus ||$(this).attr('placeholder') !== undefined || $(element)[0].validity.badInput === true) {
|
9
|
-
$(this).siblings('label
|
9
|
+
$(this).siblings('label').addClass('active');
|
10
10
|
}
|
11
11
|
else {
|
12
|
-
$(this).siblings('label
|
12
|
+
$(this).siblings('label').removeClass('active');
|
13
13
|
}
|
14
14
|
});
|
15
15
|
};
|
@@ -37,7 +37,7 @@
|
|
37
37
|
formReset.find(input_selector).removeClass('valid').removeClass('invalid');
|
38
38
|
formReset.find(input_selector).each(function () {
|
39
39
|
if ($(this).attr('value') === '') {
|
40
|
-
$(this).siblings('label
|
40
|
+
$(this).siblings('label').removeClass('active');
|
41
41
|
}
|
42
42
|
});
|
43
43
|
|
@@ -51,18 +51,19 @@
|
|
51
51
|
|
52
52
|
// Add active when element has focus
|
53
53
|
$(document).on('focus', input_selector, function () {
|
54
|
-
$(this).siblings('label,
|
54
|
+
$(this).siblings('label, .prefix').addClass('active');
|
55
55
|
});
|
56
56
|
|
57
57
|
$(document).on('blur', input_selector, function () {
|
58
58
|
var $inputElement = $(this);
|
59
|
+
var selector = ".prefix";
|
60
|
+
|
59
61
|
if ($inputElement.val().length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === undefined) {
|
60
|
-
|
62
|
+
selector += ", label";
|
61
63
|
}
|
62
64
|
|
63
|
-
|
64
|
-
|
65
|
-
}
|
65
|
+
$inputElement.siblings(selector).removeClass('active');
|
66
|
+
|
66
67
|
validate_field($inputElement);
|
67
68
|
});
|
68
69
|
|
@@ -100,7 +101,7 @@
|
|
100
101
|
$(this).addClass('tabbed');
|
101
102
|
var $this = $(this);
|
102
103
|
$this.one('blur', function(e) {
|
103
|
-
|
104
|
+
|
104
105
|
$(this).removeClass('tabbed');
|
105
106
|
});
|
106
107
|
return;
|
@@ -120,9 +121,11 @@
|
|
120
121
|
|
121
122
|
var fontFamily = $textarea.css('font-family');
|
122
123
|
var fontSize = $textarea.css('font-size');
|
124
|
+
var lineHeight = $textarea.css('line-height');
|
123
125
|
|
124
126
|
if (fontSize) { hiddenDiv.css('font-size', fontSize); }
|
125
127
|
if (fontFamily) { hiddenDiv.css('font-family', fontFamily); }
|
128
|
+
if (lineHeight) { hiddenDiv.css('line-height', lineHeight); }
|
126
129
|
|
127
130
|
if ($textarea.attr('wrap') === "off") {
|
128
131
|
hiddenDiv.css('overflow-wrap', "normal")
|
@@ -271,6 +274,88 @@
|
|
271
274
|
thumb.removeClass('active');
|
272
275
|
}
|
273
276
|
});
|
277
|
+
|
278
|
+
/**************************
|
279
|
+
* Auto complete plugin *
|
280
|
+
*************************/
|
281
|
+
$.fn.autocomplete = function (options) {
|
282
|
+
// Defaults
|
283
|
+
var defaults = {
|
284
|
+
data: {}
|
285
|
+
};
|
286
|
+
|
287
|
+
options = $.extend(defaults, options);
|
288
|
+
|
289
|
+
return this.each(function() {
|
290
|
+
var $input = $(this);
|
291
|
+
var data = options.data,
|
292
|
+
$inputDiv = $input.closest('.input-field'); // Div to append on
|
293
|
+
|
294
|
+
// Check if data isn't empty
|
295
|
+
if (!$.isEmptyObject(data)) {
|
296
|
+
// Create autocomplete element
|
297
|
+
var $autocomplete = $('<ul class="autocomplete-content dropdown-content"></ul>');
|
298
|
+
|
299
|
+
// Append autocomplete element
|
300
|
+
if ($inputDiv.length) {
|
301
|
+
$inputDiv.append($autocomplete); // Set ul in body
|
302
|
+
} else {
|
303
|
+
$input.after($autocomplete);
|
304
|
+
}
|
305
|
+
|
306
|
+
var highlight = function(string, $el) {
|
307
|
+
var img = $el.find('img');
|
308
|
+
var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
|
309
|
+
matchEnd = matchStart + string.length - 1,
|
310
|
+
beforeMatch = $el.text().slice(0, matchStart),
|
311
|
+
matchText = $el.text().slice(matchStart, matchEnd + 1),
|
312
|
+
afterMatch = $el.text().slice(matchEnd + 1);
|
313
|
+
$el.html("<span>" + beforeMatch + "<span class='highlight'>" + matchText + "</span>" + afterMatch + "</span>");
|
314
|
+
if (img.length) {
|
315
|
+
$el.prepend(img);
|
316
|
+
}
|
317
|
+
};
|
318
|
+
|
319
|
+
// Perform search
|
320
|
+
$input.on('keyup', function (e) {
|
321
|
+
// Capture Enter
|
322
|
+
if (e.which === 13) {
|
323
|
+
$autocomplete.find('li').first().click();
|
324
|
+
return;
|
325
|
+
}
|
326
|
+
|
327
|
+
var val = $input.val().toLowerCase();
|
328
|
+
$autocomplete.empty();
|
329
|
+
|
330
|
+
// Check if the input isn't empty
|
331
|
+
if (val !== '') {
|
332
|
+
for(var key in data) {
|
333
|
+
if (data.hasOwnProperty(key) &&
|
334
|
+
key.toLowerCase().indexOf(val) !== -1 &&
|
335
|
+
key.toLowerCase() !== val) {
|
336
|
+
var autocompleteOption = $('<li></li>');
|
337
|
+
if(!!data[key]) {
|
338
|
+
autocompleteOption.append('<img src="'+ data[key] +'" class="right circle"><span>'+ key +'</span>');
|
339
|
+
} else {
|
340
|
+
autocompleteOption.append('<span>'+ key +'</span>');
|
341
|
+
}
|
342
|
+
$autocomplete.append(autocompleteOption);
|
343
|
+
|
344
|
+
highlight(val, autocompleteOption);
|
345
|
+
}
|
346
|
+
}
|
347
|
+
}
|
348
|
+
});
|
349
|
+
|
350
|
+
// Set input value
|
351
|
+
$autocomplete.on('click', 'li', function () {
|
352
|
+
$input.val($(this).text().trim());
|
353
|
+
$autocomplete.empty();
|
354
|
+
});
|
355
|
+
}
|
356
|
+
});
|
357
|
+
};
|
358
|
+
|
274
359
|
}); // End of $(document).ready
|
275
360
|
|
276
361
|
/*******************
|