From 651fd8aa4989e85f84552606d4eae48d9b18a78d Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Thu, 26 Jan 2023 16:55:42 +0000 Subject: [PATCH] Load image source on scroll Set time tags to local time --- gallery/static/js/main.js | 7 +++++ gallery/templates/image.html | 8 ++--- gallery/templates/index.html | 29 +++++++++++++++++-- gallery/user/themes/default/ui/gallery.sass | 6 ++-- .../user/themes/default/ui/notification.sass | 21 ++++---------- gallery/user/themes/default/ui/pop-up.sass | 24 ++++----------- 6 files changed, 51 insertions(+), 44 deletions(-) diff --git a/gallery/static/js/main.js b/gallery/static/js/main.js index 4695556..8e344eb 100644 --- a/gallery/static/js/main.js +++ b/gallery/static/js/main.js @@ -23,6 +23,13 @@ function imgFade(obj) { //$(obj).parent().style.backgroundColor = 'transparent'; } +var times = document.getElementsByClassName('time'); +for (var i = 0; i < times.length; i++) { + var time = times[i].innerHTML; + var date = new Date(time); + times[i].innerHTML = date.toLocaleString( 'en-GB', { timeZone: 'UTC' } ); +} + function addNotification(text='Sample notification', type=4) { var container = document.querySelector('.notifications'); diff --git a/gallery/templates/image.html b/gallery/templates/image.html index c6ebfcd..283a05c 100644 --- a/gallery/templates/image.html +++ b/gallery/templates/image.html @@ -38,7 +38,7 @@ Share - + @@ -111,7 +111,7 @@

Filename: {{ image['file_name'] }}

Image ID: {{ image['id'] }}

Author: {{ image['author_id'] }}

-

Upload date: {{ image['created_at'] }}

+

Upload date: {{ image['created_at'] }}

Dimensions: {{ file['width'] }}x{{ file['height'] }}

File size: {{ size }}

@@ -155,8 +155,8 @@ addNotification("Failed to copy link! Are you on HTTP?", 2); } }); - $('#img-info').click(function() { - + $('#img-download').click(function() { + addNotification("Download started!", 4); }); {% if g.user['id'] == image['author_id'] %} diff --git a/gallery/templates/index.html b/gallery/templates/index.html index 97da671..b8de948 100644 --- a/gallery/templates/index.html +++ b/gallery/templates/index.html @@ -9,14 +9,13 @@

{{ image['id'] }}

-

{{ image['created_at'] }}

+

{{ image['created_at'] }}

{% endfor %} @@ -25,6 +24,30 @@ {% block script %}