feat: TurboSu initial release - racing telemetry dashboard
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
const Theme = {
|
||||
_current: 'dark',
|
||||
|
||||
init() {
|
||||
this._current = localStorage.getItem('turbosu-theme') || 'dark';
|
||||
this.apply();
|
||||
},
|
||||
|
||||
toggle() {
|
||||
this._current = this._current === 'dark' ? 'light' : 'dark';
|
||||
this.apply();
|
||||
},
|
||||
|
||||
apply() {
|
||||
document.body.classList.remove('theme-dark', 'theme-light');
|
||||
document.body.classList.add(`theme-${this._current}`);
|
||||
localStorage.setItem('turbosu-theme', this._current);
|
||||
},
|
||||
|
||||
get current() { return this._current; }
|
||||
};
|
||||
|
||||
window.Theme = Theme;
|
||||
@@ -0,0 +1,27 @@
|
||||
const Toast = {
|
||||
_container: null,
|
||||
|
||||
_init() {
|
||||
if (this._container) return;
|
||||
this._container = document.createElement('div');
|
||||
this._container.className = 'toast-container';
|
||||
document.body.appendChild(this._container);
|
||||
},
|
||||
|
||||
show(message, type = 'info', duration = 3000) {
|
||||
this._init();
|
||||
const toast = document.createElement('div');
|
||||
toast.className = `toast ${type}`;
|
||||
toast.textContent = message;
|
||||
this._container.appendChild(toast);
|
||||
|
||||
setTimeout(() => {
|
||||
toast.style.opacity = '0';
|
||||
toast.style.transform = 'translateX(100%)';
|
||||
toast.style.transition = 'all 0.3s ease';
|
||||
setTimeout(() => toast.remove(), 300);
|
||||
}, duration);
|
||||
}
|
||||
};
|
||||
|
||||
window.Toast = Toast;
|
||||
Reference in New Issue
Block a user