From: Chris Fulljames Date: Sat, 22 Feb 2025 17:22:02 +0000 (-0500) Subject: Use HTML for AJAX requests instead of XML X-Git-Url: https://littlesong.place/gitweb/gitweb.cgi?a=commitdiff_plain;h=6f87ae22bf5e587f4413f075a8f3b740690cedfe;p=littlesongplace.git Use HTML for AJAX requests instead of XML --- diff --git a/main.py b/main.py index 3aebd3d..0f68565 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,6 @@ from datetime import datetime, timezone from logging.handlers import RotatingFileHandler from pathlib import Path, PosixPath from typing import Optional -from xml.sax.saxutils import escape import bcrypt import bleach @@ -931,12 +930,9 @@ def get_current_user_playlists(): @app.context_processor def inject_global_vars(): - use_xml = request.headers["Accept"] == "application/xml" return dict( gif_data=get_gif_data(), current_user_playlists=get_current_user_playlists(), - use_xml=use_xml, - escape=escape, bgcolor="#e8e6b5", fgcolor="#695c73", accolor="#9373a9", diff --git a/templates/activity.html b/templates/activity.html index 3aa0938..d802b5b 100644 --- a/templates/activity.html +++ b/templates/activity.html @@ -1,4 +1,4 @@ -{% if use_xml %}{% extends "base.xml" %}{% else %}{% extends "base.html" %}{% endif %} +{% extends "base.html" %} {% block title %}Activity{% endblock %} diff --git a/templates/base.html b/templates/base.html index 8e5b282..2f7c97c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -6,36 +6,49 @@ + + + + + {% block head %} {% endblock %} @@ -136,17 +162,12 @@ function updateImageColors() { // Perform a palette swap on all gifs based on current page colors - document.querySelectorAll(".img-data").forEach(e => { document.querySelectorAll(`.${e.id}`).forEach(t => { t.src = customImage(e); }); }); } - - // Update image colors on page load - document.addEventListener("DOMContentLoaded", updateImageColors); -