mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 11:44:40 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 51c265400c | |||
| 6209b65afe | |||
| bb388ab000 | |||
| f1512ba6e1 | |||
| 13fc077686 | |||
| 7cf765121c | |||
| 4e393f14bb | |||
| 98347e038d | |||
| f2bdb22ea8 | |||
| 4afab2c52a | |||
| 4c6b43d7c7 |
+3
-1
@@ -11,7 +11,6 @@ yarn.lock
|
|||||||
|
|
||||||
# Build
|
# Build
|
||||||
extension.zip
|
extension.zip
|
||||||
build/
|
|
||||||
dist/
|
dist/
|
||||||
betterseqtaplus-safari/
|
betterseqtaplus-safari/
|
||||||
|
|
||||||
@@ -19,3 +18,6 @@ betterseqtaplus-safari/
|
|||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
**/.DS_Store
|
**/.DS_Store
|
||||||
|
|
||||||
|
# Electron
|
||||||
|
electron-dist/
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
- Easier Access Notices
|
- Easier Access Notices
|
||||||
- Assessments
|
- Assessments
|
||||||
- Options to remove certain items from the side menu
|
- Options to remove certain items from the side menu
|
||||||
|
- Grades calculator
|
||||||
- Fully customisable themes and an offical theme store
|
- Fully customisable themes and an offical theme store
|
||||||
- Notification for next lesson (sent 5 minutes before end of the lesson)
|
- Notification for next lesson (sent 5 minutes before end of the lesson)
|
||||||
- Browser Support
|
- Browser Support
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
@@ -0,0 +1,162 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>BetterSEQTA Settings</title>
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--background-primary: #ffffff;
|
||||||
|
--background-secondary: #e5e7eb;
|
||||||
|
--text-primary: black;
|
||||||
|
--theme-primary: #4F46E5;
|
||||||
|
--theme-hover: #4338CA;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--background-primary: #232323;
|
||||||
|
--background-secondary: #1a1a1a;
|
||||||
|
--text-primary: white;
|
||||||
|
--theme-primary: #6366F1;
|
||||||
|
--theme-hover: #818CF8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: var(--background-primary);
|
||||||
|
color: var(--text-primary);
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
color: #666;
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="url"] {
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
border: 1px solid var(--background-secondary);
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
background: var(--background-secondary);
|
||||||
|
color: var(--text-primary);
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="url"]:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--theme-primary);
|
||||||
|
box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin-top: 1rem;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.75rem;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--theme-primary);
|
||||||
|
color: white;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
background: var(--theme-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
#error-message {
|
||||||
|
color: #EF4444;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1>BetterSEQTA Settings</h1>
|
||||||
|
<div class="subtitle">It's time to get started! To begin type in your school's SEQTA URL below.</div>
|
||||||
|
<label for="seqtaUrl">SEQTA Website URL</label>
|
||||||
|
<input type="url" id="seqtaUrl" placeholder="Enter your school's SEQTA URL (e.g https://seqta.school.edu.au)" required>
|
||||||
|
<div id="error-message"></div>
|
||||||
|
<button onclick="saveSettings()">Save Settings</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const electron = window.require('electron');
|
||||||
|
const { ipcRenderer } = electron;
|
||||||
|
const Store = window.require('electron-store');
|
||||||
|
const store = new Store();
|
||||||
|
|
||||||
|
// Load saved URL on page load
|
||||||
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const savedUrl = store.get('seqtaUrl') || '';
|
||||||
|
document.getElementById('seqtaUrl').value = savedUrl;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle error messages from main process
|
||||||
|
ipcRenderer.on('seqta-url-error', (event, message) => {
|
||||||
|
const errorElement = document.getElementById('error-message');
|
||||||
|
errorElement.textContent = message;
|
||||||
|
errorElement.style.display = 'block';
|
||||||
|
});
|
||||||
|
|
||||||
|
// Save settings
|
||||||
|
function saveSettings() {
|
||||||
|
const url = document.getElementById('seqtaUrl').value;
|
||||||
|
const errorElement = document.getElementById('error-message');
|
||||||
|
errorElement.style.display = 'none';
|
||||||
|
|
||||||
|
if (url) {
|
||||||
|
ipcRenderer.send('set-seqta-url', url);
|
||||||
|
} else {
|
||||||
|
errorElement.textContent = 'Please enter a URL';
|
||||||
|
errorElement.style.display = 'block';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle enter key
|
||||||
|
document.getElementById('seqtaUrl').addEventListener('keypress', (e) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,333 @@
|
|||||||
|
import { app, BrowserWindow, ipcMain, session, Menu } from 'electron';
|
||||||
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import Store from 'electron-store';
|
||||||
|
|
||||||
|
// Fix for __dirname in ES modules
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
const store = new Store();
|
||||||
|
let mainWindow = null;
|
||||||
|
let settingsWindow = null;
|
||||||
|
|
||||||
|
// CSS to inject
|
||||||
|
const customCSS = `
|
||||||
|
#alertBar {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Match SEQTA's styling */
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
// Create the application menu
|
||||||
|
function createAppMenu() {
|
||||||
|
const isMac = process.platform === 'darwin';
|
||||||
|
const template = [
|
||||||
|
...(isMac ? [{
|
||||||
|
label: app.name,
|
||||||
|
submenu: [
|
||||||
|
{ role: 'about' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'services' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'hide' },
|
||||||
|
{ role: 'hideOthers' },
|
||||||
|
{ role: 'unhide' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'quit' }
|
||||||
|
]
|
||||||
|
}] : []),
|
||||||
|
{
|
||||||
|
label: 'Settings',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Configure SEQTA URL',
|
||||||
|
accelerator: isMac ? 'Cmd+,' : 'Ctrl+,',
|
||||||
|
click: () => {
|
||||||
|
createSettingsWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'View',
|
||||||
|
submenu: [
|
||||||
|
{ role: 'reload' },
|
||||||
|
{ role: 'forceReload' },
|
||||||
|
{ role: 'toggleDevTools' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'resetZoom' },
|
||||||
|
{ role: 'zoomIn' },
|
||||||
|
{ role: 'zoomOut' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'togglefullscreen' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const menu = Menu.buildFromTemplate(template);
|
||||||
|
Menu.setApplicationMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate SEQTA URL
|
||||||
|
function isValidSeqtaUrl(url) {
|
||||||
|
try {
|
||||||
|
const urlObj = new URL(url);
|
||||||
|
// Only ensure it's a valid HTTPS URL
|
||||||
|
return urlObj.protocol === 'https:';
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the correct path for the extension based on whether we're in development or production
|
||||||
|
function getExtensionPath() {
|
||||||
|
if (app.isPackaged) {
|
||||||
|
// In production, the extension is in the resources directory
|
||||||
|
return path.join(process.resourcesPath, 'chrome-extension');
|
||||||
|
} else {
|
||||||
|
// In development, the extension is in the dist directory
|
||||||
|
return path.join(__dirname, '..', 'dist', 'chrome');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the Chrome extension
|
||||||
|
async function loadExtension() {
|
||||||
|
try {
|
||||||
|
const extensionPath = getExtensionPath();
|
||||||
|
console.log('Loading extension from:', extensionPath);
|
||||||
|
|
||||||
|
await session.defaultSession.loadExtension(extensionPath, {
|
||||||
|
allowFileAccess: true
|
||||||
|
});
|
||||||
|
console.log('Extension loaded successfully!');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to load extension:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createMainWindow() {
|
||||||
|
console.log('🚀 Creating main window...');
|
||||||
|
if (mainWindow) {
|
||||||
|
if (!mainWindow.isDestroyed()) {
|
||||||
|
console.log('✨ Existing window found, focusing it');
|
||||||
|
mainWindow.focus();
|
||||||
|
return mainWindow;
|
||||||
|
}
|
||||||
|
console.log('🔄 Old window was destroyed, creating new one');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('📦 Initializing new BrowserWindow');
|
||||||
|
mainWindow = new BrowserWindow({
|
||||||
|
width: 1200,
|
||||||
|
height: 800,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false,
|
||||||
|
backgroundThrottling: false,
|
||||||
|
enableWebSQL: false,
|
||||||
|
webgl: false,
|
||||||
|
offscreen: false
|
||||||
|
},
|
||||||
|
show: false,
|
||||||
|
backgroundColor: '#ffffff'
|
||||||
|
});
|
||||||
|
|
||||||
|
const seqtaUrl = store.get('seqtaUrl');
|
||||||
|
console.log('📍 Stored SEQTA URL:', seqtaUrl);
|
||||||
|
|
||||||
|
// Register keyboard shortcut for settings
|
||||||
|
mainWindow.webContents.on('before-input-event', (event, input) => {
|
||||||
|
if ((input.meta || input.control) && input.key === ',') {
|
||||||
|
createSettingsWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Inject CSS when the page loads
|
||||||
|
mainWindow.webContents.on('did-finish-load', () => {
|
||||||
|
console.log('🎨 Page loaded, injecting CSS');
|
||||||
|
mainWindow.webContents.insertCSS(customCSS).catch(err => {
|
||||||
|
console.error('Failed to inject CSS:', err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Only show window when it's ready
|
||||||
|
mainWindow.once('ready-to-show', () => {
|
||||||
|
console.log('🎉 Window ready to show!');
|
||||||
|
mainWindow.show();
|
||||||
|
mainWindow.focus();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (seqtaUrl) {
|
||||||
|
if (!isValidSeqtaUrl(seqtaUrl)) {
|
||||||
|
console.error('❌ Invalid SEQTA URL stored:', seqtaUrl);
|
||||||
|
createSettingsWindow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('🌐 Loading SEQTA URL:', seqtaUrl);
|
||||||
|
mainWindow.loadURL(seqtaUrl)
|
||||||
|
.then(() => {
|
||||||
|
console.log('✅ Successfully loaded SEQTA URL');
|
||||||
|
mainWindow.show();
|
||||||
|
mainWindow.focus();
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error('❌ Failed to load SEQTA URL:', err);
|
||||||
|
createSettingsWindow();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('⚙️ No SEQTA URL found, opening settings');
|
||||||
|
createSettingsWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createSettingsWindow() {
|
||||||
|
if (settingsWindow) {
|
||||||
|
settingsWindow.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
settingsWindow = new BrowserWindow({
|
||||||
|
width: 600,
|
||||||
|
height: 400,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false,
|
||||||
|
},
|
||||||
|
show: false,
|
||||||
|
backgroundColor: '#ffffff'
|
||||||
|
});
|
||||||
|
|
||||||
|
const settingsPath = path.join(__dirname, 'index.html');
|
||||||
|
settingsWindow.loadFile(settingsPath);
|
||||||
|
|
||||||
|
settingsWindow.once('ready-to-show', () => {
|
||||||
|
settingsWindow.show();
|
||||||
|
settingsWindow.focus();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Only enable DevTools in development
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
settingsWindow.webContents.openDevTools();
|
||||||
|
}
|
||||||
|
|
||||||
|
settingsWindow.on('closed', () => {
|
||||||
|
settingsWindow = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Performance optimization: Disable hardware acceleration if running on low-end device
|
||||||
|
if (process.platform !== 'darwin') { // Skip for macOS
|
||||||
|
app.disableHardwareAcceleration();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Performance optimization: Disable smooth scrolling
|
||||||
|
app.commandLine.appendSwitch('disable-smooth-scrolling');
|
||||||
|
|
||||||
|
// Wait for app to be ready before creating windows
|
||||||
|
app.whenReady().then(async () => {
|
||||||
|
createAppMenu();
|
||||||
|
await loadExtension();
|
||||||
|
createMainWindow();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Performance optimization: Quit immediately instead of gracefully
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
app.quit();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('activate', () => {
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
|
createMainWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Format and validate SEQTA URL
|
||||||
|
function formatAndValidateUrl(url) {
|
||||||
|
// Remove any whitespace
|
||||||
|
url = url.trim();
|
||||||
|
|
||||||
|
// If no protocol specified, add https://
|
||||||
|
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
||||||
|
url = 'https://' + url;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it's http://, upgrade to https://
|
||||||
|
if (url.startsWith('http://')) {
|
||||||
|
url = 'https://' + url.slice(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const urlObj = new URL(url);
|
||||||
|
// Ensure it's https
|
||||||
|
if (urlObj.protocol !== 'https:') {
|
||||||
|
throw new Error('URL must use HTTPS');
|
||||||
|
}
|
||||||
|
return { isValid: true, url: url };
|
||||||
|
} catch (error) {
|
||||||
|
return { isValid: false, url: url, error: error.message };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle setting the SEQTA URL
|
||||||
|
ipcMain.on('set-seqta-url', (event, url) => {
|
||||||
|
console.log('🔧 Received new SEQTA URL:', url);
|
||||||
|
|
||||||
|
const { isValid, url: formattedUrl, error } = formatAndValidateUrl(url);
|
||||||
|
|
||||||
|
if (!isValid) {
|
||||||
|
console.error('❌ Invalid URL format:', error);
|
||||||
|
event.reply('seqta-url-error', 'Please enter a valid URL');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('💾 Saving URL to store:', formattedUrl);
|
||||||
|
store.set('seqtaUrl', formattedUrl);
|
||||||
|
|
||||||
|
// Create main window if it doesn't exist
|
||||||
|
if (!mainWindow || mainWindow.isDestroyed()) {
|
||||||
|
console.log('🆕 Creating new main window');
|
||||||
|
createMainWindow();
|
||||||
|
} else {
|
||||||
|
console.log('🔄 Loading new URL in existing window:', formattedUrl);
|
||||||
|
mainWindow.loadURL(formattedUrl).then(() => {
|
||||||
|
console.log('✅ URL loaded successfully');
|
||||||
|
|
||||||
|
console.log('🎨 Injecting CSS and settings button');
|
||||||
|
mainWindow.webContents.insertCSS(customCSS).catch(err => {
|
||||||
|
console.error('Failed to inject CSS:', err);
|
||||||
|
});
|
||||||
|
|
||||||
|
mainWindow.webContents.executeJavaScript(`
|
||||||
|
if (!document.getElementById('bsp-settings-button')) {
|
||||||
|
document.body.insertAdjacentHTML('beforeend', ${JSON.stringify(settingsButtonHTML)});
|
||||||
|
document.getElementById('bsp-settings-button').addEventListener('click', () => {
|
||||||
|
window.postMessage('open-settings', '*');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
`).catch(err => {
|
||||||
|
console.error('Failed to inject settings button:', err);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('👀 Showing and focusing window');
|
||||||
|
mainWindow.show();
|
||||||
|
mainWindow.focus();
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('❌ Failed to load SEQTA URL:', err);
|
||||||
|
event.reply('seqta-url-error', 'Failed to load SEQTA. Please check your connection and URL.');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close settings window if it exists
|
||||||
|
if (settingsWindow && !settingsWindow.isDestroyed()) {
|
||||||
|
console.log('🚪 Closing settings window');
|
||||||
|
settingsWindow.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
+53
-2
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "betterseqtaplus",
|
"name": "betterseqtaplus",
|
||||||
"version": "3.4.1",
|
"version": "3.4.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development, while incorporating a plethora of new and improved features!",
|
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development, while incorporating a plethora of new and improved features!",
|
||||||
|
"main": "electron/main.js",
|
||||||
"browserslist": "> 0.5%, last 2 versions, not dead",
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env MODE=chrome vite dev",
|
"dev": "cross-env MODE=chrome vite dev",
|
||||||
@@ -14,7 +15,11 @@
|
|||||||
"convert:safari": "xcrun safari-web-extension-converter dist/safari --project-location . --app-name $npm_package_name-safari",
|
"convert:safari": "xcrun safari-web-extension-converter dist/safari --project-location . --app-name $npm_package_name-safari",
|
||||||
"release": "gh release create $npm_package_name@$npm_package_version ./dist/*.zip --generate-notes",
|
"release": "gh release create $npm_package_name@$npm_package_version ./dist/*.zip --generate-notes",
|
||||||
"publish": "bun lib/publish.js --b",
|
"publish": "bun lib/publish.js --b",
|
||||||
"zip": "bedframe zip"
|
"zip": "bedframe zip",
|
||||||
|
"electron-dev": "electron .",
|
||||||
|
"electron-build": "electron-builder",
|
||||||
|
"electron-pack": "npm run build:chrome && electron-builder --dir",
|
||||||
|
"electron-dist": "npm run build:chrome && electron-builder"
|
||||||
},
|
},
|
||||||
"targets": {
|
"targets": {
|
||||||
"prod": {
|
"prod": {
|
||||||
@@ -37,6 +42,8 @@
|
|||||||
"@types/mime-types": "^2.1.4",
|
"@types/mime-types": "^2.1.4",
|
||||||
"@vitejs/plugin-react-swc": "^3.7.0",
|
"@vitejs/plugin-react-swc": "^3.7.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
|
"electron": "^33.2.1",
|
||||||
|
"electron-builder": "^25.1.8",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"glob": "^11.0.0",
|
"glob": "^11.0.0",
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "^2.1.35",
|
||||||
@@ -74,6 +81,7 @@
|
|||||||
"codemirror": "^6.0.1",
|
"codemirror": "^6.0.1",
|
||||||
"color": "^4.2.3",
|
"color": "^4.2.3",
|
||||||
"dompurify": "^3.1.6",
|
"dompurify": "^3.1.6",
|
||||||
|
"electron-store": "^10.0.0",
|
||||||
"embla-carousel-autoplay": "^8.3.1",
|
"embla-carousel-autoplay": "^8.3.1",
|
||||||
"embla-carousel-svelte": "^8.3.1",
|
"embla-carousel-svelte": "^8.3.1",
|
||||||
"fuse.js": "^7.0.0",
|
"fuse.js": "^7.0.0",
|
||||||
@@ -95,5 +103,48 @@
|
|||||||
"uuid": "^9.0.1",
|
"uuid": "^9.0.1",
|
||||||
"vite": "^5.4.4",
|
"vite": "^5.4.4",
|
||||||
"webextension-polyfill": "^0.10.0"
|
"webextension-polyfill": "^0.10.0"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"appId": "com.betterseqta.app",
|
||||||
|
"productName": "BetterSEQTA",
|
||||||
|
"directories": {
|
||||||
|
"output": "electron-dist",
|
||||||
|
"buildResources": "build"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist/**/*",
|
||||||
|
"electron/**/*",
|
||||||
|
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}",
|
||||||
|
"!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}",
|
||||||
|
"!**/node_modules/*.d.ts",
|
||||||
|
"!**/node_modules/.bin",
|
||||||
|
"!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}",
|
||||||
|
"!.editorconfig",
|
||||||
|
"!**/._*",
|
||||||
|
"!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}",
|
||||||
|
"!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}",
|
||||||
|
"!**/{appveyor.yml,.travis.yml,circle.yml}",
|
||||||
|
"!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}"
|
||||||
|
],
|
||||||
|
"extraResources": [
|
||||||
|
{
|
||||||
|
"from": "dist/chrome",
|
||||||
|
"to": "chrome-extension",
|
||||||
|
"filter": ["**/*"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"mac": {
|
||||||
|
"category": "public.app-category.education",
|
||||||
|
"target": ["dmg", "zip"],
|
||||||
|
"icon": "build/icon.icns"
|
||||||
|
},
|
||||||
|
"win": {
|
||||||
|
"target": "nsis",
|
||||||
|
"icon": "build/icon.ico"
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"target": "AppImage",
|
||||||
|
"icon": "build/icon.png"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-1
@@ -76,6 +76,10 @@ async function init() {
|
|||||||
if (settingsState.onoff) {
|
if (settingsState.onoff) {
|
||||||
enableCurrentTheme()
|
enableCurrentTheme()
|
||||||
|
|
||||||
|
if (typeof settingsState.assessmentsAverage == 'undefined') {
|
||||||
|
settingsState.assessmentsAverage = true
|
||||||
|
}
|
||||||
|
|
||||||
// TEMP FIX for bug! -> this is a hack to get the injected.css file to have HMR in development mode as this import system is currently broken with crxjs
|
// TEMP FIX for bug! -> this is a hack to get the injected.css file to have HMR in development mode as this import system is currently broken with crxjs
|
||||||
if (import.meta.env.MODE === 'development') {
|
if (import.meta.env.MODE === 'development') {
|
||||||
import('./css/injected.scss')
|
import('./css/injected.scss')
|
||||||
@@ -161,6 +165,10 @@ export function OpenWhatsNewPopup() {
|
|||||||
/* html */ `
|
/* html */ `
|
||||||
<div class="whatsnewTextContainer" style="height: 50%;overflow-y: scroll;">
|
<div class="whatsnewTextContainer" style="height: 50%;overflow-y: scroll;">
|
||||||
|
|
||||||
|
<h1>3.4.2 - Minor Bug Fixes</h1>
|
||||||
|
<li>Fixed a bug where Assessment Average wasn't enabled by default</li>
|
||||||
|
<li>Fixed floating menus would sometimes be placed behind other elements</li>
|
||||||
|
|
||||||
<h1>3.4.1 - Bug Fixes and Performance Improvements</h1>
|
<h1>3.4.1 - Bug Fixes and Performance Improvements</h1>
|
||||||
<li>Added a new "Subject Average" section to the assessments page</li>
|
<li>Added a new "Subject Average" section to the assessments page</li>
|
||||||
<li>Fixed a bug where animations wouldn't play correctly</li>
|
<li>Fixed a bug where animations wouldn't play correctly</li>
|
||||||
@@ -1011,9 +1019,11 @@ export async function ObserveMenuItemPosition() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
async function main() {
|
||||||
if (typeof settingsState.onoff === 'undefined') {
|
if (typeof settingsState.onoff === 'undefined') {
|
||||||
browser.runtime.sendMessage({ type: 'setDefaultStorage' })
|
browser.runtime.sendMessage({ type: 'setDefaultStorage' })
|
||||||
|
|
||||||
|
await delay(10)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDisabled = () => {
|
const handleDisabled = () => {
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ const DefaultValues: SettingsState = {
|
|||||||
originalSelectedColor: '',
|
originalSelectedColor: '',
|
||||||
DarkMode: true,
|
DarkMode: true,
|
||||||
animations: true,
|
animations: true,
|
||||||
|
assessmentsAverage: true,
|
||||||
defaultPage: 'home',
|
defaultPage: 'home',
|
||||||
shortcuts: [
|
shortcuts: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1933,6 +1933,7 @@ div.bar.flat {
|
|||||||
transition: background-color 0.5s ease-in-out;
|
transition: background-color 0.5s ease-in-out;
|
||||||
background-color: rgba(0, 0, 0, 0);
|
background-color: rgba(0, 0, 0, 0);
|
||||||
transition-duration: 500ms !important;
|
transition-duration: 500ms !important;
|
||||||
|
z-index: 22 !important;
|
||||||
}
|
}
|
||||||
.uiSlidePane.shown > .pane {
|
.uiSlidePane.shown > .pane {
|
||||||
transform: translatey(0%) !important;
|
transform: translatey(0%) !important;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "BetterSEQTA+",
|
"name": "BetterSEQTA+",
|
||||||
"version": "3.4.1",
|
"version": "3.4.2",
|
||||||
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development add add heaps more features!",
|
"description": "Enhance SEQTA Learn's usability and aesthetics! A fork of BetterSEQTA to continue development add add heaps more features!",
|
||||||
"icons": {
|
"icons": {
|
||||||
"32": "resources/icons/icon-32.png",
|
"32": "resources/icons/icon-32.png",
|
||||||
|
|||||||
@@ -6,21 +6,59 @@ import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
|||||||
import { updateAllColors } from "./colors/Manager";
|
import { updateAllColors } from "./colors/Manager";
|
||||||
import { delay } from "@/seqta/utils/delay";
|
import { delay } from "@/seqta/utils/delay";
|
||||||
|
|
||||||
|
let cachedUserInfo: any = null;
|
||||||
|
|
||||||
|
async function getUserInfo() {
|
||||||
|
if (cachedUserInfo) return cachedUserInfo;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${location.origin}/seqta/student/login`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
mode: 'normal',
|
||||||
|
query: null,
|
||||||
|
redirect_url: location.origin,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
const responseData = await response.json();
|
||||||
|
cachedUserInfo = responseData.payload;
|
||||||
|
return cachedUserInfo;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching user info:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function AddBetterSEQTAElements() {
|
export async function AddBetterSEQTAElements() {
|
||||||
if (settingsState.onoff) {
|
if (settingsState.onoff) {
|
||||||
initializeSettings();
|
initializeSettings();
|
||||||
if (settingsState.DarkMode) {
|
if (settingsState.DarkMode) {
|
||||||
document.documentElement.classList.add('dark');
|
document.documentElement.classList.add('dark');
|
||||||
}
|
}
|
||||||
createHomeButton();
|
|
||||||
|
const fragment = document.createDocumentFragment();
|
||||||
|
const menu = document.getElementById('menu')!;
|
||||||
|
const menuList = menu.firstChild as HTMLElement;
|
||||||
|
|
||||||
|
createHomeButton(fragment, menuList);
|
||||||
|
createNewsButton(fragment, menu);
|
||||||
|
|
||||||
|
menuList.insertBefore(fragment, menuList.firstChild);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await appendBackgroundToUI();
|
await Promise.all([
|
||||||
|
appendBackgroundToUI(),
|
||||||
|
handleUserInfo(),
|
||||||
|
handleStudentData()
|
||||||
|
]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error appending background to UI:', error);
|
console.error('Error initializing UI elements:', error);
|
||||||
}
|
}
|
||||||
await handleUserInfo();
|
|
||||||
handleStudentData();
|
|
||||||
createNewsButton();
|
|
||||||
setupEventListeners();
|
setupEventListeners();
|
||||||
await addDarkLightToggle();
|
await addDarkLightToggle();
|
||||||
customizeMenuToggle();
|
customizeMenuToggle();
|
||||||
@@ -28,7 +66,6 @@ export async function AddBetterSEQTAElements() {
|
|||||||
|
|
||||||
addExtensionSettings();
|
addExtensionSettings();
|
||||||
await createSettingsButton();
|
await createSettingsButton();
|
||||||
|
|
||||||
setupSettingsButton();
|
setupSettingsButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,18 +74,15 @@ function initializeSettings() {
|
|||||||
updateBgDurations();
|
updateBgDurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
function createHomeButton() {
|
function createHomeButton(fragment: DocumentFragment, menuList: HTMLElement) {
|
||||||
const container = document.getElementById('content')!;
|
const container = document.getElementById('content')!;
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.classList.add('titlebar');
|
div.classList.add('titlebar');
|
||||||
container.append(div);
|
container.append(div);
|
||||||
|
|
||||||
const NewButton = stringToHTML('<li class="item" data-key="home" id="homebutton" data-path="/home" data-betterseqta="true"><label><svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z" /></svg><span>Home</span></label></li>');
|
const NewButton = stringToHTML('<li class="item" data-key="home" id="homebutton" data-path="/home" data-betterseqta="true"><label><svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z" /></svg><span>Home</span></label></li>');
|
||||||
const menu = document.getElementById('menu')!;
|
|
||||||
const List = menu.firstChild! as HTMLElement;
|
|
||||||
|
|
||||||
if (NewButton.firstChild) {
|
if (NewButton.firstChild) {
|
||||||
List.insertBefore(NewButton.firstChild, List.firstChild);
|
fragment.appendChild(NewButton.firstChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,28 +159,6 @@ async function handleStudentData() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getUserInfo() {
|
|
||||||
try {
|
|
||||||
const response = await fetch(`${location.origin}/seqta/student/login`, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
mode: 'normal',
|
|
||||||
query: null,
|
|
||||||
redirect_url: location.origin,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
const responseData = await response.json();
|
|
||||||
return responseData.payload;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching user info:', error);
|
|
||||||
throw error; // Rethrow the error after logging it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function updateStudentInfo(students: any) {
|
async function updateStudentInfo(students: any) {
|
||||||
const info = await getUserInfo();
|
const info = await getUserInfo();
|
||||||
var index = students.findIndex(function (person: any) {
|
var index = students.findIndex(function (person: any) {
|
||||||
@@ -179,41 +191,42 @@ async function updateStudentInfo(students: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNewsButton() {
|
function createNewsButton(fragment: DocumentFragment, menu: HTMLElement) {
|
||||||
const NewsButtonStr = '<li class="item" data-key="news" id="newsbutton" data-path="/news" data-betterseqta="true"><label><svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M20 3H4C2.89 3 2 3.89 2 5V19C2 20.11 2.89 21 4 21H20C21.11 21 22 20.11 22 19V5C22 3.89 21.11 3 20 3M5 7H10V13H5V7M19 17H5V15H19V17M19 13H12V11H19V13M19 9H12V7H19V9Z" /></svg><span>News</span></label></li>';
|
const NewsButtonStr = '<li class="item" data-key="news" id="newsbutton" data-path="/news" data-betterseqta="true"><label><svg style="width:24px;height:24px" viewBox="0 0 24 24"><path fill="currentColor" d="M20 3H4C2.89 3 2 3.89 2 5V19C2 20.11 2.89 21 4 21H20C21.11 21 22 20.11 22 19V5C22 3.89 21.11 3 20 3M5 7H10V13H5V7M19 17H5V15H19V17M19 13H12V11H19V13M19 9H12V7H19V9Z" /></svg><span>News</span></label></li>';
|
||||||
const NewsButton = stringToHTML(NewsButtonStr);
|
const NewsButton = stringToHTML(NewsButtonStr);
|
||||||
const menu = document.getElementById('menu')!;
|
|
||||||
const List = menu.firstChild! as HTMLElement;
|
|
||||||
|
|
||||||
List!.appendChild(NewsButton.firstChild!);
|
if (NewsButton.firstChild) {
|
||||||
|
fragment.appendChild(NewsButton.firstChild);
|
||||||
|
}
|
||||||
|
|
||||||
let a = document.createElement('div');
|
let iconCover = document.createElement('div');
|
||||||
a.classList.add('icon-cover');
|
iconCover.classList.add('icon-cover');
|
||||||
a.id = 'icon-cover';
|
iconCover.id = 'icon-cover';
|
||||||
menu!.appendChild(a);
|
menu.appendChild(iconCover);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupEventListeners() {
|
function setupEventListeners() {
|
||||||
const menuCover = document.querySelector('#icon-cover');
|
const menuCover = document.querySelector('#icon-cover');
|
||||||
menuCover!.addEventListener('click', function () {
|
|
||||||
location.href = '../#?page=/home';
|
|
||||||
loadHomePage();
|
|
||||||
(document!.getElementById('menu')!.firstChild! as HTMLElement).classList.remove('noscroll');
|
|
||||||
});
|
|
||||||
|
|
||||||
const homebutton = document.getElementById('homebutton');
|
const homebutton = document.getElementById('homebutton');
|
||||||
homebutton!.addEventListener('click', function () {
|
const newsbutton = document.getElementById('newsbutton');
|
||||||
if (!homebutton?.classList.contains('draggable') && !homebutton?.classList.contains('active')) {
|
|
||||||
|
homebutton?.addEventListener('click', function() {
|
||||||
|
if (!homebutton.classList.contains('draggable') && !homebutton.classList.contains('active')) {
|
||||||
loadHomePage();
|
loadHomePage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const newsbutton = document.getElementById('newsbutton');
|
newsbutton?.addEventListener('click', function() {
|
||||||
newsbutton!.addEventListener('click', function () {
|
if (!newsbutton.classList.contains('draggable') && !newsbutton.classList.contains('active')) {
|
||||||
if (!newsbutton?.classList.contains('draggable') && !newsbutton?.classList.contains('active')) {
|
|
||||||
SendNewsPage();
|
SendNewsPage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
menuCover?.addEventListener('click', function() {
|
||||||
|
location.href = '../#?page=/home';
|
||||||
|
loadHomePage();
|
||||||
|
(document.getElementById('menu')!.firstChild! as HTMLElement).classList.remove('noscroll');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createSettingsButton() {
|
async function createSettingsButton() {
|
||||||
|
|||||||
Reference in New Issue
Block a user