feat: Light mode default, auth, Posts rename, display scaling, TinyMCE improvements
This commit is contained in:
+5
-10
@@ -2,7 +2,7 @@
|
||||
|
||||
// === Theme Toggle ===
|
||||
(function () {
|
||||
var saved = localStorage.getItem('sb-theme') || 'dark';
|
||||
var saved = localStorage.getItem('sb-theme') || 'light';
|
||||
document.documentElement.setAttribute('data-theme', saved);
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
@@ -11,7 +11,7 @@
|
||||
var btn = document.getElementById('themeToggle');
|
||||
if (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
var current = document.documentElement.getAttribute('data-theme') || 'dark';
|
||||
var current = document.documentElement.getAttribute('data-theme') || 'light';
|
||||
var next = current === 'dark' ? 'light' : 'dark';
|
||||
document.documentElement.setAttribute('data-theme', next);
|
||||
localStorage.setItem('sb-theme', next);
|
||||
@@ -30,17 +30,12 @@
|
||||
}
|
||||
})();
|
||||
|
||||
// Auto-dismiss alerts after 5 seconds
|
||||
// Auto-dismiss alerts
|
||||
document.querySelectorAll('.alert-dismissible').forEach(function (alert) {
|
||||
setTimeout(function () {
|
||||
var bsAlert = bootstrap.Alert.getOrCreateInstance(alert);
|
||||
bsAlert.close();
|
||||
}, 5000);
|
||||
setTimeout(function () { var bsAlert = bootstrap.Alert.getOrCreateInstance(alert); bsAlert.close(); }, 5000);
|
||||
});
|
||||
|
||||
// Confirm dangerous actions
|
||||
document.querySelectorAll('[data-confirm]').forEach(function (el) {
|
||||
el.addEventListener('click', function (e) {
|
||||
if (!confirm(this.dataset.confirm)) e.preventDefault();
|
||||
});
|
||||
el.addEventListener('click', function (e) { if (!confirm(this.dataset.confirm)) e.preventDefault(); });
|
||||
});
|
||||
|
||||
+16
-1
@@ -3,9 +3,24 @@
|
||||
'use strict';
|
||||
var slug = document.body.dataset.slug;
|
||||
var transition = document.body.dataset.transition || 'fade';
|
||||
var designW = parseInt(document.body.dataset.width) || 1920;
|
||||
var designH = parseInt(document.body.dataset.height) || 1080;
|
||||
var slides = window.playlistData || [];
|
||||
var currentIndex = -1, slideTimer = null, layerA = document.getElementById('slide-a'), layerB = document.getElementById('slide-b'), activeLayer = 'a', pollInterval = 30000, icsCache = {};
|
||||
|
||||
// === Aspect-Ratio Scaling ===
|
||||
function scaleDisplay() {
|
||||
var wrapper = document.getElementById('scale-wrapper');
|
||||
if (!wrapper) return;
|
||||
var winW = window.innerWidth, winH = window.innerHeight;
|
||||
var scaleX = winW / designW, scaleY = winH / designH;
|
||||
var scale = Math.min(scaleX, scaleY);
|
||||
wrapper.style.transform = 'translate(-50%, -50%) scale(' + scale + ')';
|
||||
}
|
||||
scaleDisplay();
|
||||
window.addEventListener('resize', scaleDisplay);
|
||||
|
||||
// === Clock ===
|
||||
function updateClock() {
|
||||
var now = new Date();
|
||||
var timeEl = document.getElementById('clock-time'), dateEl = document.getElementById('clock-date');
|
||||
@@ -111,6 +126,6 @@
|
||||
if (e.key === 'c') { document.body.style.cursor = document.body.style.cursor === 'default' ? 'none' : 'default'; }
|
||||
});
|
||||
|
||||
console.log('[Sunbeam] Display engine starting for "' + slug + '" with ' + slides.length + ' slide(s)');
|
||||
console.log('[Sunbeam] Display engine starting for "' + slug + '" with ' + slides.length + ' slide(s) at ' + designW + 'x' + designH);
|
||||
showNextSlide(); setInterval(pollForUpdates, pollInterval);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user