dlegr250_material_design 0.4.82 → 0.4.83
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b80f1be1c9fb66e5740d3ba258277db4e04df39
|
4
|
+
data.tar.gz: dde508c5e30bcfca36f10a62074fa5f6ee99d9db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ed2144bb6c885297f3e61af1ade048e3632dec1ab928d5645d177a671fc184fab4d1d09dcb48503a0e42f6d71b569f30b6e86bfc92a5bd2d8a5dfbfbd6d97cf
|
7
|
+
data.tar.gz: 372d24169f0c20ea1044df46c1bb20160ed6d81428d12cb0c633dc55614492b75d69349d854ed209f359d526ef734528877fa7daafe3f476cd6221b229eae364
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dlegr250_material_design
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.83
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel LeGrand
|
@@ -53,7 +53,6 @@ files:
|
|
53
53
|
- vendor/assets/javascripts/third_party/handlebars.latest.js
|
54
54
|
- vendor/assets/javascripts/third_party/jquery.autonumeric.1-9-44.js
|
55
55
|
- vendor/assets/javascripts/third_party/jquery.inputmask.min.3.2.8-11.js
|
56
|
-
- vendor/assets/javascripts/third_party/snackbarlight.js
|
57
56
|
- vendor/assets/stylesheets/base/base.scss
|
58
57
|
- vendor/assets/stylesheets/base/global_classes.scss
|
59
58
|
- vendor/assets/stylesheets/base/mixins.scss
|
@@ -1,218 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Constructor
|
3
|
-
*
|
4
|
-
* @param {[type]} data [description]
|
5
|
-
* @param {[type]} options [description]
|
6
|
-
* @param {Function} callback [description]
|
7
|
-
*/
|
8
|
-
function Snackbar(data, options, callback){
|
9
|
-
if (data !== "") {
|
10
|
-
this.options = this.activateOptions(options);
|
11
|
-
this.data = data;
|
12
|
-
this.callback = callback;
|
13
|
-
this.start();
|
14
|
-
this.snackbar();
|
15
|
-
} else {
|
16
|
-
console.warn("SnackbarLight: You can not create a empty snackbar please give it a string.");
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
|
-
Snackbar.prototype = {
|
21
|
-
|
22
|
-
/**
|
23
|
-
* Default options
|
24
|
-
*
|
25
|
-
* @type {Object}
|
26
|
-
*/
|
27
|
-
options: {
|
28
|
-
// How long it takes for the snackbar to disappear
|
29
|
-
timeout: 5000,
|
30
|
-
// Wich class is used to tell that the snackbar is active
|
31
|
-
activeClass: "active",
|
32
|
-
// Name of the link or action if specified
|
33
|
-
link: false,
|
34
|
-
// If not used clicking will activate the callback or do nothing
|
35
|
-
url: "#"
|
36
|
-
},
|
37
|
-
|
38
|
-
/**
|
39
|
-
* Create container for the snackbar
|
40
|
-
*
|
41
|
-
* @return {void}
|
42
|
-
*/
|
43
|
-
start: function() {
|
44
|
-
if (!document.getElementById("snackbar-container")) {
|
45
|
-
var snackbarContainer = document.createElement("div");
|
46
|
-
|
47
|
-
snackbarContainer.setAttribute("id", "snackbar-container");
|
48
|
-
|
49
|
-
document.body.appendChild(snackbarContainer);
|
50
|
-
}
|
51
|
-
},
|
52
|
-
|
53
|
-
/**
|
54
|
-
* Timer
|
55
|
-
*
|
56
|
-
* @param {Function} callback
|
57
|
-
* @param {int} delay
|
58
|
-
* @return {void}
|
59
|
-
*/
|
60
|
-
timer: function(callback, delay) {
|
61
|
-
var remaining = delay;
|
62
|
-
|
63
|
-
this.timer = {
|
64
|
-
// Create random timer id
|
65
|
-
timerId: Math.round(Math.random()*1000),
|
66
|
-
|
67
|
-
pause: function() {
|
68
|
-
// Clear the timeout
|
69
|
-
window.clearTimeout(this.timerId);
|
70
|
-
// Set the remaining to what time remains
|
71
|
-
remaining -= new Date() - start;
|
72
|
-
},
|
73
|
-
|
74
|
-
resume: function() {
|
75
|
-
start = new Date();
|
76
|
-
// Clear the timeout
|
77
|
-
window.clearTimeout(this.timerId);
|
78
|
-
// Set the timeout again
|
79
|
-
this.timerId = window.setTimeout(callback, remaining);
|
80
|
-
},
|
81
|
-
};
|
82
|
-
// Start the timer
|
83
|
-
this.timer.resume();
|
84
|
-
},
|
85
|
-
|
86
|
-
/**
|
87
|
-
* snackbar
|
88
|
-
*
|
89
|
-
* @return {void}
|
90
|
-
*/
|
91
|
-
snackbar: function() {
|
92
|
-
var __self = this,
|
93
|
-
snackbar = document.createElement("div");
|
94
|
-
|
95
|
-
// Put the snackbar inside the snackbar container
|
96
|
-
var container = document.getElementById("snackbar-container");
|
97
|
-
|
98
|
-
// 2016-02-04 / dan.legrand@gmail.com
|
99
|
-
// According to Google Material Design spec, do not stack snackbars.
|
100
|
-
// This clears out any previous snackbars before adding the new one.
|
101
|
-
container.innerHTML = null;
|
102
|
-
|
103
|
-
container.appendChild(snackbar);
|
104
|
-
|
105
|
-
// Set the html inside the snackbar
|
106
|
-
snackbar.innerHTML = this.getData();
|
107
|
-
|
108
|
-
// Set the class of the snackbar
|
109
|
-
snackbar.setAttribute("class", "snackbar");
|
110
|
-
|
111
|
-
// 2016-02-06 / dan.legrand@gmail.com
|
112
|
-
// According to Google Material Design spec, do not cover FAB buttons.
|
113
|
-
// This moves any FAB buttons from bottom-right corner up.
|
114
|
-
// Assumes only 1 FAB on screen in bottom-right corner.
|
115
|
-
if ($(window).width() <= 750) {
|
116
|
-
$(".fab").css("bottom", "64px");
|
117
|
-
}
|
118
|
-
|
119
|
-
// Wait to set the active class so animations will be activated
|
120
|
-
setTimeout(function() {
|
121
|
-
snackbar.setAttribute("class", snackbar.getAttribute("class") + " " + __self.options.activeClass);
|
122
|
-
}, 50);
|
123
|
-
|
124
|
-
// If the timeout is false the snackbar will not be destroyed after some time
|
125
|
-
// only when the user clicks on it
|
126
|
-
if (this.options.timeout !== false) {
|
127
|
-
// Start the timer
|
128
|
-
this.timer(function() {
|
129
|
-
snackbar.setAttribute("class", "snackbar");
|
130
|
-
__self.destroy(snackbar);
|
131
|
-
}, this.options.timeout);
|
132
|
-
}
|
133
|
-
|
134
|
-
// Add the event listeners
|
135
|
-
this.listeners(snackbar);
|
136
|
-
},
|
137
|
-
|
138
|
-
/**
|
139
|
-
* Get the data/ message to display in the snackbar
|
140
|
-
*
|
141
|
-
* @return {string}
|
142
|
-
*/
|
143
|
-
getData: function() {
|
144
|
-
if (this.options.link !== false) {
|
145
|
-
return "<span>" + this.data + "</span><a href='" + this.options.url + "'>" + this.options.link + "</a>";
|
146
|
-
}
|
147
|
-
return "<span>" + this.data + "</span>";
|
148
|
-
},
|
149
|
-
|
150
|
-
/**
|
151
|
-
* Activate the listeners
|
152
|
-
*
|
153
|
-
* @param {Object} element
|
154
|
-
* @return {void}
|
155
|
-
*/
|
156
|
-
listeners: function(element) {
|
157
|
-
var __self = this;
|
158
|
-
// Adding event listener for when user clicks on the snackbar to remove it
|
159
|
-
element.addEventListener("click", function(){
|
160
|
-
if (typeof __self.callback == "function") {
|
161
|
-
__self.callback();
|
162
|
-
}
|
163
|
-
element.setAttribute("class", "snackbar");
|
164
|
-
__self.destroy(element);
|
165
|
-
});
|
166
|
-
|
167
|
-
// Stopping the timer when user hovers on the snackbar
|
168
|
-
element.addEventListener("mouseenter",function(){
|
169
|
-
__self.timer.pause();
|
170
|
-
});
|
171
|
-
element.addEventListener("mouseout",function(){
|
172
|
-
__self.timer.resume();
|
173
|
-
});
|
174
|
-
},
|
175
|
-
|
176
|
-
/**
|
177
|
-
* Remove the snackbar
|
178
|
-
*
|
179
|
-
* @param {object} element
|
180
|
-
* @return {void}
|
181
|
-
*/
|
182
|
-
destroy: function(element) {
|
183
|
-
// 2016-02-06 / dan.legrand@gmail.com
|
184
|
-
// Put FAB back to original position if there are no more active snackbars.
|
185
|
-
if (($(".snackbar.active").length > 0) && ($(window).width() <= 750)) {
|
186
|
-
$(".fab").css("bottom", "64px");
|
187
|
-
} else {
|
188
|
-
$(".fab").css("bottom", "24px");
|
189
|
-
}
|
190
|
-
|
191
|
-
// Delay for removing the element (for when there are animations)
|
192
|
-
this.timer.pause();
|
193
|
-
|
194
|
-
element.remove();
|
195
|
-
|
196
|
-
setTimeout(function() {
|
197
|
-
element.remove();
|
198
|
-
}, 10000);
|
199
|
-
},
|
200
|
-
|
201
|
-
/**
|
202
|
-
* Compare the options to the default ones.
|
203
|
-
*
|
204
|
-
* @param {Object} newOptions
|
205
|
-
* @return {Object}
|
206
|
-
*/
|
207
|
-
activateOptions: function(newOptions) {
|
208
|
-
var __self = this,
|
209
|
-
options = newOptions || {};
|
210
|
-
|
211
|
-
for (var opt in this.options) {
|
212
|
-
if (__self.options.hasOwnProperty(opt) && !options.hasOwnProperty(opt)) {
|
213
|
-
options[opt] = __self.options[opt];
|
214
|
-
}
|
215
|
-
}
|
216
|
-
return options;
|
217
|
-
},
|
218
|
-
};
|