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,157 +5,148 @@
"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({
xlarge: '(max-width: 1680px)', xlarge: '(max-width: 1680px)',
large: '(max-width: 1280px)', large: '(max-width: 1280px)',
medium: '(max-width: 980px)', medium: '(max-width: 980px)',
small: '(max-width: 736px)', small: '(max-width: 736px)',
xsmall: '(max-width: 480px)' xsmall: '(max-width: 480px)'
}); });
$(function() { var $window = $(window),
$body = $('body');
var $window = $(window), // Touch mode.
$body = $('body'); if (skel.vars.mobile)
$body.addClass('is-touch');
// Touch mode. // Fix: Placeholder polyfill.
if (skel.vars.mobile) $('form').placeholder();
$body.addClass('is-touch');
// Fix: Placeholder polyfill. // Prioritize "important" elements on medium.
$('form').placeholder(); skel.on('+medium -medium', function() {
$.prioritize(
'.important\\28 medium\\29',
skel.breakpoint('medium').active
);
});
// Prioritize "important" elements on medium. // Scrolly links.
skel.on('+medium -medium', function() { $('.scrolly').scrolly({
$.prioritize( speed: 2000
'.important\\28 medium\\29', });
skel.breakpoint('medium').active
);
});
// Scrolly links. // Off-Canvas Navigation.
$('.scrolly').scrolly({
speed: 2000
});
// Off-Canvas Navigation. // Title Bar.
$(
'<div id="titleBar">' +
'<a href="#navPanel" class="fas fa-bars toggle"></a>' +
'<span class="title">' + $('#logo').html() + '</span>' +
'</div>'
)
.appendTo($body);
// Title Bar. // Navigation Panel.
$( $(
'<div id="titleBar">' + '<div id="navPanel">' +
'<a href="#navPanel" class="fas fa-bars toggle"></a>' + '<nav>' +
'<span class="title">' + $('#logo').html() + '</span>' + $('#nav').navList() +
'</div>' '</nav>' +
) '</div>'
.appendTo($body); )
.appendTo($body)
.panel({
delay: 500,
hideOnClick: true,
hideOnSwipe: true,
resetScroll: true,
resetForms: true,
side: 'left',
target: $body,
visibleClass: 'navPanel-visible'
});
// Navigation Panel. // Fix: Remove navPanel transitions on WP<10 (poor/buggy performance).
$( if (skel.vars.os == 'wp' && skel.vars.osVersion < 10)
'<div id="navPanel">' + $('#titleBar, #navPanel, #page-wrapper')
'<nav>' + .css('transition', 'none');
$('#nav').navList() +
'</nav>' +
'</div>'
)
.appendTo($body)
.panel({
delay: 500,
hideOnClick: true,
hideOnSwipe: true,
resetScroll: true,
resetForms: true,
side: 'left',
target: $body,
visibleClass: 'navPanel-visible'
});
// Fix: Remove navPanel transitions on WP<10 (poor/buggy performance). // Parallax.
if (skel.vars.os == 'wp' && skel.vars.osVersion < 10) // Disabled on IE (choppy scrolling) and mobile platforms (poor performance).
$('#titleBar, #navPanel, #page-wrapper') if (skel.vars.browser == 'ie' ||
.css('transition', 'none'); skel.vars.mobile) {
// Parallax. $.fn._parallax = function() {
// Disabled on IE (choppy scrolling) and mobile platforms (poor performance). return $(this);
if (skel.vars.browser == 'ie' };
|| skel.vars.mobile) {
$.fn._parallax = function() { } else {
$.fn._parallax = function() {
$(this).each(function() {
var $this = $(this),
on, off;
on = function() {
$this
.css('background-position', 'center 0px');
$window
.on('scroll._parallax', function() {
var pos = parseInt($window.scrollTop()) - parseInt($this.position().top);
$this.css('background-position', 'center ' + (pos * -0.15) + 'px');
});
};
return $(this); off = function() {
$this
.css('background-position', '');
$window
.off('scroll._parallax');
};
}; skel.on('change', function() {
if (skel.breakpoint('medium').active)
(off)();
else
(on)();
});
});
return $(this);
};
} $window.on('load resize', function() {
else { $window.trigger('scroll');
});
$.fn._parallax = function() { }
$(this).each(function() { // Banner.
var $banner = $('#banner');
$banner
._parallax();
var $this = $(this), loadSpaceStatus();
on, off;
on = function() {
$this
.css('background-position', 'center 0px');
$window
.on('scroll._parallax', function() {
var pos = parseInt($window.scrollTop()) - parseInt($this.position().top);
$this.css('background-position', 'center ' + (pos * -0.15) + 'px');
});
};
off = function() {
$this
.css('background-position', '');
$window
.off('scroll._parallax');
};
skel.on('change', function() {
if (skel.breakpoint('medium').active)
(off)();
else
(on)();
});
});
return $(this);
};
$window
.on('load resize', function() {
$window.trigger('scroll');
});
}
// Banner.
var $banner = $('#banner');
$banner
._parallax();
});
})(jQuery); })(jQuery);
window.setInterval(function() {
loadSpaceStatus();
}, 5000);