pwpush update
This commit is contained in:
121
web/base.html
121
web/base.html
@@ -6,6 +6,61 @@
|
||||
<title>{{block "title" .}}HeaderAnalyzer{{end}}</title>
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon">
|
||||
<style>
|
||||
/* Popup notification styles */
|
||||
.popup-notification {
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
z-index: 10000;
|
||||
background: #f44336;
|
||||
color: white;
|
||||
padding: 15px 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
|
||||
max-width: 400px;
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
transform: translateX(100%);
|
||||
transition: transform 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.popup-notification.show {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
.popup-notification.error {
|
||||
background: #f44336;
|
||||
}
|
||||
|
||||
.popup-notification.warning {
|
||||
background: #ff9800;
|
||||
}
|
||||
|
||||
.popup-notification.success {
|
||||
background: #4caf50;
|
||||
}
|
||||
|
||||
.popup-notification.info {
|
||||
background: #2196f3;
|
||||
}
|
||||
|
||||
.popup-notification .close-btn {
|
||||
float: right;
|
||||
background: none;
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
margin-left: 10px;
|
||||
padding: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.popup-notification .close-btn:hover {
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
{{block "head" .}}{{end}}
|
||||
</head>
|
||||
<body>
|
||||
@@ -25,6 +80,72 @@
|
||||
{{end}}
|
||||
</main>
|
||||
|
||||
<!-- Popup notification container -->
|
||||
<div id="popup-container"></div>
|
||||
|
||||
<script>
|
||||
// Popup notification system
|
||||
function showPopup(message, type = 'error', duration = 5000) {
|
||||
const container = document.getElementById('popup-container');
|
||||
const popup = document.createElement('div');
|
||||
popup.className = `popup-notification ${type}`;
|
||||
popup.innerHTML = `
|
||||
<button class="close-btn" onclick="this.parentElement.remove()">×</button>
|
||||
${message}
|
||||
`;
|
||||
|
||||
container.appendChild(popup);
|
||||
|
||||
// Trigger animation
|
||||
setTimeout(() => popup.classList.add('show'), 10);
|
||||
|
||||
// Auto-remove after duration
|
||||
if (duration > 0) {
|
||||
setTimeout(() => {
|
||||
popup.classList.remove('show');
|
||||
setTimeout(() => popup.remove(), 300);
|
||||
}, duration);
|
||||
}
|
||||
}
|
||||
|
||||
// Show popup from URL parameters (for redirects)
|
||||
function checkForErrorParams() {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const error = urlParams.get('error');
|
||||
const warning = urlParams.get('warning');
|
||||
const success = urlParams.get('success');
|
||||
const info = urlParams.get('info');
|
||||
|
||||
if (error) {
|
||||
showPopup(decodeURIComponent(error), 'error');
|
||||
// Clean URL
|
||||
urlParams.delete('error');
|
||||
window.history.replaceState({}, '', `${window.location.pathname}${urlParams.toString() ? '?' + urlParams.toString() : ''}`);
|
||||
}
|
||||
|
||||
if (warning) {
|
||||
showPopup(decodeURIComponent(warning), 'warning');
|
||||
urlParams.delete('warning');
|
||||
window.history.replaceState({}, '', `${window.location.pathname}${urlParams.toString() ? '?' + urlParams.toString() : ''}`);
|
||||
}
|
||||
|
||||
if (success) {
|
||||
showPopup(decodeURIComponent(success), 'success');
|
||||
urlParams.delete('success');
|
||||
window.history.replaceState({}, '', `${window.location.pathname}${urlParams.toString() ? '?' + urlParams.toString() : ''}`);
|
||||
}
|
||||
|
||||
if (info) {
|
||||
showPopup(decodeURIComponent(info), 'info');
|
||||
urlParams.delete('info');
|
||||
window.history.replaceState({}, '', `${window.location.pathname}${urlParams.toString() ? '?' + urlParams.toString() : ''}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for error parameters when page loads
|
||||
document.addEventListener('DOMContentLoaded', checkForErrorParams);
|
||||
</script>
|
||||
|
||||
{{block "scripts" .}}{{end}}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user