55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
// Open article on click without an anchor-tag.
|
|
function openArticle(link){
|
|
window.location.href=link;
|
|
}
|
|
|
|
if(cookieSet("InfoBoxHidden")){
|
|
let element = document.getElementById("infoBox");
|
|
element.classList.toggle("hidden");
|
|
}
|
|
|
|
function hideInfoBox(daysOrMonth, duration){
|
|
// Eingabe überprüfen, ob es eine Zahl ist
|
|
if(isNaN(duration)) {
|
|
duration = 2;
|
|
}
|
|
|
|
let factor = 1;
|
|
// Zeitraum überprüfen, ob er in Tagen ist
|
|
if(daysOrMonth === 'd') {
|
|
factor = 24*60;
|
|
}
|
|
const d = new Date();
|
|
d.setTime(d.getTime() + (duration*factor*60*1000));
|
|
let expires = "expires="+ d.toUTCString();
|
|
document.cookie = "InfoBoxHidden=true; expires=" + expires + ";path=/;SameSite=Strict";
|
|
}
|
|
|
|
function cookieSet(cname) {
|
|
let name = cname + "=";
|
|
let decodedCookie = decodeURIComponent(document.cookie);
|
|
let ca = decodedCookie.split(';');
|
|
for(let i = 0; i < ca.length; i++) {
|
|
let c = ca[i];
|
|
while (c.charAt(0) == ' ') {
|
|
c = c.substring(1);
|
|
}
|
|
if (c.indexOf(name) == 0) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
var spy = new Gumshoe('#scrollspy-subNav a', {
|
|
/***** Scrollspy *****/ // Active classes
|
|
navClass: 'active', // applied to the nav list item
|
|
});
|
|
|
|
/***** SmoothScroll *****/ // All animations will take exactly 500ms
|
|
var scroll = new SmoothScroll('a[href*="#"]', {
|
|
speed: 750,
|
|
speedAsDuration: true,
|
|
easing: 'easeInOutQuad'
|
|
});
|