chore: merge contributor guides, tidy util folders and helpers

This commit is contained in:
Jones Jankovic committed 2026-11-02 13:38:37 +10:30
1 parent 4708004ae3
commit 009aae49e3
78 files changed
+156 -964

No files matched your search

+1 -1
View File
@@ -46,7 +46,7 @@ body:
attributes:
label: Have you read our guides?
options:
- label: "Getting Started Guide (see docs/GETTING_STARTED_CONTRIBUTING.md)"
- label: "Contributing guide (see CONTRIBUTING.md)"
required: true
- label: "Architecture Guide (see docs/ARCHITECTURE.md)"
required: true
+48 -53
View File
@@ -1,72 +1,67 @@
# Contributing to BetterSEQTA+
Hey there! 👋 Thanks for your interest in contributing to BetterSEQTA+! We're excited to have you join our community of contributors.
Thanks for helping out! For anything bigger than a small fix, open an issue or ask in [Discord](https://discord.gg/YzmbnCDkat) first so we can agree on the approach.
## 🚀 New Contributors Start Here!
## Setup
**Never contributed to an open source project before?** No worries! We've made it super easy to get started:
You need Node.js 26+, Git and a Chromium browser (Chrome, Edge or Brave).
- **📖 Read our [contributing guide](https://docs.betterseqta.org/contributing/)** - This walks you through everything step-by-step, from setting up your development environment to making your first pull request.
- **🏗️ Understand the codebase** with the [architecture guide](https://docs.betterseqta.org/architecture/)
- **🔧 Having issues?** Check the [troubleshooting guide](https://docs.betterseqta.org/troubleshooting/)
```bash
git clone https://github.com/YOUR_USERNAME/BetterSEQTA-Plus.git
cd BetterSEQTA-Plus
npm install
npm run dev
```
We have lots of [`good first issue`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/good%20first%20issue) labels that are perfect for beginners!
Then load the extension:
## Discussion Before Contributing
1. Open `chrome://extensions` and turn on Developer mode.
2. Click **Load unpacked** and pick the `dist/chrome` folder.
3. Open a SEQTA Learn page.
For significant changes, please first discuss what you'd like to change via:
- Opening an issue
- Joining our Discord server
- Emailing the maintainers
For Firefox, run `npm run dev:firefox` and load `dist/firefox` from `about:debugging`.
This helps ensure your contribution aligns with the project's goals and saves you time!
## Project layout
## Community
| Path | What's in it |
|------|--------------|
| `src/SEQTA.ts` | Content script entry point |
| `src/background.ts`, `src/background/` | Service worker |
| `src/seqta/` | Everything injected into SEQTA pages |
| `src/interface/` | Settings popup and theme store (Svelte) |
| `src/plugins/` | Plugin system and built-in plugins |
| `src/css/` | Injected styles and the shared Tailwind setup |
| `lib/`, `scripts/` | Vite plugins and build scripts |
Join our community channels to discuss the project, get help, and connect with other contributors:
[ARCHITECTURE.md](docs/ARCHITECTURE.md) goes into more detail.
- **Discord Server**: [Join our Discord](https://discord.gg/YzmbnCDkat)
- **GitHub Discussions**: For longer-form conversations
- **GitHub Issues**: For bug reports and feature requests
## Making changes
## Creating Plugins
1. Branch from `main`, e.g. `git checkout -b fix/timetable-colours`.
2. Keep each PR to one change and match the style of the surrounding code.
3. Add tests for logic changes.
4. Before opening the PR, check everything passes:
If you're interested in creating plugins for BetterSEQTA+, check out our plugin development guides:
```bash
npm run lint
npm test
npm run build
```
5. Use short conventional commit messages: `feat:`, `fix:`, `chore:`, `docs:`.
6. Open the PR and fill in the template.
## Issues
Search [existing issues](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) before opening a new one, and use the issue forms. [`good first issue`](https://github.com/BetterSEQTA/BetterSEQTA-Plus/labels/good%20first%20issue) and [`help wanted`](https://github.com/BetterSEQTA/BetterSEQTA-Plus/labels/help%20wanted) are good places to start. Issues aren't assigned, so just open a PR when you have a fix.
## Plugins
- [Plugin development](https://docs.betterseqta.org/plugin-development/)
- [Plugin API](https://docs.betterseqta.org/plugin-api/)
## Pull Request Process
## More docs
1. It is recommended to start by opening an issue to discuss the change you wish to make. This will allow us to discuss the change and ensure it is a good fit for the project.
2. Fork the repo and create your branch from `main`.
3. When writing your pull request, make sure to use the pull request template.
### Pull Request Template
```
## Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
## Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
```
### Issues
#### Create a new issue
If you spot a problem with the readme or code, [search if an issue already exists](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues). If a related issue doesn't exist, you can open a new issue using a relevant [issue form](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues/new).
#### Solve an issue
Scan through our [existing issues](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) to find one that interests you. You can narrow down the search using `labels` as filters. As a general rule, we don’t assign issues to anyone. If you find an issue to work on, you are welcome to open a PR with a fix.
- [Troubleshooting](docs/TROUBLESHOOTING.md)
- [Releases and CI](docs/RELEASES.md)
- [Theme creation](docs/THEME_CREATION.md)
-287
View File
@@ -1,287 +0,0 @@
# Getting Started as a Contributor
**Published version:** [docs.betterseqta.org/contributing/](https://docs.betterseqta.org/contributing/)
Welcome to BetterSEQTA+! 🎉 This guide will walk you through making your first contribution, even if you're completely new to the project.
## Table of Contents
- [Before You Start](#before-you-start)
- [Your First 30 Minutes](#your-first-30-minutes)
- [Making Your First Contribution](#making-your-first-contribution)
- [Types of Contributions](#types-of-contributions)
- [Finding Something to Work On](#finding-something-to-work-on)
- [Development Workflow](#development-workflow)
- [Getting Help](#getting-help)
## Before You Start
### What You'll Need
- **Node.js** (v26 or higher) - [Download here](https://nodejs.org/)
- **Git** - [Download here](https://git-scm.com/)
- **A code editor** - We recommend [VS Code](https://code.visualstudio.com/)
- **A Chromium browser** (Chrome, Edge, Brave) for testing (recommended, however you can use firefox although it requires being built every time you make a change)
### Helpful Background (but not required!)
- Basic JavaScript/TypeScript knowledge
- Some familiarity with HTML/CSS
- Understanding of browser extensions (we'll teach you!)
**Don't worry if you're missing some of these!** We're happy to help you learn. 🤗
## Your First 30 Minutes
Let's get you up and running quickly:
### 1. Get the Code (3 minutes)
```bash
# Fork the repository on GitHub first, then:
git clone https://github.com/YOUR_USERNAME/BetterSEQTA-plus.git
cd BetterSEQTA-plus
```
### 2. Install Dependencies (3 minutes)
```bash
npm install
```
### 3. Start Development Server (2 minutes)
```bash
npm run dev
```
### 4. Load Extension in Browser (4 minutes)
1. Open Chrome and go to `chrome://extensions`
2. Enable "Developer mode" (toggle in top right)
3. Click "Load unpacked"
4. Select the `dist` folder in your project
5. Visit a SEQTA Learn page to see BetterSEQTA+ in action!
### 5. Make a Tiny Change (5 minutes)
Let's prove everything works:
1. Open `src/SEQTA.ts`
2. Find the line that says `"[BetterSEQTA+] Successfully initialised"`
3. Change it to `"[BetterSEQTA+] Successfully initialised - Hello [YOUR_NAME]!"`
4. Save the file
5. Go to `chrome://extensions`, click the refresh icon on BetterSEQTA+
6. Refresh a SEQTA page and check the browser console (F12) - you should see your message!
### 6. Reset Your Change (3 minutes)
```bash
git checkout -- src/SEQTA.ts
```
**Congratulations! 🎉 You've successfully set up BetterSEQTA+ for development!**
## Making Your First Contribution
### Easy First Contributions
Here are some great starter contributions:
1. **Fix a typo in documentation** - Super easy and always appreciated!
2. **Improve error messages** - Make them more helpful
3. **Add comments to code** - Help other contributors understand
4. **Create a simple plugin** - Follow our plugin guide
5. **Fix a bug you found** - If you found a bug, fix it!
### Step-by-Step: Your First Pull Request
#### Step 1: Pick an Issue
- Go to our [Issues page](https://github.com/BetterSEQTA/BetterSEQTA-plus/issues)
- Look for labels like:
- `good first issue` - Perfect for beginners
- `help wanted` - We'd love help with these
- `documentation` - Improve our docs
- `bug` - Fix something broken
#### Step 2: Claim the Issue
Comment on the issue saying "I'd like to work on this!" We'll assign it to you.
#### Step 3: Create a Branch
```bash
git checkout -b fix-issue-123 # Replace 123 with the issue number
```
#### Step 4: Make Your Changes
- Follow the patterns you see in existing code
- Test your changes thoroughly
- Keep changes focused and small
#### Step 5: Test Everything
```bash
# Test the extension still loads
npm run dev
# Test in browser
# 1. Reload extension at chrome://extensions
# 2. Visit SEQTA page
# 3. Verify everything still works
```
#### Step 6: Commit Your Changes
```bash
git add .
git commit -m "Fix issue #123: Brief description of what you fixed"
```
#### Step 7: Push and Create Pull Request
```bash
git push origin fix-issue-123
```
Then go to GitHub and create a pull request with:
- **Clear title**: "Fix issue #123: Brief description"
- **Description**: Explain what you changed and why
- **Testing**: Describe how you tested it
## Types of Contributions
### 🐛 Bug Fixes
- Fix broken features
- Improve error handling
- Resolve compatibility issues
**Example**: "The theme selector doesn't work on Firefox"
### ✨ New Features
- Add new plugins
- Enhance existing functionality
- Improve user experience
**Example**: "Add keyboard shortcuts for common actions"
### 📚 Documentation
- Fix typos and unclear explanations
- Add examples and tutorials
- Improve code comments
**Example**: "Add more examples to the plugin guide"
### 🎨 Design & UI
- Improve the settings interface
- Make things more user-friendly
- Add animations and polish
**Example**: "Make the theme creator more intuitive"
### 🔧 Technical Improvements
- Refactor code for clarity
- Add tests
- Improve performance
**Example**: "Simplify the plugin loading logic"
## Finding Something to Work On
### Browse Issues by Label
- [`good first issue`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/good%20first%20issue) - Perfect for beginners
- [`help wanted`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/help%20wanted) - We need help with these
- [`documentation`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/documentation) - Improve our docs
- [`bug`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/bug) - Fix something broken
- [`enhancement`](https://github.com/BetterSEQTA/BetterSEQTA-plus/labels/enhancement) - Add new features
### Create Your Own Issue
Found a bug or have an idea? Create an issue first to discuss it!
### Plugin Ideas
Want to create a plugin? Here are some ideas:
- **Study Timer**: Track study time across SEQTA pages
- **Grade Tracker**: Better visualization of grades over time
- **Quick Notes**: Add notes to any SEQTA page
- **Homework Reminder**: Smart notifications for upcoming due dates
- **Custom Shortcuts**: User-defined keyboard shortcuts
## Development Workflow
### Daily Development
```bash
# Start working
git pull origin main
npm run dev
# Make changes, test, commit
git add .
git commit -m "Descriptive commit message"
# Push when ready
git push origin your-branch-name
```
### Before Submitting PR
1. **Test thoroughly** - Make sure nothing breaks
2. **Check console** - No new errors
3. **Test in different browsers** - Chrome and Firefox
4. **Update documentation** - If you changed how something works
### Code Style
- Use TypeScript where possible
- Follow existing naming conventions
- Add comments for complex logic
- Keep functions small and focused
## Getting Help
### Stuck? Here's How to Get Unstuck
1. **Check the docs** - The [architecture guide](https://docs.betterseqta.org/architecture/) explains everything
2. **Search existing issues** - Someone might have had the same problem
3. **Ask in Discord** - Our community is super helpful
4. **Create an issue** - If you found a bug or need help
### Discord Community
Join our [Discord server](https://discord.gg/YzmbnCDkat) for:
- Real-time help and discussion
- Collaboration on features
- Sharing ideas and feedback
- Getting to know the community
### Code Review Process
- All contributions need code review
- We'll provide helpful feedback
- Don't worry about making mistakes - we're here to help!
- Reviews usually happen within 24-48 hours
## Common Questions
**Q: I'm new to browser extensions. Is this too advanced for me?**
A: Not at all! We have lots of beginner-friendly issues, and our plugin system makes it easy to add features without understanding all the browser extension complexities.
**Q: How long does it take to get my first PR merged?**
A: For simple fixes, usually 1-3 days. For larger features, it might take a week or two as we discuss the best approach.
**Q: I made a mistake in my PR. What do I do?**
A: No worries! Just push more commits to the same branch and they'll be added to your PR automatically.
**Q: Can I work on multiple issues at once?**
A: It's better to focus on one issue at a time, especially when starting out. This makes code review easier and reduces conflicts.
**Q: What if I start working on something and get stuck?**
A: Ask for help! Create a draft PR with what you have so far, and we'll help you figure out the next steps.
## Recognition
All contributors get:
- Recognition in our README
- Contributor badge in Discord
- Our eternal gratitude! 🙏
Significant contributors may also get:
- Special Discord roles
- Input on project direction
- Maintainer status
## Next Steps
Ready to contribute? Here's what to do:
1. ✅ **Set up your development environment** (follow the 30-minute guide above)
2. 🔍 **Find an issue to work on** (check the "good first issue" label)
3. 💬 **Join our Discord** and introduce yourself
4. 🚀 **Make your first contribution** and submit a PR
Remember: **Every expert was once a beginner!** We're excited to help you learn and grow as a contributor. Welcome to the team! 🎉
---
*Questions? Suggestions for improving this guide? Open an issue or message us on Discord!*
-290
View File
@@ -1,290 +0,0 @@
# Contributing to BetterSEQTA+
**Published version:** [docs.betterseqta.org/contributing/](https://docs.betterseqta.org/contributing/)
Thank you for your interest in contributing to BetterSEQTA+! This document provides guidelines and instructions for contributing to the project.
## Table of Contents
- [Code of Conduct](#code-of-conduct)
- [Getting Started](#getting-started)
- [Setting Up Your Development Environment](#setting-up-your-development-environment)
- [Project Structure](#project-structure)
- [Contributing Code](#contributing-code)
- [Branching Strategy](#branching-strategy)
- [Pull Request Process](#pull-request-process)
- [Coding Standards](#coding-standards)
- [Reporting Bugs](#reporting-bugs)
- [Suggesting Features](#suggesting-features)
- [Writing Documentation](#writing-documentation)
- [Community](#community)
## Code of Conduct
BetterSEQTA+ is committed to providing a welcoming and inclusive environment for all contributors. We expect all participants to adhere to our Code of Conduct, which promotes respectful and harassment-free interaction.
Key points:
- Be respectful and inclusive
- Focus on what is best for the community
- Show empathy towards other community members
- Be open to constructive feedback
## Getting Started
### Setting Up Your Development Environment
1. **Fork the Repository**
Start by forking the BetterSEQTA+ repository to your GitHub account.
2. **Clone Your Fork**
```bash
git clone https://github.com/yourusername/betterseqta-plus.git
cd betterseqta-plus
```
3. **Install Dependencies**
```bash
npm install
```
4. **Set Up Development Environment**
```bash
npm run dev
```
5. **Install in Chrome/Firefox**
Follow the [installation instructions](https://docs.betterseqta.org/install/) to load the development version into your browser.
### Project Structure
Understanding the project structure will help you navigate the codebase:
```
betterseqta-plus/
├── src/ # Source code
│ ├── plugins/ # Plugin system
│ │ ├── built-in/ # Built-in plugins
│ │ ├── core/ # Plugin core functionality
│ ├── settings/ # Settings system
│ ├── utils/ # Utility functions
│ ├── extension/ # Browser extension code
├── docs/ # Documentation
├── test/ # Test files
├── dist/ # Build output (generated)
├── package.json # Project dependencies
├── tsconfig.json # TypeScript configuration
└── README.md # Project README
```
## Contributing Code
### Branching Strategy
We follow a simple branching strategy:
- `main` - The main development branch
- `feature/*` - Feature branches
- `bugfix/*` - Bug fix branches
- `docs/*` - Documentation branches
Always create a new branch for your changes:
```bash
git checkout -b feature/my-new-feature
```
### Pull Request Process
1. **Keep PRs Focused**
Each pull request should address a single concern. If you're working on multiple features, create separate PRs for each.
2. **Write Clear Commit Messages**
Follow the conventional commits format:
```
feat: add new feature
fix: resolve bug with timetable
docs: update installation instructions
```
3. **Update Documentation**
If your changes require documentation updates, include them in the same PR.
4. **Run CI checks locally**
Pull requests trigger **PR CI**, which lints and builds in a clean environment:
```bash
npm run lint
npm run build
```
5. **Submit Your PR**
When you're ready, push your branch and create a pull request on GitHub.
6. **Code Review**
All PRs will be reviewed by maintainers. Be responsive to feedback and make requested changes.
7. **Merge**
Once approved, a maintainer will merge your PR.
### GitHub Actions workflows
See [RELEASES.md](RELEASES.md) for a full guide (workflows, sideload installs, and update detector).
| Workflow | Trigger | Purpose |
|----------|---------|---------|
| `pr-ci.yml` | Every PR to `main` | Typecheck, lint, and build (no release) |
| `mvp.yml` | Push to `main` | Build and upload `dist.zip` artifact |
| `release.yml` | Manual (`workflow_dispatch`) | Stable release on [BetterSEQTA/BetterSEQTA-Plus](https://github.com/BetterSEQTA/BetterSEQTA-Plus) tagged with `package.json` version |
| `nightly.yml` | Daily cron + manual | Updates the fixed `nightly` prerelease with latest `main` builds |
**Releasing a stable version:** bump `version` in `package.json` on `main`, then manually run the **Release** workflow and confirm the version checkbox. Edit the release title and notes on GitHub after the first publish. Re-running for the same tag only updates the zip files. Assets are `betterseqtaplus-{version}-chrome.zip` and `-firefox.zip`.
**Nightly builds** replace assets on the same `nightly` release. The release body warns that builds are experimental and must not be uploaded to extension stores.
**GitHub release builds** include an in-extension update checker (settings header badge). **PR CI and local dev builds do not.**
Release workflows are dispatched only on the main **BetterSEQTA/BetterSEQTA-Plus** repository and use the default `GITHUB_TOKEN`.
### Coding Standards
We follow TypeScript best practices and have a consistent code style:
1. **Use TypeScript**
All new code should be written in TypeScript with proper typing.
2. **Follow Existing Patterns**
Match the coding style of the existing codebase.
3. **Write Tests**
Add tests for new features and bug fixes.
4. **Document Your Code**
Add comments for complex logic and JSDoc comments for functions.
5. **Use Linters**
We use ESLint and Prettier. Run them before submitting your PR:
```bash
npm run lint
npm run format
```
## Reporting Bugs
If you find a bug, please report it by creating an issue on GitHub:
1. **Search Existing Issues**
Check if the bug has already been reported.
2. **Use the Bug Report Template**
Fill in all sections of the bug report template:
- Description
- Steps to reproduce
- Expected behavior
- Actual behavior
- Screenshots (if applicable)
- Environment (browser, OS, etc.)
3. **Be Specific**
The more details you provide, the easier it will be to fix the bug.
## Suggesting Features
We welcome feature suggestions! To suggest a new feature:
1. **Search Existing Suggestions**
Check if your idea has already been suggested.
2. **Use the Feature Request Template**
Fill in all sections of the feature request template:
- Description
- Use case
- Potential implementation
- Alternatives considered
3. **Be Patient**
Feature requests are evaluated based on alignment with project goals, feasibility, and maintainer bandwidth.
## Writing Documentation
Good documentation is crucial for the project. To contribute to documentation:
1. **Identify Gaps**
Look for areas where documentation is missing or unclear.
2. **Follow Documentation Style**
Maintain a consistent style and format.
3. **Use Clear Language**
Write in simple, clear English. Avoid jargon when possible.
4. **Include Examples**
Code examples and screenshots help users understand.
5. **Submit a PR**
Follow the same process as code contributions, but create a branch with a `docs/` prefix.
## Community
Join our community channels to discuss the project, get help, and connect with other contributors:
- **Discord Server**: [Join our Discord](https://discord.gg/betterseqta)
- **GitHub Discussions**: For longer-form conversations
- **GitHub Issues**: For bug reports and feature requests
## Creating Plugins
If you're interested in creating plugins for BetterSEQTA+, check out our plugin development guides:
- [Plugin development](https://docs.betterseqta.org/plugin-development/)
- [Plugin API](https://docs.betterseqta.org/plugin-api/)
## Recognition
Contributors are recognized in several ways:
1. **CONTRIBUTORS.md**: All contributors are listed in this file
2. **Release Notes**: Significant contributions are highlighted in release notes
3. **Community Recognition**: Regular shout-outs in community channels
## Questions?
If you have any questions about contributing, please:
1. Check the documentation
2. Ask in the Discord server
3. Open a GitHub Discussion
Thank you for contributing to BetterSEQTA+! Your efforts help make SEQTA better for students and teachers everywhere.
+1 -1
View File
@@ -19,7 +19,7 @@ import {
notifyRemoteConfigPageContext,
ensureKilledModeSettingsAccess,
} from "@/seqta/utils/remoteConfig/runtime";
import { runStartupPopupQueue } from "@/seqta/utils/Openers/StartupPopupQueue";
import { runStartupPopupQueue } from "@/seqta/utils/openers/StartupPopupQueue";
function registerFetchSeqtaAppLinkListener() {
browser.runtime.onMessage.addListener((request, _sender, sendResponse) => {
+1 -7
View File
@@ -1,5 +1,6 @@
import { normalizeCustomThemeApiResponse } from "@/seqta/utils/customThemes/parseApiEnvelope";
import { bsplusApiQueryParams } from "@/seqta/utils/bsplusClientContext";
import { base64ToBlob } from "@/seqta/utils/base64";
type MessageSender = { (response?: unknown): void };
@@ -16,13 +17,6 @@ type UploadPayload = {
submissionNotes?: string;
};
function base64ToBlob(base64: string, mimeType: string): Blob {
const binary = atob(base64);
const bytes = new Uint8Array(binary.length);
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
return new Blob([bytes], { type: mimeType });
}
function buildFormDataFromPayload(payload: UploadPayload): FormData {
const form = new FormData();
if (payload.themeZip) {
-4
View File
@@ -1,4 +0,0 @@
{
"last_updated": "2024-06-15T12:00:00Z",
"whatsnew_html": "<div class=\"whatsnewTextContainer\" style=\"overflow-y: auto; font-size: 1.3rem; line-height: 1.6;\"><p>It has come to our attention that several schools have expressed concerns about BetterSEQTA+. This is very disheartening, so we have decided to release a statement on the situation.</p><p>To view our privacy policy, please click the <strong>shield icon</strong> in the settings&nbsp;menu, or <a href=\"https://betterseqta.org/privacy\" target=\"_blank\" rel=\"noopener noreferrer\" id=\"privacy-link\" style=\"color: inherit; text-decoration: underline; cursor: pointer; white-space: nowrap;\">click here</a>.</p><p style=\"font-weight: bold; margin-top: 15px;\">We never collect any information from you, and aim to provide the best features possible.</p></div>"
}
@@ -1,5 +1,5 @@
<script lang="ts">
import { blobToDataUrl } from '@/plugins/built-in/themes/themeImageUrl'
import { blobToDataUrl } from '@/seqta/utils/base64'
let { source, alt = '', class: className = '' } = $props<{
source: string | Blob | null | undefined
@@ -9,7 +9,7 @@
import ThemeBlobImage from '@/interface/components/themes/ThemeBlobImage.svelte'
import ThemePlaceholderCover from '@/interface/components/themes/ThemePlaceholderCover.svelte'
import { isLocalCustomTheme } from '@/interface/utils/themeListFilters'
import { closeExtensionPopup } from '@/seqta/utils/Closers/closeExtensionPopup'
import { closeExtensionPopup } from '@/seqta/utils/closers/closeExtensionPopup'
import { formatCustomThemeApiError } from '@/seqta/utils/customThemes/apiErrors'
import { getRemoteConfigSnapshot, resolveEffectiveRemoteTheme } from '@/seqta/utils/remoteConfig/runtime'
@@ -1 +0,0 @@
export let selectedBackground = $state<string | null>(null);
+3 -3
View File
@@ -11,9 +11,9 @@
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import { isPerformanceMode } from "@/seqta/utils/performanceMode";
import { closeExtensionPopup } from "@/seqta/utils/Closers/closeExtensionPopup";
import { OpenAboutPage } from "@/seqta/utils/Openers/OpenAboutPage";
import { OpenWhatsNewPopup } from "@/seqta/utils/Openers/OpenWhatsNewPopup";
import { closeExtensionPopup } from "@/seqta/utils/closers/closeExtensionPopup";
import { OpenAboutPage } from "@/seqta/utils/openers/OpenAboutPage";
import { OpenWhatsNewPopup } from "@/seqta/utils/openers/OpenWhatsNewPopup";
import type { Component } from "svelte";
import SidebarNav from "../components/SidebarNav.svelte";
@@ -2,9 +2,9 @@
import Switch from "@/interface/components/Switch.svelte";
import Button from "@/interface/components/Button.svelte";
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import { openTermsOfServicePopup } from "@/seqta/utils/Openers/OpenTermsOfServicePopup";
import { showThemeOfTheMonthPopupNow } from "@/seqta/utils/Openers/OpenThemeOfTheMonthPopup";
import { closeExtensionPopup } from "@/seqta/utils/Closers/closeExtensionPopup";
import { openTermsOfServicePopup } from "@/seqta/utils/openers/OpenTermsOfServicePopup";
import { showThemeOfTheMonthPopupNow } from "@/seqta/utils/openers/OpenThemeOfTheMonthPopup";
import { closeExtensionPopup } from "@/seqta/utils/closers/closeExtensionPopup";
import { getSnapshotForUpload } from "@/seqta/utils/cloudSettingsSync";
import { getStoredOverride, PRODUCTION_API_BASE, setApiBase } from "@/seqta/utils/DevApiBase";
+14 -34
View File
@@ -12,8 +12,7 @@ export function generateImageId(): string {
/**
* Handles the upload of a new custom image from a file input event.
* If a file is selected, it reads the file using FileReader, converts it to a Blob,
* generates a unique ID and a default variable name for it, and then adds this new image
* If a file is selected, it generates a unique ID and a default variable name for it, and then adds this new image
* to the `CustomImages` array within the provided `theme` object.
*
* @param {Event} event The file input change event, typically from an `<input type="file">` element.
@@ -30,23 +29,17 @@ export function handleImageUpload(
const file = input.files?.[0];
input.value = "";
if (file) {
return new Promise((resolve) => {
const reader = new FileReader();
reader.onload = async () => {
const imageBlob = await fetch(reader.result as string).then((res) =>
res.blob(),
);
const imageId = generateImageId();
const variableName = `custom-image-${theme.CustomImages.length}`;
resolve({
...theme,
CustomImages: [
...theme.CustomImages,
{ id: imageId, blob: imageBlob, variableName, url: null },
],
});
};
reader.readAsDataURL(file);
return Promise.resolve({
...theme,
CustomImages: [
...theme.CustomImages,
{
id: generateImageId(),
blob: file,
variableName: `custom-image-${theme.CustomImages.length}`,
url: null,
},
],
});
}
return theme;
@@ -98,8 +91,7 @@ export function handleImageVariableChange(
/**
* Handles the upload of a cover image for the theme from a file input event.
* If a file is selected, it reads the file using FileReader, converts it to a Blob,
* and then updates the `coverImage` property of the provided `theme` object with this new blob.
* If a file is selected, it updates the `coverImage` property of the provided `theme` object with the file.
*
* @param {Event} event The file input change event, typically from an `<input type="file">` element.
* @param {LoadedCustomTheme} theme The current theme object whose cover image will be updated.
@@ -114,17 +106,5 @@ export function handleCoverImageUpload(
const input = event.target as HTMLInputElement;
const file = input.files?.[0];
input.value = "";
if (file) {
return new Promise((resolve) => {
const reader = new FileReader();
reader.onload = async () => {
const imageBlob = await fetch(reader.result as string).then((res) =>
res.blob(),
);
resolve({ ...theme, coverImage: imageBlob });
};
reader.readAsDataURL(file);
});
}
return Promise.resolve(theme);
return Promise.resolve(file ? { ...theme, coverImage: file } : theme);
}
@@ -1,24 +0,0 @@
export function CreateBackground() {
const bkCheck = document.getElementsByClassName("bg");
if (bkCheck.length !== 0) {
return;
}
// Creating and inserting 3 divs containing the background applied to the pages
const container = document.getElementById("container");
const menu = document.getElementById("menu");
if (!container || !menu) return;
const backgrounds = [
{ classes: ["bg"] },
{ classes: ["bg", "bg2"] },
{ classes: ["bg", "bg3"] },
];
backgrounds.forEach(({ classes }) => {
const bk = document.createElement("div");
classes.forEach((cls) => bk.classList.add(cls));
container.insertBefore(bk, menu);
});
}
@@ -1,6 +0,0 @@
export function RemoveBackground() {
const backgrounds = document.getElementsByClassName("bg");
// Convert HTMLCollection to Array and remove each element
Array.from(backgrounds).forEach((element) => element.remove());
}
@@ -1,5 +1,5 @@
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import { loadHomePage } from "@/seqta/utils/Loaders/LoadHomePage";
import { loadHomePage } from "@/seqta/utils/loaders/LoadHomePage";
import { waitForElm } from "@/seqta/utils/waitForElm";
export interface BaseCommandItem {
@@ -4,10 +4,10 @@ import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
import {
ensureAnalyticsMenuOrder,
insertMenuItemAfterKey,
} from "@/seqta/utils/Openers/analyticsMenuOrder";
} from "@/seqta/utils/openers/analyticsMenuOrder";
import { processMenuItemNode } from "@/seqta/utils/sidebarMenuIcons";
import { ChangeMenuItemPositions } from "@/seqta/utils/Openers/menuOrder";
import { isMenuOptionsOpen } from "@/seqta/utils/Openers/menuOptionsState";
import { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import { checkRemoteFeature } from "@/seqta/utils/remoteConfig/runtime";
import { applyMenuItemVisibility } from "@/seqta/utils/menuItemVisibility";
@@ -1,5 +1,5 @@
import stringToHTML from "@/seqta/utils/stringToHTML";
import { openPopup } from "@/seqta/utils/Openers/PopupManager";
import { openPopup } from "@/seqta/utils/openers/PopupManager";
/** Grade Analytics privacy — uses the shared BetterSEQTA+ whatsnew popup shell. */
export function openAnalyticsPrivacyPopup() {
+1 -1
View File
@@ -39,7 +39,7 @@ import {
base64ToBlob,
blobToBase64Data,
stripBase64Prefix,
} from "./themeImageUrl";
} from "@/seqta/utils/base64";
type ThemeContent = {
id: string;
@@ -1,34 +0,0 @@
/**
* Theme decorative images must use data URLs instead of blob URLs on Firefox:
* blob: URLs are tied to the origin where createObjectURL ran (page), while
* settings UI runs in extension shadow DOM (moz-extension://).
*/
import base64ToBlob from "@/seqta/utils/base64ToBlob";
export { base64ToBlob };
export function blobToDataUrl(blob: Blob): Promise<string> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onloadend = () => {
if (typeof reader.result === "string") resolve(reader.result);
else reject(new Error("FileReader did not return a string"));
};
reader.onerror = () =>
reject(reader.error ?? new Error("FileReader failed"));
reader.readAsDataURL(blob);
});
}
/** Base64 payload only (no `data:…;base64,` prefix) for the page-context bridge. */
export function blobToBase64Data(blob: Blob): Promise<string> {
return blobToDataUrl(blob).then((dataUrl) => {
const comma = dataUrl.indexOf(",");
return comma >= 0 ? dataUrl.slice(comma + 1) : dataUrl;
});
}
export function stripBase64Prefix(base64String: string): string {
if (!base64String) return "";
return base64String.replace(/^data:[^;]+;base64,/, "");
}
@@ -1,7 +1,7 @@
<script lang="ts">
import Button from "@/interface/components/Button.svelte";
import { cloudAuth } from "@/seqta/utils/CloudAuth";
import { closeExtensionPopup } from "@/seqta/utils/Closers/closeExtensionPopup";
import { closeExtensionPopup } from "@/seqta/utils/closers/closeExtensionPopup";
import { runTimetableClassmatesSync } from "./syncOrchestrator";
import { loadSession, resolveClassmatesScope } from "./rosterStore";
import { accountsAvailability } from "./accountsAvailability";
@@ -1,6 +1,6 @@
import stringToHTML from "@/seqta/utils/stringToHTML";
import { createPopupHeroVideo } from "@/seqta/utils/Openers/attachPopupMediaFullscreen";
import { closePopup, openPopup } from "@/seqta/utils/Openers/PopupManager";
import { createPopupHeroVideo } from "@/seqta/utils/openers/attachPopupMediaFullscreen";
import { closePopup, openPopup } from "@/seqta/utils/openers/PopupManager";
import { mount, unmount } from "svelte";
import TimetableClassmatesOptInPopup from "./TimetableClassmatesOptInPopup.svelte";
import TimetableClassmatesOptOutPopup from "./TimetableClassmatesOptOutPopup.svelte";
+4 -4
View File
@@ -27,10 +27,10 @@ import { getEngageRoutePage } from "@/seqta/utils/engageRoute";
import {
loadEngageHomePage,
updateEngageHomeMenuActive,
} from "@/seqta/utils/Loaders/LoadEngageHomePage";
import { loadHomePage } from "@/seqta/utils/Loaders/LoadHomePage";
import { runStartupPopupQueue } from "@/seqta/utils/Openers/StartupPopupQueue";
import { OpenCoursesAssessmentsFixPopup } from "@/seqta/utils/Openers/OpenCoursesAssessmentsFixPopup";
} from "@/seqta/utils/loaders/LoadEngageHomePage";
import { loadHomePage } from "@/seqta/utils/loaders/LoadHomePage";
import { runStartupPopupQueue } from "@/seqta/utils/openers/StartupPopupQueue";
import { OpenCoursesAssessmentsFixPopup } from "@/seqta/utils/openers/OpenCoursesAssessmentsFixPopup";
import {
syncTimetableUrlMonitoring,
+1 -1
View File
@@ -2,7 +2,7 @@ import { getEngageRoutePage } from "@/seqta/utils/engageRoute";
import {
loadEngageHomePage,
updateEngageHomeMenuActive,
} from "@/seqta/utils/Loaders/LoadEngageHomePage";
} from "@/seqta/utils/loaders/LoadEngageHomePage";
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
let engageHashListenerAttached = false;
+4 -4
View File
@@ -1,8 +1,8 @@
import { waitForEngageMenuList } from "@/seqta/utils/waitForEngageMenuList";
import { addExtensionSettings } from "@/seqta/utils/Adders/AddExtensionSettings";
import { addExtensionSettings } from "@/seqta/utils/adders/AddExtensionSettings";
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
import { loadEngageHomePage } from "@/seqta/utils/Loaders/LoadEngageHomePage";
import { loadHomePage } from "@/seqta/utils/Loaders/LoadHomePage";
import { loadEngageHomePage } from "@/seqta/utils/loaders/LoadEngageHomePage";
import { loadHomePage } from "@/seqta/utils/loaders/LoadHomePage";
import { SendNewsPage } from "@/seqta/utils/SendNewsPage";
import { attachNotificationsPanelAnimation } from "@/seqta/utils/attachNotificationsPanelAnimation";
import { setupSettingsButton } from "@/seqta/utils/setupSettingsButton";
@@ -19,7 +19,7 @@ import {
ensureThemeToggleSurprisePageScript,
openThemeToggleSurprise,
THEME_TOGGLE_SURPRISE_TRIGGER_AT,
} from "@/seqta/utils/Openers/openThemeToggleSurprise";
} from "@/seqta/utils/openers/openThemeToggleSurprise";
import { LUCIDE_MOON_ICON_SVG } from "@/lib/icons/lucideMoon";
import { LUCIDE_SUN_ICON_SVG } from "@/lib/icons/lucideSun";
import { ensureTitlebarFounderBadgeMounted, refreshTitlebarFounderBadge } from "@/seqta/ui/founderBadge/mountTitlebarFounderBadge";
@@ -1,5 +1,5 @@
import stringToHTML from "@/seqta/utils/stringToHTML";
import { closePopup, openPopup } from "@/seqta/utils/Openers/PopupManager";
import { closePopup, openPopup } from "@/seqta/utils/openers/PopupManager";
import { openFounderBadgeSettings } from "@/seqta/ui/founderBadge/openFounderBadgeSettings";
import {
badgeBlobStyle,
-43
View File
@@ -1,43 +0,0 @@
/**
* Uploads an image file to a specified endpoint using a POST request.
*
* @param {File} file - The file to be uploaded.
* @returns {Promise} A promise that resolves to the response from the server.
* @throws {Error} If no file is provided or if there is an error during upload.
*/
export async function UploadImage(file: File): Promise<any> {
// Ensuring that file is provided
if (!file) {
throw new Error("No file provided");
}
// Extracting the filename
const fileName = file.name;
// Assuming 'document.cookie' contains all the cookies in the format you provided
const cookies = document.cookie;
// Setting up the request options
const requestOptions = {
method: "POST",
headers: {
Cookie: cookies,
"X-File-Name": fileName,
},
body: file, // Binary file data
};
// Making the fetch request and returning the promise
return await fetch("/seqta/student/file/upload/xhr2", requestOptions)
.then(async (response) => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const json = await response.json();
return `/seqta/student/load/file?type=message&file=${json.uuid}`;
})
.catch((error) => {
console.error("Error during file upload:", error);
throw error;
});
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { CreateElement } from "@/seqta/utils/CreateEnable/CreateElement";
import { CreateElement } from "@/seqta/utils/createEnable/CreateElement";
export function FilterUpcomingAssessments(subjectoptions: any) {
for (var item in subjectoptions) {
@@ -1,4 +1,4 @@
import { closeExtensionPopup } from "../Closers/closeExtensionPopup";
import { closeExtensionPopup } from "../closers/closeExtensionPopup";
import { isExtensionSettingsOpen } from "../settingsPopupAnimation";
let isSettingsRendered = false;
+27
View File
@@ -0,0 +1,27 @@
export function base64ToBlob(base64: string, type = ""): Blob {
const binary = atob(base64);
const bytes = new Uint8Array(binary.length);
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
return new Blob([bytes], { type });
}
export function blobToDataUrl(blob: Blob): Promise<string> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onloadend = () => {
if (typeof reader.result === "string") resolve(reader.result);
else reject(new Error("FileReader did not return a string"));
};
reader.onerror = () => reject(reader.error ?? new Error("FileReader failed"));
reader.readAsDataURL(blob);
});
}
export async function blobToBase64Data(blob: Blob): Promise<string> {
return stripBase64Prefix(await blobToDataUrl(blob));
}
export function stripBase64Prefix(base64String: string): string {
if (!base64String) return "";
return base64String.replace(/^data:[^;]*;base64,/, "");
}
-17
View File
@@ -1,17 +0,0 @@
const base64ToBlob = (base64: string, contentType: string = ""): Blob => {
const byteCharacters = atob(base64);
const byteArrays: Uint8Array[] = [];
for (let offset = 0; offset < byteCharacters.length; offset += 512) {
const slice = byteCharacters.slice(offset, offset + 512);
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
return new Blob(byteArrays, { type: contentType });
};
export default base64ToBlob;
-11
View File
@@ -1,11 +0,0 @@
export const blobToBase64 = (blob: Blob) => {
return new Promise<string>((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
const base64 = reader.result as string;
resolve(base64);
};
reader.onerror = reject;
reader.readAsDataURL(blob);
});
};
@@ -1,5 +1,5 @@
import type { LoadedCustomTheme } from "@/types/CustomThemes";
import { blobToBase64Data } from "@/plugins/built-in/themes/themeImageUrl";
import { blobToBase64Data } from "@/seqta/utils/base64";
import type { CustomThemeUploadFilePart, CustomThemeUploadPayload } from "./types";
/** Build serializable upload parts from a local custom theme (loose files, not ZIP). */
@@ -66,7 +66,7 @@ export async function buildUploadPartsFromLocalTheme(
/** Build upload payload from a user-selected ZIP file. */
export async function buildUploadPartsFromZipFile(file: File): Promise<CustomThemeUploadPayload> {
const dataBase64 = await readFileAsBase64(file);
const dataBase64 = await blobToBase64Data(file);
return {
themeZip: {
fieldName: "theme_zip",
@@ -84,23 +84,6 @@ function base64FromUtf8(text: string): string {
return btoa(binary);
}
function readFileAsBase64(file: File): Promise<string> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
const result = reader.result;
if (typeof result !== "string") {
reject(new Error("Failed to read file"));
return;
}
const comma = result.indexOf(",");
resolve(comma >= 0 ? result.slice(comma + 1) : result);
};
reader.onerror = () => reject(reader.error ?? new Error("Failed to read file"));
reader.readAsDataURL(file);
});
}
export function mergeUploadPayload(
base: CustomThemeUploadPayload,
submissionNotes?: string,
@@ -1,7 +1,7 @@
import { BSPLUS_GOOGLE_CALENDAR_EVENT_PROP } from "@/config/googleCalendar";
import { BSPLUS_OUTLOOK_CALENDAR_EVENT_CATEGORY } from "@/config/outlookCalendar";
import { outlookDescriptionWithKey } from "@/seqta/utils/calendarSync/eventFingerprint";
import { toISODate } from "@/seqta/utils/Loaders/engageParentTimetable";
import { toISODate } from "@/seqta/utils/loaders/engageParentTimetable";
import { nearestGoogleEventColorId } from "./eventColor";
import type { GoogleCalendarEventInput, SeqtaTimetableLesson } from "./types";
@@ -1,4 +1,4 @@
import { toISODate } from "@/seqta/utils/Loaders/engageParentTimetable";
import { toISODate } from "@/seqta/utils/loaders/engageParentTimetable";
import type { CalendarSyncAssessment } from "./eventMapper";
import type { SyncDateRange } from "./syncDateRange";
import { isDateInRange, syncWindowRange } from "./syncDateRange";
@@ -1,5 +1,5 @@
import { GOOGLE_CALENDAR_SYNC_WEEKS } from "@/config/googleCalendar";
import { toISODate, weekRangeContaining } from "@/seqta/utils/Loaders/engageParentTimetable";
import { toISODate, weekRangeContaining } from "@/seqta/utils/loaders/engageParentTimetable";
export interface SyncDateRange {
from: string;
-19
View File
@@ -1,19 +0,0 @@
export function base64toblobURL(base64: string) {
// Extract base64 data from the data URI
const base64Index = base64.indexOf(",") + 1;
const imageBase64 = base64.substring(base64Index);
// Convert base64 to blob
const byteCharacters = atob(imageBase64);
const byteNumbers = new Uint8Array(byteCharacters.length);
for (let i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
const blob = new Blob([byteArray], { type: "image/png" });
// Convert blob to blob URL
const imageUrl = URL.createObjectURL(blob);
return imageUrl;
}
+1 -1
View File
@@ -1,6 +1,6 @@
/** Close settings (if open) and mount the theme builder on the SEQTA page body. */
export async function launchPageThemeBuilder(themeId?: string): Promise<void> {
const { closeExtensionPopup } = await import("@/seqta/utils/Closers/closeExtensionPopup");
const { closeExtensionPopup } = await import("@/seqta/utils/closers/closeExtensionPopup");
const { OpenThemeCreator } = await import("@/plugins/built-in/themes/ThemeCreator");
closeExtensionPopup();
+3 -3
View File
@@ -1,8 +1,8 @@
import browser from "webextension-polyfill";
import { closeExtensionPopup } from "@/seqta/utils/Closers/closeExtensionPopup";
import { OpenMenuOptions } from "@/seqta/utils/Openers/OpenMenuOptions";
import { isMenuOptionsOpen } from "@/seqta/utils/Openers/menuOptionsState";
import { closeExtensionPopup } from "@/seqta/utils/closers/closeExtensionPopup";
import { OpenMenuOptions } from "@/seqta/utils/openers/OpenMenuOptions";
import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
import sendThemeUpdate from "@/seqta/utils/sendThemeUpdate";
import hideSensitiveContent from "@/seqta/ui/dev/hideSensitiveContent";
@@ -3,19 +3,19 @@ import { settingsState } from "./SettingsState";
import { StorageChangeHandler } from "./StorageChanges";
jest.mock("@/seqta/ui/colors/Manager", () => ({ updateAllColors: jest.fn() }));
jest.mock("@/seqta/utils/Render/renderShortcuts", () => ({
jest.mock("@/seqta/utils/render/renderShortcuts", () => ({
renderShortcuts: jest.fn(),
}));
jest.mock("@/seqta/utils/FilterUpcomingAssessments", () => ({
FilterUpcomingAssessments: jest.fn(),
}));
jest.mock("@/seqta/utils/Loaders/LoadHomePage", () => ({
jest.mock("@/seqta/utils/loaders/LoadHomePage", () => ({
registerHomeUpcomingSettingsListeners: jest.fn(),
}));
jest.mock("@/seqta/utils/menuItemVisibility", () => ({
scheduleMenuItemVisibility: jest.fn(),
}));
jest.mock("@/seqta/utils/Openers/menuOrder", () => ({
jest.mock("@/seqta/utils/openers/menuOrder", () => ({
ChangeMenuItemPositions: jest.fn(),
}));
jest.mock("@/seqta/utils/performanceMode", () => ({
+3 -3
View File
@@ -3,11 +3,11 @@ import { updateAllColors } from "@/seqta/ui/colors/Manager";
import { applySelectedFont } from "@/seqta/ui/fonts/Manager";
// Shortcuts rendering
import { renderShortcuts } from "@/seqta/utils/Render/renderShortcuts";
import { renderShortcuts } from "@/seqta/utils/render/renderShortcuts";
import { FilterUpcomingAssessments } from "@/seqta/utils/FilterUpcomingAssessments";
import { registerHomeUpcomingSettingsListeners } from "@/seqta/utils/Loaders/LoadHomePage";
import { registerHomeUpcomingSettingsListeners } from "@/seqta/utils/loaders/LoadHomePage";
import { applyMenuItemVisibility, scheduleMenuItemVisibility } from "@/seqta/utils/menuItemVisibility";
import { ChangeMenuItemPositions } from "@/seqta/utils/Openers/menuOrder";
import { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
import { syncPerformanceModeEffects } from "@/seqta/utils/performanceMode";
import type { CustomShortcut } from "@/types/storage";
@@ -4,8 +4,8 @@ import { convertTo12HourFormat } from "@/seqta/utils/convertTo12HourFormat";
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import stringToHTML from "@/seqta/utils/stringToHTML";
import { waitForElm } from "@/seqta/utils/waitForElm";
import { renderShortcuts } from "@/seqta/utils/Render/renderShortcuts";
import { lessonsSubtitleForViewDate } from "@/seqta/utils/Loaders/timetableSubtitle";
import { renderShortcuts } from "@/seqta/utils/render/renderShortcuts";
import { lessonsSubtitleForViewDate } from "@/seqta/utils/loaders/timetableSubtitle";
import {
type EngageParentChild,
type EngageParentTimetableItem,
@@ -14,7 +14,7 @@ import {
isDateInCachedWeek,
toISODate,
weekRangeContaining,
} from "@/seqta/utils/Loaders/engageParentTimetable";
} from "@/seqta/utils/loaders/engageParentTimetable";
import { resolveNoticeFilterTokens } from "@/seqta/utils/notices/noticeLabelFilters";
import { setupNoticesSection } from "@/seqta/utils/notices/noticeHomeUi";
@@ -8,8 +8,8 @@ import { convertTo12HourFormat } from "../convertTo12HourFormat";
import { delay } from "../delay";
import { settingsState } from "../listeners/SettingsState";
import stringToHTML from "../stringToHTML";
import { renderShortcuts } from "@/seqta/utils/Render/renderShortcuts";
import { CreateElement } from "@/seqta/utils/CreateEnable/CreateElement";
import { renderShortcuts } from "@/seqta/utils/render/renderShortcuts";
import { CreateElement } from "@/seqta/utils/createEnable/CreateElement";
import { FilterUpcomingAssessments } from "@/seqta/utils/FilterUpcomingAssessments";
import { setupFixedTooltips } from "@/seqta/utils/fixedTooltip";
import { verboseInfo } from "@/utils/verboseLog";
@@ -21,7 +21,7 @@ import {
} from "@/plugins/built-in/assessmentsOverview/utils";
import { resolveNoticeFilterTokens } from "@/seqta/utils/notices/noticeLabelFilters";
import { setupNoticesSection } from "@/seqta/utils/notices/noticeHomeUi";
import { lessonsSubtitleForViewDate } from "@/seqta/utils/Loaders/timetableSubtitle";
import { lessonsSubtitleForViewDate } from "@/seqta/utils/loaders/timetableSubtitle";
import {
applyPageFeatureGateEarly,
injectPageFeatureBanner,
-51
View File
@@ -1,51 +0,0 @@
/**
* @callback UnlockFunction
* @description A function that must be called to release the mutex.
* @returns {void}
*/
/**
* A simple mutex implementation for managing asynchronous operations.
* It ensures that only one operation can hold the lock at a time.
* Operations queue up and are granted access sequentially.
*/
export class Mutex {
private mutex = Promise.resolve();
/**
* Acquires the mutex.
*
* This method returns a Promise that resolves with an {@link UnlockFunction}.
* The calling code *must* call this {@link UnlockFunction} to release the mutex
* once the critical section of code has completed.
*
* If the mutex is already locked, this method will wait until it is released
* before resolving the Promise.
*
* @returns {Promise<UnlockFunction>} A Promise that resolves with the function to call to release the lock.
*/
acquire(): Promise<() => void> {
let begin: (unlock: () => void) => void = () => {}; // Initialize with a no-op
const newPromise = new Promise<void>((resolve) => {
begin = resolve;
});
const chainedPromise = this.mutex.then(() => {
return new Promise<() => void>((resolveOuter) => {
// The 'begin' function, when called, will resolve the newPromise,
// effectively passing control to the next then() in the chain.
// We pass 'begin' itself as the unlock function.
// So, when the user calls unlock (which is 'begin'), newPromise resolves.
resolveOuter(begin);
});
});
this.mutex = newPromise;
return chainedPromise;
}
// Note: There isn't a separate `release()` method in this pattern.
// The lock is released by calling the function returned by `acquire()`.
}
@@ -1,17 +1,17 @@
import type { SettingsState } from "@/types/storage";
import { settingsState } from "../listeners/SettingsState";
import { applyMenuItemVisibility } from "../menuItemVisibility";
import { ensureAnalyticsMenuOrder } from "@/seqta/utils/Openers/analyticsMenuOrder";
import { ensureAnalyticsMenuOrder } from "@/seqta/utils/openers/analyticsMenuOrder";
import {
isMenuOptionsOpen,
setMenuOptionsOpen,
} from "@/seqta/utils/Openers/menuOptionsState";
import { ChangeMenuItemPositions } from "@/seqta/utils/Openers/menuOrder";
} from "@/seqta/utils/openers/menuOptionsState";
import { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
import stringToHTML from "../stringToHTML";
import Sortable from "sortablejs";
export { MenuOptionsOpen, setMenuOptionsOpen } from "@/seqta/utils/Openers/menuOptionsState";
export { ChangeMenuItemPositions } from "@/seqta/utils/Openers/menuOrder";
export { MenuOptionsOpen, setMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
export { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
function escapeHtmlAttr(value: string): string {
return value
File renamed without changes.
@@ -4,7 +4,7 @@
import patchScript from "@/seqta/utils/themeImagePagePatch.js?script&iife";
import { extensionPageScriptUrl } from "@/lib/extensionPageScriptUrl";
import { blobToBase64Data } from "@/plugins/built-in/themes/themeImageUrl";
import { blobToBase64Data } from "@/seqta/utils/base64";
const PAGE_PATCH_LOADER_ID = "bsplus-theme-image-page-patch-loader";
const BRIDGE_ID = "bsplus-theme-image-bridge";
+1 -1
View File
@@ -1,6 +1,6 @@
import browser from "webextension-polyfill";
import stringToHTML from "@/seqta/utils/stringToHTML";
import { addExtensionSettings } from "@/seqta/utils/Adders/AddExtensionSettings";
import { addExtensionSettings } from "@/seqta/utils/adders/AddExtensionSettings";
import { setupSettingsButton } from "@/seqta/utils/setupSettingsButton";
import { waitForElm } from "@/seqta/utils/waitForElm";
import { isSeqtaEngageExperience } from "@/seqta/utils/isSeqtaEngage";
@@ -1,6 +1,6 @@
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import { addShortcuts } from "@/seqta/utils/Adders/AddShortcuts";
import { CreateCustomShortcutDiv } from "@/seqta/utils/CreateEnable/CreateCustomShortcutDiv";
import { addShortcuts } from "@/seqta/utils/adders/AddShortcuts";
import { CreateCustomShortcutDiv } from "@/seqta/utils/createEnable/CreateCustomShortcutDiv";
export function renderShortcuts() {
const container = document.getElementById("shortcuts");
+3 -3
View File
@@ -1,6 +1,6 @@
import { closeExtensionPopup, getSettingsOpenGeneration } from "./Closers/closeExtensionPopup";
import { closeExtensionPopup, getSettingsOpenGeneration } from "./closers/closeExtensionPopup";
import { animateSettingsOpen, isExtensionSettingsOpen, prefetchSettingsShell } from "./settingsPopupAnimation";
import { renderSettingsIfNeeded } from "./Adders/AddExtensionSettings";
import { renderSettingsIfNeeded } from "./adders/AddExtensionSettings";
export function setupSettingsButton() {
const AddedSettings = document.getElementById("AddedSettings");
@@ -33,7 +33,7 @@ export async function openSettingsPopup(): Promise<void> {
try {
let host = document.getElementById("ExtensionPopup");
if (!host) {
const { addExtensionSettings } = await import("./Adders/AddExtensionSettings");
const { addExtensionSettings } = await import("./adders/AddExtensionSettings");
addExtensionSettings();
host = document.getElementById("ExtensionPopup");
}
+2 -2
View File
@@ -1,6 +1,6 @@
import MenuitemSVGKey from "@/seqta/content/MenuItemSVGKey.json";
import { ChangeMenuItemPositions } from "@/seqta/utils/Openers/menuOrder";
import { isMenuOptionsOpen } from "@/seqta/utils/Openers/menuOptionsState";
import { ChangeMenuItemPositions } from "@/seqta/utils/openers/menuOrder";
import { isMenuOptionsOpen } from "@/seqta/utils/openers/menuOptionsState";
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
import stringToHTML from "@/seqta/utils/stringToHTML";
import { waitForEngageMenuList } from "@/seqta/utils/waitForEngageMenuList";