This commit is contained in:
Zan
2025-03-13 21:08:24 +01:00
parent 42e94bfbf4
commit c14608dd76
64 changed files with 9818 additions and 1 deletions

276
settings/index.css Normal file
View File

@@ -0,0 +1,276 @@
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
width: 400px;
margin: 0;
padding: 0;
color: var(--text-primary);
background-color: var(--background) !important;
font-family: "Montserrat", serif;
font-size: 14px;
}
* {
scrollbar-width: none;
-ms-overflow-style: none;
}
*::-webkit-scrollbar {
display: none;
}
.popup-container {
padding: 16px;
}
.popup-header {
text-align: center;
margin-bottom: 16px;
}
.logo-text {
color: var(--text-primary);
font-size: 20px;
font-weight: 600;
margin: 8px 0;
display: flex;
align-items: center;
justify-content: center;
}
.logo {
width: 20px;
border-radius: 6px;
margin-right: 8px;
}
.settings-card,
.about-card,
.support-card {
background: var(--card-card);
border-radius: 16px;
padding: 16px;
margin-bottom: 16px;
box-shadow: 0px 1px var(--shadow-blur) 0px var(--accent-shadow);
}
h2 {
font-size: 16px;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 12px;
background-color: var(--card-card);
}
.settings-group {
display: flex;
flex-direction: column;
gap: 16px;
}
.setting-section {
display: flex;
flex-direction: column;
gap: 12px;
}
.setting-header {
display: flex;
align-items: center;
gap: 8px;
color: var(--text-primary);
font-weight: 500;
}
.theme-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
}
.theme-option {
background: none;
border: none;
padding: 0;
cursor: pointer;
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
transition: transform 0.2s ease;
}
.theme-option:hover {
transform: translateY(-2px);
}
.theme-option.active .theme-preview {
outline: 2px solid var(--accent-accent);
outline-offset: 2px;
}
.theme-preview {
width: 100%;
height: 100px;
border-radius: 8px;
overflow: hidden;
position: relative;
}
.theme-option.disabled {
opacity: 0.5;
cursor: not-allowed;
position: relative;
}
.theme-option.disabled::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
.theme-preview.light-blue {
background: #DAE4F7;
}
.theme-preview.light-blue .preview-header {
background: #EDF3FF;
}
.theme-preview.light-blue .preview-card {
background: #FBFCFF;
}
.theme-preview.light-green {
background: #FAFFF0;
}
.theme-preview.light-green .preview-header {
background: #F3FBDE;
}
.theme-preview.light-green .preview-card {
background: #FEFFFD;
}
.theme-preview.dark-blue {
background: #070A0E;
}
.theme-preview.dark-blue .preview-header {
background: #0F131B;
}
.theme-preview.dark-blue .preview-card {
background: #131822;
}
.theme-preview.dark-green {
background: #0D1202;
}
.theme-preview.dark-green .preview-header {
background: #141905;
}
.theme-preview.dark-green .preview-card {
background: #20290b;
}
.preview-header {
height: 30%;
width: 100%;
}
.preview-content {
padding: 8px;
}
.preview-card {
height: 30px;
border-radius: 4px;
}
.theme-name {
color: var(--text-primary);
font-size: 12px;
font-weight: 500;
}
.about-content,
.support-content {
color: var(--text-secondary);
font-size: 14px;
line-height: 1.5;
}
.about-content p,
.support-content p {
margin-bottom: 12px;
}
.github-link {
display: inline-flex;
align-items: center;
gap: 6px;
color: var(--accent-accent);
text-decoration: none;
font-weight: 500;
transition: color 0.2s;
}
.github-link:hover {
color: var(--accent-secondary);
}
.support-buttons {
display: flex;
gap: 8px;
margin-top: 12px;
}
.support-button {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
padding: 8px;
background: var(--accent-15);
color: var(--text-primary);
text-decoration: none;
border-radius: 8px;
font-weight: 500;
transition: all 0.2s;
}
.support-button:hover {
background: var(--accent-accent);
color: var(--button-secondaryFill);
}
.popup-footer {
text-align: center;
margin-top: 16px;
}
.version-info {
color: var(--text-secondary);
font-size: 12px;
}
.material-icons-round {
font-size: 18px;
vertical-align: middle;
}

103
settings/index.html Normal file
View File

