Fix JavaScript syntax errors by escaping emoji Unicode sequences
Replaced literal emoji characters in JavaScript strings with Unicode escape sequences to prevent encoding issues that cause syntax errors. This resolves the "Uncaught SyntaxError: Invalid or unexpected token" error at line 2572. Changes: - ⚠️ (U+26A0 U+FE0F) → \u26A0\uFE0F in confirm() dialogs - 🔌 (U+1F50C) → \uD83D\uDD0C in shutdown alert - 🔄 (U+1F504) → \uD83D\uDD04 in restart alert - Template version updated to 1.9.2 The emojis still display correctly in the browser, but are now safely encoded in the JavaScript source to prevent parsing errors. Fixes: "shutdownSystem is not defined" and "restartSystem is not defined" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -151,7 +151,7 @@ BACKUP_ON_WRITE = BACKUP_CONFIG.get('backup_on_write', True)
|
||||
WEB_PORT = SYS_CONFIG['web']['port']
|
||||
|
||||
# Template version - increment this when HTML template changes
|
||||
TEMPLATE_VERSION = "1.9.1" # Updated: Fixed UTF-8 encoding for JavaScript special characters
|
||||
TEMPLATE_VERSION = "1.9.2" # Updated: Use Unicode escapes for emojis in JavaScript strings
|
||||
|
||||
# Flask app
|
||||
app = Flask(__name__)
|
||||
@@ -2521,7 +2521,7 @@ def main():
|
||||
|
||||
// System Control Functions
|
||||
function shutdownSystem() {
|
||||
if (confirm('⚠️ Are you sure you want to SHUTDOWN the system?\n\nThe Raspberry Pi will power off in 1 minute.')) {
|
||||
if (confirm('\\u26A0\\uFE0F Are you sure you want to SHUTDOWN the system?\\n\\nThe Raspberry Pi will power off in 1 minute.')) {
|
||||
fetch('/api/system/shutdown', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
@@ -2529,7 +2529,7 @@ def main():
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
showAlert('🔌 System shutting down in 1 minute...', 'warning');
|
||||
showAlert('\\uD83D\\uDD0C System shutting down in 1 minute...', 'warning');
|
||||
setTimeout(() => {
|
||||
showAlert('System is now shutting down. This page will be unavailable.', 'error');
|
||||
}, 3000);
|
||||
@@ -2542,7 +2542,7 @@ def main():
|
||||
}
|
||||
|
||||
function restartSystem() {
|
||||
if (confirm('⚠️ Are you sure you want to RESTART the system?\n\nThe Raspberry Pi will reboot shortly.')) {
|
||||
if (confirm('\\u26A0\\uFE0F Are you sure you want to RESTART the system?\\n\\nThe Raspberry Pi will reboot shortly.')) {
|
||||
fetch('/api/system/restart', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
@@ -2550,7 +2550,7 @@ def main():
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
showAlert('🔄 System restarting...', 'warning');
|
||||
showAlert('\\uD83D\\uDD04 System restarting...', 'warning');
|
||||
setTimeout(() => {
|
||||
showAlert('System is rebooting. Page will reload automatically.', 'warning');
|
||||
// Try to reload page after 30 seconds
|
||||
|
||||
Reference in New Issue
Block a user