update javascript

This commit is contained in:
Lilian Roller 2019-12-02 09:00:21 +01:00
parent d483244c4a
commit bbdf78f976
No known key found for this signature in database
GPG key ID: 5215C3441797AB2B

View file

@ -5,9 +5,23 @@
"Cleaned" - aka destroyed and rewritten by L3D. "Cleaned" - aka destroyed and rewritten by L3D.
<WARNING> L3D does not know how JavaScript works and just deleted some random lines. <WARNING> L3D does not know how JavaScript works and just deleted some random lines.
And made some other weird changes no one understood!
*/ */
function loadSpaceStatus() {
$.getJSON("/c3woc.json", function(data) {
$("link[href='/css/spacestatus.css']").remove();
if (data.state.open == true) {
$('#space-closed').hide();
$('#space-opened').css("display", "block");
} else {
$('#space-opened').hide();
$('#space-closed').show();
}
});
}
(function($) { (function($) {
skel.breakpoints({ skel.breakpoints({
@ -18,8 +32,6 @@
xsmall: '(max-width: 480px)' xsmall: '(max-width: 480px)'
}); });
$(function() {
var $window = $(window), var $window = $(window),
$body = $('body'); $body = $('body');
@ -81,81 +93,60 @@
// Parallax. // Parallax.
// Disabled on IE (choppy scrolling) and mobile platforms (poor performance). // Disabled on IE (choppy scrolling) and mobile platforms (poor performance).
if (skel.vars.browser == 'ie' if (skel.vars.browser == 'ie' ||
|| skel.vars.mobile) { skel.vars.mobile) {
$.fn._parallax = function() { $.fn._parallax = function() {
return $(this); return $(this);
}; };
} } else {
else {
$.fn._parallax = function() { $.fn._parallax = function() {
$(this).each(function() { $(this).each(function() {
var $this = $(this), var $this = $(this),
on, off; on, off;
on = function() { on = function() {
$this $this
.css('background-position', 'center 0px'); .css('background-position', 'center 0px');
$window $window
.on('scroll._parallax', function() { .on('scroll._parallax', function() {
var pos = parseInt($window.scrollTop()) - parseInt($this.position().top); var pos = parseInt($window.scrollTop()) - parseInt($this.position().top);
$this.css('background-position', 'center ' + (pos * -0.15) + 'px'); $this.css('background-position', 'center ' + (pos * -0.15) + 'px');
}); });
}; };
off = function() { off = function() {
$this $this
.css('background-position', ''); .css('background-position', '');
$window $window
.off('scroll._parallax'); .off('scroll._parallax');
}; };
skel.on('change', function() { skel.on('change', function() {
if (skel.breakpoint('medium').active) if (skel.breakpoint('medium').active)
(off)(); (off)();
else else
(on)(); (on)();
}); });
}); });
return $(this); return $(this);
}; };
$window $window.on('load resize', function() {
.on('load resize', function() {
$window.trigger('scroll'); $window.trigger('scroll');
}); });
} }
// Banner. // Banner.
var $banner = $('#banner'); var $banner = $('#banner');
$banner $banner
._parallax(); ._parallax();
}); loadSpaceStatus();
})(jQuery); })(jQuery);
window.setInterval(function() {
loadSpaceStatus();
}, 5000);