From a23b72cf8437b41d772a0ea4ecc029b2447745ec Mon Sep 17 00:00:00 2001 From: Paul <203217+uniquePWD@users.noreply.github.com> Date: Sun, 6 Jul 2025 11:34:49 +0100 Subject: [PATCH] Update base.html Modernised. Needs testing --- data/interfaces/default/base.html | 278 +++++++++++++++++------------- 1 file changed, 159 insertions(+), 119 deletions(-) diff --git a/data/interfaces/default/base.html b/data/interfaces/default/base.html index 9dfa8a9d..92b27f21 100644 --- a/data/interfaces/default/base.html +++ b/data/interfaces/default/base.html @@ -2,142 +2,182 @@ import headphones from headphones import version %> - - - - - + + - - + + + - Headphones - ${title} - - + Headphones - ${title} + + - + + - - - - - - - - ${next.headIncludes()} - - + + + + ${next.headIncludes()} -
-
- % if headphones.CONFIG.CHECK_GITHUB and not headphones.CURRENT_VERSION: -
- You're running an unknown version of Headphones. Update or - Close -
- % elif headphones.CONFIG.CHECK_GITHUB and headphones.CURRENT_VERSION != headphones.LATEST_VERSION and headphones.COMMITS_BEHIND > 0 and headphones.INSTALL_TYPE != 'win': -
- A newer version is available. You're ${headphones.COMMITS_BEHIND} commits behind. Update or Close -
- % endif +
+
-
-
- - - + % if headphones.CONFIG.CHECK_GITHUB and not headphones.CURRENT_VERSION: +
+ You're running an unknown version of Headphones. Update or + Close +
+ % elif headphones.CONFIG.CHECK_GITHUB and headphones.CURRENT_VERSION != headphones.LATEST_VERSION and headphones.COMMITS_BEHIND > 0 and headphones.INSTALL_TYPE != 'win': +
+ A newer version is available. You're ${headphones.COMMITS_BEHIND} commits behind. Update or Close +
+ % endif -
-
+
+
+ + + +
+
-
-
- ${next.headerIncludes()} -
- ${next.body()} -
+
+
+ ${next.headerIncludes()} +
+ ${next.body()} +
-
-
- - Website | - %if headphones.CONFIG.GIT_USER != 'rembo10': - GitHub | - %endif - Help - -
- -
- Version: ${headphones.CURRENT_VERSION} - %if version.HEADPHONES_VERSION != 'master': - (${version.HEADPHONES_VERSION}) - %endif - %if headphones.CONFIG.GIT_BRANCH != 'master': - (${headphones.CONFIG.GIT_BRANCH}) - %endif -
-
- Back to top -
+ + Back to top +
- - - + + + - ${next.javascriptIncludes()} + ${next.javascriptIncludes()} - - + - - + // Modernized event listener for "Check for new version" (delegated) + $('#actions').on('click', '.check-update-btn', function(e) { + e.preventDefault(); // Prevent default link behavior + // Assuming doAjaxCall is defined in common.js or script.js + doAjaxCall('checkGithub', $(this)); + }); + + // Event listener for search type change + $('select[id=search_type]').on('change', function() { + var type = $(this).val(); + try { + window.localStorage.setItem('search_type', type); + } catch (e) { + console.error("Local Storage not available or error accessing it:", e); + } + }); + + // Handle placeholder text for search input (no longer needs onfocus in HTML) + $('#search-input').on('focus', function() { + if (this.value === this.defaultValue) { + this.value = ''; + } + }).on('blur', function() { + if (this.value === '') { + this.value = this.defaultValue; + } + }); + + // "Back to top" functionality + // Show/hide #toTop button based on scroll position + $(window).scroll(function() { + if ($(this).scrollTop() > 100) { // Show after scrolling 100px + $('#toTop').fadeIn(); + } else { + $('#toTop').fadeOut(); + } + }); + + // Smooth scroll to top when button is clicked + $('#toTop').click(function(e) { + e.preventDefault(); + $('html, body').animate({scrollTop : 0}, 800); + return false; + }); + }); +