mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-01-01 04:16:07 +00:00
Loading images on scroll
Better api
This commit is contained in:
parent
4279ebed00
commit
3f64c56ec8
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -1,5 +1,11 @@
|
||||||
# temporarily remove image folder
|
# Remove all development files
|
||||||
static/images
|
uploads/
|
||||||
|
|
||||||
|
# remove all PyCharm files
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# remove all VSCode files
|
||||||
|
.vscode
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
73
app.py
73
app.py
|
@ -2,7 +2,6 @@ from flask import Flask, render_template, send_from_directory, abort, url_for, j
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
# Get database stuff
|
# Get database stuff
|
||||||
DB_USER = os.environ.get('USERNAME')
|
DB_USER = os.environ.get('USERNAME')
|
||||||
DB_PASS = os.environ.get('PASSWORD')
|
DB_PASS = os.environ.get('PASSWORD')
|
||||||
|
@ -11,13 +10,12 @@ DB_PORT = os.environ.get('PORT')
|
||||||
|
|
||||||
DB = os.environ.get('DATABASE')
|
DB = os.environ.get('DATABASE')
|
||||||
|
|
||||||
|
|
||||||
# Set flask config
|
# Set flask config
|
||||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
IMAGE_DIR = os.path.join(BASE_DIR, 'static/images')
|
UPLOAD_FOLDER = os.path.join(BASE_DIR, 'uploads')
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config['IMAGE_DIR'] = IMAGE_DIR
|
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -27,31 +25,35 @@ app.config['IMAGE_DIR'] = IMAGE_DIR
|
||||||
def method_not_allowed(e):
|
def method_not_allowed(e):
|
||||||
error = '405'
|
error = '405'
|
||||||
msg = 'Method sussy wussy'
|
msg = 'Method sussy wussy'
|
||||||
return render_template('error.html', error = error, msg = msg), 404
|
return render_template('error.html', error=error, msg=msg), 404
|
||||||
|
|
||||||
|
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
def page_not_found(e):
|
def page_not_found(e):
|
||||||
error = '404'
|
error = '404'
|
||||||
msg = 'Could not find what you need!'
|
msg = 'Could not find what you need!'
|
||||||
return render_template('error.html', error = error, msg = msg), 404
|
return render_template('error.html', error=error, msg=msg), 404
|
||||||
|
|
||||||
|
|
||||||
@app.errorhandler(403)
|
@app.errorhandler(403)
|
||||||
def forbidden(e):
|
def forbidden(e):
|
||||||
error = '403'
|
error = '403'
|
||||||
msg = 'Go away! This is no place for you!'
|
msg = 'Go away! This is no place for you!'
|
||||||
return render_template('error.html', error = error, msg = msg), 403
|
return render_template('error.html', error=error, msg=msg), 403
|
||||||
|
|
||||||
|
|
||||||
@app.errorhandler(410)
|
@app.errorhandler(410)
|
||||||
def gone(e):
|
def gone(e):
|
||||||
error = '410'
|
error = '410'
|
||||||
msg = 'The page is no longer available! *sad face*'
|
msg = 'The page is no longer available! *sad face*'
|
||||||
return render_template('error.html', error = error, msg = msg), 410
|
return render_template('error.html', error=error, msg=msg), 410
|
||||||
|
|
||||||
|
|
||||||
@app.errorhandler(500)
|
@app.errorhandler(500)
|
||||||
def internal_server_error(e):
|
def internal_server_error(e):
|
||||||
error = '500'
|
error = '500'
|
||||||
msg = 'Server died inside :c'
|
msg = 'Server died inside :c'
|
||||||
return render_template('error.html', error = error, msg = msg), 500
|
return render_template('error.html', error=error, msg=msg), 500
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -59,33 +61,50 @@ def internal_server_error(e):
|
||||||
#
|
#
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def home():
|
def home():
|
||||||
image_list = os.listdir(app.config['IMAGE_DIR'])
|
return render_template('home.html')
|
||||||
return render_template('home.html', images = image_list)
|
|
||||||
|
|
||||||
@app.route('/image/<id>')
|
|
||||||
def image(id):
|
@app.route('/image/<file_id>')
|
||||||
|
def image(file_id):
|
||||||
try:
|
try:
|
||||||
id = int(id)
|
file_id = int(file_id)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
image_list = os.listdir(app.config['IMAGE_DIR'])
|
file_list = os.listdir(os.path.join(app.config['UPLOAD_FOLDER'], 'original'))
|
||||||
fileName = image_list[id]
|
file_name = file_list[file_id]
|
||||||
|
|
||||||
return render_template('image.html', fileName = fileName, id = id)
|
return render_template('image.html', fileName=file_name, id=file_id)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# METHODS
|
# METHODS
|
||||||
#
|
#
|
||||||
@app.route('/fileList', methods = ['GET'])
|
@app.route('/fileList/<item_type>', methods=['GET'])
|
||||||
def imageList():
|
def image_list(item_type):
|
||||||
image_list = os.listdir(app.config['IMAGE_DIR'])
|
if request.method != 'GET':
|
||||||
return jsonify(image_list)
|
abort(405)
|
||||||
|
|
||||||
@app.route('/file/<filename>', methods = ['GET'])
|
item_type = secure_filename(item_type)
|
||||||
def pfp(filename):
|
type_dir = os.path.join(app.config['UPLOAD_FOLDER'], item_type)
|
||||||
if (request.method == 'GET'):
|
if not os.path.isdir(type_dir):
|
||||||
return send_from_directory(app.config['IMAGE_DIR'], filename)
|
abort(404)
|
||||||
else:
|
|
||||||
return None
|
return jsonify(os.listdir(type_dir))
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/uploads/<item_type>/<file_id>', methods=['GET'])
|
||||||
|
def uploads(item_type, file_id):
|
||||||
|
if request.method != 'GET':
|
||||||
|
abort(405)
|
||||||
|
|
||||||
|
item_type = secure_filename(item_type)
|
||||||
|
type_dir = os.path.join(app.config['UPLOAD_FOLDER'], item_type)
|
||||||
|
if not os.path.isdir(type_dir):
|
||||||
|
abort(404)
|
||||||
|
|
||||||
|
file_id = secure_filename(file_id)
|
||||||
|
if not os.path.isfile(os.path.join(type_dir, file_id)):
|
||||||
|
abort(404)
|
||||||
|
|
||||||
|
return send_from_directory(type_dir, file_id)
|
||||||
|
|
|
@ -39,7 +39,7 @@ nav {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
transition: width 0.4s ease-in-out, background-color 0.3s ease-in-out;
|
transition: width 0.4s cubic-bezier(0.86, 0, 0.07, 1), background-color 0.3s ease-in-out;
|
||||||
}
|
}
|
||||||
nav:hover {
|
nav:hover {
|
||||||
width: 25rem;
|
width: 25rem;
|
||||||
|
@ -100,13 +100,11 @@ main {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
main header {
|
main header {
|
||||||
margin: 0 0 -15rem 0;
|
margin: 0 0 -10vh 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40vh;
|
height: 40vh;
|
||||||
background-color: #121212;
|
background-color: #121212;
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
main header img {
|
main header img {
|
||||||
|
@ -115,6 +113,7 @@ main header img {
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
filter: blur(0.5rem);
|
||||||
-o-object-fit: cover;
|
-o-object-fit: cover;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
@ -125,8 +124,6 @@ main header span {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), #151515);
|
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), #151515);
|
||||||
-webkit-backdrop-filter: blur(0.5rem);
|
|
||||||
backdrop-filter: blur(0.5rem);
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +142,7 @@ main header span {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s cubic-bezier(0.86, 0, 0.07, 1);
|
||||||
}
|
}
|
||||||
#topButton:hover {
|
#topButton:hover {
|
||||||
background-color: #121212;
|
background-color: #121212;
|
||||||
|
@ -153,17 +150,17 @@ main header span {
|
||||||
}
|
}
|
||||||
|
|
||||||
.app {
|
.app {
|
||||||
margin: 10rem 1rem 0 4.5rem;
|
margin: 0 0 0 3.5rem;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
width: auto;
|
width: auto;
|
||||||
min-height: calc(150vh - 10rem);
|
min-height: 90vh;
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
background-color: #151515;
|
background-color: #151515;
|
||||||
color: #e8e3e3;
|
color: #e8e3e3;
|
||||||
border-radius: 0.5rem 0.5rem 0 0;
|
border-radius: 8px 8px 0 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
overflow: unset;
|
overflow: unset;
|
||||||
|
@ -178,6 +175,29 @@ main header span {
|
||||||
color: #8C977D;
|
color: #8C977D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes imgLoading {
|
||||||
|
0% {
|
||||||
|
background-position: 0% 50%;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
background-position: 100% 50%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
background-position: 0% 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes imgLoading {
|
||||||
|
0% {
|
||||||
|
background-position: 0% 50%;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
background-position: 100% 50%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
background-position: 0% 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
.gallery {
|
.gallery {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -191,8 +211,11 @@ main header span {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
height: auto;
|
height: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
background-color: #121212;
|
background: linear-gradient(-45deg, #151515, #0e0e0e, #151515);
|
||||||
border-radius: 0.25rem;
|
background-size: 400% 400%;
|
||||||
|
border-radius: 4px;
|
||||||
|
-webkit-animation: imgLoading 10s ease infinite;
|
||||||
|
animation: imgLoading 10s ease infinite;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +239,7 @@ main header span {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: scale(1.05);
|
transform: scale(1.05);
|
||||||
transition: all 0.35s ease-in-out;
|
transition: all 0.5s cubic-bezier(0.79, 0.14, 0.15, 0.86);
|
||||||
}
|
}
|
||||||
.gallery .gallery__item .gallery__item-info h2 {
|
.gallery .gallery__item .gallery__item-info h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -229,7 +252,7 @@ main header span {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: all 0.35s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
.gallery .gallery__item .gallery__item-info p {
|
.gallery .gallery__item .gallery__item-info p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -241,7 +264,7 @@ main header span {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: all 0.35s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
.gallery .gallery__item .gallery__item-info:hover {
|
.gallery .gallery__item .gallery__item-info:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
@ -264,7 +287,7 @@ main header span {
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
-o-object-position: center;
|
-o-object-position: center;
|
||||||
object-position: center;
|
object-position: center;
|
||||||
border-radius: 0.5rem;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image__container {
|
.image__container {
|
||||||
|
@ -276,7 +299,7 @@ main header span {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
border-radius: 0.25rem;
|
border-radius: 4px;
|
||||||
background-color: #121212;
|
background-color: #121212;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +312,7 @@ main header span {
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
-o-object-position: center;
|
-o-object-position: center;
|
||||||
object-position: center;
|
object-position: center;
|
||||||
border-radius: 0.25rem;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image__info {
|
.image__info {
|
||||||
|
@ -299,7 +322,7 @@ main header span {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background-color: #121212;
|
background-color: #121212;
|
||||||
border-radius: 0.25rem;
|
border-radius: 4px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.image__info h2 {
|
.image__info h2 {
|
||||||
|
|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BAAA;EAEA,oCAhbI;EAibJ,iBAAA;EACA,gBAAA;EAEA,cA/bG;EAicH,uBAAA;EACA,gBAAA;AChIR","file":"style.css"}
|
|
@ -1,6 +1,7 @@
|
||||||
$black100: #151515;
|
$black100: #151515;
|
||||||
$black200: #121212;
|
$black200: #121212;
|
||||||
$black300: #101010;
|
$black300: #101010;
|
||||||
|
$black400: #0e0e0e;
|
||||||
|
|
||||||
$white100: #e8e3e3;
|
$white100: #e8e3e3;
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ $green: #8C977D;
|
||||||
$blue: #8DA3B9;
|
$blue: #8DA3B9;
|
||||||
$purple: #A988B0;
|
$purple: #A988B0;
|
||||||
|
|
||||||
$rad: 0.5rem;
|
$rad: 8px;
|
||||||
$font-header: "Hubot-Sans", sans-serif;
|
$font-header: "Hubot-Sans", sans-serif;
|
||||||
$font-body: "Mona-Sans", sans-serif;
|
$font-body: "Mona-Sans", sans-serif;
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ nav {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
transition: width 0.4s ease-in-out, background-color 0.3s ease-in-out;
|
transition: width 0.4s cubic-bezier(.86,0,.07,1), background-color 0.3s ease-in-out;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
width: 25rem;
|
width: 25rem;
|
||||||
|
@ -148,15 +149,13 @@ main {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
header {
|
header {
|
||||||
margin: 0 0 -15rem 0;
|
margin: 0 0 calc((10vh) * -1) 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40vh;
|
height: 40vh;
|
||||||
|
|
||||||
background-color: $black200;
|
background-color: $black200;
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
@ -168,6 +167,8 @@ main {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
|
filter: blur(0.5rem);
|
||||||
|
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
span {
|
span {
|
||||||
|
@ -179,7 +180,6 @@ main {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
background-image: linear-gradient(to bottom, #00000000, rgba($black100, 1));
|
background-image: linear-gradient(to bottom, #00000000, rgba($black100, 1));
|
||||||
backdrop-filter: blur(0.5rem);
|
|
||||||
|
|
||||||
z-index: +1;
|
z-index: +1;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ main {
|
||||||
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s cubic-bezier(.86,0,.07,1);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: $black200;
|
background-color: $black200;
|
||||||
|
@ -217,11 +217,11 @@ main {
|
||||||
}
|
}
|
||||||
|
|
||||||
.app {
|
.app {
|
||||||
margin: 10rem 1rem 0 4.5rem;
|
margin: 0 0 0 3.5rem;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
|
|
||||||
width: auto;
|
width: auto;
|
||||||
min-height: calc(150vh - 10rem);
|
min-height: 90vh;
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
@ -250,6 +250,18 @@ main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes imgLoading {
|
||||||
|
0% {
|
||||||
|
background-position: 0% 50%;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
background-position: 100% 50%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
background-position: 0% 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.gallery {
|
.gallery {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -268,8 +280,10 @@ main {
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
background-color: $black200;
|
background: linear-gradient(-45deg, $black100, $black400, $black100);
|
||||||
|
background-size: 400% 400%;
|
||||||
border-radius: calc($rad / 2);
|
border-radius: calc($rad / 2);
|
||||||
|
animation: imgLoading 10s ease infinite;
|
||||||
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -301,7 +315,7 @@ main {
|
||||||
|
|
||||||
opacity: 0; // hide
|
opacity: 0; // hide
|
||||||
transform: scale(1.05); // scale up
|
transform: scale(1.05); // scale up
|
||||||
transition: all 0.35s ease-in-out;
|
transition: all 0.5s cubic-bezier(.79,.14,.15,.86);
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -318,7 +332,7 @@ main {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
opacity: 0; // hide
|
opacity: 0; // hide
|
||||||
transition: all 0.35s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
|
@ -335,7 +349,7 @@ main {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
opacity: 0; // hide
|
opacity: 0; // hide
|
||||||
transition: all 0.35s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -364,7 +378,7 @@ main {
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
object-position: center;
|
object-position: center;
|
||||||
|
|
||||||
border-radius: $rad;
|
border-radius: calc($rad / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
static/images/leaves.jpg
Normal file
BIN
static/images/leaves.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 MiB |
|
@ -5,28 +5,51 @@
|
||||||
<span></span>
|
<span></span>
|
||||||
</header>
|
</header>
|
||||||
<div class="app">
|
<div class="app">
|
||||||
<h1 style="margin-bottom: 1rem">Gallery</h1>
|
<h1>Gallery</h1>
|
||||||
<div id="gallery" class="gallery"></div>
|
<div id="gallery" class="gallery"></div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$.ajax({
|
let imageList = [];
|
||||||
url: '/fileList',
|
let imageIndex = 0;
|
||||||
type: 'get',
|
|
||||||
success: function(response) {
|
function loadMore(startIndex, amount = 10) {
|
||||||
for (var i = 0; i < response.length; i++) {
|
for (let i = startIndex; i < startIndex + amount; i++) {
|
||||||
|
if (i < imageList.length) {
|
||||||
|
loadImg(i, imageList[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadImg(id, fileName) {
|
||||||
var imgDiv = `
|
var imgDiv = `
|
||||||
<a class="gallery__item" href="/image/${i}">
|
<a class="gallery__item" href="/image/${id}">
|
||||||
<div class="gallery__item-info">
|
<div class="gallery__item-info">
|
||||||
<p>${i}</p>\
|
<p>${id}</p>\
|
||||||
<h2>${response[i]}</h2>
|
<h2>${fileName}</h2>
|
||||||
</div>
|
</div>
|
||||||
<span class="gallery__item-filter"></span>
|
<span class="gallery__item-filter"></span>
|
||||||
<img class="gallery__item-image" src="/file/${response[i]}" onload="imgFade(this)" style="display:none;"/>
|
<img class="gallery__item-image" src="/uploads/original/${fileName}" onload="imgFade(this)" style="display:none;">
|
||||||
</a>
|
</a>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
$(imgDiv).hide().appendTo('#gallery').fadeIn(250);
|
$(imgDiv).hide().appendTo('#gallery').fadeIn(250);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '/fileList/original',
|
||||||
|
type: 'get',
|
||||||
|
success: function(response) {
|
||||||
|
imageList = response;
|
||||||
|
|
||||||
|
loadMore(0, 20);
|
||||||
|
imageIndex += 20;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(window).scroll(function() {
|
||||||
|
if ($(window).height() + $(window).scrollTop() >= $(document).height() - 100) {
|
||||||
|
loadMore(imageIndex);
|
||||||
|
imageIndex += 10;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<header>
|
|
||||||
<img src="/file/{{ fileName }}" alt="leaves"/>
|
|
||||||
<span></span>
|
|
||||||
</header>
|
|
||||||
<div class="app">
|
<div class="app">
|
||||||
<div class="image__container">
|
<div class="image__container">
|
||||||
<img class="image__item" src="/file/{{ fileName }}" onload="imgFade(this)" style="display:none;"/>
|
<img class="image__item" src="/uploads/original/{{ fileName }}" onload="imgFade(this)" style="display:none;"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="image__info">
|
<div class="image__info">
|
||||||
<h2>{{ fileName }}</h2>
|
<h2>{{ fileName }}</h2>
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function imgFade(obj) {
|
function imgFade(obj) {
|
||||||
$(obj).fadeIn(1000);
|
$(obj).fadeIn(621);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue