Update base.html

Modernised. Needs testing
This commit is contained in:
Paul
2025-07-06 11:34:49 +01:00
committed by GitHub
parent 62757c0fcf
commit a23b72cf84

View File

@@ -2,142 +2,182 @@
import headphones
from headphones import version
%>
<!doctype html>
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Headphones - ${title}</title>
<meta name="description" content="Headphones 'default' interface - made by Elmar Kouwenhoven">
<meta name="author" content="Elmar Kouwenhoven">
<title>Headphones - ${title}</title>
<meta name="description" content="Headphones 'default' interface - made by Elmar Kouwenhoven">
<meta name="author" content="Elmar Kouwenhoven">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/headphoneslogo.png">
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/headphoneslogo.png">
<link rel="stylesheet" href="css/jquery-ui.min.css">
<link rel="stylesheet" href="interfaces/default/css/style.css">
<link rel="stylesheet" href="interfaces/default/css/font-awesome.min.css">
${next.headIncludes()}
<script src="js/libs/modernizr-2.8.3.min.js"></script>
<link rel="stylesheet" href="css/jquery-ui.min.css">
<link rel="stylesheet" href="interfaces/default/css/style.css">
<link rel="stylesheet" href="interfaces/default/css/font-awesome.min.css">
${next.headIncludes()}
</head>
<body>
<div id="container">
<div id="ajaxMsg" class="ajaxMsg"></div>
% if headphones.CONFIG.CHECK_GITHUB and not headphones.CURRENT_VERSION:
<div id="updatebar">
You're running an unknown version of Headphones. <a href="update">Update</a> or
<a href="javascript:void(0)" onclick="$('#updatebar').slideUp('slow');">Close</a>
</div>
% elif headphones.CONFIG.CHECK_GITHUB and headphones.CURRENT_VERSION != headphones.LATEST_VERSION and headphones.COMMITS_BEHIND > 0 and headphones.INSTALL_TYPE != 'win':
<div id="updatebar">
A <a href="https://github.com/${headphones.CONFIG.GIT_USER}/headphones/compare/${headphones.CURRENT_VERSION}...${headphones.LATEST_VERSION}"> newer version</a> is available. You're ${headphones.COMMITS_BEHIND} commits behind. <a href="update">Update</a> or <a href="javascript:void(0)" onclick="$('#updatebar').slideUp('slow');">Close</a>
</div>
% endif
<div id="container">
<div id="ajaxMsg" class="ajaxMsg"></div>
<header>
<div class="wrapper">
<div id="logo">
<a href="home"><img src="images/headphoneslogo.png" alt="headphones" width="64"></a>
</div>
<ul id="nav">
<li><a href="upcoming">wanted</a></li>
<li><a href="extras">extras</a></li>
<li><a href="manage">manage</a></li>
<li><a href="history">history</a></li>
<li><a href="logs">logs</a></li>
<li><a href="config" class="config"><i class="fa fa-gear fa-lg"></i></a></li>
</ul>
<div id="searchbar">
<form action="search" method="get">
<input type="text" value="" placeholder="Search" onfocus="if(this.value==this.defaultValue) this.value='';" name="name" />
<i class='fa fa-search mini-icon'></i>
<select name="type" id="search_type">
<option value="artist">Artist</option>
<option value="album">Album</option>
<option value="series">Series</option>
</select>
<input type="submit" value="Search"/>
</form>
</div>
% if headphones.CONFIG.CHECK_GITHUB and not headphones.CURRENT_VERSION:
<div id="updatebar">
You're running an unknown version of Headphones. <a href="update">Update</a> or
<a href="#" class="close-updatebar">Close</a>
</div>
% elif headphones.CONFIG.CHECK_GITHUB and headphones.CURRENT_VERSION != headphones.LATEST_VERSION and headphones.COMMITS_BEHIND > 0 and headphones.INSTALL_TYPE != 'win':
<div id="updatebar">
A <a href="https://github.com/${headphones.CONFIG.GIT_USER}/headphones/compare/${headphones.CURRENT_VERSION}...${headphones.LATEST_VERSION}"> newer version</a> is available. You're ${headphones.COMMITS_BEHIND} commits behind. <a href="update">Update</a> or <a href="#" class="close-updatebar">Close</a>
</div>
% endif
</div>
</header>
<header>
<div class="wrapper">
<div id="logo">
<a href="home"><img src="images/headphoneslogo.png" alt="headphones" width="64"></a>
</div>
<nav id="nav">
<ul>
<li><a href="upcoming">wanted</a></li>
<li><a href="extras">extras</a></li>
<li><a href="manage">manage</a></li>
<li><a href="history">history</a></li>
<li><a href="logs">logs</a></li>
<li><a href="config" class="config" aria-label="Configuration"><i class="fa fa-gear fa-lg"></i></a></li>
</ul>
</nav>
<div id="searchbar">
<form action="search" method="get">
<input type="text" value="" placeholder="Search" name="name" id="search-input" />
<i class='fa fa-search mini-icon'></i>
<select name="type" id="search_type">
<option value="artist">Artist</option>
<option value="album">Album</option>
<option value="series">Series</option>
</select>
<button type="submit">Search</button>
</form>
</div>
</div>
</header>
<div id="main" class="main">
<div id="subhead">
${next.headerIncludes()}
</div>
${next.body()}
</div>
<main id="main" class="main">
<div id="subhead">
${next.headerIncludes()}
</div>
${next.body()}
</main>
<footer>
<div id="info">
<small>
<a href="https://github.com/rembo10/headphones"><i class="fa fa-headphones"></i> Website</a> |
%if headphones.CONFIG.GIT_USER != 'rembo10':
<a href="https://github.com/${headphones.CONFIG.GIT_USER}/headphones" title="Open this fork on github"><i class="fa fa-github"></i> GitHub</a> |
%endif
<a href="https://github.com/rembo10/headphones/wiki/TroubleShooting"><i class="fa fa-ambulance"></i> Help</a>
</small>
</div>
<div id="actions">
<small>
<a href="shutdown"><i class="fa fa-power-off"></i> Shutdown</a> |
<a href="restart"><i class="fa fa-power-off"></i> Restart</a> |
<a href="javascript:void(0)" onclick="doAjaxCall('checkGithub',$(this))" data-success="Checking for update successful" data-error="Error checking for update"><i class="fa fa-refresh"></i> Check for new version</a>
</small>
</div>
<div id="version">
Version: <em>${headphones.CURRENT_VERSION}</em>
%if version.HEADPHONES_VERSION != 'master':
(${version.HEADPHONES_VERSION})
%endif
%if headphones.CONFIG.GIT_BRANCH != 'master':
(${headphones.CONFIG.GIT_BRANCH})
%endif
</div>
</footer>
<a href="#main" id="toTop"><i class="fa fa-angle-double-up"></i> <span>Back to top</span></a>
</div>
<footer>
<div id="info">
<small>
<a href="https://github.com/rembo10/headphones"><i class="fa fa-headphones"></i> Website</a> |
%if headphones.CONFIG.GIT_USER != 'rembo10':
<a href="https://github.com/${headphones.CONFIG.GIT_USER}/headphones" title="Open this fork on github"><i class="fa fa-github"></i> GitHub</a> |
%endif
<a href="https://github.com/rembo10/headphones/wiki/TroubleShooting"><i class="fa fa-ambulance"></i> Help</a>
</small>
</div>
<div id="actions">
<small>
<a href="shutdown"><i class="fa fa-power-off"></i> Shutdown</a> |
<a href="restart"><i class="fa fa-power-off"></i> Restart</a> |
<a href="#" class="check-update-btn" data-success="Checking for update successful" data-error="Error checking for update"><i class="fa fa-refresh"></i> Check for new version</a>
</small>
</div>
<div id="version">
Version: <em>${headphones.CURRENT_VERSION}</em>
%if version.HEADPHONES_VERSION != 'master':
(${version.HEADPHONES_VERSION})
%endif
%if headphones.CONFIG.GIT_BRANCH != 'master':
(${headphones.CONFIG.GIT_BRANCH})
%endif
</div>
</footer>
<a href="#main" id="toTop" aria-label="Back to top"><i class="fa fa-angle-double-up"></i> <span>Back to top</span></a>
</div>
<script src="js/libs/jquery-1.11.1.min.js"></script>
<script src="js/libs/jquery-ui.min.js"></script>
<script src="js/common.js"></script>
<script src="js/libs/jquery-3.7.1.min.js"></script>
<script src="js/libs/jquery-ui.min.js"></script>
<script src="js/common.js"></script>
${next.javascriptIncludes()}
${next.javascriptIncludes()}
<script src="interfaces/default/js/script.js"></script>
<!-- This template is made by Elmar Kouwenhoven -->
<script src="interfaces/default/js/script.js"></script>
<!-- Persist search type using local storage -->
<script type="text/javascript">
<script type="text/javascript">
$(document).ready(function() {
// Focus on the first form input that's not hidden
$('form:first *:input[type!=hidden]:first').focus();
$(document).ready(function() {
$('form:first *:input[type!=hidden]:first').focus();
try{
var type = window.localStorage.getItem('search_type') || "artist";
$("#search_type").val(type);
} catch(e) {
}
});
// Persist search type using local storage
try {
var type = window.localStorage.getItem('search_type') || "artist";
$("#search_type").val(type);
} catch (e) {
console.error("Local Storage not available or error accessing it:", e);
}
$('select[id=search_type]').change(function() {
var type = $(this).val()
try{
window.localStorage.setItem('search_type', type);
} catch(e) {
}
});
// Modernized event listener for closing update bar (delegated)
// Uses event delegation for robustness: attaches handler to parent (#container)
// which listens for clicks on elements with class .close-updatebar
$('#container').on('click', '.close-updatebar', function(e) {
e.preventDefault(); // Prevent default link behavior
$(this).closest('#updatebar').slideUp('slow');
});
</script>
// 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;
});
});
</script>
</body>
</html>