Files
Hellion-NewTab/src/js/state.js
T
JonKazama-Hellion 6704f4c955 feat(privacy): replace Google Favicons with local letter icons
Remove getFaviconUrl() and all external network requests. Bookmarks now
show a colored letter icon with deterministic hue based on title.
Eliminates privacy leak and Brave Shields compatibility issues.
2026-04-16 20:22:18 +02:00

58 lines
1.4 KiB
JavaScript

/* =============================================
HELLION NEWTAB — state.js
Globaler State, Default-Werte, Hilfsfunktionen
============================================= */
let boards = [];
let settings = {
compact: false,
shortenTitles: false,
newTab: true,
showDesc: false,
hideExtra: false,
visibleCount: 10,
bgUrl: '',
theme: 'nebula',
showSearch: true,
searchEngine: 'google',
toolbarPos: 'right',
imageRefEnabled: false,
language: 'auto'
};
function uid() {
return Math.random().toString(36).slice(2, 10) + Date.now().toString(36);
}
function escHtml(str) {
return String(str)
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
}
function getDefaultBoards() {
return [
{
id: uid(),
title: 'Getting Started',
bookmarks: [
{ id: uid(), title: 'GitHub', url: 'https://github.com', desc: '' },
{ id: uid(), title: 'MDN Web Docs', url: 'https://developer.mozilla.org', desc: '' },
{ id: uid(), title: 'Next.js Docs', url: 'https://nextjs.org/docs', desc: '' },
],
blurred: false
}
];
}
async function saveBoards() {
await Store.set('boards', boards);
}
async function saveSettings() {
await Store.set('settings', settings);
}