[2024-10-12] Adding footer, minor fixes to Python

This commit is contained in:
Andrew Conlin 2024-10-12 10:59:43 +01:00
parent f1c63d0ecf
commit 7356b00de1
3 changed files with 37 additions and 25 deletions

View File

@ -6,9 +6,10 @@ body {
div.content { div.content {
width: 50%; width: 50%;
height: auto; height: 100%;
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
border: 1px solid var(--bg);
} }
@media screen and (max-width: 1440px) { @media screen and (max-width: 1440px) {
@ -45,7 +46,7 @@ progress {
} }
div.left { div.left {
border: 2px solid black; border: 2px solid var(--fg);
width: fit-content; width: fit-content;
height: fit-content; height: fit-content;
padding: 5px; padding: 5px;
@ -55,7 +56,7 @@ div.left {
} }
div.right { div.right {
border: 2px solid black; border: 2px solid var(--fg);
width: fit-content; width: fit-content;
height: fit-content; height: fit-content;
padding: 5px; padding: 5px;
@ -63,3 +64,13 @@ div.right {
margin-left: auto; margin-left: auto;
margin-right: 0; margin-right: 0;
} }
div.footer {
position: absolute;
left: 0;
right: 0;
bottom: 5px;
margin-left: auto;
margin-right: auto;
width: 100%; /* Need a specific value to work */
}

View File

@ -33,8 +33,13 @@
<div class="left"> <div class="left">
🧬 the history of life on Earth, {{ homoSapiens }} 🧬 the history of life on Earth, {{ homoSapiens }}
</div><br> </div><br>
<footer> <br>
</footer> <div class="footer">
<a href="mailto:andrew@andrewconl.in">📨 Suggestions?</a> |
<a href="https://github.com/andrwcnln/year-progress">🧑‍💻 Source</a> |
<a href="https://concrete.style">🎨 Style</a> |
<a href="https://ko-fi.com">☕ Buy me a coffee!</a>
</div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -35,7 +35,6 @@ def cartesianToLatLong(x,y,z):
return lat, long return lat, long
def getPercentageLatLong(yearPercent,lat1,long1,lat2,long2): def getPercentageLatLong(yearPercent,lat1,long1,lat2,long2):
# http://www.geomidpoint.com/calculation.html # http://www.geomidpoint.com/calculation.html
x1, y1, z1 = latLongToCartesian(lat1,long1) x1, y1, z1 = latLongToCartesian(lat1,long1)
@ -127,7 +126,7 @@ def transatlanticFlight(yearPercent):
long2 = -73.780968 long2 = -73.780968
lat, long = getPercentageLatLong(yearPercent,lat1,long1,lat2,long2) lat, long = getPercentageLatLong(yearPercent,lat1,long1,lat2,long2)
return lat, long return round(lat,2), round(long,2)
def getHomoSapiens(yearPercent): def getHomoSapiens(yearPercent):
totalYears = 4.3e9 totalYears = 4.3e9
@ -148,7 +147,7 @@ def getTemplate():
yearPercent = delta/totalDays yearPercent = delta/totalDays
footballMinute = math.floor(yearPercent*90) footballMinute = math.floor(yearPercent*90)
workDay, workTime = workWeek(yearPercent) workDay, workTime = workWeek(yearPercent)
marathonMile = 26.2 - math.floor(yearPercent*26.2) marathonMile = round(26.2 - math.floor(yearPercent*26.2),2)
abbeyRoadSong = abbeyRoad(yearPercent) abbeyRoadSong = abbeyRoad(yearPercent)
hobbitChapter = "having an unexpected party" hobbitChapter = "having an unexpected party"
lat, long = transatlanticFlight(yearPercent) lat, long = transatlanticFlight(yearPercent)
@ -156,9 +155,6 @@ def getTemplate():
return now.year, nowTime, nowDate, round(yearPercent*100,2), footballMinute, workDay, workTime, marathonMile, abbeyRoadSong, hobbitChapter, lat, long, homoSapiens return now.year, nowTime, nowDate, round(yearPercent*100,2), footballMinute, workDay, workTime, marathonMile, abbeyRoadSong, hobbitChapter, lat, long, homoSapiens
# Transatlantic flight
# History of the earth
@app.route("/") @app.route("/")
def index(): def index():
year, nowTime, nowDate, yearPercent, footballMinute, workDay, workTime, marathonMile, abbeyRoadSong, hobbitChapter, lat, long, homoSapiens = getTemplate() year, nowTime, nowDate, yearPercent, footballMinute, workDay, workTime, marathonMile, abbeyRoadSong, hobbitChapter, lat, long, homoSapiens = getTemplate()