mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-01-01 12:26:13 +00:00
Switched to keeping time with UTC for easier timezones
Removed useless JS
This commit is contained in:
parent
56c82513ba
commit
b5bc0ec50c
|
@ -143,7 +143,7 @@ def upload():
|
||||||
# Save to database
|
# Save to database
|
||||||
try:
|
try:
|
||||||
query = db.Posts(author_id = g.user.id,
|
query = db.Posts(author_id = g.user.id,
|
||||||
created_at = dt.now(),
|
created_at = dt.utcnow(),
|
||||||
file_name = img_name+'.'+img_ext,
|
file_name = img_name+'.'+img_ext,
|
||||||
file_type = img_ext,
|
file_type = img_ext,
|
||||||
image_exif = img_exif,
|
image_exif = img_exif,
|
||||||
|
|
|
@ -100,7 +100,7 @@ def register():
|
||||||
register_user = db.Users(username=username,
|
register_user = db.Users(username=username,
|
||||||
email=email,
|
email=email,
|
||||||
password=generate_password_hash(password),
|
password=generate_password_hash(password),
|
||||||
created_at=dt.now())
|
created_at=dt.utcnow())
|
||||||
db_session.add(register_user)
|
db_session.add(register_user)
|
||||||
db_session.commit()
|
db_session.commit()
|
||||||
except exc.IntegrityError:
|
except exc.IntegrityError:
|
||||||
|
@ -148,7 +148,7 @@ def login():
|
||||||
ip_address=request.remote_addr,
|
ip_address=request.remote_addr,
|
||||||
user_agent=request.user_agent.string,
|
user_agent=request.user_agent.string,
|
||||||
active=True,
|
active=True,
|
||||||
created_at=dt.now())
|
created_at=dt.utcnow())
|
||||||
|
|
||||||
db_session.add(session_query)
|
db_session.add(session_query)
|
||||||
db_session.commit()
|
db_session.commit()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Onlylegs Gallery - Routing
|
Onlylegs Gallery - Routing
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
from datetime import datetime as dt
|
from datetime import datetime as dt
|
||||||
|
|
||||||
from flask import Blueprint, render_template, current_app, request, g
|
from flask import Blueprint, render_template, current_app, request, g
|
||||||
|
|
|
@ -1,24 +1,6 @@
|
||||||
let navToggle = true;
|
let navToggle = true;
|
||||||
|
|
||||||
document.onscroll = function() {
|
document.onscroll = function() {
|
||||||
try {
|
|
||||||
document.querySelector('.background-decoration').style.opacity = `${1 - window.scrollY / 621}`;
|
|
||||||
document.querySelector('.background-decoration').style.top = `-${window.scrollY / 5}px`;
|
|
||||||
} catch (e) {
|
|
||||||
// Do nothing if banner not found
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) {
|
|
||||||
document.querySelector('.banner').classList = 'banner banner-scrolled';
|
|
||||||
} else {
|
|
||||||
document.querySelector('.banner').classList = 'banner';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
// Do nothing if banner not found
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) {
|
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) {
|
||||||
document.querySelector('.jumpUp').classList = 'jumpUp jumpUp--show';
|
document.querySelector('.jumpUp').classList = 'jumpUp jumpUp--show';
|
||||||
} else {
|
} else {
|
||||||
|
@ -35,9 +17,21 @@ function imgFade(obj) {
|
||||||
$(obj).animate({opacity: 1}, 250);
|
$(obj).animate({opacity: 1}, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
var times = document.getElementsByClassName('time');
|
let times = document.getElementsByClassName('time');
|
||||||
for (var i = 0; i < times.length; i++) {
|
for (let i = 0; i < times.length; i++) {
|
||||||
var time = times[i].innerHTML;
|
// Remove milliseconds
|
||||||
var date = new Date(time);
|
const raw = times[i].innerHTML.split('.')[0];
|
||||||
times[i].innerHTML = date.toLocaleString('en-GB');
|
|
||||||
|
// Parse YYYY-MM-DD HH:MM:SS to Date object
|
||||||
|
const time = raw.split(' ')[1]
|
||||||
|
const date = raw.split(' ')[0].split('-');
|
||||||
|
|
||||||
|
// Format to YYYY/MM/DD HH:MM:SS
|
||||||
|
let formatted = date[0] + '/' + date[1] + '/' + date[2] + ' ' + time + ' UTC';
|
||||||
|
|
||||||
|
// Convert to UTC Date object
|
||||||
|
let dateTime = new Date(formatted);
|
||||||
|
|
||||||
|
// Convert to local time
|
||||||
|
times[i].innerHTML = dateTime.toLocaleDateString() + ' ' + dateTime.toLocaleTimeString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,3 +183,4 @@
|
||||||
align-items: center
|
align-items: center
|
||||||
|
|
||||||
border-radius: $rad
|
border-radius: $rad
|
||||||
|
border: 1px solid $white
|
||||||
|
|
Loading…
Reference in a new issue