2020-12-21 18:41:55 +01:00
|
|
|
// Cloud section ===================== old school code divider =================
|
2020-12-11 16:54:09 +01:00
|
|
|
function rn(from, to) {
|
|
|
|
return ~~(Math.random() * (to - from + 1)) + from;
|
|
|
|
}
|
|
|
|
|
|
|
|
function rs() {
|
|
|
|
return arguments[rn(1, arguments.length) - 1];
|
2020-12-21 18:41:55 +01:00
|
|
|
}
|
2020-12-11 16:54:09 +01:00
|
|
|
|
|
|
|
function boxShadows(max) {
|
|
|
|
let ret = [];
|
|
|
|
for (let i = 0; i < max; ++i) {
|
|
|
|
ret.push(`
|
|
|
|
${ rn(1, 100) }vw ${ rn(1, 100) }vh ${ rn(20, 40) }vmin ${ rn(1, 20) }vmin
|
|
|
|
${ rs('#F52D75', '#CCBD4F', '#32497F', '#EB4377') }
|
|
|
|
`)
|
|
|
|
}
|
|
|
|
return ret.join(',');
|
|
|
|
}
|
|
|
|
|
|
|
|
const cloud = document.querySelector('#cloud');
|
|
|
|
function update() {
|
2020-12-21 18:41:55 +01:00
|
|
|
cloud.style.boxShadow = boxShadows(120);
|
|
|
|
}
|
|
|
|
// Filter section ===================== old school code divider ================
|
|
|
|
|
|
|
|
filterSelection("all")
|
|
|
|
function filterSelection(c) {
|
|
|
|
var x, i;
|
|
|
|
allpublications = document.getElementsByClassName("filter");
|
|
|
|
if (c == "all") {
|
|
|
|
for (i = 0; i < allpublications.length; i++) {
|
|
|
|
addClass(allpublications[i], "show");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for (i = 0; i < allpublications.length; i++) {
|
|
|
|
removeClass(allpublications[i], "show");
|
|
|
|
if (allpublications[i].className.indexOf(c) > -1) {
|
|
|
|
addClass(allpublications[i], "show");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-12-11 16:54:09 +01:00
|
|
|
}
|
|
|
|
|
2020-12-21 18:41:55 +01:00
|
|
|
function addClass(element, name) {
|
|
|
|
var i, arr1, arr2;
|
|
|
|
arr1 = element.className.split(" ");
|
|
|
|
arr2 = name.split(" ");
|
|
|
|
for (i = 0; i < arr2.length; i++) {
|
|
|
|
if (arr1.indexOf(arr2[i]) == -1) {element.className += " " + arr2[i];}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function removeClass(element, name) {
|
|
|
|
var i, arr1, arr2;
|
|
|
|
arr1 = element.className.split(" ");
|
|
|
|
arr2 = name.split(" ");
|
|
|
|
for (i = 0; i < arr2.length; i++) {
|
|
|
|
while (arr1.indexOf(arr2[i]) > -1) {
|
|
|
|
arr1.splice(arr1.indexOf(arr2[i]), 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
element.className = arr1.join(" ");
|
|
|
|
}
|
|
|
|
window.addEventListener('load', update);
|