materialize-sass 0.100.2.1 → 1.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +18 -42
- data/Rakefile +17 -17
- data/{app/assets → assets}/javascripts/materialize-sprockets.js +8 -12
- data/assets/javascripts/materialize.js +11877 -0
- data/assets/javascripts/materialize/autocomplete.js +420 -0
- data/assets/javascripts/materialize/buttons.js +388 -0
- data/assets/javascripts/materialize/cards.js +28 -0
- data/assets/javascripts/materialize/carousel.js +791 -0
- data/assets/javascripts/materialize/cash.js +992 -0
- data/assets/javascripts/materialize/characterCounter.js +180 -0
- data/assets/javascripts/materialize/chips.js +555 -0
- data/assets/javascripts/materialize/collapsible.js +275 -0
- data/assets/javascripts/materialize/datepicker.js +898 -0
- data/assets/javascripts/materialize/dropdown.js +530 -0
- data/{app/assets → assets}/javascripts/materialize/extras/nouislider.js +1 -1
- data/{app/assets → assets}/javascripts/materialize/extras/nouislider.min.js +1 -1
- data/assets/javascripts/materialize/forms.js +223 -0
- data/assets/javascripts/materialize/global.js +353 -0
- data/assets/javascripts/materialize/materialbox.js +432 -0
- data/{app/assets → assets}/javascripts/materialize/modal.js +82 -113
- data/assets/javascripts/materialize/parallax.js +135 -0
- data/assets/javascripts/materialize/pushpin.js +158 -0
- data/assets/javascripts/materialize/range.js +305 -0
- data/assets/javascripts/materialize/scrollspy.js +322 -0
- data/assets/javascripts/materialize/select.js +426 -0
- data/assets/javascripts/materialize/sidenav.js +584 -0
- data/assets/javascripts/materialize/slider.js +383 -0
- data/assets/javascripts/materialize/tabs.js +460 -0
- data/assets/javascripts/materialize/tapTarget.js +347 -0
- data/assets/javascripts/materialize/timepicker.js +616 -0
- data/{app/assets → assets}/javascripts/materialize/toasts.js +42 -46
- data/assets/javascripts/materialize/tooltip.js +325 -0
- data/assets/javascripts/materialize/velocity.min.js +782 -0
- data/{app/assets → assets}/javascripts/materialize/waves.js +0 -0
- data/{app/assets → assets}/stylesheets/materialize.scss +5 -6
- data/{app/assets → assets}/stylesheets/materialize/components/_badges.scss +1 -1
- data/{app/assets → assets}/stylesheets/materialize/components/_buttons.scss +34 -2
- data/{app/assets → assets}/stylesheets/materialize/components/_cards.scss +0 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_carousel.scss +1 -1
- data/{app/assets → assets}/stylesheets/materialize/components/_chips.scss +6 -5
- data/{app/assets → assets}/stylesheets/materialize/components/_collapsible.scss +3 -3
- data/{app/assets → assets}/stylesheets/materialize/components/_color.scss +0 -0
- data/assets/stylesheets/materialize/components/_datepicker.scss +180 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_dropdown.scss +16 -15
- data/{app/assets → assets}/stylesheets/materialize/components/_global.scss +49 -14
- data/{app/assets → assets}/stylesheets/materialize/components/_grid.scss +1 -1
- data/{app/assets → assets}/stylesheets/materialize/components/_icons-material-design.scss +0 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_materialbox.scss +0 -0
- data/assets/stylesheets/materialize/components/_mixins.scss +5 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_modal.scss +1 -1
- data/{app/assets → assets}/stylesheets/materialize/components/_navbar.scss +0 -0
- data/assets/stylesheets/materialize/components/_normalize.scss +447 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_preloader.scss +0 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_pulse.scss +0 -0
- data/{app/assets/stylesheets/materialize/components/_sideNav.scss → assets/stylesheets/materialize/components/_sidenav.scss} +23 -21
- data/{app/assets → assets}/stylesheets/materialize/components/_slider.scss +0 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_table_of_contents.scss +3 -3
- data/{app/assets → assets}/stylesheets/materialize/components/_tabs.scss +2 -2
- data/{app/assets → assets}/stylesheets/materialize/components/_tapTarget.scss +0 -0
- data/assets/stylesheets/materialize/components/_timepicker.scss +182 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_toast.scss +0 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_tooltip.scss +1 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_transitions.scss +0 -0
- data/{app/assets → assets}/stylesheets/materialize/components/_typography.scss +8 -8
- data/{app/assets → assets}/stylesheets/materialize/components/_variables.scss +42 -44
- data/{app/assets → assets}/stylesheets/materialize/components/_waves.scss +0 -0
- data/{app/assets → assets}/stylesheets/materialize/components/forms/_checkboxes.scss +24 -24
- data/{app/assets → assets}/stylesheets/materialize/components/forms/_file-input.scss +0 -0
- data/{app/assets → assets}/stylesheets/materialize/components/forms/_forms.scss +0 -0
- data/{app/assets → assets}/stylesheets/materialize/components/forms/_input-fields.scss +49 -35
- data/{app/assets → assets}/stylesheets/materialize/components/forms/_radio-buttons.scss +29 -29
- data/{app/assets → assets}/stylesheets/materialize/components/forms/_range.scss +32 -31
- data/{app/assets → assets}/stylesheets/materialize/components/forms/_select.scss +20 -11
- data/{app/assets → assets}/stylesheets/materialize/components/forms/_switches.scss +0 -0
- data/{app/assets → assets}/stylesheets/materialize/extras/nouislider.css +1 -1
- data/lib/materialize-sass.rb +13 -23
- data/lib/materialize-sass/engine.rb +6 -9
- data/lib/materialize-sass/version.rb +1 -1
- data/materialize-sass.gemspec +2 -1
- metadata +97 -97
- data/app/assets/fonts/roboto/Roboto-Bold.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.woff +0 -0
- data/app/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
- data/app/assets/javascripts/materialize.js +0 -10021
- data/app/assets/javascripts/materialize/animation.js +0 -7
- data/app/assets/javascripts/materialize/buttons.js +0 -253
- data/app/assets/javascripts/materialize/cards.js +0 -28
- data/app/assets/javascripts/materialize/carousel.js +0 -543
- data/app/assets/javascripts/materialize/character_counter.js +0 -64
- data/app/assets/javascripts/materialize/chips.js +0 -315
- data/app/assets/javascripts/materialize/collapsible.js +0 -178
- data/app/assets/javascripts/materialize/date_picker/picker.date.js +0 -1399
- data/app/assets/javascripts/materialize/date_picker/picker.js +0 -1196
- data/app/assets/javascripts/materialize/date_picker/picker.time.js +0 -646
- data/app/assets/javascripts/materialize/dropdown.js +0 -257
- data/app/assets/javascripts/materialize/forms.js +0 -806
- data/app/assets/javascripts/materialize/global.js +0 -170
- data/app/assets/javascripts/materialize/hammer.min.js +0 -424
- data/app/assets/javascripts/materialize/initial.js +0 -10
- data/app/assets/javascripts/materialize/jquery.easing.1.4.js +0 -144
- data/app/assets/javascripts/materialize/jquery.hammer.js +0 -33
- data/app/assets/javascripts/materialize/materialbox.js +0 -263
- data/app/assets/javascripts/materialize/parallax.js +0 -54
- data/app/assets/javascripts/materialize/pushpin.js +0 -68
- data/app/assets/javascripts/materialize/scrollFire.js +0 -49
- data/app/assets/javascripts/materialize/scrollspy.js +0 -230
- data/app/assets/javascripts/materialize/sideNav.js +0 -395
- data/app/assets/javascripts/materialize/slider.js +0 -295
- data/app/assets/javascripts/materialize/tabs.js +0 -244
- data/app/assets/javascripts/materialize/tapTarget.js +0 -184
- data/app/assets/javascripts/materialize/tooltip.js +0 -227
- data/app/assets/javascripts/materialize/transitions.js +0 -163
- data/app/assets/javascripts/materialize/velocity.min.js +0 -626
- data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -424
- data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -39
- data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +0 -469
- data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +0 -216
- data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +0 -267
@@ -1,184 +0,0 @@
|
|
1
|
-
(function ($) {
|
2
|
-
|
3
|
-
var methods = {
|
4
|
-
init: function (options) {
|
5
|
-
return this.each(function () {
|
6
|
-
var origin = $('#' + $(this).attr('data-activates'));
|
7
|
-
var screen = $('body');
|
8
|
-
|
9
|
-
// Creating tap target
|
10
|
-
var tapTargetEl = $(this);
|
11
|
-
var tapTargetWrapper = tapTargetEl.parent('.tap-target-wrapper');
|
12
|
-
var tapTargetWave = tapTargetWrapper.find('.tap-target-wave');
|
13
|
-
var tapTargetOriginEl = tapTargetWrapper.find('.tap-target-origin');
|
14
|
-
var tapTargetContentEl = tapTargetEl.find('.tap-target-content');
|
15
|
-
|
16
|
-
// Creating wrapper
|
17
|
-
if (!tapTargetWrapper.length) {
|
18
|
-
tapTargetWrapper = tapTargetEl.wrap($('<div class="tap-target-wrapper"></div>')).parent();
|
19
|
-
}
|
20
|
-
|
21
|
-
// Creating content
|
22
|
-
if (!tapTargetContentEl.length) {
|
23
|
-
tapTargetContentEl = $('<div class="tap-target-content"></div>');
|
24
|
-
tapTargetEl.append(tapTargetContentEl);
|
25
|
-
}
|
26
|
-
|
27
|
-
// Creating foreground wave
|
28
|
-
if (!tapTargetWave.length) {
|
29
|
-
tapTargetWave = $('<div class="tap-target-wave"></div>');
|
30
|
-
|
31
|
-
// Creating origin
|
32
|
-
if (!tapTargetOriginEl.length) {
|
33
|
-
tapTargetOriginEl = origin.clone(true, true);
|
34
|
-
tapTargetOriginEl.addClass('tap-target-origin');
|
35
|
-
tapTargetOriginEl.removeAttr('id');
|
36
|
-
tapTargetOriginEl.removeAttr('style');
|
37
|
-
tapTargetWave.append(tapTargetOriginEl);
|
38
|
-
}
|
39
|
-
|
40
|
-
tapTargetWrapper.append(tapTargetWave);
|
41
|
-
}
|
42
|
-
|
43
|
-
// Open
|
44
|
-
var openTapTarget = function () {
|
45
|
-
if (tapTargetWrapper.is('.open')) {
|
46
|
-
return;
|
47
|
-
}
|
48
|
-
|
49
|
-
// Adding open class
|
50
|
-
tapTargetWrapper.addClass('open');
|
51
|
-
|
52
|
-
setTimeout(function () {
|
53
|
-
tapTargetOriginEl.off('click.tapTarget').on('click.tapTarget', function (e) {
|
54
|
-
closeTapTarget();
|
55
|
-
tapTargetOriginEl.off('click.tapTarget');
|
56
|
-
});
|
57
|
-
|
58
|
-
$(document).off('click.tapTarget').on('click.tapTarget', function (e) {
|
59
|
-
closeTapTarget();
|
60
|
-
$(document).off('click.tapTarget');
|
61
|
-
});
|
62
|
-
|
63
|
-
var throttledCalc = Materialize.throttle(function () {
|
64
|
-
calculateTapTarget();
|
65
|
-
}, 200);
|
66
|
-
$(window).off('resize.tapTarget').on('resize.tapTarget', throttledCalc);
|
67
|
-
}, 0);
|
68
|
-
};
|
69
|
-
|
70
|
-
// Close
|
71
|
-
var closeTapTarget = function () {
|
72
|
-
if (!tapTargetWrapper.is('.open')) {
|
73
|
-
return;
|
74
|
-
}
|
75
|
-
|
76
|
-
tapTargetWrapper.removeClass('open');
|
77
|
-
tapTargetOriginEl.off('click.tapTarget');
|
78
|
-
$(document).off('click.tapTarget');
|
79
|
-
$(window).off('resize.tapTarget');
|
80
|
-
};
|
81
|
-
|
82
|
-
// Pre calculate
|
83
|
-
var calculateTapTarget = function () {
|
84
|
-
// Element or parent is fixed position?
|
85
|
-
var isFixed = origin.css('position') === 'fixed';
|
86
|
-
if (!isFixed) {
|
87
|
-
var parents = origin.parents();
|
88
|
-
for (var i = 0; i < parents.length; i++) {
|
89
|
-
isFixed = $(parents[i]).css('position') == 'fixed';
|
90
|
-
if (isFixed) {
|
91
|
-
break;
|
92
|
-
}
|
93
|
-
}
|
94
|
-
}
|
95
|
-
|
96
|
-
// Calculating origin
|
97
|
-
var originWidth = origin.outerWidth();
|
98
|
-
var originHeight = origin.outerHeight();
|
99
|
-
var originTop = isFixed ? origin.offset().top - $(document).scrollTop() : origin.offset().top;
|
100
|
-
var originLeft = isFixed ? origin.offset().left - $(document).scrollLeft() : origin.offset().left;
|
101
|
-
|
102
|
-
// Calculating screen
|
103
|
-
var windowWidth = $(window).width();
|
104
|
-
var windowHeight = $(window).height();
|
105
|
-
var centerX = windowWidth / 2;
|
106
|
-
var centerY = windowHeight / 2;
|
107
|
-
var isLeft = originLeft <= centerX;
|
108
|
-
var isRight = originLeft > centerX;
|
109
|
-
var isTop = originTop <= centerY;
|
110
|
-
var isBottom = originTop > centerY;
|
111
|
-
var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75;
|
112
|
-
var isCenterY = originTop >= windowHeight * 0.25 && originTop <= windowHeight * 0.75;
|
113
|
-
|
114
|
-
// Calculating tap target
|
115
|
-
var tapTargetWidth = tapTargetEl.outerWidth();
|
116
|
-
var tapTargetHeight = tapTargetEl.outerHeight();
|
117
|
-
var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2;
|
118
|
-
var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2;
|
119
|
-
var tapTargetPosition = isFixed ? 'fixed' : 'absolute';
|
120
|
-
|
121
|
-
// Calculating content
|
122
|
-
var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth;
|
123
|
-
var tapTargetTextHeight = tapTargetHeight / 2;
|
124
|
-
var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0;
|
125
|
-
var tapTargetTextBottom = 0;
|
126
|
-
var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0;
|
127
|
-
var tapTargetTextRight = 0;
|
128
|
-
var tapTargetTextPadding = originWidth;
|
129
|
-
var tapTargetTextAlign = isBottom ? 'bottom' : 'top';
|
130
|
-
|
131
|
-
// Calculating wave
|
132
|
-
var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2;
|
133
|
-
var tapTargetWaveHeight = tapTargetWaveWidth;
|
134
|
-
var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2;
|
135
|
-
var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2;
|
136
|
-
|
137
|
-
// Setting tap target
|
138
|
-
var tapTargetWrapperCssObj = {};
|
139
|
-
tapTargetWrapperCssObj.top = isTop ? tapTargetTop : '';
|
140
|
-
tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth : '';
|
141
|
-
tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight : '';
|
142
|
-
tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft : '';
|
143
|
-
tapTargetWrapperCssObj.position = tapTargetPosition;
|
144
|
-
tapTargetWrapper.css(tapTargetWrapperCssObj);
|
145
|
-
|
146
|
-
// Setting content
|
147
|
-
tapTargetContentEl.css({
|
148
|
-
width: tapTargetTextWidth,
|
149
|
-
height: tapTargetTextHeight,
|
150
|
-
top: tapTargetTextTop,
|
151
|
-
right: tapTargetTextRight,
|
152
|
-
bottom: tapTargetTextBottom,
|
153
|
-
left: tapTargetTextLeft,
|
154
|
-
padding: tapTargetTextPadding,
|
155
|
-
verticalAlign: tapTargetTextAlign
|
156
|
-
});
|
157
|
-
|
158
|
-
// Setting wave
|
159
|
-
tapTargetWave.css({
|
160
|
-
top: tapTargetWaveTop,
|
161
|
-
left: tapTargetWaveLeft,
|
162
|
-
width: tapTargetWaveWidth,
|
163
|
-
height: tapTargetWaveHeight
|
164
|
-
});
|
165
|
-
};
|
166
|
-
|
167
|
-
if (options == 'open') {
|
168
|
-
calculateTapTarget();
|
169
|
-
openTapTarget();
|
170
|
-
}
|
171
|
-
|
172
|
-
if (options == 'close') closeTapTarget();
|
173
|
-
});
|
174
|
-
},
|
175
|
-
open: function () {},
|
176
|
-
close: function () {}
|
177
|
-
};
|
178
|
-
|
179
|
-
$.fn.tapTarget = function (methodOrOptions) {
|
180
|
-
if (methods[methodOrOptions] || typeof methodOrOptions === 'object') return methods.init.apply(this, arguments);
|
181
|
-
|
182
|
-
$.error('Method ' + methodOrOptions + ' does not exist on jQuery.tap-target');
|
183
|
-
};
|
184
|
-
})(jQuery);
|
@@ -1,227 +0,0 @@
|
|
1
|
-
(function ($) {
|
2
|
-
$.fn.tooltip = function (options) {
|
3
|
-
var timeout = null,
|
4
|
-
margin = 5;
|
5
|
-
|
6
|
-
// Defaults
|
7
|
-
var defaults = {
|
8
|
-
delay: 350,
|
9
|
-
tooltip: '',
|
10
|
-
position: 'bottom',
|
11
|
-
html: false
|
12
|
-
};
|
13
|
-
|
14
|
-
// Remove tooltip from the activator
|
15
|
-
if (options === "remove") {
|
16
|
-
this.each(function () {
|
17
|
-
$('#' + $(this).attr('data-tooltip-id')).remove();
|
18
|
-
$(this).removeAttr('data-tooltip-id');
|
19
|
-
$(this).off('mouseenter.tooltip mouseleave.tooltip');
|
20
|
-
});
|
21
|
-
return false;
|
22
|
-
}
|
23
|
-
|
24
|
-
options = $.extend(defaults, options);
|
25
|
-
|
26
|
-
return this.each(function () {
|
27
|
-
var tooltipId = Materialize.guid();
|
28
|
-
var origin = $(this);
|
29
|
-
|
30
|
-
// Destroy old tooltip
|
31
|
-
if (origin.attr('data-tooltip-id')) {
|
32
|
-
$('#' + origin.attr('data-tooltip-id')).remove();
|
33
|
-
}
|
34
|
-
|
35
|
-
origin.attr('data-tooltip-id', tooltipId);
|
36
|
-
|
37
|
-
// Get attributes.
|
38
|
-
var allowHtml, tooltipDelay, tooltipPosition, tooltipText, tooltipEl, backdrop;
|
39
|
-
var setAttributes = function () {
|
40
|
-
allowHtml = origin.attr('data-html') ? origin.attr('data-html') === 'true' : options.html;
|
41
|
-
tooltipDelay = origin.attr('data-delay');
|
42
|
-
tooltipDelay = tooltipDelay === undefined || tooltipDelay === '' ? options.delay : tooltipDelay;
|
43
|
-
tooltipPosition = origin.attr('data-position');
|
44
|
-
tooltipPosition = tooltipPosition === undefined || tooltipPosition === '' ? options.position : tooltipPosition;
|
45
|
-
tooltipText = origin.attr('data-tooltip');
|
46
|
-
tooltipText = tooltipText === undefined || tooltipText === '' ? options.tooltip : tooltipText;
|
47
|
-
};
|
48
|
-
setAttributes();
|
49
|
-
|
50
|
-
var renderTooltipEl = function () {
|
51
|
-
var tooltip = $('<div class="material-tooltip"></div>');
|
52
|
-
|
53
|
-
// Create Text span
|
54
|
-
if (allowHtml) {
|
55
|
-
tooltipText = $('<span></span>').html(tooltipText);
|
56
|
-
} else {
|
57
|
-
tooltipText = $('<span></span>').text(tooltipText);
|
58
|
-
}
|
59
|
-
|
60
|
-
// Create tooltip
|
61
|
-
tooltip.append(tooltipText).appendTo($('body')).attr('id', tooltipId);
|
62
|
-
|
63
|
-
// Create backdrop
|
64
|
-
backdrop = $('<div class="backdrop"></div>');
|
65
|
-
backdrop.appendTo(tooltip);
|
66
|
-
return tooltip;
|
67
|
-
};
|
68
|
-
tooltipEl = renderTooltipEl();
|
69
|
-
|
70
|
-
// Destroy previously binded events
|
71
|
-
origin.off('mouseenter.tooltip mouseleave.tooltip');
|
72
|
-
// Mouse In
|
73
|
-
var started = false,
|
74
|
-
timeoutRef;
|
75
|
-
origin.on({ 'mouseenter.tooltip': function (e) {
|
76
|
-
var showTooltip = function () {
|
77
|
-
setAttributes();
|
78
|
-
started = true;
|
79
|
-
tooltipEl.velocity('stop');
|
80
|
-
backdrop.velocity('stop');
|
81
|
-
tooltipEl.css({ visibility: 'visible', left: '0px', top: '0px' });
|
82
|
-
|
83
|
-
// Tooltip positioning
|
84
|
-
var originWidth = origin.outerWidth();
|
85
|
-
var originHeight = origin.outerHeight();
|
86
|
-
var tooltipHeight = tooltipEl.outerHeight();
|
87
|
-
var tooltipWidth = tooltipEl.outerWidth();
|
88
|
-
var tooltipVerticalMovement = '0px';
|
89
|
-
var tooltipHorizontalMovement = '0px';
|
90
|
-
var backdropOffsetWidth = backdrop[0].offsetWidth;
|
91
|
-
var backdropOffsetHeight = backdrop[0].offsetHeight;
|
92
|
-
var scaleXFactor = 8;
|
93
|
-
var scaleYFactor = 8;
|
94
|
-
var scaleFactor = 0;
|
95
|
-
var targetTop, targetLeft, newCoordinates;
|
96
|
-
|
97
|
-
if (tooltipPosition === "top") {
|
98
|
-
// Top Position
|
99
|
-
targetTop = origin.offset().top - tooltipHeight - margin;
|
100
|
-
targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
|
101
|
-
newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
|
102
|
-
tooltipVerticalMovement = '-10px';
|
103
|
-
backdrop.css({
|
104
|
-
bottom: 0,
|
105
|
-
left: 0,
|
106
|
-
borderRadius: '14px 14px 0 0',
|
107
|
-
transformOrigin: '50% 100%',
|
108
|
-
marginTop: tooltipHeight,
|
109
|
-
marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
|
110
|
-
});
|
111
|
-
}
|
112
|
-
// Left Position
|
113
|
-
else if (tooltipPosition === "left") {
|
114
|
-
targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
|
115
|
-
targetLeft = origin.offset().left - tooltipWidth - margin;
|
116
|
-
newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
|
117
|
-
|
118
|
-
tooltipHorizontalMovement = '-10px';
|
119
|
-
backdrop.css({
|
120
|
-
top: '-7px',
|
121
|
-
right: 0,
|
122
|
-
width: '14px',
|
123
|
-
height: '14px',
|
124
|
-
borderRadius: '14px 0 0 14px',
|
125
|
-
transformOrigin: '95% 50%',
|
126
|
-
marginTop: tooltipHeight / 2,
|
127
|
-
marginLeft: tooltipWidth
|
128
|
-
});
|
129
|
-
}
|
130
|
-
// Right Position
|
131
|
-
else if (tooltipPosition === "right") {
|
132
|
-
targetTop = origin.offset().top + originHeight / 2 - tooltipHeight / 2;
|
133
|
-
targetLeft = origin.offset().left + originWidth + margin;
|
134
|
-
newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
|
135
|
-
|
136
|
-
tooltipHorizontalMovement = '+10px';
|
137
|
-
backdrop.css({
|
138
|
-
top: '-7px',
|
139
|
-
left: 0,
|
140
|
-
width: '14px',
|
141
|
-
height: '14px',
|
142
|
-
borderRadius: '0 14px 14px 0',
|
143
|
-
transformOrigin: '5% 50%',
|
144
|
-
marginTop: tooltipHeight / 2,
|
145
|
-
marginLeft: '0px'
|
146
|
-
});
|
147
|
-
} else {
|
148
|
-
// Bottom Position
|
149
|
-
targetTop = origin.offset().top + origin.outerHeight() + margin;
|
150
|
-
targetLeft = origin.offset().left + originWidth / 2 - tooltipWidth / 2;
|
151
|
-
newCoordinates = repositionWithinScreen(targetLeft, targetTop, tooltipWidth, tooltipHeight);
|
152
|
-
tooltipVerticalMovement = '+10px';
|
153
|
-
backdrop.css({
|
154
|
-
top: 0,
|
155
|
-
left: 0,
|
156
|
-
marginLeft: tooltipWidth / 2 - backdropOffsetWidth / 2
|
157
|
-
});
|
158
|
-
}
|
159
|
-
|
160
|
-
// Set tooptip css placement
|
161
|
-
tooltipEl.css({
|
162
|
-
top: newCoordinates.y,
|
163
|
-
left: newCoordinates.x
|
164
|
-
});
|
165
|
-
|
166
|
-
// Calculate Scale to fill
|
167
|
-
scaleXFactor = Math.SQRT2 * tooltipWidth / parseInt(backdropOffsetWidth);
|
168
|
-
scaleYFactor = Math.SQRT2 * tooltipHeight / parseInt(backdropOffsetHeight);
|
169
|
-
scaleFactor = Math.max(scaleXFactor, scaleYFactor);
|
170
|
-
|
171
|
-
tooltipEl.velocity({ translateY: tooltipVerticalMovement, translateX: tooltipHorizontalMovement }, { duration: 350, queue: false }).velocity({ opacity: 1 }, { duration: 300, delay: 50, queue: false });
|
172
|
-
backdrop.css({ visibility: 'visible' }).velocity({ opacity: 1 }, { duration: 55, delay: 0, queue: false }).velocity({ scaleX: scaleFactor, scaleY: scaleFactor }, { duration: 300, delay: 0, queue: false, easing: 'easeInOutQuad' });
|
173
|
-
};
|
174
|
-
|
175
|
-
timeoutRef = setTimeout(showTooltip, tooltipDelay); // End Interval
|
176
|
-
|
177
|
-
// Mouse Out
|
178
|
-
},
|
179
|
-
'mouseleave.tooltip': function () {
|
180
|
-
// Reset State
|
181
|
-
started = false;
|
182
|
-
clearTimeout(timeoutRef);
|
183
|
-
|
184
|
-
// Animate back
|
185
|
-
setTimeout(function () {
|
186
|
-
if (started !== true) {
|
187
|
-
tooltipEl.velocity({
|
188
|
-
opacity: 0, translateY: 0, translateX: 0 }, { duration: 225, queue: false });
|
189
|
-
backdrop.velocity({ opacity: 0, scaleX: 1, scaleY: 1 }, {
|
190
|
-
duration: 225,
|
191
|
-
queue: false,
|
192
|
-
complete: function () {
|
193
|
-
backdrop.css({ visibility: 'hidden' });
|
194
|
-
tooltipEl.css({ visibility: 'hidden' });
|
195
|
-
started = false;
|
196
|
-
}
|
197
|
-
});
|
198
|
-
}
|
199
|
-
}, 225);
|
200
|
-
}
|
201
|
-
});
|
202
|
-
});
|
203
|
-
};
|
204
|
-
|
205
|
-
var repositionWithinScreen = function (x, y, width, height) {
|
206
|
-
var newX = x;
|
207
|
-
var newY = y;
|
208
|
-
|
209
|
-
if (newX < 0) {
|
210
|
-
newX = 4;
|
211
|
-
} else if (newX + width > window.innerWidth) {
|
212
|
-
newX -= newX + width - window.innerWidth;
|
213
|
-
}
|
214
|
-
|
215
|
-
if (newY < 0) {
|
216
|
-
newY = 4;
|
217
|
-
} else if (newY + height > window.innerHeight + $(window).scrollTop) {
|
218
|
-
newY -= newY + height - window.innerHeight;
|
219
|
-
}
|
220
|
-
|
221
|
-
return { x: newX, y: newY };
|
222
|
-
};
|
223
|
-
|
224
|
-
$(document).on('ready turbolinks:load', function () {
|
225
|
-
$('.tooltipped').tooltip();
|
226
|
-
});
|
227
|
-
})(jQuery);
|
@@ -1,163 +0,0 @@
|
|
1
|
-
(function ($) {
|
2
|
-
// Image transition function
|
3
|
-
Materialize.fadeInImage = function (selectorOrEl) {
|
4
|
-
var element;
|
5
|
-
if (typeof selectorOrEl === 'string') {
|
6
|
-
element = $(selectorOrEl);
|
7
|
-
} else if (typeof selectorOrEl === 'object') {
|
8
|
-
element = selectorOrEl;
|
9
|
-
} else {
|
10
|
-
return;
|
11
|
-
}
|
12
|
-
element.css({ opacity: 0 });
|
13
|
-
$(element).velocity({ opacity: 1 }, {
|
14
|
-
duration: 650,
|
15
|
-
queue: false,
|
16
|
-
easing: 'easeOutSine'
|
17
|
-
});
|
18
|
-
$(element).velocity({ opacity: 1 }, {
|
19
|
-
duration: 1300,
|
20
|
-
queue: false,
|
21
|
-
easing: 'swing',
|
22
|
-
step: function (now, fx) {
|
23
|
-
fx.start = 100;
|
24
|
-
var grayscale_setting = now / 100;
|
25
|
-
var brightness_setting = 150 - (100 - now) / 1.75;
|
26
|
-
|
27
|
-
if (brightness_setting < 100) {
|
28
|
-
brightness_setting = 100;
|
29
|
-
}
|
30
|
-
if (now >= 0) {
|
31
|
-
$(this).css({
|
32
|
-
"-webkit-filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)",
|
33
|
-
"filter": "grayscale(" + grayscale_setting + ")" + "brightness(" + brightness_setting + "%)"
|
34
|
-
});
|
35
|
-
}
|
36
|
-
}
|
37
|
-
});
|
38
|
-
};
|
39
|
-
|
40
|
-
// Horizontal staggered list
|
41
|
-
Materialize.showStaggeredList = function (selectorOrEl) {
|
42
|
-
var element;
|
43
|
-
if (typeof selectorOrEl === 'string') {
|
44
|
-
element = $(selectorOrEl);
|
45
|
-
} else if (typeof selectorOrEl === 'object') {
|
46
|
-
element = selectorOrEl;
|
47
|
-
} else {
|
48
|
-
return;
|
49
|
-
}
|
50
|
-
var time = 0;
|
51
|
-
element.find('li').velocity({ translateX: "-100px" }, { duration: 0 });
|
52
|
-
|
53
|
-
element.find('li').each(function () {
|
54
|
-
$(this).velocity({ opacity: "1", translateX: "0" }, { duration: 800, delay: time, easing: [60, 10] });
|
55
|
-
time += 120;
|
56
|
-
});
|
57
|
-
};
|
58
|
-
|
59
|
-
$(document).on('ready turbolinks:load', function () {
|
60
|
-
// Hardcoded .staggered-list scrollFire
|
61
|
-
// var staggeredListOptions = [];
|
62
|
-
// $('ul.staggered-list').each(function (i) {
|
63
|
-
|
64
|
-
// var label = 'scrollFire-' + i;
|
65
|
-
// $(this).addClass(label);
|
66
|
-
// staggeredListOptions.push(
|
67
|
-
// {selector: 'ul.staggered-list.' + label,
|
68
|
-
// offset: 200,
|
69
|
-
// callback: 'showStaggeredList("ul.staggered-list.' + label + '")'});
|
70
|
-
// });
|
71
|
-
// scrollFire(staggeredListOptions);
|
72
|
-
|
73
|
-
// HammerJS, Swipe navigation
|
74
|
-
|
75
|
-
// Touch Event
|
76
|
-
var swipeLeft = false;
|
77
|
-
var swipeRight = false;
|
78
|
-
|
79
|
-
// Dismissible Collections
|
80
|
-
$('.dismissable').each(function () {
|
81
|
-
$(this).hammer({
|
82
|
-
prevent_default: false
|
83
|
-
}).on('pan', function (e) {
|
84
|
-
if (e.gesture.pointerType === "touch") {
|
85
|
-
var $this = $(this);
|
86
|
-
var direction = e.gesture.direction;
|
87
|
-
var x = e.gesture.deltaX;
|
88
|
-
var velocityX = e.gesture.velocityX;
|
89
|
-
|
90
|
-
$this.velocity({ translateX: x
|
91
|
-
}, { duration: 50, queue: false, easing: 'easeOutQuad' });
|
92
|
-
|
93
|
-
// Swipe Left
|
94
|
-
if (direction === 4 && (x > $this.innerWidth() / 2 || velocityX < -0.75)) {
|
95
|
-
swipeLeft = true;
|
96
|
-
}
|
97
|
-
|
98
|
-
// Swipe Right
|
99
|
-
if (direction === 2 && (x < -1 * $this.innerWidth() / 2 || velocityX > 0.75)) {
|
100
|
-
swipeRight = true;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
}).on('panend', function (e) {
|
104
|
-
// Reset if collection is moved back into original position
|
105
|
-
if (Math.abs(e.gesture.deltaX) < $(this).innerWidth() / 2) {
|
106
|
-
swipeRight = false;
|
107
|
-
swipeLeft = false;
|
108
|
-
}
|
109
|
-
|
110
|
-
if (e.gesture.pointerType === "touch") {
|
111
|
-
var $this = $(this);
|
112
|
-
if (swipeLeft || swipeRight) {
|
113
|
-
var fullWidth;
|
114
|
-
if (swipeLeft) {
|
115
|
-
fullWidth = $this.innerWidth();
|
116
|
-
} else {
|
117
|
-
fullWidth = -1 * $this.innerWidth();
|
118
|
-
}
|
119
|
-
|
120
|
-
$this.velocity({ translateX: fullWidth
|
121
|
-
}, { duration: 100, queue: false, easing: 'easeOutQuad', complete: function () {
|
122
|
-
$this.css('border', 'none');
|
123
|
-
$this.velocity({ height: 0, padding: 0
|
124
|
-
}, { duration: 200, queue: false, easing: 'easeOutQuad', complete: function () {
|
125
|
-
$this.remove();
|
126
|
-
}
|
127
|
-
});
|
128
|
-
}
|
129
|
-
});
|
130
|
-
} else {
|
131
|
-
$this.velocity({ translateX: 0
|
132
|
-
}, { duration: 100, queue: false, easing: 'easeOutQuad' });
|
133
|
-
}
|
134
|
-
swipeLeft = false;
|
135
|
-
swipeRight = false;
|
136
|
-
}
|
137
|
-
});
|
138
|
-
});
|
139
|
-
|
140
|
-
// time = 0
|
141
|
-
// // Vertical Staggered list
|
142
|
-
// $('ul.staggered-list.vertical li').velocity(
|
143
|
-
// { translateY: "100px"},
|
144
|
-
// { duration: 0 });
|
145
|
-
|
146
|
-
// $('ul.staggered-list.vertical li').each(function() {
|
147
|
-
// $(this).velocity(
|
148
|
-
// { opacity: "1", translateY: "0"},
|
149
|
-
// { duration: 800, delay: time, easing: [60, 25] });
|
150
|
-
// time += 120;
|
151
|
-
// });
|
152
|
-
|
153
|
-
// // Fade in and Scale
|
154
|
-
// $('.fade-in.scale').velocity(
|
155
|
-
// { scaleX: .4, scaleY: .4, translateX: -600},
|
156
|
-
// { duration: 0});
|
157
|
-
// $('.fade-in').each(function() {
|
158
|
-
// $(this).velocity(
|
159
|
-
// { opacity: "1", scaleX: 1, scaleY: 1, translateX: 0},
|
160
|
-
// { duration: 800, easing: [60, 10] });
|
161
|
-
// });
|
162
|
-
});
|
163
|
-
})(jQuery);
|