dae-material 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/app/assets/fonts/material-design-icons/LICENSE.txt +428 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.eot +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.svg +751 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.ttf +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff +0 -0
- data/app/assets/fonts/material-design-icons/Material-Design-Icons.woff2 +0 -0
- data/app/assets/fonts/roboto/Roboto-Bold.ttf +0 -0
- 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.ttf +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.ttf +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.ttf +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.ttf +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-sprockets.js +27 -0
- data/app/assets/javascripts/materialize.js +6023 -0
- data/app/assets/javascripts/materialize/animation.js +9 -0
- data/app/assets/javascripts/materialize/buttons.js +35 -0
- data/app/assets/javascripts/materialize/cards.js +27 -0
- data/app/assets/javascripts/materialize/character_counter.js +59 -0
- data/app/assets/javascripts/materialize/collapsible.js +139 -0
- data/app/assets/javascripts/materialize/date_picker/picker.date.js +1430 -0
- data/app/assets/javascripts/materialize/date_picker/picker.js +1123 -0
- data/app/assets/javascripts/materialize/dropdown.js +176 -0
- data/app/assets/javascripts/materialize/forms.js +397 -0
- data/app/assets/javascripts/materialize/global.js +31 -0
- data/app/assets/javascripts/materialize/hammer.min.js +1 -0
- data/app/assets/javascripts/materialize/init.js +137 -0
- data/app/assets/javascripts/materialize/jquery.easing.1.3.js +205 -0
- data/app/assets/javascripts/materialize/jquery.hammer.js +33 -0
- data/app/assets/javascripts/materialize/jquery.timeago.min.js +1 -0
- data/app/assets/javascripts/materialize/leanModal.js +139 -0
- data/app/assets/javascripts/materialize/materialbox.js +249 -0
- data/app/assets/javascripts/materialize/parallax.js +58 -0
- data/app/assets/javascripts/materialize/prism.js +8 -0
- data/app/assets/javascripts/materialize/pushpin.js +62 -0
- data/app/assets/javascripts/materialize/scrollFire.js +69 -0
- data/app/assets/javascripts/materialize/scrollspy.js +284 -0
- data/app/assets/javascripts/materialize/sideNav.js +335 -0
- data/app/assets/javascripts/materialize/slider.js +263 -0
- data/app/assets/javascripts/materialize/tabs.js +129 -0
- data/app/assets/javascripts/materialize/toasts.js +121 -0
- data/app/assets/javascripts/materialize/tooltip.js +166 -0
- data/app/assets/javascripts/materialize/transitions.js +145 -0
- data/app/assets/javascripts/materialize/velocity.min.js +4 -0
- data/app/assets/javascripts/materialize/waves.js +338 -0
- data/app/assets/stylesheets/materialize.scss +38 -0
- data/app/assets/stylesheets/materialize/components/_buttons.scss +151 -0
- data/app/assets/stylesheets/materialize/components/_cards.scss +150 -0
- data/app/assets/stylesheets/materialize/components/_collapsible.scss +88 -0
- data/app/assets/stylesheets/materialize/components/_color.scss +412 -0
- data/app/assets/stylesheets/materialize/components/_dropdown.scss +38 -0
- data/app/assets/stylesheets/materialize/components/_form.scss +850 -0
- data/app/assets/stylesheets/materialize/components/_global.scss +682 -0
- data/app/assets/stylesheets/materialize/components/_grid.scss +118 -0
- data/app/assets/stylesheets/materialize/components/_icons-material-design.scss +783 -0
- data/app/assets/stylesheets/materialize/components/_materialbox.scss +41 -0
- data/app/assets/stylesheets/materialize/components/_mixins.scss +5 -0
- data/app/assets/stylesheets/materialize/components/_modal.scss +89 -0
- data/app/assets/stylesheets/materialize/components/_navbar.scss +143 -0
- data/app/assets/stylesheets/materialize/components/_normalize.scss +427 -0
- data/app/assets/stylesheets/materialize/components/_prefixer.scss +376 -0
- data/app/assets/stylesheets/materialize/components/_preloader.scss +332 -0
- data/app/assets/stylesheets/materialize/components/_roboto.scss +38 -0
- data/app/assets/stylesheets/materialize/components/_sideNav.scss +111 -0
- data/app/assets/stylesheets/materialize/components/_slider.scss +92 -0
- data/app/assets/stylesheets/materialize/components/_table_of_contents.scss +33 -0
- data/app/assets/stylesheets/materialize/components/_tabs.scss +42 -0
- data/app/assets/stylesheets/materialize/components/_toast.scss +63 -0
- data/app/assets/stylesheets/materialize/components/_tooltip.scss +34 -0
- data/app/assets/stylesheets/materialize/components/_typography.scss +56 -0
- data/app/assets/stylesheets/materialize/components/_variables.scss +143 -0
- data/app/assets/stylesheets/materialize/components/_waves.scss +167 -0
- data/app/assets/stylesheets/materialize/components/date_picker/_default.date.scss +435 -0
- data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +201 -0
- data/app/assets/stylesheets/materialize/components/date_picker/_default.time.scss +125 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/dae-material.gemspec +23 -0
- data/lib/dae/material.rb +7 -0
- data/lib/dae/material/version.rb +8 -0
- metadata +166 -0
@@ -0,0 +1,249 @@
|
|
1
|
+
(function ($) {
|
2
|
+
|
3
|
+
$.fn.materialbox = function () {
|
4
|
+
|
5
|
+
return this.each(function() {
|
6
|
+
|
7
|
+
if ($(this).hasClass('intialized')) {
|
8
|
+
return;
|
9
|
+
}
|
10
|
+
|
11
|
+
$(this).addClass('intialized');
|
12
|
+
|
13
|
+
var overlayActive = false;
|
14
|
+
var doneAnimating = true;
|
15
|
+
var inDuration = 275;
|
16
|
+
var outDuration = 200;
|
17
|
+
var origin = $(this);
|
18
|
+
var placeholder = $('<div></div>').addClass('material-placeholder');
|
19
|
+
var originalWidth = 0;
|
20
|
+
var originalHeight = 0;
|
21
|
+
origin.wrap(placeholder);
|
22
|
+
|
23
|
+
|
24
|
+
origin.on('click', function(){
|
25
|
+
var placeholder = origin.parent('.material-placeholder');
|
26
|
+
var windowWidth = window.innerWidth;
|
27
|
+
var windowHeight = window.innerHeight;
|
28
|
+
var originalWidth = origin.width();
|
29
|
+
var originalHeight = origin.height();
|
30
|
+
|
31
|
+
|
32
|
+
// If already modal, return to original
|
33
|
+
if (doneAnimating === false) {
|
34
|
+
returnToOriginal();
|
35
|
+
return false;
|
36
|
+
}
|
37
|
+
else if (overlayActive && doneAnimating===true) {
|
38
|
+
returnToOriginal();
|
39
|
+
return false;
|
40
|
+
}
|
41
|
+
|
42
|
+
|
43
|
+
// Set states
|
44
|
+
doneAnimating = false;
|
45
|
+
origin.addClass('active');
|
46
|
+
overlayActive = true;
|
47
|
+
|
48
|
+
// Set positioning for placeholder
|
49
|
+
|
50
|
+
placeholder.css({
|
51
|
+
width: placeholder[0].getBoundingClientRect().width,
|
52
|
+
height: placeholder[0].getBoundingClientRect().height,
|
53
|
+
position: 'relative',
|
54
|
+
top: 0,
|
55
|
+
left: 0
|
56
|
+
});
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
// Set css on origin
|
61
|
+
origin.css({position: 'absolute', 'z-index': 1000})
|
62
|
+
.data('width', originalWidth)
|
63
|
+
.data('height', originalHeight);
|
64
|
+
|
65
|
+
// Add overlay
|
66
|
+
var overlay = $('<div id="materialbox-overlay"></div>')
|
67
|
+
.css({
|
68
|
+
opacity: 0
|
69
|
+
})
|
70
|
+
.click(function(){
|
71
|
+
if (doneAnimating === true)
|
72
|
+
returnToOriginal();
|
73
|
+
});
|
74
|
+
// Animate Overlay
|
75
|
+
$('body').append(overlay);
|
76
|
+
overlay.velocity({opacity: 1}, {duration: inDuration, queue: false, easing: 'easeOutQuad'}
|
77
|
+
);
|
78
|
+
|
79
|
+
|
80
|
+
// Add and animate caption if it exists
|
81
|
+
if (origin.data('caption') !== "") {
|
82
|
+
var $photo_caption = $('<div class="materialbox-caption"></div>');
|
83
|
+
$photo_caption.text(origin.data('caption'));
|
84
|
+
$('body').append($photo_caption);
|
85
|
+
$photo_caption.css({ "display": "inline" });
|
86
|
+
$photo_caption.velocity({opacity: 1}, {duration: inDuration, queue: false, easing: 'easeOutQuad'})
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
// Resize Image
|
92
|
+
var ratio = 0;
|
93
|
+
var widthPercent = originalWidth / windowWidth;
|
94
|
+
var heightPercent = originalHeight / windowHeight;
|
95
|
+
var newWidth = 0;
|
96
|
+
var newHeight = 0;
|
97
|
+
|
98
|
+
if (widthPercent > heightPercent) {
|
99
|
+
ratio = originalHeight / originalWidth;
|
100
|
+
newWidth = windowWidth * 0.9;
|
101
|
+
newHeight = windowWidth * 0.9 * ratio;
|
102
|
+
}
|
103
|
+
else {
|
104
|
+
ratio = originalWidth / originalHeight;
|
105
|
+
newWidth = (windowHeight * 0.9) * ratio;
|
106
|
+
newHeight = windowHeight * 0.9;
|
107
|
+
}
|
108
|
+
|
109
|
+
// Animate image + set z-index
|
110
|
+
if(origin.hasClass('responsive-img')) {
|
111
|
+
origin.velocity({'max-width': newWidth, 'width': originalWidth}, {duration: 0, queue: false,
|
112
|
+
complete: function(){
|
113
|
+
origin.css({left: 0, top: 0})
|
114
|
+
.velocity(
|
115
|
+
{
|
116
|
+
height: newHeight,
|
117
|
+
width: newWidth,
|
118
|
+
left: $(document).scrollLeft() + windowWidth/2 - origin.parent('.material-placeholder').offset().left - newWidth/2,
|
119
|
+
top: $(document).scrollTop() + windowHeight/2 - origin.parent('.material-placeholder').offset().top - newHeight/ 2
|
120
|
+
},
|
121
|
+
{
|
122
|
+
duration: inDuration,
|
123
|
+
queue: false,
|
124
|
+
easing: 'easeOutQuad',
|
125
|
+
complete: function(){doneAnimating = true;}
|
126
|
+
}
|
127
|
+
);
|
128
|
+
} // End Complete
|
129
|
+
}); // End Velocity
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
origin.css('left', 0)
|
133
|
+
.css('top', 0)
|
134
|
+
.velocity(
|
135
|
+
{
|
136
|
+
height: newHeight,
|
137
|
+
width: newWidth,
|
138
|
+
left: $(document).scrollLeft() + windowWidth/2 - origin.parent('.material-placeholder').offset().left - newWidth/2,
|
139
|
+
top: $(document).scrollTop() + windowHeight/2 - origin.parent('.material-placeholder').offset().top - newHeight/ 2
|
140
|
+
},
|
141
|
+
{
|
142
|
+
duration: inDuration,
|
143
|
+
queue: false,
|
144
|
+
easing: 'easeOutQuad',
|
145
|
+
complete: function(){doneAnimating = true;}
|
146
|
+
}
|
147
|
+
); // End Velocity
|
148
|
+
}
|
149
|
+
|
150
|
+
}); // End origin on click
|
151
|
+
|
152
|
+
|
153
|
+
// Return on scroll
|
154
|
+
$(window).scroll(function() {
|
155
|
+
if (overlayActive ) {
|
156
|
+
returnToOriginal();
|
157
|
+
}
|
158
|
+
});
|
159
|
+
|
160
|
+
// Return on ESC
|
161
|
+
$(document).keyup(function(e) {
|
162
|
+
|
163
|
+
if (e.keyCode === 27 && doneAnimating === true) { // ESC key
|
164
|
+
if (overlayActive) {
|
165
|
+
returnToOriginal();
|
166
|
+
}
|
167
|
+
}
|
168
|
+
});
|
169
|
+
|
170
|
+
|
171
|
+
// This function returns the modaled image to the original spot
|
172
|
+
function returnToOriginal() {
|
173
|
+
|
174
|
+
doneAnimating = false;
|
175
|
+
|
176
|
+
var placeholder = origin.parent('.material-placeholder');
|
177
|
+
var windowWidth = window.innerWidth;
|
178
|
+
var windowHeight = window.innerHeight;
|
179
|
+
var originalWidth = origin.data('width');
|
180
|
+
var originalHeight = origin.data('height');
|
181
|
+
|
182
|
+
origin.velocity("stop", true);
|
183
|
+
$('#materialbox-overlay').velocity("stop", true);
|
184
|
+
$('.materialbox-caption').velocity("stop", true);
|
185
|
+
|
186
|
+
|
187
|
+
$('#materialbox-overlay').velocity({opacity: 0}, {
|
188
|
+
duration: outDuration, // Delay prevents animation overlapping
|
189
|
+
queue: false, easing: 'easeOutQuad',
|
190
|
+
complete: function(){
|
191
|
+
// Remove Overlay
|
192
|
+
overlayActive = false;
|
193
|
+
$(this).remove();
|
194
|
+
}
|
195
|
+
});
|
196
|
+
|
197
|
+
// Resize Image
|
198
|
+
origin.velocity(
|
199
|
+
{
|
200
|
+
width: originalWidth,
|
201
|
+
height: originalHeight,
|
202
|
+
left: 0,
|
203
|
+
top: 0
|
204
|
+
},
|
205
|
+
{
|
206
|
+
duration: outDuration,
|
207
|
+
queue: false, easing: 'easeOutQuad'
|
208
|
+
}
|
209
|
+
);
|
210
|
+
|
211
|
+
// Remove Caption + reset css settings on image
|
212
|
+
$('.materialbox-caption').velocity({opacity: 0}, {
|
213
|
+
duration: outDuration, // Delay prevents animation overlapping
|
214
|
+
queue: false, easing: 'easeOutQuad',
|
215
|
+
complete: function(){
|
216
|
+
placeholder.css({
|
217
|
+
height: '',
|
218
|
+
width: '',
|
219
|
+
position: '',
|
220
|
+
top: '',
|
221
|
+
left: ''
|
222
|
+
});
|
223
|
+
|
224
|
+
origin.css({
|
225
|
+
height: '',
|
226
|
+
top: '',
|
227
|
+
left: '',
|
228
|
+
width: '',
|
229
|
+
'max-width': '',
|
230
|
+
position: '',
|
231
|
+
'z-index': ''
|
232
|
+
});
|
233
|
+
|
234
|
+
// Remove class
|
235
|
+
origin.removeClass('active');
|
236
|
+
doneAnimating = true;
|
237
|
+
$(this).remove();
|
238
|
+
}
|
239
|
+
});
|
240
|
+
|
241
|
+
}
|
242
|
+
});
|
243
|
+
};
|
244
|
+
|
245
|
+
$(document).ready(function(){
|
246
|
+
$('.materialboxed').materialbox();
|
247
|
+
});
|
248
|
+
|
249
|
+
}( jQuery ));
|
@@ -0,0 +1,58 @@
|
|
1
|
+
(function ($) {
|
2
|
+
|
3
|
+
$.fn.parallax = function () {
|
4
|
+
var window_width = $(window).width();
|
5
|
+
// Parallax Scripts
|
6
|
+
return this.each(function(i) {
|
7
|
+
var $this = $(this);
|
8
|
+
$this.addClass('parallax');
|
9
|
+
|
10
|
+
function updateParallax(initial) {
|
11
|
+
var container_height;
|
12
|
+
if (window_width < 601) {
|
13
|
+
container_height = ($this.height() > 0) ? $this.height() : $this.children("img").height();
|
14
|
+
}
|
15
|
+
else {
|
16
|
+
container_height = ($this.height() > 0) ? $this.height() : 500;
|
17
|
+
}
|
18
|
+
var $img = $this.children("img").first();
|
19
|
+
var img_height = $img.height();
|
20
|
+
var parallax_dist = img_height - container_height;
|
21
|
+
var bottom = $this.offset().top + container_height;
|
22
|
+
var top = $this.offset().top;
|
23
|
+
var scrollTop = $(window).scrollTop();
|
24
|
+
var windowHeight = window.innerHeight;
|
25
|
+
var windowBottom = scrollTop + windowHeight;
|
26
|
+
var percentScrolled = (windowBottom - top) / (container_height + windowHeight);
|
27
|
+
var parallax = Math.round((parallax_dist * percentScrolled));
|
28
|
+
|
29
|
+
if (initial) {
|
30
|
+
$img.css('display', 'block');
|
31
|
+
}
|
32
|
+
if ((bottom > scrollTop) && (top < (scrollTop + windowHeight))) {
|
33
|
+
$img.css('transform', "translate3D(-50%," + parallax + "px, 0)");
|
34
|
+
}
|
35
|
+
|
36
|
+
}
|
37
|
+
|
38
|
+
// Wait for image load
|
39
|
+
$this.children("img").one("load", function() {
|
40
|
+
updateParallax(true);
|
41
|
+
}).each(function() {
|
42
|
+
if(this.complete) $(this).load();
|
43
|
+
});
|
44
|
+
|
45
|
+
$(window).scroll(function() {
|
46
|
+
window_width = $(window).width();
|
47
|
+
updateParallax(false);
|
48
|
+
});
|
49
|
+
|
50
|
+
$(window).resize(function() {
|
51
|
+
window_width = $(window).width();
|
52
|
+
updateParallax(false);
|
53
|
+
});
|
54
|
+
|
55
|
+
});
|
56
|
+
|
57
|
+
};
|
58
|
+
}( jQuery ));
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+scss+bash */
|
2
|
+
self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=t.util.clone(e[r]));return a;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var a=t.util.clone(t.languages[e]);for(var r in n)a[r]=n[r];return a},insertBefore:function(e,n,a,r){r=r||t.languages;var i=r[e];if(2==arguments.length){a=arguments[1];for(var l in a)a.hasOwnProperty(l)&&(i[l]=a[l]);return i}var s={};for(var o in i)if(i.hasOwnProperty(o)){if(o==n)for(var l in a)a.hasOwnProperty(l)&&(s[l]=a[l]);s[o]=i[o]}return t.languages.DFS(t.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=s)}),r[e]=s},DFS:function(e,n,a){for(var r in e)e.hasOwnProperty(r)&&(n.call(e,r,e[r],a||r),"Object"===t.util.type(e[r])?t.languages.DFS(e[r],n):"Array"===t.util.type(e[r])&&t.languages.DFS(e[r],n,r))}},highlightAll:function(e,n){for(var a,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),i=0;a=r[i++];)t.highlightElement(a,e===!0,n)},highlightElement:function(a,r,i){for(var l,s,o=a;o&&!e.test(o.className);)o=o.parentNode;if(o&&(l=(o.className.match(e)||[,""])[1],s=t.languages[l]),s){a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,o=a.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+l);var g=a.textContent;if(g){var u={element:a,language:l,grammar:s,code:g};if(t.hooks.run("before-highlight",u),r&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){u.highlightedCode=n.stringify(JSON.parse(e.data),l),t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,i&&i.call(u.element),t.hooks.run("after-highlight",u)},c.postMessage(JSON.stringify({language:u.language,code:u.code}))}else u.highlightedCode=t.highlight(u.code,u.grammar,u.language),t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,i&&i.call(a),t.hooks.run("after-highlight",u)}}},highlight:function(e,a,r){var i=t.tokenize(e,a);return n.stringify(t.util.encode(i),r)},tokenize:function(e,n){var a=t.Token,r=[e],i=n.rest;if(i){for(var l in i)n[l]=i[l];delete n.rest}e:for(var l in n)if(n.hasOwnProperty(l)&&n[l]){var s=n[l];s="Array"===t.util.type(s)?s:[s];for(var o=0;o<s.length;++o){var g=s[o],u=g.inside,c=!!g.lookbehind,f=0,h=g.alias;g=g.pattern||g;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){g.lastIndex=0;var m=g.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),O=[p,1];b&&O.push(b);var N=new a(l,u?t.tokenize(m,u):m,h);O.push(N),w&&O.push(w),Array.prototype.splice.apply(r,O)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("[object Array]"==Object.prototype.toString.call(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var s="";for(var o in i.attributes)s+=o+'="'+(i.attributes[o]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+s+">"+i.content+"</"+i.tag+">"},!self.document)return self.addEventListener?(self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code;self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),self.close()},!1),self.Prism):self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism);;
|
3
|
+
Prism.languages.markup={comment:/<!--[\w\W]*?-->/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/\&#?[\da-z]{1,8};/gi},Prism.hooks.add("wrap",function(t){"entity"===t.type&&(t.attributes.title=t.content.replace(/&/,"&"))});;
|
4
|
+
Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/gi,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,"function":/[-a-z0-9]+(?=\()/gi},Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/<style[\w\W]*?>[\w\W]*?<\/style>/gi,inside:{tag:{pattern:/<style[\w\W]*?>|<\/style>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').+?\1/gi,inside:{"attr-name":{pattern:/^\s*style/gi,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/gi,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));;
|
5
|
+
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//g,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*?(\r?\n|$)/g,lookbehind:!0}],string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/gi,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/gi,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};;
|
6
|
+
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|-?Infinity)\b/g,"function":/(?!\d)[a-z0-9_$]+(?=\()/gi}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/<script[\w\W]*?>[\w\W]*?<\/script>/gi,inside:{tag:{pattern:/<script[\w\W]*?>|<\/script>/gi,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript},alias:"language-javascript"}});;
|
7
|
+
Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},atrule:/@[\w-]+(?=\s+(\(|\{|;))/gi,url:/([-a-z]+-)*url(?=\()/gi,selector:/([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|\#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm}),Prism.languages.insertBefore("scss","atrule",{keyword:/@(if|else if|else|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)|(?=@for\s+\$[-_\w]+\s)+from/i}),Prism.languages.insertBefore("scss","property",{variable:/((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i}),Prism.languages.insertBefore("scss","ignore",{placeholder:/%[-_\w]+/i,statement:/\B!(default|optional)\b/gi,"boolean":/\b(true|false)\b/g,"null":/\b(null)\b/g,operator:/\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|\%)\s+/g});;
|
8
|
+
Prism.languages.bash=Prism.languages.extend("clike",{comment:{pattern:/(^|[^"{\\])(#.*?(\r?\n|$))/g,lookbehind:!0},string:{pattern:/("|')(\\?[\s\S])*?\1/g,inside:{property:/\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^\}]+\})/g}},keyword:/\b(if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)\b/g}),Prism.languages.insertBefore("bash","keyword",{property:/\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^}]+\})/g}),Prism.languages.insertBefore("bash","comment",{important:/(^#!\s*\/bin\/bash)|(^#!\s*\/bin\/sh)/g});;
|
@@ -0,0 +1,62 @@
|
|
1
|
+
(function ($) {
|
2
|
+
$(document).ready(function() {
|
3
|
+
|
4
|
+
$.fn.pushpin = function (options) {
|
5
|
+
|
6
|
+
var defaults = {
|
7
|
+
top: 0,
|
8
|
+
bottom: Infinity,
|
9
|
+
offset: 0
|
10
|
+
}
|
11
|
+
options = $.extend(defaults, options);
|
12
|
+
|
13
|
+
$index = 0;
|
14
|
+
return this.each(function() {
|
15
|
+
var $uniqueId = Materialize.guid(),
|
16
|
+
$this = $(this),
|
17
|
+
$original_offset = $(this).offset().top;
|
18
|
+
|
19
|
+
function removePinClasses(object) {
|
20
|
+
object.removeClass('pin-top');
|
21
|
+
object.removeClass('pinned');
|
22
|
+
object.removeClass('pin-bottom');
|
23
|
+
}
|
24
|
+
|
25
|
+
function updateElements(objects, scrolled) {
|
26
|
+
objects.each(function () {
|
27
|
+
// Add position fixed (because its between top and bottom)
|
28
|
+
if (options.top <= scrolled && options.bottom >= scrolled && !$(this).hasClass('pinned')) {
|
29
|
+
removePinClasses($(this));
|
30
|
+
$(this).css('top', options.offset);
|
31
|
+
$(this).addClass('pinned');
|
32
|
+
}
|
33
|
+
|
34
|
+
// Add pin-top (when scrolled position is above top)
|
35
|
+
if (scrolled < options.top && !$(this).hasClass('pin-top')) {
|
36
|
+
removePinClasses($(this));
|
37
|
+
$(this).css('top', 0);
|
38
|
+
$(this).addClass('pin-top');
|
39
|
+
}
|
40
|
+
|
41
|
+
// Add pin-bottom (when scrolled position is below bottom)
|
42
|
+
if (scrolled > options.bottom && !$(this).hasClass('pin-bottom')) {
|
43
|
+
removePinClasses($(this));
|
44
|
+
$(this).addClass('pin-bottom');
|
45
|
+
$(this).css('top', options.bottom - $original_offset);
|
46
|
+
}
|
47
|
+
});
|
48
|
+
}
|
49
|
+
|
50
|
+
updateElements($this, $(window).scrollTop());
|
51
|
+
$(window).on('scroll.' + $uniqueId, function () {
|
52
|
+
var $scrolled = $(window).scrollTop() + options.offset;
|
53
|
+
updateElements($this, $scrolled);
|
54
|
+
});
|
55
|
+
|
56
|
+
});
|
57
|
+
|
58
|
+
};
|
59
|
+
|
60
|
+
|
61
|
+
});
|
62
|
+
}( jQuery ));
|
@@ -0,0 +1,69 @@
|
|
1
|
+
(function($) {
|
2
|
+
|
3
|
+
// Input: Array of JSON objects {selector, offset, callback}
|
4
|
+
|
5
|
+
Materialize.scrollFire = function(options) {
|
6
|
+
|
7
|
+
var didScroll = false;
|
8
|
+
|
9
|
+
window.addEventListener("scroll", function() {
|
10
|
+
didScroll = true;
|
11
|
+
});
|
12
|
+
|
13
|
+
// Rate limit to 100ms
|
14
|
+
setInterval(function() {
|
15
|
+
if(didScroll) {
|
16
|
+
didScroll = false;
|
17
|
+
|
18
|
+
var windowScroll = window.pageYOffset + window.innerHeight;
|
19
|
+
|
20
|
+
for (var i = 0 ; i < options.length; i++) {
|
21
|
+
// Get options from each line
|
22
|
+
var value = options[i];
|
23
|
+
var selector = value.selector,
|
24
|
+
offset = value.offset,
|
25
|
+
callback = value.callback;
|
26
|
+
|
27
|
+
var currentElement = document.querySelector(selector);
|
28
|
+
if ( currentElement !== null) {
|
29
|
+
var elementOffset = currentElement.getBoundingClientRect().top + document.body.scrollTop;
|
30
|
+
|
31
|
+
if (windowScroll > (elementOffset + offset)) {
|
32
|
+
if (value.done != true) {
|
33
|
+
var callbackFunc = new Function(callback);
|
34
|
+
callbackFunc();
|
35
|
+
value.done = true;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
};
|
40
|
+
}
|
41
|
+
}, 100);
|
42
|
+
|
43
|
+
|
44
|
+
// $(window).scroll(function () {
|
45
|
+
// var windowScroll = $(window).scrollTop() + $(window).height();
|
46
|
+
|
47
|
+
// $.each( options, function( i, value ){
|
48
|
+
// var selector = value.selector,
|
49
|
+
// offset = value.offset,
|
50
|
+
// callback = value.callback;
|
51
|
+
|
52
|
+
// if ($(selector).length != 0) {
|
53
|
+
// var elementOffset = $(selector).offset().top;
|
54
|
+
|
55
|
+
// if (windowScroll > (elementOffset + offset)) {
|
56
|
+
// if (value.done != true) {
|
57
|
+
// var callbackFunc = new Function(callback);
|
58
|
+
// callbackFunc();
|
59
|
+
// value.done = true;
|
60
|
+
// }
|
61
|
+
// }
|
62
|
+
// }
|
63
|
+
|
64
|
+
// });
|
65
|
+
// });
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
})(jQuery);
|