Template refactor, task update

Banter no longer fails if AI offline. Refactoring of templates.
This commit is contained in:
2024-02-18 23:33:09 +01:00
parent c7bd7fda9b
commit fcf31cb896
14 changed files with 90 additions and 46 deletions
+5 -14
View File
@@ -1,17 +1,10 @@
{% load static %}
<html>
<head>
{% load static %}
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="{% static 'js/htmx.min.js' %}" defer></script>
<script src="https://unpkg.com/interactjs"></script>
<link rel="stylesheet" href="https://unpkg.com/98.css" >
<link href="{% static 'style.css'%}" rel="stylesheet" type="text/css" />
<script src="https://open.spotify.com/embed/iframe-api/v1" async></script>
{% include "head.html" %}
</head>
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}' style="background:#01817F;">
<div class="window">
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
<div class="window" id="main-window">
<div class="title-bar">
<div class="title-bar-text">
{% block window-title %}{% endblock %}
@@ -42,14 +35,12 @@
</div>
{% block clippy %}{% endblock %}
<script>
position = { x: 0, y: 0 }
position.get_pos(); // Gets position from localStorage
interact('.title-bar').draggable({
listeners: {
move (event) {
position.x += event.dx
position.y += event.dy
event.target.parentElement.style.transform =
`translate(${position.x}px, ${position.y}px)`
},
+2 -1
View File
@@ -1,4 +1,5 @@
{% load static %}
{% if body %}
<script>
function closeclippy(e) {
console.log(e)
@@ -14,4 +15,4 @@
<img src="{% static img %}" />
{% endif %}
</div>
{% endif %}
+39
View File
@@ -0,0 +1,39 @@
{% load static %}
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="{% static 'js/htmx.min.js' %}" defer></script>
<script src="https://unpkg.com/interactjs"></script>
<link rel="stylesheet" href="https://unpkg.com/98.css" >
<link href="{% static 'style.css'%}" rel="stylesheet" type="text/css" />
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'apple-touch-icon.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'favicon-16x16.png' %}">
<link rel="manifest" href="/site.webmanifest">
<script src="https://open.spotify.com/embed/iframe-api/v1" async></script>
<title>HD Muzak: {{ request.path }}</title>
<script>
//Global position object for cross-page window positioning
position = {
set x(val) {
this._x = val
localStorage.setItem("position", JSON.stringify({x: val, y: this._y}));
},
set y(val) {
this._y = val
localStorage.setItem("position", JSON.stringify({x: this._x, y: val}));
},
get x() { return this._x },
get y() { return this._y },
_x: 0, _y: 0,
get_pos() {
stored_position = JSON.parse(localStorage.getItem("position"));
if (stored_position != null) {
position.x = stored_position.x
position.y = stored_position.y
document.getElementById("main-window").style.transform =
`translate(${position.x}px, ${position.y}px)`
} else {
localStorage.removeItem("position")
}
},
}
</script>