From f7df3b6b116222b6ce73a4a5ef780e6b0372b94d Mon Sep 17 00:00:00 2001 From: zvevqx Date: Wed, 16 Oct 2024 08:53:36 +0200 Subject: [PATCH] randon picto added to bg --- app.py | 10 ++++++---- static/js/script.js | 8 ++++---- templates/base.html | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app.py b/app.py index 3ca365e..ec0b965 100644 --- a/app.py +++ b/app.py @@ -2,6 +2,7 @@ from flask import Flask from flask import render_template, request from flask_flatpages import FlatPages import markdown2, os +import random app = Flask(__name__) application = app @@ -38,15 +39,16 @@ def imagelist(articlename): @app.route('/') def index(): - infobox = pages.get('info-box') + pictoPath = os.listdir('./static/img/shape/') + pictoR = random.choice(pictoPath) + print(pictoR) page = pages.get_or_404('home') - return render_template('home.html' , page=page , infobox=infobox ) + return render_template('home.html' , page=page , picto=pictoR) @app.route('/home/') def home(): - infobox = pages.get('info-box') page = pages.get_or_404('home') - return render_template('home.html' , page=page , infobox=infobox ) + return render_template('home.html' , page=page ) @app.route('//') def pageStat(path): diff --git a/static/js/script.js b/static/js/script.js index f72cb3f..3063add 100644 --- a/static/js/script.js +++ b/static/js/script.js @@ -14,11 +14,11 @@ $(document).ready(function(){ function getRndInteger(min, max) { return Math.floor(Math.random() * (max - min + 1) ) + min; } - - var sun_x = getRndInteger(0, 850); + var vw = $(window).width(); + var sun_x = getRndInteger(0, vw - 100); var sun_y = getRndInteger(0, 550); - var shape_x = getRndInteger(-1500, 200); - var shape_y = getRndInteger(0, 500); + var shape_x = getRndInteger(-1500, vw - 200); + var shape_y = getRndInteger(0, 200); $('.picto_sun').css({top:sun_y , left:sun_x,}); diff --git a/templates/base.html b/templates/base.html index f5952e2..058bec0 100644 --- a/templates/base.html +++ b/templates/base.html @@ -26,7 +26,7 @@
- +
{% block content %}