2018-05-15 20:55:14 +02:00
|
|
|
$(function() {
|
|
|
|
|
2018-05-17 20:30:00 +02:00
|
|
|
var disableResponsiveImagesForInlineLis = function() {
|
|
|
|
$('li img.img-responsive').each(function() {
|
|
|
|
$(this).removeClass('img-responsive');
|
|
|
|
$(this).css('border', 'none');
|
|
|
|
});
|
|
|
|
};
|
2020-05-25 09:17:26 +02:00
|
|
|
disableResponsiveImagesForInlineLis();
|
|
|
|
|
2020-06-07 10:18:09 +02:00
|
|
|
const box = new SimpleLightbox('.lbox', { /* options */ });
|
2020-05-25 09:17:26 +02:00
|
|
|
|
|
|
|
function offCanvas() {
|
|
|
|
$('[data-toggle="offcanvas"]').click(function () {
|
|
|
|
$('.row-offcanvas').toggleClass('active')
|
|
|
|
});
|
|
|
|
}
|
|
|
|
offCanvas();
|
|
|
|
|
|
|
|
function scrollThenFixSidebar() {
|
2020-06-05 14:10:22 +02:00
|
|
|
var maxHeight = $('.sidebar-content').height() - $(window).height();
|
2020-05-25 20:49:24 +02:00
|
|
|
$(document).on('scroll', function(e) {
|
2020-05-25 11:16:11 +02:00
|
|
|
var s = document.scrollingElement.scrollTop || $('html').scrollTop() || $('body').scrollTop();
|
|
|
|
if(s > maxHeight) {
|
2020-05-25 09:17:26 +02:00
|
|
|
$('.sidebar-content').addClass('sidebar-fixed').removeClass('sidebar-scrolling');
|
|
|
|
} else {
|
|
|
|
$('.sidebar-content').addClass('sidebar-scrolling').removeClass('sidebar-fixed');
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
scrollThenFixSidebar();
|
|
|
|
|
|
|
|
var addTargetBlankToExternalLinks = function() {
|
|
|
|
var host = (new URL(window.location.href)).hostname;
|
2020-06-05 14:10:22 +02:00
|
|
|
$('article a').each(function() {
|
2020-05-25 09:17:26 +02:00
|
|
|
var me = $(this);
|
|
|
|
var url = me.attr('href');
|
2020-06-01 09:52:47 +02:00
|
|
|
if(url && url.startsWith('http') && url.indexOf(host) === -1) {
|
2020-05-25 16:53:30 +02:00
|
|
|
me.attr('target', '_blank').addClass('external');
|
2020-05-25 09:17:26 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
};
|
|
|
|
addTargetBlankToExternalLinks();
|
2018-05-17 20:30:00 +02:00
|
|
|
|
2018-05-15 20:55:14 +02:00
|
|
|
var enableScrollToTopOnInternalLinks = function() {
|
|
|
|
$('#totop').click(function() {
|
2020-05-25 09:17:26 +02:00
|
|
|
$("html, body").animate({ scrollTop: 0 }, "slow");
|
2018-05-15 20:55:14 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
$('a.internal').click(function() {
|
2020-05-25 09:17:26 +02:00
|
|
|
$($(this).data('to')).animate({ scrollTop: 0 }, "slow");
|
2018-05-15 20:55:14 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
var addRandomImageToSideBarMenus = function() {
|
|
|
|
var rand = Math.floor(Math.random() * 10) + 1;
|
|
|
|
$('.sidebar-menu li').mouseenter(function() {
|
|
|
|
$(this).css('background', '#f1f4dd url(/img/random/' + rand + '.gif) no-repeat right');
|
|
|
|
}).mouseleave(function() {
|
|
|
|
$(this).css('background', 'none');
|
|
|
|
}).click(function() {
|
|
|
|
location.href = $(this).find('a').attr('href');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
var setSideBarPlatformHeight = function() {
|
|
|
|
$('.sidebar-game-platform').height($('.sidebar-content .img-inactive').height());
|
|
|
|
};
|
|
|
|
|
|
|
|
var animateActiveGameImagesIfFound = function() {
|
|
|
|
var animate = function() {
|
|
|
|
var active = $(this).find('.img-active');
|
|
|
|
if(active.length > 0) {
|
|
|
|
active.css('display', 'block');
|
|
|
|
$(this).find('.img-inactive').css('display', 'none');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var inanimate = function() {
|
|
|
|
var active = $(this).find('.img-active');
|
|
|
|
if(active.length > 0) {
|
|
|
|
active.css('display', 'none');
|
|
|
|
$(this).find('.img-inactive').css('display', 'block');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
$('.box-masonry').mouseenter(animate).mouseleave(inanimate);
|
2020-05-25 11:16:11 +02:00
|
|
|
$('.sidebar').mouseenter(animate).mouseleave(inanimate);
|
2018-05-15 20:55:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
animateActiveGameImagesIfFound();
|
|
|
|
setSideBarPlatformHeight();
|
|
|
|
addRandomImageToSideBarMenus();
|
|
|
|
enableScrollToTopOnInternalLinks();
|
|
|
|
});
|