@@ -0,0 +1,103 @@
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Firxa Beállítások</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons+Round" rel="stylesheet">
<link rel="stylesheet" href="index.css">
<link rel="stylesheet" href="../global/theme.css">
</head>
<body>
<div class="popup-container">
<header class="popup-header">
<p class="logo-text">
<img src="https://i.imgur.com/WugwlzI.png" alt="Firka" class="logo">
Firxa
</p>
</header>
<div class="settings-card">
<h2>Beállítások</h2>
<div class="settings-group">
<div class="setting-section">
<div class="setting-header">
<span class="material-icons-round">palette</span>
Téma
</div>
<div class="theme-grid">
<button class="theme-option" data-theme="default">
<div class="theme-preview light-blue">
<div class="preview-header"></div>
<div class="preview-content">
<div class="preview-card"></div>
</div>
</div>
<span class="theme-name">Világos Kék</span>
</button>
<button class="theme-option" data-theme="light-green">
<div class="theme-preview light-green">
<div class="preview-header"></div>
<div class="preview-content">
<div class="preview-card"></div>
</div>
</div>
<span class="theme-name">Világos Zöld</span>
</button>
<button class="theme-option" data-theme="dark-blue">
<div class="theme-preview dark-blue">
<div class="preview-header"></div>
<div class="preview-content">
<div class="preview-card"></div>
</div>
</div>
<span class="theme-name">Sötét Kék</span>
</button>
<button class="theme-option" data-theme="dark-green">
<div class="theme-preview dark-green">
<div class="preview-header"></div>
<div class="preview-content">
<div class="preview-card"></div>
</div>
</div>
<span class="theme-name">Sötét Zöld</span>
</button>
</div>
</div>
</div>
</div>
<div class="about-card">
<h2>Névjegy</h2>
<div class="about-content">
<p>A Firka egy nyílt forráskódú projekt, amely a KRÉTA rendszerhez készít saját felhasználói felületet.</p>
<a href="https://github.com/QwIT-Development/" target="_blank" class="github-link">
<span class="material-icons-round">code</span>
GitHub
</a>
</div>
</div>
<div class="support-card">
<h2>Támogatás</h2>
<div class="support-content">
<p>Ha tetszik a munkánk és szeretnéd támogatni a fejlesztést, az alábbi módon teheted meg:</p>
<div class="support-buttons">
<a href="https://ko-fi.com/zan1456" target="_blank" class="support-button">
<span class="material-icons-round">coffee</span>
Ko-Fi
</a>
</div>
</div>
</div>
<footer class="popup-footer">
<div class="version-info" id="version">v1.1.0</div>
</footer>
</div>
<script src="index.js"></script>
</body>
</html>

141
settings/index.js Normal file
View File

@@ -0,0 +1,141 @@
document.addEventListener('DOMContentLoaded', async () => {
function getCookie(name) {
const cookieName = `${name}=`;
const decodedCookie = decodeURIComponent(document.cookie);
const cookieArray = decodedCookie.split(';');
for(let i = 0; i < cookieArray.length; i++) {
let cookie = cookieArray[i];
while (cookie.charAt(0) === ' ') {
cookie = cookie.substring(1);
}
if (cookie.indexOf(cookieName) === 0) {
return cookie.substring(cookieName.length, cookie.length);
}
}
return null;
}
function setCookie(name, value, days = 365) {
const date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
const expires = `expires=${date.toUTCString()}`;
document.cookie = `${name}=${value}; ${expires}; path=/; domain=.e-kreta.hu`;
}
async function getCurrentTheme() {
try {
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
const response = await chrome.tabs.sendMessage(tab.id, { action: 'getTheme' });
return response.theme;
} catch (error) {
console.error('Error getting current theme:', error);
return 'default';
}
}
function updateThemeButtons(currentTheme) {
document.querySelectorAll('.theme-option').forEach(button => {
const theme = button.dataset.theme;
button.classList.toggle('active', theme === currentTheme);
/*if (theme === 'light-blue' || theme === 'dark-blue' || theme === 'default') {
button.classList.add('disabled');
button.setAttribute('disabled', 'true');
}*/
});
}
function isThemeDisabled(theme) {
return theme === 'default' || theme === 'dark-blue';
}
async function applyTheme(theme) {
if (isThemeDisabled(theme)) {
alert('Ez a téma jelenleg nem elérhető.');
return;
}
setCookie('themePreference', theme);
localStorage.setItem('themePreference', theme);
document.documentElement.setAttribute('data-theme', theme);
updateThemeButtons(theme);
const tabs = await chrome.tabs.query({});
tabs.forEach(tab => {
chrome.tabs.sendMessage(tab.id, {
action: 'changeTheme',
theme: theme
}).catch(() => {
console.log('Tab not ready for theme change:', tab.id);
});
});
}
const themeButtons = document.querySelectorAll('.theme-option');
themeButtons.forEach(button => {
button.addEventListener('click', () => {
const theme = button.dataset.theme;
if (button.hasAttribute('disabled')) {
alert('Ez a téma jelenleg nem elérhető.');
return;
}
applyTheme(theme);
});
});
let initialTheme = localStorage.getItem('themePreference') ||
getCookie('themePreference') ||
await getCurrentTheme() ||
'light-green';
if (isThemeDisabled(initialTheme)) {
initialTheme = 'light-green';
}
await applyTheme(initialTheme);
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.action === 'themeChanged') {
updateThemeButtons(message.theme);
document.documentElement.setAttribute('data-theme', message.theme);
}
});
const manifest = chrome.runtime.getManifest();
document.getElementById('version').textContent = `v${manifest.version}`;
themeButtons.forEach(button => {
button.addEventListener('mouseover', () => {
if (!button.hasAttribute('disabled')) {
button.style.transform = 'translateY(-2px)';
}
});
button.addEventListener('mouseout', () => {
button.style.transform = 'translateY(0)';
});
});
});