mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 03:26:16 +00:00
Add basic Image Group functions
Make the Upload Pannel usable on mobile Remove useless code as Django had built-in functions to read the config Remove useless JS code Cleanup tempaltes
This commit is contained in:
parent
35c5951318
commit
e3a0eaf60b
18 changed files with 531 additions and 213 deletions
|
@ -1,18 +1,3 @@
|
|||
let navToggle = true;
|
||||
|
||||
document.onscroll = function() {
|
||||
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) {
|
||||
document.querySelector('.jumpUp').classList = 'jumpUp jumpUp--show';
|
||||
} else {
|
||||
document.querySelector('.jumpUp').classList = 'jumpUp';
|
||||
}
|
||||
}
|
||||
|
||||
document.querySelector('.jumpUp').onclick = function() {
|
||||
document.body.scrollTop = 0;
|
||||
document.documentElement.scrollTop = 0;
|
||||
}
|
||||
|
||||
function imgFade(obj) {
|
||||
$(obj).animate({opacity: 1}, 250);
|
||||
}
|
||||
|
@ -36,6 +21,43 @@ for (let i = 0; i < times.length; i++) {
|
|||
times[i].innerHTML = dateTime.toLocaleDateString() + ' ' + dateTime.toLocaleTimeString();
|
||||
}
|
||||
|
||||
let images = document.querySelectorAll('.gallery-item img');
|
||||
function loadOnView() {
|
||||
for (let i = 0; i < images.length; i++) {
|
||||
let image = images[i];
|
||||
if (image.getBoundingClientRect().top < window.innerHeight && image.getBoundingClientRect().bottom > 0) {
|
||||
if (!image.src) {
|
||||
image.src = `/api/uploads/${image.getAttribute('data-src')}?w=500&h=500`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (images.length > 0) {
|
||||
window.onload = function() {
|
||||
loadOnView();
|
||||
};
|
||||
window.onscroll = function() {
|
||||
loadOnView();
|
||||
};
|
||||
window.onresize = function() {
|
||||
loadOnView();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
document.onscroll = function() {
|
||||
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) {
|
||||
document.querySelector('.jumpUp').classList = 'jumpUp jumpUp--show';
|
||||
} else {
|
||||
document.querySelector('.jumpUp').classList = 'jumpUp';
|
||||
}
|
||||
}
|
||||
document.querySelector('.jumpUp').onclick = function() {
|
||||
document.body.scrollTop = 0;
|
||||
document.documentElement.scrollTop = 0;
|
||||
}
|
||||
|
||||
|
||||
function uploadFile(){
|
||||
// AJAX takes control of subby form
|
||||
event.preventDefault();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue