mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-12-06 19:56:45 +10:30
docs: drop duplicated docs and tidy readme, templates and comments
This commit is contained in:
64 files changed
+228
-3149
No files matched your search
@@ -1,42 +1,51 @@
|
|||||||
name: Bug report
|
name: Bug report
|
||||||
description: Report an issue with the modpack in its unmodified state. For other issues, use Discord.
|
description: Something in BetterSEQTA+ is broken. For questions, ask in Discord instead.
|
||||||
labels: bug
|
labels: bug
|
||||||
title: "[BUG]"
|
title: "[BUG] "
|
||||||
type: "Bug"
|
type: "Bug"
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
Before reporting an issue, [please search](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) to make sure it has not already been reported (make sure to search closed issues as well!).
|
Please [search existing issues](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues?q=is%3Aissue) first, including closed ones. For general help you'll get a faster answer in [Discord](https://discord.gg/YzmbnCDkat).
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Describe the bug
|
label: What happened?
|
||||||
description: Describe your issue. For general issues and questions you'll get a faster answer [from our Discord.](https://discord.gg/YzmbnCDkat)
|
description: What went wrong, and what did you expect to happen instead?
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
placeholder: |
|
||||||
|
1. Open the timetable
|
||||||
|
2. Click a class
|
||||||
|
3. ...
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Extension version
|
label: Extension version
|
||||||
description: What version of the extension are you using?
|
description: Shown on your browser's extensions page (`chrome://extensions` or `about:addons`).
|
||||||
placeholder: Find it by opening the config menu and clicking the about icon in the top right.
|
placeholder: "1.0.0"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
attributes:
|
attributes:
|
||||||
label: Browser
|
label: Browser
|
||||||
description: Which Browser are you using?
|
|
||||||
options:
|
options:
|
||||||
- Chrome
|
- Chrome
|
||||||
- Firefox
|
|
||||||
- Brave
|
|
||||||
- Safari
|
|
||||||
- DuckDuckGO
|
|
||||||
- Microsoft Edge
|
- Microsoft Edge
|
||||||
- Other Chromium-Based Browser
|
- Brave
|
||||||
- Other Non-Chromium-Based Browser
|
- Opera
|
||||||
|
- Other Chromium browser
|
||||||
|
- Firefox
|
||||||
|
- Safari
|
||||||
|
- Other
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
@@ -44,14 +53,13 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Confirm
|
label: Confirm
|
||||||
options:
|
options:
|
||||||
- label: This bug report is about an issue with the extension itself. I have not modified the extension nor added any unsupported plugins. If this is not the case, I know that I should post the issue to the extension's Discord support channel instead.
|
- label: I'm using an unmodified build from a store or GitHub release, without third-party plugins.
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Additional context
|
label: Screenshots and console output
|
||||||
description: Screenshots, video or any other information. Include photos of the console if possible
|
description: Screenshots, a video, or errors from the browser console all help.
|
||||||
placeholder: |
|
placeholder: Drag images or log files into this box to attach them.
|
||||||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
contact_links:
|
contact_links:
|
||||||
- name: BetterSEQTA Community Support
|
- name: Discord
|
||||||
url: https://discord.gg/YzmbnCDkat
|
url: https://discord.gg/YzmbnCDkat
|
||||||
about: Join our discord for community updates, discussion, and more!
|
about: Questions, help and community chat.
|
||||||
|
- name: Documentation
|
||||||
|
url: https://docs.betterseqta.org
|
||||||
|
about: Guides for installing, making themes and writing plugins.
|
||||||
@@ -1,52 +1,42 @@
|
|||||||
name: Feature request
|
name: Feature request
|
||||||
description: Suggest a new Feature to be added or replaced in BetterSeqtaPLUS
|
description: Suggest something new for BetterSEQTA+ or a change to an existing feature.
|
||||||
labels: enhancement
|
labels: enhancement
|
||||||
title: "[FR]"
|
title: "[FR] "
|
||||||
|
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: Confirm
|
|
||||||
options:
|
|
||||||
- label: "Is this feature request related to a Bug report?"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: Bug report link
|
|
||||||
description: "If this feature request is related to a bug report, please insert the link to the bug report here"
|
|
||||||
placeholder: "https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues/..."
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
## Feature details
|
Please [search existing issues](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues?q=is%3Aissue) first, including closed ones, in case it's already been suggested.
|
||||||
Before you request a feature, [please search](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) if it has already been requested. (Make sure to check closed issues as well!)
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: What would you like?
|
||||||
|
description: Describe the feature in as much detail as you can, and the problem it solves.
|
||||||
|
placeholder: It would be great if...
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
attributes:
|
attributes:
|
||||||
label: Feature type
|
label: Type
|
||||||
multiple: false
|
|
||||||
options:
|
options:
|
||||||
- Graphical
|
- Visual / design
|
||||||
- Functional
|
- Functionality
|
||||||
- Not Sure
|
- Not sure
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
label: Feature Details
|
label: Related bug report
|
||||||
description: Please write, with as much detail as possible, what you would like to see from this feature.
|
description: If this comes from a bug report, link it here.
|
||||||
placeholder: it would be cool if
|
placeholder: https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues/...
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Additional details
|
label: Anything else
|
||||||
description: Anything else that would help describe your vision (reference images, descriptions, etc)
|
description: Mockups, reference images, or examples from other apps.
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
@@ -1,114 +1,64 @@
|
|||||||
name: 🙋 New Contributor - Need Help Getting Started
|
name: New contributor
|
||||||
description: Perfect for first-time contributors who need guidance
|
description: First time contributing? Tell us what you'd like to work on and we'll help you get started.
|
||||||
labels: ["help wanted", "documentation"]
|
labels: ["help wanted"]
|
||||||
title: "[NEW CONTRIBUTOR] "
|
title: "[NEW CONTRIBUTOR] "
|
||||||
|
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
## Hi there! 👋
|
Welcome to BetterSEQTA+! Fill in what you can and a maintainer will point you in the right direction. For real-time help, join the [Discord](https://discord.gg/YzmbnCDkat).
|
||||||
Welcome to BetterSEQTA+! We're excited to have you join our community.
|
|
||||||
|
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
attributes:
|
attributes:
|
||||||
label: Tell us about yourself (check all that apply)
|
label: About you
|
||||||
options:
|
options:
|
||||||
- label: "This is my first time contributing to open source"
|
- label: This is my first open source contribution
|
||||||
required: false
|
- label: I'm new to browser extensions
|
||||||
- label: "I'm new to browser extensions"
|
- label: I'm new to TypeScript or Svelte
|
||||||
required: false
|
- label: I've coded before but I'm new to this project
|
||||||
- label: "I'm new to TypeScript/JavaScript"
|
|
||||||
required: false
|
|
||||||
- label: "I have some coding experience but new to this project"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: What would you like to work on? (check all that apply)
|
|
||||||
options:
|
|
||||||
- label: "Fix a bug 🐛"
|
|
||||||
required: false
|
|
||||||
- label: "Add a new feature ✨"
|
|
||||||
required: false
|
|
||||||
- label: "Improve documentation 📚"
|
|
||||||
required: false
|
|
||||||
- label: "Create a plugin 🧩"
|
|
||||||
required: false
|
|
||||||
- label: "Improve the UI/design 🎨"
|
|
||||||
required: false
|
|
||||||
- label: "Write tests 🧪"
|
|
||||||
required: false
|
|
||||||
- label: "Not sure - I want to help but need guidance!"
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
attributes:
|
attributes:
|
||||||
label: Have you read our guides?
|
label: What would you like to work on?
|
||||||
options:
|
options:
|
||||||
- label: "Contributing guide (see CONTRIBUTING.md)"
|
- label: Fixing a bug
|
||||||
required: true
|
- label: A new feature
|
||||||
- label: "Architecture Guide (see docs/ARCHITECTURE.md)"
|
- label: A plugin
|
||||||
required: true
|
- label: UI and design
|
||||||
- label: "Plugin Development Guide (see docs/plugins/README.md)"
|
- label: Tests
|
||||||
|
- label: Documentation
|
||||||
|
- label: Not sure yet, I'd like suggestions
|
||||||
|
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: Have you read the guides?
|
||||||
|
options:
|
||||||
|
- label: "[CONTRIBUTING.md](https://github.com/BetterSEQTA/BetterSEQTA-Plus/blob/main/CONTRIBUTING.md)"
|
||||||
required: true
|
required: true
|
||||||
|
- label: "The [architecture guide](https://docs.betterseqta.org/architecture/)"
|
||||||
|
- label: "The [plugin development guide](https://docs.betterseqta.org/plugin-development/), if you're writing a plugin"
|
||||||
|
|
||||||
- type: checkboxes
|
- type: dropdown
|
||||||
attributes:
|
attributes:
|
||||||
label: Have you set up the development environment yet?
|
label: Is your dev environment working?
|
||||||
options:
|
options:
|
||||||
- label: Yes, everything works! 🎉
|
- Yes, `npm run dev` works
|
||||||
required: false
|
- Partly, I'm running into issues
|
||||||
- label: Partially - I can run `npm run dev` but having some issues
|
- Not set up yet
|
||||||
required: false
|
validations:
|
||||||
- label: No, I need help with setup
|
required: true
|
||||||
required: false
|
|
||||||
- label: I tried but ran into errors (please describe below)
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: input
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Errors
|
label: Errors
|
||||||
description: "Please list any encountered errors here:"
|
description: Paste any errors you've hit.
|
||||||
placeholder: "I am encountering issues with..."
|
render: shell
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
- type: input
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Questions or Issues
|
label: Questions
|
||||||
description: "Tell us:
|
description: What would you like help with? Is anything in the docs unclear?
|
||||||
1. What specifically would you like help with?
|
|
||||||
2. Are you stuck on anything?
|
|
||||||
3. Do you have any questions about the codebase?
|
|
||||||
4. Is there anything in our documentation that's unclear?"
|
|
||||||
placeholder: "I want help with..."
|
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: Ideas or Suggestions
|
|
||||||
description: "If you have any ideas for features, improvements, or just want to share your thoughts:"
|
|
||||||
placeholder: "It would be cool if I could help add..."
|
|
||||||
validations:
|
|
||||||
required: false
|
|
||||||
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
## What happens next?
|
|
||||||
|
|
||||||
A maintainer will respond within 24-48 hours to:
|
|
||||||
- Answer your questions
|
|
||||||
- Suggest some good issues to work on
|
|
||||||
- Help you with setup if needed
|
|
||||||
- Point you to relevant documentation
|
|
||||||
|
|
||||||
Don't worry if you're new to this - we're here to help! Every expert was once a beginner. 🚀
|
|
||||||
|
|
||||||
**Join our [Discord server](https://discord.gg/YzmbnCDkat) for real-time help and community chat!**
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,14 +1,17 @@
|
|||||||
## Description
|
## What does this change?
|
||||||
|
|
||||||
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.
|
<!-- A short summary, and why it's needed. -->
|
||||||
|
|
||||||
Fixes # (issue)
|
Fixes #
|
||||||
|
|
||||||
## Type of change
|
## Type of change
|
||||||
|
|
||||||
Please delete options that are not relevant.
|
- [ ] Bug fix
|
||||||
|
- [ ] New feature
|
||||||
|
- [ ] Breaking change
|
||||||
|
- [ ] Docs or tooling only
|
||||||
|
|
||||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
## Checklist
|
||||||
- [ ] New feature (non-breaking change which adds functionality)
|
|
||||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
- [ ] `npm run lint`, `npm test` and `npm run build` pass
|
||||||
- [ ] This change requires a documentation update
|
- [ ] Tested on a SEQTA page
|
||||||
@@ -1,15 +1,11 @@
|
|||||||
# Nightly release workflow — updates the same "nightly" release with fresh builds from main.
|
# Rebuilds main every night and replaces the assets on the "nightly" prerelease.
|
||||||
# Runs only on BetterSEQTA/BetterSEQTA-Plus. Uses the default GITHUB_TOKEN.
|
# Runs on Windows because the layerchart Svelte build fails on Linux.
|
||||||
#
|
|
||||||
# Scheduled at midnight Australia/Adelaide (ACST/ACDT). GitHub cron is UTC-only, so we
|
|
||||||
# trigger at 13:30 and 14:30 UTC and only proceed when Adelaide local time is 00:00.
|
|
||||||
# Builds on windows-latest (matches local dev; Linux nightly builds were failing on Vite/Svelte).
|
|
||||||
|
|
||||||
name: Nightly Release
|
name: Nightly Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
# 13:30 UTC = 00:00 Adelaide during daylight saving (ACDT, UTC+10:30)
|
# Midnight in Adelaide during daylight saving (UTC+10:30).
|
||||||
- cron: "30 13 * * *"
|
- cron: "30 13 * * *"
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
# windows-latest: Vite/Svelte build fails on Linux CI for layerchart vendor .svelte (see nightly.yml).
|
# The layerchart Svelte build fails on Linux, so CI runs on Windows.
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
# Manual release workflow only — runs on BetterSEQTA/BetterSEQTA-Plus via workflow_dispatch.
|
# Manual stable release. Bump the version in package.json on main first.
|
||||||
# Bump package.json version on main, confirm when dispatching, then run.
|
|
||||||
# Uses the default GITHUB_TOKEN (contents: write).
|
|
||||||
|
|
||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -59,8 +59,9 @@ representative at an online or offline event.
|
|||||||
## Enforcement
|
## Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
reported to the community leaders responsible for enforcement at
|
reported to the community leaders responsible for enforcement by emailing
|
||||||
N/A (literally sorry guys).
|
[betterseqta.plus@gmail.com](mailto:betterseqta.plus@gmail.com) or messaging a
|
||||||
|
moderator in the [Discord](https://discord.gg/YzmbnCDkat).
|
||||||
All complaints will be reviewed and investigated promptly and fairly.
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
All community leaders are obligated to respect the privacy and security of the
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
|||||||
+5
-9
@@ -7,7 +7,7 @@ Thanks for helping out! For anything bigger than a small fix, open an issue or a
|
|||||||
You need Node.js 26+, Git and a Chromium browser (Chrome, Edge or Brave).
|
You need Node.js 26+, Git and a Chromium browser (Chrome, Edge or Brave).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/YOUR_USERNAME/BetterSEQTA-Plus.git
|
git clone https://github.com/YOUR_USERNAME/BetterSEQTA-Plus
|
||||||
cd BetterSEQTA-Plus
|
cd BetterSEQTA-Plus
|
||||||
npm install
|
npm install
|
||||||
npm run dev
|
npm run dev
|
||||||
@@ -33,7 +33,7 @@ For Firefox, run `npm run dev:firefox` and load `dist/firefox` from `about:debug
|
|||||||
| `src/css/` | Injected styles and the shared Tailwind setup |
|
| `src/css/` | Injected styles and the shared Tailwind setup |
|
||||||
| `lib/`, `scripts/` | Vite plugins and build scripts |
|
| `lib/`, `scripts/` | Vite plugins and build scripts |
|
||||||
|
|
||||||
[ARCHITECTURE.md](docs/ARCHITECTURE.md) goes into more detail.
|
The [architecture guide](https://docs.betterseqta.org/architecture/) goes into more detail.
|
||||||
|
|
||||||
## Making changes
|
## Making changes
|
||||||
|
|
||||||
@@ -55,13 +55,9 @@ For Firefox, run `npm run dev:firefox` and load `dist/firefox` from `about:debug
|
|||||||
|
|
||||||
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.
|
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/)
|
|
||||||
|
|
||||||
## More docs
|
## More docs
|
||||||
|
|
||||||
- [Troubleshooting](docs/TROUBLESHOOTING.md)
|
- [Plugin development](https://docs.betterseqta.org/plugin-development/) and the [Plugin API](https://docs.betterseqta.org/plugin-api/)
|
||||||
|
- [Theme creation](https://docs.betterseqta.org/theme-creation/)
|
||||||
|
- [Troubleshooting](https://docs.betterseqta.org/troubleshooting/)
|
||||||
- [Releases and CI](docs/RELEASES.md)
|
- [Releases and CI](docs/RELEASES.md)
|
||||||
- [Theme creation](docs/THEME_CREATION.md)
|
|
||||||
@@ -3,92 +3,61 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
A beautiful 🤩 browser extension that transforms <a href="https://www.tes.com/en-au/for-schools/seqta">SEQTA</a> with modern themes, powerful customization, productivity tools, and an improved user experience. Contributions are always welcome!
|
A browser extension that makes <a href="https://www.tes.com/en-au/for-schools/seqta">SEQTA</a> faster, nicer to look at and easier to use.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a target="_blank" href="https://chromewebstore.google.com/detail/betterseqta+/afdgaoaclhkhemfkkkonemoapeinchel"><img src="https://user-images.githubusercontent.com/95666457/149519713-159d7ef7-2c21-4034-a616-f037ff46d9a4.png" alt="ChromeDownload" width="250"></a>
|
<a target="_blank" href="https://chromewebstore.google.com/detail/betterseqta+/afdgaoaclhkhemfkkkonemoapeinchel"><img src="https://user-images.githubusercontent.com/95666457/149519713-159d7ef7-2c21-4034-a616-f037ff46d9a4.png" alt="Available in the Chrome Web Store" width="250"></a>
|
||||||
<a target="_blank" href="https://discord.gg/YzmbnCDkat"><img src="https://github.com/BetterSEQTA/BetterSEQTA-Plus/assets/108050083/23055730-b16e-44c0-9bef-221d8545af92" width="240" style="border-radius:10%;" /></a>
|
<a target="_blank" href="https://discord.gg/YzmbnCDkat"><img src="https://github.com/BetterSEQTA/BetterSEQTA-Plus/assets/108050083/23055730-b16e-44c0-9bef-221d8545af92" alt="Join the Discord" width="240" style="border-radius:10%;" /></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div>
|
<p align="center">
|
||||||
<img src="https://img.shields.io/chrome-web-store/users/afdgaoaclhkhemfkkkonemoapeinchel" />
|
<img src="https://img.shields.io/chrome-web-store/users/afdgaoaclhkhemfkkkonemoapeinchel" alt="Chrome Web Store users" />
|
||||||
<img src="https://img.shields.io/chrome-web-store/rating/afdgaoaclhkhemfkkkonemoapeinchel" />
|
<img src="https://img.shields.io/chrome-web-store/rating/afdgaoaclhkhemfkkkonemoapeinchel" alt="Chrome Web Store rating" />
|
||||||
</div>
|
</p>
|
||||||
|
|
||||||
## Documentation
|
|
||||||
|
|
||||||
Everything you need to get started with BetterSEQTA+ can be found in the [official documentation](https://docs.betterseqta.org).
|
|
||||||
|
|
||||||
Includes:
|
|
||||||
- Getting Started
|
|
||||||
- Installation & Development
|
|
||||||
- Architecture
|
|
||||||
- Plugin System
|
|
||||||
- Theme Creation
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Dark mode
|
- **Themes:** dark mode, custom colours and backgrounds, a community theme store and a theme creator.
|
||||||
- Custom Background/Themes
|
- **Home page:** today's lessons, upcoming assessments, notices and your own shortcuts in one place.
|
||||||
- Improved Styling/CSS
|
- **Global search:** jump to assessments, messages, courses and notices from a keyboard shortcut.
|
||||||
- Improved look for SEQTA Learn
|
- **Assessments:** an overview board grouped by status, averages and weightings on the assessments page, and grade analytics with trends and charts.
|
||||||
- Custom Home Page including:
|
- **Timetable:** extra timetable tools, editable room and teacher names, calendar sync and opt-in classmates.
|
||||||
- Daily Lessons
|
- **Messages and notifications:** custom message folders and a local archive of notifications that outlasts SEQTA's own history.
|
||||||
- Shortcuts
|
- **BetterSEQTA Cloud:** sign in to back up your settings and use your profile picture across devices.
|
||||||
- Easier Access Notices
|
- **Extras:** hide side menu items, animated backgrounds, background music and the classic kitten 404 page.
|
||||||
- Assessments
|
|
||||||
- Options to remove certain items from the side menu
|
|
||||||
- Grades calculator
|
|
||||||
- Fully customisable themes and an official theme store
|
|
||||||
- Notification for next lesson (sent 5 minutes before end of the lesson)
|
|
||||||
- Browser Support
|
|
||||||
- Chrome, Edge, Brave, Opera and other Chromium-Based browsers are supported
|
|
||||||
- Firefox Supported: [here](https://addons.mozilla.org/en-US/firefox/addon/betterseqta-plus/)!
|
|
||||||
- Safari (Experimental and not recommended - only available via compilation)
|
|
||||||
|
|
||||||
## Creating Custom Themes
|
Works in Chrome, Edge, Brave, Opera and other Chromium browsers, and in [Firefox](https://addons.mozilla.org/en-US/firefox/addon/betterseqta-plus/). Safari support is experimental and needs a build from source.
|
||||||
|
|
||||||
If you are looking to create custom themes, I would recommend you start at the official documentation [here](https://docs.betterseqta.org/theme-creation/). You can see some premade examples along with a compilation script that can be used to allow for CSS frameworks and libraries such as SCSS to be used [here](https://github.com/BetterSEQTA/BetterSEQTA-Theme-Generator).
|
## Documentation
|
||||||
|
|
||||||
Don't worry- if you get stuck feel free to ask around in the [discord](https://discord.gg/YzmbnCDkat). We're open and happy to help out! Happy creating :)
|
Guides for installing, making themes and writing plugins are at **[docs.betterseqta.org](https://docs.betterseqta.org)**. If you get stuck, ask in the [Discord](https://discord.gg/YzmbnCDkat).
|
||||||
|
|
||||||
## 🚀 Contributing
|
## Contributing
|
||||||
**New contributors welcome!**
|
|
||||||
- 📖 Start here: https://docs.betterseqta.org/install/
|
|
||||||
- 🧠 Architecture: https://docs.betterseqta.org/architecture/
|
|
||||||
- 🧩 Plugins: https://docs.betterseqta.org/plugins/
|
|
||||||
- 💬 Discord: https://discord.gg/YzmbnCDkat
|
|
||||||
|
|
||||||
|
Contributions are welcome. Setup takes a few minutes:
|
||||||
## ⚡ Quick Start
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/YOUR_USERNAME_FORKED_WITH/BetterSEQTA-Plus
|
git clone https://github.com/YOUR_USERNAME/BetterSEQTA-Plus
|
||||||
cd BetterSEQTA-Plus
|
cd BetterSEQTA-Plus
|
||||||
npm install
|
npm install
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Then load `dist` in `chrome://extensions` (Developer Mode → Load unpacked).
|
Then open `chrome://extensions`, turn on Developer mode, click **Load unpacked** and pick `dist/chrome`.
|
||||||
|
|
||||||
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for the full guide.
|
||||||
|
|
||||||
Full development setup guide can be found [here](https://docs.betterseqta.org/install/#for-developers-development-environment).
|
<a href="https://github.com/BetterSEQTA/BetterSEQTA-Plus/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=betterseqta/betterseqta-plus" alt="Contributors" />
|
||||||
## Contributors
|
|
||||||
|
|
||||||
<a href="https://github.com/betterseqta/betterseqta-plus/graphs/contributors">
|
|
||||||
<img src="https://contrib.rocks/image?repo=betterseqta/betterseqta-plus" />
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
Want to contribute? [Click Here!](https://docs.betterseqta.org/contributing/)
|
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
Originally developed by [Nulkem](https://github.com/Nulkem/betterseqta)
|
Originally developed by [Nulkem](https://github.com/Nulkem/betterseqta).
|
||||||
Ported to Manifest V3 by [MEGA-Dawg68](https://github.com/MEGA-Dawg68)
|
Ported to Manifest V3 by [MEGA-Dawg68](https://github.com/MEGA-Dawg68).
|
||||||
Maintained by [SethBurkart123](https://github.com/SethBurkart123), [Crazypersonalph](https://github.com/Crazypersonalph) & the rest of the BetterSEQTA team!
|
Maintained by [SethBurkart123](https://github.com/SethBurkart123), [Crazypersonalph](https://github.com/Crazypersonalph) and the rest of the BetterSEQTA team.
|
||||||
|
|
||||||
## Star History
|
## Star history
|
||||||
|
|
||||||
[](https://star-history.com/#BetterSEQTA/BetterSEQTA-Plus&Date)
|
[](https://star-history.com/#BetterSEQTA/BetterSEQTA-Plus&Date)
|
||||||
+5
-12
@@ -1,16 +1,9 @@
|
|||||||
# Security Policy
|
# Security policy
|
||||||
|
|
||||||
## Supported Versions
|
## Supported versions
|
||||||
|
|
||||||
The following versions of BetterSEQTA+ are currently supported.
|
Only the latest release gets security fixes. Store installs update automatically. If you sideload from GitHub, grab the newest [release](https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases).
|
||||||
|
|
||||||
| Version | Supported |
|
## Reporting a vulnerability
|
||||||
| ------- | --------- |
|
|
||||||
| 3.4.3 or later | ✅ |
|
|
||||||
| Earlier than 3.4.3 | ❌ |
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
Please report vulnerabilities privately through [GitHub Security Advisories](https://github.com/BetterSEQTA/BetterSEQTA-Plus/security/advisories/new), not in a public issue.
|
||||||
|
|
||||||
If you discover a security vulnerability, please report it responsibly through GitHub Security Advisories:
|
|
||||||
|
|
||||||
https://github.com/BetterSEQTA/BetterSEQTA-Plus/security/advisories/new
|
|
||||||
@@ -1,237 +0,0 @@
|
|||||||
# BetterSEQTA+ Architecture
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/architecture/](https://docs.betterseqta.org/architecture/)
|
|
||||||
|
|
||||||
Hey there! 👋 New to the codebase and feeling a bit lost? Don't worry - this guide will help you understand how everything fits together!
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Overview](#overview)
|
|
||||||
- [High-Level Architecture](#high-level-architecture)
|
|
||||||
- [Core Components](#core-components)
|
|
||||||
- [Plugin System](#plugin-system)
|
|
||||||
- [File Structure Explained](#file-structure-explained)
|
|
||||||
- [Data Flow](#data-flow)
|
|
||||||
- [Browser Extension Basics](#browser-extension-basics)
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
BetterSEQTA+ is a browser extension that enhances SEQTA Learn by:
|
|
||||||
- Adding new features through a plugin system
|
|
||||||
- Providing customizable themes and UI improvements
|
|
||||||
- Offering better navigation and user experience
|
|
||||||
|
|
||||||
Think of it like this: **SEQTA Learn + BetterSEQTA+ = Enhanced SEQTA Experience**
|
|
||||||
|
|
||||||
## High-Level Architecture
|
|
||||||
|
|
||||||
```
|
|
||||||
┌─────────────────────────────────────────────────────────────┐
|
|
||||||
│ BROWSER EXTENSION │
|
|
||||||
├─────────────────────────────────────────────────────────────┤
|
|
||||||
│ │
|
|
||||||
│ ┌─────────────────┐ ┌──────────────────┐ │
|
|
||||||
│ │ Background │ │ Content Script │ │
|
|
||||||
│ │ Script │ │ (SEQTA.ts) │ │
|
|
||||||
│ │ │ │ │ │
|
|
||||||
│ │ - Settings │◄───┤ - Page Detection│ │
|
|
||||||
│ │ - Storage │ │ - Plugin Loading│ │
|
|
||||||
│ │ - Updates │ │ - UI Injection │ │
|
|
||||||
│ └─────────────────┘ └──────────────────┘ │
|
|
||||||
│ │ │
|
|
||||||
│ ┌─────────▼─────────┐ │
|
|
||||||
│ │ Plugin System │ │
|
|
||||||
│ │ │ │
|
|
||||||
│ │ ┌─────────────┐ │ │
|
|
||||||
│ │ │ Built-in │ │ │
|
|
||||||
│ │ │ Plugins │ │ │
|
|
||||||
│ │ │ │ │ │
|
|
||||||
│ │ │ - Themes │ │ │
|
|
||||||
│ │ │ - Search │ │ │
|
|
||||||
│ │ │ - Timetable │ │ │
|
|
||||||
│ │ │ - etc... │ │ │
|
|
||||||
│ │ └─────────────┘ │ │
|
|
||||||
│ └───────────────────┘ │
|
|
||||||
│ │ │
|
|
||||||
│ ┌─────────▼─────────┐ │
|
|
||||||
│ │ Settings UI │ │
|
|
||||||
│ │ (Svelte App) │ │
|
|
||||||
│ │ │ │
|
|
||||||
│ │ - Plugin Config │ │
|
|
||||||
│ │ - Theme Creator │ │
|
|
||||||
│ │ - General Settings│ │
|
|
||||||
│ └───────────────────┘ │
|
|
||||||
└─────────────────────────────────────────────────────────────┘
|
|
||||||
│
|
|
||||||
┌─────────▼─────────┐
|
|
||||||
│ SEQTA Learn │
|
|
||||||
│ Website │
|
|
||||||
└───────────────────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
## Core Components
|
|
||||||
|
|
||||||
### 1. Entry Point (`src/SEQTA.ts`)
|
|
||||||
This is where it all begins! When you visit a SEQTA page:
|
|
||||||
1. Detects if you're on a SEQTA Learn page
|
|
||||||
2. Injects our CSS styles
|
|
||||||
3. Changes the favicon to BetterSEQTA+ icon
|
|
||||||
4. Loads settings from storage
|
|
||||||
5. Initializes the plugin system
|
|
||||||
|
|
||||||
### 2. Plugin System (`src/plugins/`)
|
|
||||||
The heart of BetterSEQTA+! This is what makes it extensible:
|
|
||||||
- **Plugin Manager**: Registers and manages all plugins
|
|
||||||
- **Built-in Plugins**: Pre-made plugins (themes, search, etc.)
|
|
||||||
- **Plugin API**: Provides plugins with tools to interact with SEQTA
|
|
||||||
|
|
||||||
### 3. Settings UI (`src/interface/`)
|
|
||||||
A Svelte application that lets users:
|
|
||||||
- Enable/disable plugins
|
|
||||||
- Configure plugin settings
|
|
||||||
- Create custom themes
|
|
||||||
- Browse the theme store
|
|
||||||
|
|
||||||
### 4. Background Script (`src/background.ts`)
|
|
||||||
Runs in the background and handles:
|
|
||||||
- Extension-wide settings storage
|
|
||||||
- Communication between different parts
|
|
||||||
- Update notifications
|
|
||||||
|
|
||||||
## Plugin System
|
|
||||||
|
|
||||||
Our plugin system is what makes BetterSEQTA+ so powerful. Here's how it works:
|
|
||||||
|
|
||||||
### Plugin Lifecycle
|
|
||||||
```
|
|
||||||
Plugin Registration → Settings Loading → Plugin Initialization → Running → Cleanup
|
|
||||||
```
|
|
||||||
|
|
||||||
### Built-in Plugins Overview
|
|
||||||
|
|
||||||
| Plugin | What it does | Files |
|
|
||||||
|--------|-------------|-------|
|
|
||||||
| **Themes** | Custom CSS themes and backgrounds | `src/plugins/built-in/themes/` |
|
|
||||||
| **Global Search** | Search across all SEQTA content | `src/plugins/built-in/globalSearch/` |
|
|
||||||
| **Timetable** | Enhanced timetable features | `src/plugins/built-in/timetable/` |
|
|
||||||
| **Profile Picture** | Custom profile pictures | `src/plugins/built-in/profilePicture/` |
|
|
||||||
| **Animated Background** | Moving background animations | `src/plugins/built-in/animatedBackground/` |
|
|
||||||
|
|
||||||
### Creating a Plugin
|
|
||||||
Every plugin follows this structure:
|
|
||||||
```typescript
|
|
||||||
const myPlugin: Plugin = {
|
|
||||||
id: "unique-plugin-id",
|
|
||||||
name: "Human Readable Name",
|
|
||||||
description: "What does this plugin do?",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: { /* user configurable options */ },
|
|
||||||
run: async (api) => {
|
|
||||||
// Your plugin code goes here!
|
|
||||||
}
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
## File Structure Explained
|
|
||||||
|
|
||||||
```
|
|
||||||
src/
|
|
||||||
├── SEQTA.ts # 🚀 Main entry point - start reading here!
|
|
||||||
├── background.ts # 🔧 Background script for extension
|
|
||||||
├── manifests/ # 📦 Browser extension manifests
|
|
||||||
├── plugins/ # 🧩 Plugin system (the magic happens here!)
|
|
||||||
│ ├── core/ # 🏗️ Plugin infrastructure
|
|
||||||
│ ├── built-in/ # 🎁 Pre-made plugins
|
|
||||||
│ └── index.ts # 📋 Plugin registration
|
|
||||||
├── interface/ # 🎨 Settings UI (Svelte app)
|
|
||||||
│ ├── pages/ # 📄 Settings pages
|
|
||||||
│ ├── components/ # 🧱 Reusable UI components
|
|
||||||
│ └── main.ts # 🏠 Settings app entry point
|
|
||||||
├── seqta/ # 🔗 SEQTA-specific utilities
|
|
||||||
│ ├── main.ts # 🎯 Core SEQTA modifications
|
|
||||||
│ ├── ui/ # 🎨 UI manipulation helpers
|
|
||||||
│ └── utils/ # 🛠️ Helper functions
|
|
||||||
└── css/ # 💄 Styles and themes
|
|
||||||
```
|
|
||||||
|
|
||||||
### Where to Start Reading?
|
|
||||||
1. **New to the project?** Start with `src/SEQTA.ts`
|
|
||||||
2. **Want to understand plugins?** Look at `src/plugins/core/types.ts`
|
|
||||||
3. **Want to see a simple plugin?** Check out `src/plugins/built-in/profilePicture/`
|
|
||||||
4. **Interested in the UI?** Explore `src/interface/main.ts`
|
|
||||||
|
|
||||||
## Data Flow
|
|
||||||
|
|
||||||
Here's how data flows through the system:
|
|
||||||
|
|
||||||
```
|
|
||||||
User visits SEQTA → SEQTA.ts detects page → Loads settings from storage
|
|
||||||
│
|
|
||||||
▼
|
|
||||||
Plugin Manager initializes → Each plugin gets API access → Plugins modify SEQTA
|
|
||||||
│
|
|
||||||
▼
|
|
||||||
User opens settings → Svelte UI loads → Settings changed → Storage updated
|
|
||||||
│
|
|
||||||
▼
|
|
||||||
Storage change detected → Plugins notified → UI updates automatically
|
|
||||||
```
|
|
||||||
|
|
||||||
## Browser Extension Basics
|
|
||||||
|
|
||||||
Never worked on a browser extension before? Here's what you need to know:
|
|
||||||
|
|
||||||
### Content Scripts vs Background Scripts
|
|
||||||
- **Content Script** (`SEQTA.ts`): Runs on SEQTA pages, can access and modify the page
|
|
||||||
- **Background Script** (`background.ts`): Runs in the background, handles storage and messaging
|
|
||||||
|
|
||||||
### Manifest Files
|
|
||||||
Each browser needs a slightly different manifest file:
|
|
||||||
- `manifests/chrome.ts` - Chrome, Edge, Brave
|
|
||||||
- `manifests/firefox.ts` - Firefox
|
|
||||||
- `manifests/safari.ts` - Safari (experimental)
|
|
||||||
|
|
||||||
### Communication
|
|
||||||
Different parts of the extension communicate using:
|
|
||||||
- `browser.runtime.sendMessage()` - Send messages
|
|
||||||
- `browser.storage` - Shared storage, but we have created a custom storage system that is easier to use:
|
|
||||||
```ts
|
|
||||||
settingsState.[the setting name] = [whatever you want to set it to]
|
|
||||||
console.log(settingsState.[the setting name])
|
|
||||||
```
|
|
||||||
- Custom events for plugin communication
|
|
||||||
|
|
||||||
## Development Tips
|
|
||||||
|
|
||||||
### Debugging
|
|
||||||
1. **Chrome DevTools**: Right-click → Inspect → Console tab
|
|
||||||
2. **Extension Console**: `chrome://extensions` → BetterSEQTA+ → "Inspect views: background page"
|
|
||||||
3. **Look for logs**: We log everything with `[BetterSEQTA+]` prefix
|
|
||||||
|
|
||||||
### Making Changes
|
|
||||||
1. Edit code → Save → Browser auto-reloads extension → Refresh SEQTA page
|
|
||||||
2. For UI changes: The dev server hot-reloads automatically
|
|
||||||
3. For plugin changes: May need to disable/enable the plugin in settings
|
|
||||||
|
|
||||||
### Common Gotchas
|
|
||||||
- Settings take a moment to load (use `api.settings.loaded` promise)
|
|
||||||
- Some SEQTA elements load dynamically (use `api.seqta.onMount()`)
|
|
||||||
- Plugin cleanup is important (always return a cleanup function)
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
Ready to contribute? Here's what to do next:
|
|
||||||
|
|
||||||
1. **Read the code**: Start with `src/SEQTA.ts` and follow the flow
|
|
||||||
2. **Try creating a simple plugin**: Follow the [plugin documentation](https://docs.betterseqta.org/plugins/)
|
|
||||||
3. **Look at existing issues**: Check our [GitHub issues](https://github.com/BetterSEQTA/BetterSEQTA-plus/issues) for "good first issue" labels
|
|
||||||
4. **Join our Discord**: Get help from the community!
|
|
||||||
|
|
||||||
## Questions?
|
|
||||||
|
|
||||||
Still confused about something? That's totally normal! Here are your options:
|
|
||||||
- 💬 Ask in our [Discord server](https://discord.gg/YzmbnCDkat)
|
|
||||||
- 🐛 Open an issue on GitHub
|
|
||||||
- 📧 Email us at betterseqta.plus@gmail.com
|
|
||||||
|
|
||||||
Remember: **Every expert was once a beginner!** We're here to help you learn and contribute. 🚀
|
|
||||||
+14
-51
@@ -1,56 +1,19 @@
|
|||||||
# BetterSEQTA+ Documentation
|
# Docs
|
||||||
|
|
||||||
**Canonical documentation lives at [docs.betterseqta.org](https://docs.betterseqta.org/).** The pages below are the same topics; use the site for search, navigation, and the latest updates.
|
The main documentation lives at **[docs.betterseqta.org](https://docs.betterseqta.org/)**, built from [BetterSEQTA-Docs](https://github.com/BetterSEQTA/BetterSEQTA-Docs). Send fixes for those pages there.
|
||||||
|
|
||||||
## Table of Contents
|
| Topic | Where |
|
||||||
|
|-------|-------|
|
||||||
|
| Installing | [docs.betterseqta.org/install](https://docs.betterseqta.org/install/) |
|
||||||
|
| Architecture | [docs.betterseqta.org/architecture](https://docs.betterseqta.org/architecture/) |
|
||||||
|
| Writing plugins | [Plugin development](https://docs.betterseqta.org/plugin-development/), [Plugin API](https://docs.betterseqta.org/plugin-api/), [Example plugin](https://docs.betterseqta.org/example-plugin/) |
|
||||||
|
| Making themes | [docs.betterseqta.org/theme-creation](https://docs.betterseqta.org/theme-creation/) |
|
||||||
|
| Troubleshooting | [docs.betterseqta.org/troubleshooting](https://docs.betterseqta.org/troubleshooting/) |
|
||||||
|
|
||||||
### Getting Started
|
These pages only live in this repo because they track the code closely:
|
||||||
|
|
||||||
- [Documentation home](https://docs.betterseqta.org/)
|
- [RELEASES.md](RELEASES.md): CI, stable and nightly releases, and the update badge.
|
||||||
- [Installation](https://docs.betterseqta.org/install/)
|
- [CLOUD_SETTINGS_SYNC_SERVER.md](CLOUD_SETTINGS_SYNC_SERVER.md): the HTTP API the extension expects for cloud settings backup.
|
||||||
- [Contributing](https://docs.betterseqta.org/contributing/)
|
- [CLOUD_SETTINGS_SYNC_OPTIONS.md](CLOUD_SETTINGS_SYNC_OPTIONS.md): every value that goes into a cloud backup and how it is stored.
|
||||||
- [GitHub releases & CI](RELEASES.md) — workflows, nightly builds, update detector
|
|
||||||
- [Architecture](https://docs.betterseqta.org/architecture/)
|
|
||||||
- [Contribution guidelines (repository)](../CONTRIBUTING.md)
|
|
||||||
- [Troubleshooting](https://docs.betterseqta.org/troubleshooting/)
|
|
||||||
|
|
||||||
### Features & customization
|
For contributing, see [CONTRIBUTING.md](../CONTRIBUTING.md).
|
||||||
|
|
||||||
- [Features](https://docs.betterseqta.org/features/)
|
|
||||||
- [Themes & customization](https://docs.betterseqta.org/customization/)
|
|
||||||
- [Theme creation](https://docs.betterseqta.org/theme-creation/)
|
|
||||||
|
|
||||||
### Plugin system
|
|
||||||
|
|
||||||
- [Plugins overview](https://docs.betterseqta.org/plugins/)
|
|
||||||
- [Plugin development](https://docs.betterseqta.org/plugin-development/)
|
|
||||||
- [Plugin API](https://docs.betterseqta.org/plugin-api/)
|
|
||||||
- [Example plugin](https://docs.betterseqta.org/example-plugin/)
|
|
||||||
|
|
||||||
## Core Concepts
|
|
||||||
|
|
||||||
BetterSEQTA+ is built around several core concepts:
|
|
||||||
|
|
||||||
1. **Plugin System**: BetterSEQTA+ uses a plugin system to extend SEQTA with new features. Plugins are self-contained pieces of code that can be enabled or disabled by the user. See the [plugins documentation](https://docs.betterseqta.org/plugins/).
|
|
||||||
|
|
||||||
2. **Type-Safe Settings**: Each plugin can define settings that are type-safe and automatically rendered in the settings UI. The settings system uses TypeScript decorators to make it easy to define settings with proper typing.
|
|
||||||
|
|
||||||
3. **Storage API**: Plugins can use the Storage API to persist data between sessions. The Storage API is also type-safe, ensuring that plugins can only access their own data.
|
|
||||||
|
|
||||||
4. **SEQTA Integration**: BetterSEQTA+ integrates with SEQTA Learn by injecting code into the page. This allows plugins to modify the SEQTA UI and add new features.
|
|
||||||
|
|
||||||
## Getting Help
|
|
||||||
|
|
||||||
If you need help with BetterSEQTA+, you can:
|
|
||||||
|
|
||||||
- [Open an Issue](https://github.com/BetterSEQTA/BetterSEQTA-Plus/issues) - Report bugs or request features
|
|
||||||
- [Join the Discord](https://discord.gg/YzmbnCDkat) - Chat with the community
|
|
||||||
- [Email the Maintainers](mailto:betterseqta.plus@gmail.com) - Contact the maintainers directly
|
|
||||||
|
|
||||||
## Contributing to the Documentation
|
|
||||||
|
|
||||||
We welcome contributions to the documentation. The published site is built from the documentation repository; see [Contributing](https://docs.betterseqta.org/contributing/) for how to help.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
BetterSEQTA+ is licensed under the [MIT License](../LICENSE).
|
|
||||||
+32
-242
@@ -1,267 +1,57 @@
|
|||||||
# GitHub releases, CI, and the update detector
|
# Releases, CI and the update badge
|
||||||
|
|
||||||
BetterSEQTA+ is distributed on the Chrome Web Store and Firefox Add-ons, but some users sideload builds from GitHub. This document explains how automated builds, releases, and the in-extension update badge work.
|
BetterSEQTA+ ships through the Chrome Web Store and Firefox Add-ons. GitHub also hosts sideload builds, and those builds can tell users when a newer one is out. This page covers how all of that is built.
|
||||||
|
|
||||||
All published releases target the upstream repository: **[BetterSEQTA/BetterSEQTA-Plus](https://github.com/BetterSEQTA/BetterSEQTA-Plus)**.
|
## Workflows
|
||||||
|
|
||||||
---
|
| Workflow | Runs on | What it does |
|
||||||
|
|----------|---------|--------------|
|
||||||
|
| [`pr-ci.yml`](../.github/workflows/pr-ci.yml) | Every pull request and push to `main` | Lint, unit tests, then build and smoke test. Uploads the zips as an artifact. |
|
||||||
|
| [`nightly.yml`](../.github/workflows/nightly.yml) | Daily at 13:30 UTC (midnight in Adelaide during daylight saving) | Builds `main` and replaces the assets on the `nightly` prerelease. |
|
||||||
|
| [`release.yml`](../.github/workflows/release.yml) | Manually only | Builds the version in `package.json` and publishes it as a release with that tag. |
|
||||||
|
|
||||||
## Overview
|
Every build goes through the shared [`build-extension`](../.github/actions/build-extension/action.yml) action: install with `npm ci`, run `npm run build` for Chrome and Firefox, then zip `dist/chrome` and `dist/firefox`. The release workflows publish with the default `GITHUB_TOKEN`, so they need no extra secrets.
|
||||||
|
|
||||||
```mermaid
|
## Publishing a stable release
|
||||||
flowchart TB
|
|
||||||
subgraph ci [Continuous integration]
|
|
||||||
PrCi[pr-ci.yml — every PR]
|
|
||||||
Mvp[mvp.yml — push to main]
|
|
||||||
end
|
|
||||||
|
|
||||||
subgraph releases [GitHub releases]
|
1. Bump `version` in `package.json` on `main` and push it.
|
||||||
Manual[release.yml — manual stable]
|
2. Go to Actions → **Release** → **Run workflow** and tick the confirmation box.
|
||||||
Nightly[nightly.yml — daily cron]
|
3. On the first run for a version, edit the release title and notes on GitHub afterwards.
|
||||||
end
|
|
||||||
|
|
||||||
subgraph output [Outputs]
|
Running it again for the same version only replaces the zips (`betterseqtaplus@{version}-chrome.zip` and `-firefox.zip`).
|
||||||
Zips["betterseqtaplus-VERSION-chrome.zip\nbetterseqtaplus-VERSION-firefox.zip"]
|
|
||||||
GhStable["Release tag: 3.7.0"]
|
|
||||||
GhNightly["Release tag: nightly"]
|
|
||||||
Badge[Update badge in settings]
|
|
||||||
end
|
|
||||||
|
|
||||||
PrCi -->|build only| NoRelease[No release]
|
## Nightly builds
|
||||||
Mvp -->|artifact| DistZip[dist.zip artifact]
|
|
||||||
|
|
||||||
Manual --> Zips
|
The `nightly` tag always points at the latest build of `main`. Each run renames the release to `Nightly (YYYY-MM-DD)` and replaces its zips (`betterseqtaplus-nightly-{date}-chrome.zip` and `-firefox.zip`). The release text comes from [`nightly-release-notes.md`](../.github/nightly-release-notes.md) when the release is first created.
|
||||||
Manual --> GhStable
|
|
||||||
Manual --> Badge
|
|
||||||
|
|
||||||
Nightly --> Zips
|
Get it from [releases/tag/nightly](https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases/tag/nightly).
|
||||||
Nightly --> GhNightly
|
|
||||||
Nightly --> Badge
|
|
||||||
```
|
|
||||||
|
|
||||||
| Workflow | Trigger | Creates a release? | Update detector in build? |
|
GitHub builds are for sideloading only. Never upload them to an extension store.
|
||||||
|----------|---------|------------------|---------------------------|
|
|
||||||
| `pr-ci.yml` | Every pull request to `main` | No | No |
|
|
||||||
| `mvp.yml` | Every push to `main` | No | No |
|
|
||||||
| `release.yml` | Manual (`workflow_dispatch`) | Yes — stable version tag | Yes — stable channel |
|
|
||||||
| `nightly.yml` | Daily at 03:00 UTC + manual | Yes — reuses `nightly` tag | Yes — nightly channel |
|
|
||||||
|
|
||||||
---
|
## Build-time flags
|
||||||
|
|
||||||
## Shared build action
|
Release workflows pass these into Vite, which bakes them in through `define` in [`vite.config.ts`](../vite.config.ts). Their types live in [`src/env.d.ts`](../src/env.d.ts).
|
||||||
|
|
||||||
All release and CI builds that need packaged extensions use the composite action at [`.github/actions/build-extension/action.yml`](../.github/actions/build-extension/action.yml).
|
| Variable | Stable | Nightly | PRs and local builds |
|
||||||
|
|----------|--------|---------|----------------------|
|
||||||
It:
|
| `GH_RELEASE_UPDATE_CHECK` | `true` | `true` | unset |
|
||||||
|
| `UPDATE_CHANNEL` | `stable` | `nightly` | unset |
|
||||||
1. Installs dependencies (`npm ci`)
|
|
||||||
2. Runs `npm run build` (Chrome then Firefox via Vite)
|
|
||||||
3. Zips each unpacked folder into sideload-ready archives:
|
|
||||||
- `dist/betterseqtaplus-{version}-chrome.zip`
|
|
||||||
- `dist/betterseqtaplus-{version}-firefox.zip`
|
|
||||||
|
|
||||||
The `{version}` comes from `package.json`.
|
|
||||||
|
|
||||||
### Build-time flags (release builds only)
|
|
||||||
|
|
||||||
Release and nightly workflows pass environment variables into Vite, which bakes them into the extension at compile time via `define` in [`vite.config.ts`](../vite.config.ts):
|
|
||||||
|
|
||||||
| Variable | Stable release | Nightly | PR / local dev |
|
|
||||||
|----------|----------------|---------|----------------|
|
|
||||||
| `GH_RELEASE_UPDATE_CHECK` | `true` | `true` | `false` / unset |
|
|
||||||
| `UPDATE_CHANNEL` | `stable` | `nightly` | `stable` (unused) |
|
|
||||||
| `GH_RELEASE_REPO` | `BetterSEQTA/BetterSEQTA-Plus` | same | same |
|
| `GH_RELEASE_REPO` | `BetterSEQTA/BetterSEQTA-Plus` | same | same |
|
||||||
| `BUILD_LABEL` | empty | UTC build date (`YYYY-MM-DD`) | empty |
|
| `BUILD_LABEL` | empty | UTC build date | empty |
|
||||||
|
|
||||||
When `GH_RELEASE_UPDATE_CHECK` is not `true`, the update-checker code is tree-shaken out of the bundle. PR CI builds and local `npm run build` do **not** include the update badge.
|
Without `GH_RELEASE_UPDATE_CHECK=true`, the update checker is removed from the bundle entirely. To try a release-style build locally:
|
||||||
|
|
||||||
To test a release-style build locally:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# PowerShell
|
|
||||||
$env:GH_RELEASE_UPDATE_CHECK="true"
|
|
||||||
$env:UPDATE_CHANNEL="stable"
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
# bash
|
|
||||||
GH_RELEASE_UPDATE_CHECK=true UPDATE_CHANNEL=stable npm run build
|
GH_RELEASE_UPDATE_CHECK=true UPDATE_CHANNEL=stable npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
## Update badge
|
||||||
|
|
||||||
## Stable release (`release.yml`)
|
Release builds show an amber **Update — {version}** pill at the bottom of the settings sidebar when a newer build exists. Clicking it opens the releases page. The logic is in [`src/utils/githubReleaseUpdate.ts`](../src/utils/githubReleaseUpdate.ts):
|
||||||
|
|
||||||
**Purpose:** A safe, manual way to publish versioned builds that users can download from GitHub.
|
- **Stable** compares the highest semver release tag (ignoring `nightly`) with the installed version.
|
||||||
|
- **Nightly** compares the `nightly` release's publish time with the last one seen, stored as `lastSeenNightlyPublishedAt`. The first check after install only records it.
|
||||||
|
|
||||||
**Trigger:** Manual only — Actions → **Release** → **Run workflow**. There is no schedule or automatic trigger.
|
Checks run at most every 6 hours (`localStorage` key `bsplus_lastGhReleaseCheck`).
|
||||||
|
|
||||||
When dispatching, check **“I have already updated the version in package.json”**. The workflow will not run without that confirmation.
|
To test the badge without publishing, turn on dev mode (click the settings logo and type `dev`), then set **GitHub latest version override** in the Advanced section to a higher version such as `9.9.9`.
|
||||||
|
|
||||||
### Before you run it
|
|
||||||
|
|
||||||
1. Merge your changes to `main`.
|
|
||||||
2. Bump `version` in [`package.json`](../package.json) (e.g. `3.7.0` → `3.8.0`).
|
|
||||||
3. Commit and push that bump.
|
|
||||||
|
|
||||||
### What the workflow does
|
|
||||||
|
|
||||||
1. Aborts if the version confirmation was not checked.
|
|
||||||
2. Reads the version from `package.json`.
|
|
||||||
3. Builds Chrome and Firefox with the update detector enabled (stable channel).
|
|
||||||
4. If no release exists for that tag: creates one (e.g. `3.8.0`) with a placeholder description.
|
|
||||||
5. If a release already exists for that tag: **only replaces the zip assets** (`--clobber`). Title and body are left unchanged.
|
|
||||||
6. Uploads `betterseqtaplus-{version}-chrome.zip` and `-firefox.zip`.
|
|
||||||
|
|
||||||
On first publish, edit the **title** and **release notes** on GitHub afterward. Re-running for the same version refreshes the files only.
|
|
||||||
|
|
||||||
### Downloading and installing
|
|
||||||
|
|
||||||
1. Open [github.com/BetterSEQTA/BetterSEQTA-Plus/releases](https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases).
|
|
||||||
2. Pick the version you want.
|
|
||||||
3. Download `betterseqtaplus-{version}-chrome.zip` or `-firefox.zip`.
|
|
||||||
4. Unzip and load the unpacked folder as a temporary extension (Chrome: Extensions → Load unpacked; Firefox: `about:debugging` → Load Temporary Add-on).
|
|
||||||
|
|
||||||
**These GitHub builds are for sideloading only. Do not upload them to the Chrome Web Store or Firefox Add-ons.**
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Nightly release (`nightly.yml`)
|
|
||||||
|
|
||||||
**Purpose:** Continuous experimental builds from `main` so testers always have a single place to get the latest code.
|
|
||||||
|
|
||||||
**Trigger:**
|
|
||||||
|
|
||||||
- Automatically every day at **03:00 UTC**
|
|
||||||
- Manually via Actions → **Nightly Release** → **Run workflow**
|
|
||||||
|
|
||||||
### What the workflow does
|
|
||||||
|
|
||||||
1. Builds from the current `main` branch with the update detector enabled (nightly channel).
|
|
||||||
2. Uses a fixed release tag: **`nightly`** (marked as prerelease).
|
|
||||||
3. On first run: creates the `nightly` release with the text in [`.github/nightly-release-notes.md`](../.github/nightly-release-notes.md).
|
|
||||||
4. On every run: sets the release title to **`Nightly (YYYY-MM-DD)`** (UTC build date) and **replaces** the zip assets on the same release (`--clobber`). The release body is not rewritten.
|
|
||||||
5. Packages zips as `betterseqtaplus-nightly-{date}-chrome.zip` / `-firefox.zip`.
|
|
||||||
|
|
||||||
The nightly release body warns that builds are experimental and must not be uploaded to extension stores.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## PR CI (`pr-ci.yml`)
|
|
||||||
|
|
||||||
**Purpose:** Verify that every pull request builds cleanly in a fresh environment.
|
|
||||||
|
|
||||||
**Trigger:** Every pull request targeting `main`.
|
|
||||||
|
|
||||||
**Steps:**
|
|
||||||
|
|
||||||
1. `npm ci`
|
|
||||||
2. `npm run lint` (ESLint on `src/**/*.{js,ts}`)
|
|
||||||
3. Build via the shared action with **no** update detector
|
|
||||||
|
|
||||||
No release is created and no artifacts are published for end users.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Push CI (`mvp.yml`)
|
|
||||||
|
|
||||||
**Purpose:** Build verification when code lands on `main`.
|
|
||||||
|
|
||||||
**Trigger:** Push to `main` only (not pull requests — those use `pr-ci.yml`).
|
|
||||||
|
|
||||||
Uploads a `dist.zip` artifact containing the full `dist/` folder for debugging. No release, no update detector.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Authentication
|
|
||||||
|
|
||||||
Release workflows run **only on [BetterSEQTA/BetterSEQTA-Plus](https://github.com/BetterSEQTA/BetterSEQTA-Plus)**. They use the default `GITHUB_TOKEN` with `contents: write` — no extra secrets or PATs required.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Update detector (in-extension)
|
|
||||||
|
|
||||||
GitHub release builds include a small feature that tells sideload users when a newer build is available, so they do not have to check GitHub manually.
|
|
||||||
|
|
||||||
### Where it appears
|
|
||||||
|
|
||||||
In the **settings popup** header (top-right): an amber **“Update available — X.X.X”** pill when an update exists, plus a muted line:
|
|
||||||
|
|
||||||
> GitHub release build — do not upload to extension stores.
|
|
||||||
|
|
||||||
Clicking the badge opens the relevant GitHub releases page.
|
|
||||||
|
|
||||||
### How it checks for updates
|
|
||||||
|
|
||||||
Implementation: [`src/utils/githubReleaseUpdate.ts`](../src/utils/githubReleaseUpdate.ts)
|
|
||||||
|
|
||||||
**Stable channel** (from `release.yml` builds):
|
|
||||||
|
|
||||||
1. Fetches releases from the GitHub API for `BetterSEQTA/BetterSEQTA-Plus`.
|
|
||||||
2. Ignores the `nightly` tag and any non-semver tags.
|
|
||||||
3. Finds the highest semver tag.
|
|
||||||
4. Compares it to `browser.runtime.getManifest().version`.
|
|
||||||
5. Shows the badge if the remote version is newer.
|
|
||||||
|
|
||||||
**Nightly channel** (from `nightly.yml` builds):
|
|
||||||
|
|
||||||
1. Fetches the `nightly` release.
|
|
||||||
2. Compares its `published_at` timestamp to `lastSeenNightlyPublishedAt` in extension storage.
|
|
||||||
3. On first install, records the current publish time without showing a badge.
|
|
||||||
4. Shows **“Update available — nightly (YYYY-MM-DD)”** when a newer nightly has been published.
|
|
||||||
|
|
||||||
Checks are throttled to once every **6 hours** per browser profile (`localStorage` key `bsplus_lastGhReleaseCheck`). Recent results are cached in memory for the session.
|
|
||||||
|
|
||||||
### Dev override (testing)
|
|
||||||
|
|
||||||
To test the badge without publishing a real release:
|
|
||||||
|
|
||||||
1. Open settings and unlock **dev mode** (click the logo, type `dev`).
|
|
||||||
2. In the developer section, set **GitHub latest version override** to a version higher than your installed one (e.g. `9.9.9`).
|
|
||||||
3. Reopen settings — the badge should appear.
|
|
||||||
|
|
||||||
This only applies when dev mode is on. Clear the field to return to normal API checks.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## File reference
|
|
||||||
|
|
||||||
| Path | Role |
|
|
||||||
|------|------|
|
|
||||||
| `.github/actions/build-extension/action.yml` | Shared install, build, zip |
|
|
||||||
| `.github/workflows/release.yml` | Manual stable releases |
|
|
||||||
| `.github/workflows/nightly.yml` | Nightly releases |
|
|
||||||
| `.github/workflows/pr-ci.yml` | PR lint + build |
|
|
||||||
| `.github/workflows/mvp.yml` | Push-to-main build artifact |
|
|
||||||
| `.github/nightly-release-notes.md` | Static body for the `nightly` release |
|
|
||||||
| `vite.config.ts` | Injects build-time `define` flags |
|
|
||||||
| `src/env.d.ts` | TypeScript declarations for those flags |
|
|
||||||
| `src/utils/githubReleaseUpdate.ts` | Update check logic |
|
|
||||||
| `src/interface/pages/settings.svelte` | Badge and disclaimer UI |
|
|
||||||
| `src/interface/pages/settings/general.svelte` | Dev override input |
|
|
||||||
| `src/types/storage.ts` | `devGhReleaseVersionOverride`, `lastSeenNightlyPublishedAt` |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Quick reference
|
|
||||||
|
|
||||||
### Publish a stable release
|
|
||||||
|
|
||||||
```text
|
|
||||||
1. Bump version in package.json on main
|
|
||||||
2. Actions → Release → Run workflow → confirm version checkbox
|
|
||||||
3. Edit release title/notes on GitHub (first time only)
|
|
||||||
4. Re-run with same version to refresh zips without changing release text
|
|
||||||
```
|
|
||||||
|
|
||||||
### Get the latest nightly
|
|
||||||
|
|
||||||
```text
|
|
||||||
https://github.com/BetterSEQTA/BetterSEQTA-Plus/releases/tag/nightly
|
|
||||||
```
|
|
||||||
|
|
||||||
### Verify a PR locally
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run lint
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
@@ -1,587 +0,0 @@
|
|||||||
# Theme Creation Guide
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/theme-creation/](https://docs.betterseqta.org/theme-creation/)
|
|
||||||
|
|
||||||
This guide covers everything you need to know about creating custom themes for BetterSEQTA+.
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
1. [Overview](#overview)
|
|
||||||
2. [Theme Structure](#theme-structure)
|
|
||||||
3. [CSS Variables](#css-variables)
|
|
||||||
4. [CSS Selectors & Classes](#css-selectors--classes)
|
|
||||||
5. [Custom Images](#custom-images)
|
|
||||||
6. [Theme Settings](#theme-settings)
|
|
||||||
7. [Best Practices](#best-practices)
|
|
||||||
8. [Examples](#examples)
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
Themes in BetterSEQTA+ allow you to completely customize the appearance of SEQTA Learn. A theme consists of:
|
|
||||||
|
|
||||||
- **Custom CSS**: CSS rules that override default styles
|
|
||||||
- **Custom Images**: Images that can be referenced via CSS variables
|
|
||||||
- **Theme Metadata**: Name, description, default color, etc.
|
|
||||||
- **Theme Settings**: Options like forcing dark/light mode
|
|
||||||
|
|
||||||
Themes are applied by injecting CSS into the SEQTA page and setting CSS custom properties (variables) on the document root.
|
|
||||||
|
|
||||||
## CSS Variables
|
|
||||||
|
|
||||||
BetterSEQTA+ provides a comprehensive set of CSS variables that you can use in your themes. These variables automatically adapt to light/dark mode and user preferences.
|
|
||||||
|
|
||||||
### Core Background Variables
|
|
||||||
|
|
||||||
| Variable | Light Mode | Dark Mode | Description |
|
|
||||||
|----------|------------|-----------|-------------|
|
|
||||||
| `--background-primary` | `#ffffff` | `#232323` | Main background color |
|
|
||||||
| `--background-secondary` | `#e5e7eb` | `#1a1a1a` | Secondary background color |
|
|
||||||
| `--theme-primary` | `#ffffff` | `#232323` | Primary theme color (same as background-primary) |
|
|
||||||
| `--theme-secondary` | `#e5e7eb` | `#1a1a1a` | Secondary theme color (same as background-secondary) |
|
|
||||||
| `--text-primary` | `black` | `white` | Primary text color |
|
|
||||||
| `--text-color` | `black` | `white` | Text color (alias for text-primary) |
|
|
||||||
|
|
||||||
### BetterSEQTA+ Specific Variables
|
|
||||||
|
|
||||||
| Variable | Description | Notes |
|
|
||||||
|----------|-------------|-------|
|
|
||||||
| `--better-main` | User's selected accent color | Dynamically set based on color picker |
|
|
||||||
| `--better-sub` | Dark navy color | Always `#161616` |
|
|
||||||
| `--better-pale` | Lightened version of accent color | Only available in light mode |
|
|
||||||
| `--better-light` | Lighter version of accent color | Calculated based on brightness |
|
|
||||||
| `--better-alert-highlight` | Alert/highlight color | `#c61851` |
|
|
||||||
| `--betterseqta-logo` | Logo URL | Changes based on dark/light mode |
|
|
||||||
| `--auto-background` | Auto background color | Falls back to `--better-pale` or `--background-secondary` |
|
|
||||||
| `--navy` | Navy color | `#1a1a1a` |
|
|
||||||
| `--theme-fg-parts` | Theme foreground parts | `white` |
|
|
||||||
|
|
||||||
### Subject/Item Color Variables
|
|
||||||
|
|
||||||
| Variable | Description |
|
|
||||||
|----------|-------------|
|
|
||||||
| `--item-colour` | Subject/item color | Set dynamically per subject/item |
|
|
||||||
| `--colour` | Generic color variable | Used in various contexts |
|
|
||||||
| `--person-colour` | Person/avatar color | `var(--better-light)` for staff |
|
|
||||||
|
|
||||||
### Transparency Effects
|
|
||||||
|
|
||||||
When transparency effects are enabled, background variables become semi-transparent:
|
|
||||||
|
|
||||||
| Variable | Light Mode (Transparent) | Dark Mode (Transparent) |
|
|
||||||
|----------|--------------------------|-------------------------|
|
|
||||||
| `--background-primary` | `rgba(255, 255, 255, 0.6)` | `rgba(35, 35, 35, 0.6)` |
|
|
||||||
| `--background-secondary` | `rgba(229, 231, 235, 0.6)` | `rgba(26, 26, 26, 0.6)` |
|
|
||||||
|
|
||||||
### Using CSS Variables
|
|
||||||
|
|
||||||
You can use these variables in your custom CSS:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Example: Style a custom element */
|
|
||||||
.my-custom-element {
|
|
||||||
background: var(--background-primary);
|
|
||||||
color: var(--text-primary);
|
|
||||||
border: 1px solid var(--better-main);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Example: Create a gradient */
|
|
||||||
.gradient-box {
|
|
||||||
background: linear-gradient(
|
|
||||||
to bottom,
|
|
||||||
var(--better-main),
|
|
||||||
var(--background-secondary)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## CSS Selectors & Classes
|
|
||||||
|
|
||||||
BetterSEQTA+ uses specific CSS selectors and classes that you can target in your themes. Here are the most important ones:
|
|
||||||
|
|
||||||
### Main Layout Elements
|
|
||||||
|
|
||||||
| Selector | Description |
|
|
||||||
|----------|-------------|
|
|
||||||
| `#container` | Main container element |
|
|
||||||
| `#content` | Content area |
|
|
||||||
| `#main` | Main content wrapper |
|
|
||||||
| `#title` | Top title bar |
|
|
||||||
| `#menu` | Sidebar menu |
|
|
||||||
|
|
||||||
### Dark Mode
|
|
||||||
|
|
||||||
The `dark` class is added to `html` when dark mode is active:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Target dark mode specifically */
|
|
||||||
html.dark #main {
|
|
||||||
background: var(--background-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Target light mode */
|
|
||||||
html:not(.dark) #main {
|
|
||||||
background: var(--background-primary);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Transparency Effects
|
|
||||||
|
|
||||||
When transparency effects are enabled, the `transparencyEffects` class is added to `html`:
|
|
||||||
|
|
||||||
```css
|
|
||||||
html.transparencyEffects .notice {
|
|
||||||
backdrop-filter: blur(80px);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Common SEQTA Classes
|
|
||||||
|
|
||||||
| Class/Selector | Description |
|
|
||||||
|----------------|-------------|
|
|
||||||
| `.notice` | Notice cards |
|
|
||||||
| `.day` | Day containers in timetable |
|
|
||||||
| `.dashboard` | Dashboard sections |
|
|
||||||
| `.dashlet` | Dashboard widgets |
|
|
||||||
| `.document` | Document elements |
|
|
||||||
| `.quickbar` | Quick action bar |
|
|
||||||
| `.calendar` | Calendar elements |
|
|
||||||
| `.message` | Message elements |
|
|
||||||
| `.thread` | Forum threads |
|
|
||||||
| `.shortcut` | Shortcut buttons |
|
|
||||||
| `.upcoming-assessment` | Upcoming assessments |
|
|
||||||
| `.entry.class` | Timetable entries |
|
|
||||||
|
|
||||||
### BetterSEQTA+ Specific Classes
|
|
||||||
|
|
||||||
| Class | Description |
|
|
||||||
|-------|-------------|
|
|
||||||
| `.addedButton` | BetterSEQTA+ added buttons |
|
|
||||||
| `.tooltip` | Tooltip elements |
|
|
||||||
| `.notice-unified-content` | Unified notice content |
|
|
||||||
| `.home-container` | Home page container |
|
|
||||||
| `.timetable-container` | Timetable container |
|
|
||||||
| `.notices-container` | Notices container |
|
|
||||||
|
|
||||||
### Attribute Selectors
|
|
||||||
|
|
||||||
SEQTA uses data attributes that you can target:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Target specific data types */
|
|
||||||
[data-type="student"] .header {
|
|
||||||
color: var(--text-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Target specific labels */
|
|
||||||
[data-label="inbox"] {
|
|
||||||
/* Styles */
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### CSS Modules
|
|
||||||
|
|
||||||
SEQTA uses CSS modules with hashed class names. You can target them using attribute selectors:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Target CSS module classes */
|
|
||||||
[class*="MessageList__MessageList___"] {
|
|
||||||
background: var(--background-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
[class*="BasicPanel__BasicPanel___"] {
|
|
||||||
border-radius: 16px;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Custom Images
|
|
||||||
|
|
||||||
Themes can include custom images that are made available as CSS variables.
|
|
||||||
|
|
||||||
### Adding Images
|
|
||||||
|
|
||||||
1. Upload an image in the theme creator
|
|
||||||
2. Set a CSS variable name (e.g., `custom-background`)
|
|
||||||
3. The image will be available as `var(--custom-background)`
|
|
||||||
|
|
||||||
### Using Image Variables
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Use as background */
|
|
||||||
.my-element {
|
|
||||||
background-image: var(--custom-background);
|
|
||||||
background-size: cover;
|
|
||||||
background-position: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Use in content */
|
|
||||||
.my-icon::before {
|
|
||||||
content: '';
|
|
||||||
background-image: var(--custom-icon);
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Image Variable Format
|
|
||||||
|
|
||||||
Images are stored as `url()` values:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* The variable contains: url(blob:...) */
|
|
||||||
--custom-background: url(blob:chrome-extension://...);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Theme Settings
|
|
||||||
|
|
||||||
### Force Dark/Light Mode
|
|
||||||
|
|
||||||
You can force a theme to always use dark or light mode:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
forceDark: true // Force dark mode
|
|
||||||
forceDark: false // Force light mode
|
|
||||||
forceDark: undefined // Use user's preference (default)
|
|
||||||
```
|
|
||||||
|
|
||||||
When `forceDark` is set, users cannot toggle dark/light mode while the theme is active.
|
|
||||||
|
|
||||||
### Default Color
|
|
||||||
|
|
||||||
Set a default accent color for your theme:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
defaultColour: "rgba(0, 123, 255, 1)" // Blue
|
|
||||||
defaultColour: "#ff6b6b" // Red (hex format)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Allow Color Changes
|
|
||||||
|
|
||||||
Control whether users can change the accent color:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
CanChangeColour: true // Users can change color
|
|
||||||
CanChangeColour: false // Color is locked
|
|
||||||
```
|
|
||||||
|
|
||||||
## Best Practices
|
|
||||||
|
|
||||||
### 1. Use CSS Variables
|
|
||||||
|
|
||||||
Always use CSS variables instead of hardcoded colors:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Good */
|
|
||||||
.my-element {
|
|
||||||
background: var(--background-primary);
|
|
||||||
color: var(--text-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bad */
|
|
||||||
.my-element {
|
|
||||||
background: #ffffff;
|
|
||||||
color: #000000;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Support Both Light and Dark Modes
|
|
||||||
|
|
||||||
Unless your theme forces a specific mode, ensure it works in both:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Use variables that adapt automatically */
|
|
||||||
.my-element {
|
|
||||||
background: var(--background-primary);
|
|
||||||
color: var(--text-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Or explicitly handle both modes */
|
|
||||||
html.dark .my-element {
|
|
||||||
background: #1a1a1a;
|
|
||||||
}
|
|
||||||
|
|
||||||
html:not(.dark) .my-element {
|
|
||||||
background: #ffffff;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Use !important Sparingly
|
|
||||||
|
|
||||||
Only use `!important` when necessary to override SEQTA's default styles:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Good - necessary override */
|
|
||||||
#title {
|
|
||||||
background: var(--background-primary) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bad - unnecessary */
|
|
||||||
.my-element {
|
|
||||||
color: var(--text-primary) !important;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Test Responsive Design
|
|
||||||
|
|
||||||
SEQTA is responsive. Test your theme at different screen sizes:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Example: Mobile-specific styles */
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
#menu {
|
|
||||||
transform: translate(-270px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 5. Use Semantic Selectors
|
|
||||||
|
|
||||||
Prefer semantic selectors over fragile ones:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Good - stable selector */
|
|
||||||
#main > .dashboard > section {
|
|
||||||
border-radius: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Caution - CSS module classes may change */
|
|
||||||
[class*="Dashboard__Dashboard___"] {
|
|
||||||
border-radius: 16px;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 6. Optimize Images
|
|
||||||
|
|
||||||
Keep image file sizes reasonable:
|
|
||||||
|
|
||||||
- Use appropriate formats (PNG for transparency, JPG for photos)
|
|
||||||
- Compress images before uploading
|
|
||||||
- Consider using CSS for simple graphics instead of images
|
|
||||||
|
|
||||||
### 7. Document Your Theme
|
|
||||||
|
|
||||||
Include comments in your CSS explaining complex styles:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/*
|
|
||||||
* Custom gradient background for dashboard
|
|
||||||
* Uses the user's accent color for a cohesive look
|
|
||||||
*/
|
|
||||||
#main > .dashboard {
|
|
||||||
background: linear-gradient(
|
|
||||||
135deg,
|
|
||||||
var(--better-main),
|
|
||||||
var(--background-secondary)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
### Example 1: Simple Color Theme
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Change accent color throughout */
|
|
||||||
:root {
|
|
||||||
--better-main: #ff6b6b;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Style the menu */
|
|
||||||
#menu {
|
|
||||||
background: var(--background-primary);
|
|
||||||
border-right: 3px solid var(--better-main);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Style buttons */
|
|
||||||
.uiButton {
|
|
||||||
background: var(--better-main);
|
|
||||||
color: var(--text-color);
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example 2: Custom Background Image
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Use a custom background image */
|
|
||||||
body {
|
|
||||||
background-image: var(--custom-background);
|
|
||||||
background-size: cover;
|
|
||||||
background-attachment: fixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add overlay for readability */
|
|
||||||
#main::before {
|
|
||||||
content: '';
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: rgba(0, 0, 0, 0.3);
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example 3: Rounded Corners Theme
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Make everything more rounded */
|
|
||||||
#main > .dashboard > section,
|
|
||||||
.dashlet,
|
|
||||||
.notice,
|
|
||||||
.document {
|
|
||||||
border-radius: 20px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Round buttons */
|
|
||||||
.uiButton {
|
|
||||||
border-radius: 25px !important;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example 4: Minimal Theme
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Remove shadows and borders */
|
|
||||||
#main > .dashboard > section,
|
|
||||||
.dashlet,
|
|
||||||
.notice {
|
|
||||||
box-shadow: none !important;
|
|
||||||
border: 1px solid var(--background-secondary) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Simplify colors */
|
|
||||||
#menu {
|
|
||||||
background: var(--background-primary) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove gradients */
|
|
||||||
.day {
|
|
||||||
background: var(--background-primary) !important;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example 5: High Contrast Theme
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Increase contrast */
|
|
||||||
:root {
|
|
||||||
--background-primary: #000000;
|
|
||||||
--background-secondary: #1a1a1a;
|
|
||||||
--text-primary: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
html:not(.dark) {
|
|
||||||
--background-primary: #ffffff;
|
|
||||||
--background-secondary: #f0f0f0;
|
|
||||||
--text-primary: #000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add borders for clarity */
|
|
||||||
.dashlet,
|
|
||||||
.notice,
|
|
||||||
.document {
|
|
||||||
border: 2px solid var(--better-main) !important;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Advanced Techniques
|
|
||||||
|
|
||||||
### CSS Custom Properties Override
|
|
||||||
|
|
||||||
You can override CSS variables in your theme:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Override a variable */
|
|
||||||
:root {
|
|
||||||
--better-main: #your-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Override conditionally */
|
|
||||||
html.dark {
|
|
||||||
--background-primary: #your-dark-color;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Animations
|
|
||||||
|
|
||||||
Add smooth transitions:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Smooth color transitions */
|
|
||||||
#menu li {
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hover effects */
|
|
||||||
.dashlet:hover {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pseudo-elements
|
|
||||||
|
|
||||||
Use pseudo-elements for decorative elements:
|
|
||||||
|
|
||||||
```css
|
|
||||||
/* Add decorative border */
|
|
||||||
.notice::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: 4px;
|
|
||||||
background: var(--better-main);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Theme Not Applying
|
|
||||||
|
|
||||||
1. Check browser console for CSS errors
|
|
||||||
2. Verify CSS syntax is correct
|
|
||||||
3. Ensure selectors are specific enough
|
|
||||||
4. Check if `!important` is needed
|
|
||||||
|
|
||||||
### Colors Not Changing
|
|
||||||
|
|
||||||
1. Verify you're using CSS variables
|
|
||||||
2. Check if `forceDark` is overriding your styles
|
|
||||||
3. Ensure variables are set on `:root` or `html`
|
|
||||||
|
|
||||||
### Images Not Showing
|
|
||||||
|
|
||||||
1. Verify image variable name matches CSS
|
|
||||||
2. Check image format is supported
|
|
||||||
3. Ensure image size is reasonable
|
|
||||||
4. Verify `url()` wrapper in CSS
|
|
||||||
|
|
||||||
### Dark Mode Issues
|
|
||||||
|
|
||||||
1. Test with `forceDark: true` and `forceDark: false`
|
|
||||||
2. Check if transparency effects are interfering
|
|
||||||
3. Verify `html.dark` selector is correct
|
|
||||||
|
|
||||||
## Resources
|
|
||||||
|
|
||||||
- **Theme Creator**: Access via BetterSEQTA+ settings
|
|
||||||
- **CSS Variables Reference**: See [CSS Variables](#css-variables) section above
|
|
||||||
- **SEQTA DOM Structure**: Inspect SEQTA pages in browser DevTools
|
|
||||||
- **BetterSEQTA+ Source**: Check `src/css/injected.scss` for default styles
|
|
||||||
|
|
||||||
## Contributing Themes
|
|
||||||
|
|
||||||
If you create a great theme, consider sharing it:
|
|
||||||
|
|
||||||
1. Export your theme (Share button in theme creator)
|
|
||||||
2. Submit to the BetterSEQTA+ theme store
|
|
||||||
3. Or share on GitHub/Discord
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Note**: This documentation is based on BetterSEQTA+ v3.4.13. Some details may change in future versions.
|
|
||||||
|
|
||||||
@@ -1,350 +0,0 @@
|
|||||||
# Troubleshooting Guide
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/troubleshooting/](https://docs.betterseqta.org/troubleshooting/)
|
|
||||||
|
|
||||||
Having issues with BetterSEQTA+ development? This guide covers the most common problems and their solutions.
|
|
||||||
|
|
||||||
## Table of Contents
|
|
||||||
|
|
||||||
- [Installation Issues](#installation-issues)
|
|
||||||
- [Development Server Issues](#development-server-issues)
|
|
||||||
- [Browser Extension Issues](#browser-extension-issues)
|
|
||||||
- [Plugin Development Issues](#plugin-development-issues)
|
|
||||||
- [Build Issues](#build-issues)
|
|
||||||
- [Still Stuck?](#still-stuck)
|
|
||||||
|
|
||||||
## Installation Issues
|
|
||||||
|
|
||||||
### ❌ "npm install" fails with peer dependency errors
|
|
||||||
|
|
||||||
**Problem**: You see errors about peer dependencies or conflicting packages.
|
|
||||||
|
|
||||||
**Solution**:
|
|
||||||
```bash
|
|
||||||
rm -rf node_modules
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
### ❌ "Cannot find module" errors
|
|
||||||
|
|
||||||
**Problem**: Node.js can't find required packages.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Clear and reinstall**:
|
|
||||||
```bash
|
|
||||||
rm -rf node_modules
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Check Node.js version**:
|
|
||||||
```bash
|
|
||||||
node --version # Should be v26 or higher
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Try with npm cache clean**:
|
|
||||||
```bash
|
|
||||||
npm cache clean --force
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
### ❌ Permission errors on macOS/Linux
|
|
||||||
|
|
||||||
**Problem**: "EACCES" or permission denied errors.
|
|
||||||
|
|
||||||
**Solution**:
|
|
||||||
```bash
|
|
||||||
sudo chown -R $(whoami) ~/.npm
|
|
||||||
sudo chown -R $(whoami) /usr/local/lib/node_modules
|
|
||||||
```
|
|
||||||
|
|
||||||
## Development Server Issues
|
|
||||||
|
|
||||||
### ❌ "npm run dev" fails
|
|
||||||
|
|
||||||
**Problem**: Development server won't start.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check if port is in use**:
|
|
||||||
```bash
|
|
||||||
lsof -i :5173 # Kill the process using the port
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Clear dist folder**:
|
|
||||||
```bash
|
|
||||||
rm -rf dist
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Check for TypeScript errors**:
|
|
||||||
```bash
|
|
||||||
npx tsc --noEmit # Check for type errors
|
|
||||||
```
|
|
||||||
|
|
||||||
### ❌ Changes not reflecting in browser
|
|
||||||
|
|
||||||
**Problem**: You make code changes but don't see them in the browser.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Reload the extension**:
|
|
||||||
- Go to `chrome://extensions`
|
|
||||||
- Find BetterSEQTA+ and click the refresh icon
|
|
||||||
- Refresh your SEQTA page
|
|
||||||
|
|
||||||
2. **Check if dev server is running**:
|
|
||||||
- Look for "Build completed" in your terminal
|
|
||||||
- If not, restart `npm run dev`
|
|
||||||
|
|
||||||
3. **Hard refresh the page**:
|
|
||||||
- Press `Ctrl+Shift+R` (or `Cmd+Shift+R` on Mac)
|
|
||||||
|
|
||||||
## Browser Extension Issues
|
|
||||||
|
|
||||||
### ❌ Extension doesn't load in Chrome
|
|
||||||
|
|
||||||
**Problem**: Extension appears in `chrome://extensions` but doesn't work.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check for errors**:
|
|
||||||
- Go to `chrome://extensions`
|
|
||||||
- Click "Errors" button on BetterSEQTA+
|
|
||||||
- Fix any JavaScript errors shown
|
|
||||||
|
|
||||||
2. **Verify manifest**:
|
|
||||||
- Check if `dist/manifest.json` exists
|
|
||||||
- Ensure it has proper structure
|
|
||||||
|
|
||||||
3. **Check permissions**:
|
|
||||||
- Extension needs permission to access SEQTA pages
|
|
||||||
- Click "Details" → "Site access" → "On all sites"
|
|
||||||
|
|
||||||
### ❌ Extension doesn't appear on SEQTA pages
|
|
||||||
|
|
||||||
**Problem**: Extension loads but doesn't modify SEQTA.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check if you're on a SEQTA Learn page**:
|
|
||||||
- URL should contain "seqta" or "learn"
|
|
||||||
- Page title should include "SEQTA Learn"
|
|
||||||
|
|
||||||
2. **Check browser console**:
|
|
||||||
- Press `F12` → Console tab
|
|
||||||
- Look for "[BetterSEQTA+]" messages
|
|
||||||
- If no messages, extension isn't running
|
|
||||||
|
|
||||||
3. **Verify page detection**:
|
|
||||||
- Extension only runs on actual SEQTA Learn pages
|
|
||||||
- Test on a real SEQTA instance
|
|
||||||
|
|
||||||
### ❌ Settings page won't open
|
|
||||||
|
|
||||||
**Problem**: Clicking the extension icon doesn't open settings.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check popup errors**:
|
|
||||||
- Right-click extension icon → "Inspect popup"
|
|
||||||
- Look for JavaScript errors
|
|
||||||
|
|
||||||
2. **Clear extension storage**:
|
|
||||||
```javascript
|
|
||||||
// In browser console on any page:
|
|
||||||
chrome.storage.local.clear()
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Reload extension and try again**
|
|
||||||
|
|
||||||
## Plugin Development Issues
|
|
||||||
|
|
||||||
### ❌ My plugin doesn't appear in settings
|
|
||||||
|
|
||||||
**Problem**: Created a plugin but it's not showing up.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check plugin registration**:
|
|
||||||
- Ensure your plugin is imported in `src/plugins/index.ts`
|
|
||||||
- Verify `pluginManager.registerPlugin(yourPlugin)` is called
|
|
||||||
|
|
||||||
2. **Check plugin structure**:
|
|
||||||
```typescript
|
|
||||||
// Ensure your plugin has all required fields
|
|
||||||
const myPlugin: Plugin = {
|
|
||||||
id: "unique-id", // Must be unique
|
|
||||||
name: "Display Name",
|
|
||||||
description: "What it does",
|
|
||||||
version: "1.0.0",
|
|
||||||
run: async (api) => {
|
|
||||||
// Your code here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Check for errors**:
|
|
||||||
- Look in browser console for plugin loading errors
|
|
||||||
|
|
||||||
### ❌ Plugin settings not working
|
|
||||||
|
|
||||||
**Problem**: Plugin settings don't save or load properly.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check settings definition**:
|
|
||||||
```typescript
|
|
||||||
import { defineSettings, booleanSetting } from "@/plugins/core/settingsHelpers";
|
|
||||||
|
|
||||||
const settings = defineSettings({
|
|
||||||
myOption: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "My Option",
|
|
||||||
description: "What this does"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Wait for settings to load**:
|
|
||||||
```typescript
|
|
||||||
run: async (api) => {
|
|
||||||
await api.settings.loaded; // Wait for settings to load
|
|
||||||
console.log(api.settings.myOption); // Now you can use settings
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### ❌ Plugin API functions not working
|
|
||||||
|
|
||||||
**Problem**: `api.seqta.onMount()` or other API functions don't work.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check selector specificity**:
|
|
||||||
```typescript
|
|
||||||
// Be specific with selectors
|
|
||||||
api.seqta.onMount(".home-page", (element) => {
|
|
||||||
// Your code
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Wait for elements**:
|
|
||||||
```typescript
|
|
||||||
// Some elements load after page navigation
|
|
||||||
api.seqta.onPageChange((page) => {
|
|
||||||
if (page === "home") {
|
|
||||||
api.seqta.onMount(".home-content", (element) => {
|
|
||||||
// Now element should exist
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Build Issues
|
|
||||||
|
|
||||||
### ❌ "npm run build" fails
|
|
||||||
|
|
||||||
**Problem**: Production build fails with errors.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Check TypeScript errors**:
|
|
||||||
```bash
|
|
||||||
npx tsc --noEmit
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Clear cache and rebuild**:
|
|
||||||
```bash
|
|
||||||
rm -rf dist node_modules
|
|
||||||
npm install
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Check for import errors**:
|
|
||||||
- Ensure all imports use correct paths
|
|
||||||
- Check for missing files
|
|
||||||
|
|
||||||
### ❌ Built extension doesn't work
|
|
||||||
|
|
||||||
**Problem**: `npm run build` succeeds but extension doesn't work.
|
|
||||||
|
|
||||||
**Solutions**:
|
|
||||||
1. **Test the built extension**:
|
|
||||||
- Load the `dist` folder as unpacked extension
|
|
||||||
- Check console for errors
|
|
||||||
|
|
||||||
2. **Compare with dev version**:
|
|
||||||
- If dev works but build doesn't, there might be a build configuration issue
|
|
||||||
|
|
||||||
3. **Check manifest generation**:
|
|
||||||
- Verify `dist/manifest.json` looks correct
|
|
||||||
- Compare with working version
|
|
||||||
|
|
||||||
## Common Error Messages
|
|
||||||
|
|
||||||
### "Cannot access contents of the URL"
|
|
||||||
- **Cause**: Extension permissions issue
|
|
||||||
- **Fix**: Go to `chrome://extensions` → BetterSEQTA+ → Details → Site access → "On all sites"
|
|
||||||
|
|
||||||
### "Extension context invalidated"
|
|
||||||
- **Cause**: Extension was reloaded while page was open
|
|
||||||
- **Fix**: Refresh the SEQTA page
|
|
||||||
|
|
||||||
### "Uncaught ReferenceError: browser is not defined"
|
|
||||||
- **Cause**: Missing webextension-polyfill import
|
|
||||||
- **Fix**: Add `import browser from "webextension-polyfill";` at top of file
|
|
||||||
|
|
||||||
### "Module not found: Can't resolve '@/...' "
|
|
||||||
- **Cause**: TypeScript path mapping issue
|
|
||||||
- **Fix**: Check `tsconfig.json` and `vite.config.ts` for path configuration
|
|
||||||
|
|
||||||
## Performance Issues
|
|
||||||
|
|
||||||
### Extension makes SEQTA slow
|
|
||||||
1. **Check for memory leaks**:
|
|
||||||
- Use Chrome DevTools → Performance tab
|
|
||||||
- Look for growing memory usage
|
|
||||||
|
|
||||||
2. **Optimize plugin code**:
|
|
||||||
- Remove unnecessary listeners
|
|
||||||
- Clean up intervals/timeouts
|
|
||||||
- Use efficient selectors
|
|
||||||
|
|
||||||
3. **Profile your changes**:
|
|
||||||
- Test with extension disabled vs enabled
|
|
||||||
- Identify which plugin is causing issues
|
|
||||||
|
|
||||||
## Still Stuck?
|
|
||||||
|
|
||||||
If none of these solutions work:
|
|
||||||
|
|
||||||
1. **🔍 Search existing issues**: [GitHub Issues](https://github.com/BetterSEQTA/BetterSEQTA-plus/issues)
|
|
||||||
|
|
||||||
2. **💬 Ask on Discord**: [Join our server](https://discord.gg/YzmbnCDkat) - fastest way to get help!
|
|
||||||
|
|
||||||
3. **📝 Create a new issue**: Include:
|
|
||||||
- Your operating system
|
|
||||||
- Node.js version (`node --version`)
|
|
||||||
- Browser version
|
|
||||||
- Exact error message
|
|
||||||
- Steps to reproduce
|
|
||||||
- What you've already tried
|
|
||||||
|
|
||||||
4. **📧 Email us**: betterseqta.plus@gmail.com for urgent issues
|
|
||||||
|
|
||||||
## Getting More Debug Info
|
|
||||||
|
|
||||||
### Enable verbose logging
|
|
||||||
Add this to your plugin's `run` function:
|
|
||||||
```typescript
|
|
||||||
console.log("[DEBUG] Plugin starting:", api);
|
|
||||||
```
|
|
||||||
|
|
||||||
### Check extension background page
|
|
||||||
1. Go to `chrome://extensions`
|
|
||||||
2. Click "Details" on BetterSEQTA+
|
|
||||||
3. Click "Inspect views: background page"
|
|
||||||
4. Check console for background script errors
|
|
||||||
|
|
||||||
### Export debug info
|
|
||||||
Run this in browser console on a SEQTA page:
|
|
||||||
```javascript
|
|
||||||
console.log("Extension info:", {
|
|
||||||
version: chrome.runtime.getManifest().version,
|
|
||||||
url: window.location.href,
|
|
||||||
userAgent: navigator.userAgent,
|
|
||||||
storage: await chrome.storage.local.get()
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
Remember: **Don't give up!** Every developer faces these issues. The community is here to help, and solving these problems makes you a better developer. 💪
|
|
||||||
@@ -1,153 +0,0 @@
|
|||||||
# Installing BetterSEQTA+
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/install/](https://docs.betterseqta.org/install/)
|
|
||||||
|
|
||||||
This guide will walk you through the process of installing and setting up BetterSEQTA+ for development or usage.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
Before you begin, make sure you have the following installed:
|
|
||||||
|
|
||||||
- [Node.js](https://nodejs.org/) v26 or higher
|
|
||||||
- A modern web browser (Chrome, Firefox, Edge, etc.)
|
|
||||||
|
|
||||||
## Installation Methods
|
|
||||||
|
|
||||||
There are two ways to install BetterSEQTA+:
|
|
||||||
|
|
||||||
1. **For Users**: Install the browser extension
|
|
||||||
2. **For Developers**: Clone the repository and set up the development environment
|
|
||||||
|
|
||||||
## For Users: Installing the Browser Extension
|
|
||||||
|
|
||||||
BetterSEQTA+ is available as a browser extension for Chrome, Firefox, and Edge.
|
|
||||||
|
|
||||||
### Chrome/Edge
|
|
||||||
|
|
||||||
1. Visit the [Chrome Web Store page for BetterSEQTA+](https://chrome.google.com/webstore/detail/betterseqta)
|
|
||||||
2. Click the "Add to Chrome" button
|
|
||||||
3. Confirm the installation when prompted
|
|
||||||
4. The extension will be installed and ready to use
|
|
||||||
|
|
||||||
### Firefox
|
|
||||||
|
|
||||||
1. Visit the [Firefox Add-ons page for BetterSEQTA+](https://addons.mozilla.org/en-US/firefox/addon/betterseqta)
|
|
||||||
2. Click the "Add to Firefox" button
|
|
||||||
3. Confirm the installation when prompted
|
|
||||||
4. The extension will be installed and ready to use
|
|
||||||
|
|
||||||
## For Developers: Setting Up the Development Environment
|
|
||||||
|
|
||||||
If you want to develop for BetterSEQTA+ or modify the code, follow these steps:
|
|
||||||
|
|
||||||
### 1. Clone the Repository
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
|
|
||||||
cd BetterSEQTA-Plus
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Install Dependencies
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. Set Up Environment Variables - Only required for pushing to extension stores from the command line
|
|
||||||
|
|
||||||
Copy the example environment file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp .env.submit.example .env
|
|
||||||
```
|
|
||||||
|
|
||||||
Edit the `.env` file with your SEQTA credentials and settings.
|
|
||||||
|
|
||||||
### 4. Start the Development Server
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
This will start a development server and build the extension in watch mode.
|
|
||||||
|
|
||||||
### 5. Load the Extension in Your Browser
|
|
||||||
|
|
||||||
#### Chrome/Edge
|
|
||||||
|
|
||||||
1. Open Chrome/Edge and navigate to `chrome://extensions` or `edge://extensions`
|
|
||||||
2. Enable "Developer mode" using the toggle in the top right
|
|
||||||
3. Click "Load unpacked" and select the `dist/chrome` folder in your BetterSEQTA+ directory
|
|
||||||
4. The extension should now appear in your extensions list
|
|
||||||
|
|
||||||
#### Firefox
|
|
||||||
|
|
||||||
1. Open Firefox and navigate to `about:debugging#/runtime/this-firefox`
|
|
||||||
2. Click "Load Temporary Add-on..."
|
|
||||||
3. Select the `manifest.json` file in the `dist` folder
|
|
||||||
4. The extension should now appear in your add-ons list
|
|
||||||
|
|
||||||
### 6. Test Your Changes
|
|
||||||
|
|
||||||
After making changes to the code, the development server will automatically rebuild the extension. However, you may need to reload the extension in your browser to see the changes:
|
|
||||||
|
|
||||||
1. Go to the extensions page in your browser
|
|
||||||
2. Find BetterSEQTA+ and click the reload icon
|
|
||||||
3. Refresh any SEQTA Learn pages you have open
|
|
||||||
|
|
||||||
## Troubleshooting Installation
|
|
||||||
|
|
||||||
### Common Issues
|
|
||||||
|
|
||||||
#### "Cannot find module" errors
|
|
||||||
|
|
||||||
If you see errors about missing modules, try:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
rm -rf node_modules
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Extension not appearing in SEQTA
|
|
||||||
|
|
||||||
Make sure:
|
|
||||||
|
|
||||||
- You're visiting a SEQTA Learn page
|
|
||||||
- The extension is enabled
|
|
||||||
- You've refreshed the page after installing the extension
|
|
||||||
|
|
||||||
#### Development build not updating
|
|
||||||
|
|
||||||
Try:
|
|
||||||
|
|
||||||
1. Stopping the development server
|
|
||||||
2. Clearing your browser cache
|
|
||||||
3. Removing the extension from your browser
|
|
||||||
4. Rebuilding the extension
|
|
||||||
5. Loading it again
|
|
||||||
|
|
||||||
## Updating BetterSEQTA+
|
|
||||||
|
|
||||||
### For Users
|
|
||||||
|
|
||||||
Browser extensions update automatically, but you can manually check for updates:
|
|
||||||
|
|
||||||
- **Chrome/Edge**: Go to `chrome://extensions` or `edge://extensions`, enable Developer mode, and click "Update"
|
|
||||||
- **Firefox**: Go to `about:addons`, click the gear icon, and select "Check for Updates"
|
|
||||||
|
|
||||||
### For Developers
|
|
||||||
|
|
||||||
If you're working on the code, pull the latest changes and reinstall dependencies:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git pull
|
|
||||||
npm install
|
|
||||||
npm run dev
|
|
||||||
```
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
Now that you have BetterSEQTA+ installed, you can:
|
|
||||||
|
|
||||||
- [Plugins](https://docs.betterseqta.org/plugins/)
|
|
||||||
- [Contribute to the project](https://docs.betterseqta.org/contributing/) · [Repository CONTRIBUTING.md](../CONTRIBUTING.md)
|
|
||||||
@@ -1,337 +0,0 @@
|
|||||||
# Example Plugin Template
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/example-plugin/](https://docs.betterseqta.org/example-plugin/)
|
|
||||||
|
|
||||||
This is a complete, working example of a simple BetterSEQTA+ plugin. You can copy this code and modify it to create your own plugin!
|
|
||||||
|
|
||||||
## What This Example Does
|
|
||||||
|
|
||||||
This plugin adds a friendly welcome message to the SEQTA homepage and lets users customize the message through settings.
|
|
||||||
|
|
||||||
## Complete Plugin Code
|
|
||||||
|
|
||||||
Create a new file in `src/plugins/built-in/my-first-plugin/index.ts`:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
import { BasePlugin } from "@/plugins/core/settings";
|
|
||||||
import {
|
|
||||||
defineSettings,
|
|
||||||
booleanSetting,
|
|
||||||
stringSetting
|
|
||||||
} from "@/plugins/core/settingsHelpers";
|
|
||||||
import { Setting } from "@/plugins/core/settingsHelpers";
|
|
||||||
|
|
||||||
// Define the plugin settings
|
|
||||||
const settings = defineSettings({
|
|
||||||
enabled: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "Show Welcome Message",
|
|
||||||
description: "Display a welcome message on the SEQTA homepage"
|
|
||||||
}),
|
|
||||||
customMessage: stringSetting({
|
|
||||||
default: "Welcome to SEQTA! 🎉",
|
|
||||||
title: "Custom Message",
|
|
||||||
description: "The message to display on the homepage",
|
|
||||||
maxLength: 100
|
|
||||||
}),
|
|
||||||
showEmoji: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "Show Emoji",
|
|
||||||
description: "Include emojis in the welcome message"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create settings class
|
|
||||||
class MyFirstPluginSettings extends BasePlugin<typeof settings> {
|
|
||||||
@Setting(settings.enabled)
|
|
||||||
enabled!: boolean;
|
|
||||||
|
|
||||||
@Setting(settings.customMessage)
|
|
||||||
customMessage!: string;
|
|
||||||
|
|
||||||
@Setting(settings.showEmoji)
|
|
||||||
showEmoji!: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create settings instance
|
|
||||||
const settingsInstance = new MyFirstPluginSettings();
|
|
||||||
|
|
||||||
// Define the plugin
|
|
||||||
const myFirstPlugin: Plugin<typeof settings> = {
|
|
||||||
id: "my-first-plugin",
|
|
||||||
name: "My First Plugin",
|
|
||||||
description: "Adds a customizable welcome message to the SEQTA homepage",
|
|
||||||
version: "1.0.0",
|
|
||||||
|
|
||||||
// Link our settings
|
|
||||||
settings: settingsInstance.settings,
|
|
||||||
|
|
||||||
// Mark as beta (optional)
|
|
||||||
beta: true,
|
|
||||||
|
|
||||||
// Add some CSS styles (optional)
|
|
||||||
styles: `
|
|
||||||
.my-plugin-welcome {
|
|
||||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
||||||
color: white;
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 12px;
|
|
||||||
margin: 20px;
|
|
||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
text-align: center;
|
|
||||||
font-size: 18px;
|
|
||||||
animation: slideIn 0.5s ease-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes slideIn {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(-20px);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-plugin-welcome .close-btn {
|
|
||||||
float: right;
|
|
||||||
background: rgba(255, 255, 255, 0.2);
|
|
||||||
border: none;
|
|
||||||
color: white;
|
|
||||||
padding: 5px 10px;
|
|
||||||
border-radius: 20px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-plugin-welcome .close-btn:hover {
|
|
||||||
background: rgba(255, 255, 255, 0.3);
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
|
|
||||||
// Main plugin function
|
|
||||||
run: async (api) => {
|
|
||||||
console.log("[My First Plugin] Starting up! 🚀");
|
|
||||||
|
|
||||||
// Wait for settings to load
|
|
||||||
await api.settings.loaded;
|
|
||||||
|
|
||||||
let welcomeElement: HTMLElement | null = null;
|
|
||||||
|
|
||||||
// Function to create the welcome message
|
|
||||||
const createWelcomeMessage = () => {
|
|
||||||
// Only show if enabled in settings
|
|
||||||
if (!api.settings.enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove existing message if it exists
|
|
||||||
if (welcomeElement) {
|
|
||||||
welcomeElement.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the message element
|
|
||||||
welcomeElement = document.createElement("div");
|
|
||||||
welcomeElement.className = "my-plugin-welcome";
|
|
||||||
|
|
||||||
// Build the message content
|
|
||||||
let message = api.settings.customMessage;
|
|
||||||
if (!api.settings.showEmoji) {
|
|
||||||
// Remove emojis if disabled
|
|
||||||
message = message.replace(/[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/gu, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
welcomeElement.innerHTML = `
|
|
||||||
<button class="close-btn" onclick="this.parentElement.remove()">×</button>
|
|
||||||
<div>${message}</div>
|
|
||||||
<small style="opacity: 0.8; margin-top: 10px; display: block;">
|
|
||||||
Powered by My First Plugin
|
|
||||||
</small>
|
|
||||||
`;
|
|
||||||
|
|
||||||
return welcomeElement;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Function to add message to homepage
|
|
||||||
const addToHomepage = () => {
|
|
||||||
api.seqta.onMount(".home-page, .dashboard, [class*='home']", (homePage) => {
|
|
||||||
console.log("[My First Plugin] Found homepage, adding welcome message");
|
|
||||||
|
|
||||||
const message = createWelcomeMessage();
|
|
||||||
if (message) {
|
|
||||||
// Add to the top of the homepage
|
|
||||||
homePage.insertBefore(message, homePage.firstChild);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Add message when plugin starts
|
|
||||||
addToHomepage();
|
|
||||||
|
|
||||||
// Re-add message when user navigates to homepage
|
|
||||||
api.seqta.onPageChange((page) => {
|
|
||||||
console.log("[My First Plugin] Page changed to:", page);
|
|
||||||
if (page.includes("home") || page.includes("dashboard")) {
|
|
||||||
// Small delay to let the page load
|
|
||||||
setTimeout(addToHomepage, 500);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Listen for settings changes and update the message
|
|
||||||
api.settings.onChange("enabled", (enabled) => {
|
|
||||||
console.log("[My First Plugin] Enabled setting changed:", enabled);
|
|
||||||
if (enabled) {
|
|
||||||
addToHomepage();
|
|
||||||
} else if (welcomeElement) {
|
|
||||||
welcomeElement.remove();
|
|
||||||
welcomeElement = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
api.settings.onChange("customMessage", (newMessage) => {
|
|
||||||
console.log("[My First Plugin] Message changed:", newMessage);
|
|
||||||
if (welcomeElement && api.settings.enabled) {
|
|
||||||
// Update existing message
|
|
||||||
addToHomepage();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
api.settings.onChange("showEmoji", (showEmoji) => {
|
|
||||||
console.log("[My First Plugin] Show emoji changed:", showEmoji);
|
|
||||||
if (welcomeElement && api.settings.enabled) {
|
|
||||||
// Update existing message
|
|
||||||
addToHomepage();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Return cleanup function (called when plugin is disabled)
|
|
||||||
return () => {
|
|
||||||
console.log("[My First Plugin] Cleaning up...");
|
|
||||||
if (welcomeElement) {
|
|
||||||
welcomeElement.remove();
|
|
||||||
welcomeElement = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default myFirstPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to Use This Example
|
|
||||||
|
|
||||||
### Step 1: Create the Plugin File
|
|
||||||
1. Create a new folder: `src/plugins/built-in/my-first-plugin/`
|
|
||||||
2. Create `index.ts` in that folder
|
|
||||||
3. Copy the code above into `index.ts`
|
|
||||||
|
|
||||||
### Step 2: Register the Plugin
|
|
||||||
Add this to `src/plugins/index.ts`:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Add this import at the top
|
|
||||||
import myFirstPlugin from "./built-in/my-first-plugin";
|
|
||||||
|
|
||||||
// Add this line where other plugins are registered
|
|
||||||
pluginManager.registerPlugin(myFirstPlugin);
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 3: Test It
|
|
||||||
1. Run `npm run dev`
|
|
||||||
2. Reload your extension in Chrome
|
|
||||||
3. Visit a SEQTA page
|
|
||||||
4. You should see your welcome message!
|
|
||||||
5. Open BetterSEQTA+ settings to customize it
|
|
||||||
|
|
||||||
## Key Concepts Explained
|
|
||||||
|
|
||||||
### 1. Plugin Structure
|
|
||||||
```typescript
|
|
||||||
const myPlugin: Plugin = {
|
|
||||||
id: "unique-id", // Must be unique across all plugins
|
|
||||||
name: "Display Name", // Shown in settings
|
|
||||||
description: "What it does", // Shown in settings
|
|
||||||
version: "1.0.0", // Plugin version
|
|
||||||
settings: settingsObject, // User-configurable options
|
|
||||||
styles: "/* CSS here */", // Optional CSS styles
|
|
||||||
run: async (api) => { // Main plugin code
|
|
||||||
// Your code here
|
|
||||||
}
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Settings System
|
|
||||||
```typescript
|
|
||||||
// Define what settings your plugin has
|
|
||||||
const settings = defineSettings({
|
|
||||||
myOption: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "My Option",
|
|
||||||
description: "What this option does"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
// Use in your plugin
|
|
||||||
if (api.settings.myOption) {
|
|
||||||
// Do something
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 3. SEQTA Integration
|
|
||||||
```typescript
|
|
||||||
// Wait for elements to appear
|
|
||||||
api.seqta.onMount(".some-selector", (element) => {
|
|
||||||
// Modify the element
|
|
||||||
});
|
|
||||||
|
|
||||||
// Detect page changes
|
|
||||||
api.seqta.onPageChange((page) => {
|
|
||||||
if (page === "home") {
|
|
||||||
// User navigated to homepage
|
|
||||||
}
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### 4. Cleanup
|
|
||||||
Always return a cleanup function to remove your changes when the plugin is disabled:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
run: async (api) => {
|
|
||||||
// Add your features
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
// Remove your features
|
|
||||||
};
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Customization Ideas
|
|
||||||
|
|
||||||
Want to modify this example? Here are some ideas:
|
|
||||||
|
|
||||||
1. **Change the styling**: Modify the CSS to use different colors, animations, or layouts
|
|
||||||
2. **Add more settings**: Number settings, select dropdowns, hotkeys
|
|
||||||
3. **Different trigger**: Show on different pages, or based on time of day
|
|
||||||
4. **Add interactions**: Buttons that do things when clicked
|
|
||||||
5. **Store data**: Use `api.storage` to remember user preferences
|
|
||||||
6. **Communicate with other plugins**: Use `api.events` to send/receive events
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
Once you've got this working:
|
|
||||||
|
|
||||||
1. **Experiment**: Try changing things and see what happens
|
|
||||||
2. **Read other plugins**: Look at the built-in plugins for inspiration
|
|
||||||
3. **Check the API docs**: Learn about all available API functions
|
|
||||||
4. **Share your creation**: Show it off in Discord!
|
|
||||||
|
|
||||||
## Need Help?
|
|
||||||
|
|
||||||
- 💬 Ask in our [Discord server](https://discord.gg/YzmbnCDkat)
|
|
||||||
- 📚 Read the [plugin documentation](https://docs.betterseqta.org/plugins/)
|
|
||||||
- 🐛 Check the [troubleshooting guide](https://docs.betterseqta.org/troubleshooting/)
|
|
||||||
- 📝 Open an issue on GitHub
|
|
||||||
|
|
||||||
Happy coding! 🎉
|
|
||||||
@@ -1,299 +0,0 @@
|
|||||||
# Creating Plugins for BetterSEQTA+
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/plugins/](https://docs.betterseqta.org/plugins/) · [Plugin development](https://docs.betterseqta.org/plugin-development/) · [Plugin API](https://docs.betterseqta.org/plugin-api/)
|
|
||||||
|
|
||||||
Hey there! 👋 So you want to create a plugin for BetterSEQTA+? That's awesome! This guide will walk you through everything you need to know, from the very basics to more advanced features. Don't worry if you're new to this - we'll explain everything step by step.
|
|
||||||
|
|
||||||
## What is a Plugin?
|
|
||||||
|
|
||||||
In BetterSEQTA+, a plugin is like a mini-app that adds new features to SEQTA. Think of it as a piece of LEGO that you can snap onto SEQTA to make it do new things. For example, you could create a plugin that:
|
|
||||||
|
|
||||||
- Changes how SEQTA looks
|
|
||||||
- Adds new buttons or features
|
|
||||||
- Shows extra information on your timetable
|
|
||||||
- Collects notifications in a better way
|
|
||||||
- Really, anything you can imagine!
|
|
||||||
|
|
||||||
## Your First Plugin
|
|
||||||
|
|
||||||
Let's create a super simple plugin together. We'll make one that adds a friendly message to the SEQTA homepage. Here's what we'll need:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
|
|
||||||
const myFirstPlugin: Plugin = {
|
|
||||||
// Every plugin needs these basic details
|
|
||||||
id: "my-first-plugin",
|
|
||||||
name: "My First Plugin",
|
|
||||||
description: "Adds a friendly message to SEQTA",
|
|
||||||
version: "1.0.0",
|
|
||||||
|
|
||||||
// This tells BetterSEQTA+ that users can turn our plugin on/off
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
// Optional: Mark your plugin as beta to show a "Beta" tag in settings
|
|
||||||
beta: true,
|
|
||||||
|
|
||||||
// This is where the magic happens!
|
|
||||||
run: async (api) => {
|
|
||||||
// Wait for the homepage to load
|
|
||||||
api.seqta.onMount(".home-page", (homePage) => {
|
|
||||||
// Create our message
|
|
||||||
const message = document.createElement("div");
|
|
||||||
message.textContent = "Hello from my first plugin! 🎉";
|
|
||||||
message.style.padding = "20px";
|
|
||||||
message.style.backgroundColor = "#e9f5ff";
|
|
||||||
message.style.borderRadius = "8px";
|
|
||||||
message.style.margin = "20px";
|
|
||||||
|
|
||||||
// Add it to the page
|
|
||||||
homePage.prepend(message);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Return a cleanup function that removes our message when the plugin is disabled
|
|
||||||
return () => {
|
|
||||||
const message = document.querySelector(".home-page > div");
|
|
||||||
message?.remove();
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default myFirstPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
Let's break down what's happening here:
|
|
||||||
|
|
||||||
1. First, we import the `Plugin` type that tells TypeScript what a plugin should look like
|
|
||||||
2. We create our plugin object with some basic information:
|
|
||||||
- `id`: A unique name for your plugin (use lowercase and dashes)
|
|
||||||
- `name`: A friendly name that users will see
|
|
||||||
- `description`: Explain what your plugin does
|
|
||||||
- `version`: Your plugin's version number
|
|
||||||
3. We set `disableToggle: true` so users can turn our plugin on/off in settings
|
|
||||||
4. We set `beta: true` to mark the plugin as beta
|
|
||||||
5. The `run` function is where we put our plugin's code
|
|
||||||
6. We use `api.seqta.onMount` to wait for the homepage to load
|
|
||||||
7. We create and style a message element
|
|
||||||
8. We return a cleanup function that removes our changes when the plugin is disabled
|
|
||||||
|
|
||||||
## The Plugin API
|
|
||||||
|
|
||||||
When your plugin runs, it gets access to a powerful API that lets you do all sorts of things. Let's look at what you can do:
|
|
||||||
|
|
||||||
### SEQTA API (`api.seqta`)
|
|
||||||
|
|
||||||
This helps you interact with SEQTA's pages:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Wait for an element to appear on the page
|
|
||||||
api.seqta.onMount(".some-class", (element) => {
|
|
||||||
// Do something with the element
|
|
||||||
});
|
|
||||||
|
|
||||||
// Know when the user changes pages
|
|
||||||
api.seqta.onPageChange((page) => {
|
|
||||||
console.log("User went to:", page);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Get the current page
|
|
||||||
const currentPage = api.seqta.getCurrentPage();
|
|
||||||
```
|
|
||||||
|
|
||||||
### Settings API (`api.settings`)
|
|
||||||
|
|
||||||
Want to let users customize your plugin? Use settings!
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import { BasePlugin } from "@/plugins/core/settings";
|
|
||||||
import {
|
|
||||||
booleanSetting,
|
|
||||||
defineSettings,
|
|
||||||
Setting,
|
|
||||||
} from "@/plugins/core/settingsHelpers";
|
|
||||||
|
|
||||||
// Define your settings
|
|
||||||
const settings = defineSettings({
|
|
||||||
showMessage: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "Show Welcome Message",
|
|
||||||
description: "Show a friendly message on the homepage",
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create a class for your plugin
|
|
||||||
class MyPluginClass extends BasePlugin<typeof settings> {
|
|
||||||
@Setting(settings.showMessage)
|
|
||||||
showMessage!: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create your plugin
|
|
||||||
const settingsInstance = new MyPluginClass();
|
|
||||||
|
|
||||||
const myPlugin: Plugin<typeof settings> = {
|
|
||||||
// ... other plugin details ...
|
|
||||||
settings: settingsInstance.settings,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Use the setting
|
|
||||||
if (api.settings.showMessage) {
|
|
||||||
// Show the message
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listen for setting changes
|
|
||||||
api.settings.onChange("showMessage", (newValue) => {
|
|
||||||
if (newValue) {
|
|
||||||
// Show the message
|
|
||||||
} else {
|
|
||||||
// Hide the message
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
### Storage API (`api.storage`)
|
|
||||||
|
|
||||||
Need to save some data? The storage API has got you covered:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Save some data
|
|
||||||
await api.storage.set("lastVisit", new Date().toISOString());
|
|
||||||
|
|
||||||
// Get it back later
|
|
||||||
const lastVisit = await api.storage.get("lastVisit");
|
|
||||||
|
|
||||||
// Listen for changes
|
|
||||||
api.storage.onChange("lastVisit", (newValue) => {
|
|
||||||
console.log("Last visit updated:", newValue);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### Events API (`api.events`)
|
|
||||||
|
|
||||||
Want your plugin to be able to interface with other plugins? Then use events!
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Listen for an event
|
|
||||||
api.events.on("myCustomEvent", (data) => {
|
|
||||||
console.log("Got event:", data);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Send an event
|
|
||||||
api.events.emit("myCustomEvent", { some: "data" });
|
|
||||||
```
|
|
||||||
|
|
||||||
## Adding Styles
|
|
||||||
|
|
||||||
Want to make your plugin look pretty? You can add CSS styles:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const myPlugin: Plugin = {
|
|
||||||
// ... other plugin details ...
|
|
||||||
|
|
||||||
// Add your CSS here
|
|
||||||
styles: `
|
|
||||||
.my-plugin-message {
|
|
||||||
background: linear-gradient(135deg, #6e8efb, #a777e3);
|
|
||||||
color: white;
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 12px;
|
|
||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
margin: 20px;
|
|
||||||
animation: slide-in 0.3s ease-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes slide-in {
|
|
||||||
from { transform: translateY(-20px); opacity: 0; }
|
|
||||||
to { transform: translateY(0); opacity: 1; }
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Your plugin code here
|
|
||||||
},
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
## Best Practices
|
|
||||||
|
|
||||||
Here are some tips to make your plugin awesome:
|
|
||||||
|
|
||||||
1. **Always Clean Up**: When your plugin is disabled, clean up any changes you made:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
run: async (api) => {
|
|
||||||
// Add stuff to the page
|
|
||||||
const element = document.createElement("div");
|
|
||||||
document.body.appendChild(element);
|
|
||||||
|
|
||||||
// Return a cleanup function
|
|
||||||
return () => {
|
|
||||||
element.remove();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Use TypeScript**: It helps catch errors before they happen and makes your code easier to understand.
|
|
||||||
|
|
||||||
3. **Test Your Plugin**: Make sure it works in different situations:
|
|
||||||
|
|
||||||
- When SEQTA is loading
|
|
||||||
- When the user switches pages
|
|
||||||
- When the plugin is enabled/disabled
|
|
||||||
- When settings are changed
|
|
||||||
|
|
||||||
4. **Keep It Fast**: Don't slow down SEQTA:
|
|
||||||
|
|
||||||
- Use `onMount` instead of intervals or timeouts
|
|
||||||
- Clean up event listeners when they're not needed
|
|
||||||
- Don't do heavy calculations on the main thread
|
|
||||||
|
|
||||||
5. **Make It User-Friendly**:
|
|
||||||
- Add clear settings with good descriptions
|
|
||||||
- Use `disableToggle: true` so users can turn it off if needed
|
|
||||||
- Add helpful error messages if something goes wrong
|
|
||||||
- Use `beta: true` for experimental features to let users know they're trying something new
|
|
||||||
|
|
||||||
## Plugin Metadata Options
|
|
||||||
|
|
||||||
Your plugin object supports several optional flags to customize how it appears and behaves:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
const myPlugin: Plugin = {
|
|
||||||
id: "my-plugin",
|
|
||||||
name: "My Plugin",
|
|
||||||
description: "What my plugin does",
|
|
||||||
version: "1.0.0",
|
|
||||||
|
|
||||||
// Optional flags:
|
|
||||||
disableToggle: true, // Show enable/disable toggle in settings
|
|
||||||
defaultEnabled: false, // Start disabled by default (requires disableToggle: true)
|
|
||||||
beta: true, // Show "Beta" tag in settings UI
|
|
||||||
|
|
||||||
// Your plugin code...
|
|
||||||
run: async (api) => { /* ... */ },
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
- **`disableToggle`**: When `true`, users can enable/disable your plugin in settings
|
|
||||||
- **`defaultEnabled`**: When `false`, your plugin starts disabled (only works with `disableToggle: true`)
|
|
||||||
- **`beta`**: When `true`, shows an orange "Beta" tag next to your plugin name in settings
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
Want to see more examples? Check out our built-in plugins:
|
|
||||||
|
|
||||||
- [themes](../../src/plugins/built-in/themes/index.ts): Shows how to change SEQTA's appearance
|
|
||||||
- [notificationCollector](../../src/plugins/built-in/notificationCollector/index.ts): Shows how to work with SEQTA's notifications
|
|
||||||
- [timetable](../../src/plugins/built-in/timetable/index.ts): Shows how to modify SEQTA's timetable view
|
|
||||||
- [assessmentsAverage](../../src/plugins/built-in/assessmentsAverage/index.ts): Shows how to add new features to existing pages
|
|
||||||
|
|
||||||
## Need Help?
|
|
||||||
|
|
||||||
Got stuck? No worries! Here's where you can get help:
|
|
||||||
|
|
||||||
- Join our [Discord server](https://discord.gg/YzmbnCDkat)
|
|
||||||
- Check out the built-in plugins in the `src/plugins/built-in` folder
|
|
||||||
- Open an issue on our [GitHub page](https://github.com/betterseqta/betterseqta-plus/issues)
|
|
||||||
|
|
||||||
Happy coding and feel free to check out the [plugin API](https://docs.betterseqta.org/plugin-api/) on the documentation site.
|
|
||||||
@@ -1,368 +0,0 @@
|
|||||||
# Plugin API Reference
|
|
||||||
|
|
||||||
**Published version:** [docs.betterseqta.org/plugin-api/](https://docs.betterseqta.org/plugin-api/)
|
|
||||||
|
|
||||||
This document provides detailed technical information about BetterSEQTA+'s plugin APIs. For a beginner-friendly introduction, see the [plugins section](https://docs.betterseqta.org/plugins/) at [docs.betterseqta.org](https://docs.betterseqta.org/).
|
|
||||||
|
|
||||||
## Plugin Structure
|
|
||||||
|
|
||||||
Here's how a plugin is structured:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
import { BasePlugin } from "@/plugins/core/settings";
|
|
||||||
import {
|
|
||||||
booleanSetting,
|
|
||||||
defineSettings,
|
|
||||||
Setting,
|
|
||||||
} from "@/plugins/core/settingsHelpers";
|
|
||||||
|
|
||||||
// First, define your settings
|
|
||||||
const settings = defineSettings({
|
|
||||||
enabled: booleanSetting({
|
|
||||||
default: true,
|
|
||||||
title: "Enable Feature",
|
|
||||||
description: "Turn this feature on or off",
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create a class to handle your settings
|
|
||||||
class MyPluginClass extends BasePlugin<typeof settings> {
|
|
||||||
@Setting(settings.enabled)
|
|
||||||
enabled!: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create an instance of your settings
|
|
||||||
const settingsInstance = new MyPluginClass();
|
|
||||||
|
|
||||||
// Create your plugin
|
|
||||||
const myPlugin: Plugin<typeof settings> = {
|
|
||||||
id: "my-plugin",
|
|
||||||
name: "My Plugin",
|
|
||||||
description: "A cool plugin that does things",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: settingsInstance.settings,
|
|
||||||
disableToggle: true,
|
|
||||||
beta: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
console.log("Plugin is running!");
|
|
||||||
|
|
||||||
// Do stuff when settings change
|
|
||||||
api.settings.onChange("enabled", (enabled) => {
|
|
||||||
if (enabled) {
|
|
||||||
console.log("Feature enabled!");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Return a cleanup function
|
|
||||||
return () => {
|
|
||||||
console.log("Plugin cleanup");
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default myPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Plugin Metadata
|
|
||||||
|
|
||||||
The plugin object supports several metadata fields and options:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
interface Plugin {
|
|
||||||
// Required fields
|
|
||||||
id: string; // Unique identifier (lowercase, dashes)
|
|
||||||
name: string; // Display name shown to users
|
|
||||||
description: string; // Brief description of what the plugin does
|
|
||||||
version: string; // Semantic version (e.g., "1.0.0")
|
|
||||||
settings: PluginSettings; // Plugin settings object
|
|
||||||
run: (api: PluginAPI) => void; // Main plugin function
|
|
||||||
|
|
||||||
// Optional fields
|
|
||||||
styles?: string; // CSS styles to inject
|
|
||||||
disableToggle?: boolean; // Show enable/disable toggle in settings
|
|
||||||
defaultEnabled?: boolean; // Start enabled/disabled (requires disableToggle)
|
|
||||||
beta?: boolean; // Show "Beta" tag in settings UI
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Metadata Options
|
|
||||||
|
|
||||||
- **`disableToggle`**: When `true`, users can enable/disable your plugin in the settings page
|
|
||||||
- **`defaultEnabled`**: When `false`, your plugin starts disabled by default (only works with `disableToggle: true`)
|
|
||||||
- **`beta`**: When `true`, displays an orange "Beta" tag next to your plugin name in the settings UI
|
|
||||||
- **`styles`**: CSS string that gets injected into the page when your plugin runs
|
|
||||||
|
|
||||||
## SEQTA API
|
|
||||||
|
|
||||||
The SEQTA API helps you interact with SEQTA's pages:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
|
|
||||||
const seqtaPlugin: Plugin<typeof settings> = {
|
|
||||||
id: "seqta-example",
|
|
||||||
name: "SEQTA Example",
|
|
||||||
description: "Shows how to use the SEQTA API",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: {},
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Wait for elements to appear
|
|
||||||
const { unregister: timetableUnregister } = api.seqta.onMount(
|
|
||||||
".timetable",
|
|
||||||
(timetable) => {
|
|
||||||
const button = document.createElement("button");
|
|
||||||
button.textContent = "Export";
|
|
||||||
timetable.appendChild(button);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Track page changes
|
|
||||||
const { unregister: pageUnregister } = api.seqta.onPageChange((page) => {
|
|
||||||
console.log("User went to:", page);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Clean up when disabled
|
|
||||||
return () => {
|
|
||||||
timetableUnregister();
|
|
||||||
pageUnregister();
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default seqtaPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Settings API
|
|
||||||
|
|
||||||
Here's how to add settings to your plugin:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
import { BasePlugin } from "@/plugins/core/settings";
|
|
||||||
import {
|
|
||||||
booleanSetting,
|
|
||||||
stringSetting,
|
|
||||||
numberSetting,
|
|
||||||
selectSetting,
|
|
||||||
defineSettings,
|
|
||||||
Setting,
|
|
||||||
} from "@/plugins/core/settingsHelpers";
|
|
||||||
|
|
||||||
// Define your settings
|
|
||||||
const settings = defineSettings({
|
|
||||||
darkMode: booleanSetting({
|
|
||||||
default: false,
|
|
||||||
title: "Dark Mode",
|
|
||||||
description: "Enable dark mode",
|
|
||||||
}),
|
|
||||||
userName: stringSetting({
|
|
||||||
default: "",
|
|
||||||
title: "User Name",
|
|
||||||
description: "Your display name",
|
|
||||||
placeholder: "Enter your name...",
|
|
||||||
}),
|
|
||||||
theme: selectSetting({
|
|
||||||
default: "light",
|
|
||||||
title: "Theme",
|
|
||||||
description: "Choose your theme",
|
|
||||||
options: [
|
|
||||||
{ value: "light", label: "Light" },
|
|
||||||
{ value: "dark", label: "Dark" },
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create your settings class
|
|
||||||
class ThemePluginClass extends BasePlugin<typeof settings> {
|
|
||||||
@Setting(settings.darkMode)
|
|
||||||
darkMode!: boolean;
|
|
||||||
|
|
||||||
@Setting(settings.userName)
|
|
||||||
userName!: string;
|
|
||||||
|
|
||||||
@Setting(settings.theme)
|
|
||||||
theme!: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the plugin
|
|
||||||
const themePlugin: Plugin<typeof settings> = {
|
|
||||||
id: "theme-example",
|
|
||||||
name: "Theme Example",
|
|
||||||
description: "Shows how to use settings",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: new ThemePluginClass().settings,
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Apply initial settings
|
|
||||||
if (api.settings.darkMode) {
|
|
||||||
document.body.classList.add("dark");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listen for changes
|
|
||||||
const { unregister } = api.settings.onChange("darkMode", (enabled) => {
|
|
||||||
document.body.classList.toggle("dark", enabled);
|
|
||||||
});
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
unregister();
|
|
||||||
document.body.classList.remove("dark");
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default themePlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Storage API
|
|
||||||
|
|
||||||
Here's how to use storage in your plugin:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
|
|
||||||
const storagePlugin: Plugin<typeof settings> = {
|
|
||||||
id: "storage-example",
|
|
||||||
name: "Storage Example",
|
|
||||||
description: "Shows how to use storage",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: {},
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Wait for storage to be ready
|
|
||||||
await api.storage.loaded;
|
|
||||||
|
|
||||||
// Save some data
|
|
||||||
await api.storage.set("lastVisit", new Date().toISOString());
|
|
||||||
|
|
||||||
// Get saved data
|
|
||||||
const lastVisit = await api.storage.get("lastVisit");
|
|
||||||
console.log("Last visit:", lastVisit);
|
|
||||||
|
|
||||||
// Listen for changes
|
|
||||||
const { unregister } = api.storage.onChange("lastVisit", (newValue) => {
|
|
||||||
console.log("Last visit updated:", newValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
unregister();
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default storagePlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Events API
|
|
||||||
|
|
||||||
Here's how to use events in your plugin:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
|
|
||||||
const eventsPlugin: Plugin<typeof settings> = {
|
|
||||||
id: "events-example",
|
|
||||||
name: "Events Example",
|
|
||||||
description: "Shows how to use events",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: {},
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// Listen for theme changes
|
|
||||||
const { unregister: themeListener } = api.events.on(
|
|
||||||
"theme.changed",
|
|
||||||
(theme) => {
|
|
||||||
console.log("Theme changed to:", theme);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Listen for notifications
|
|
||||||
const { unregister: notifyListener } = api.events.on(
|
|
||||||
"notification.new",
|
|
||||||
(notification) => {
|
|
||||||
console.log("New notification:", notification);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Clean up listeners
|
|
||||||
return () => {
|
|
||||||
themeListener();
|
|
||||||
notifyListener();
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default eventsPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Performance Tips
|
|
||||||
|
|
||||||
Here's how to write efficient plugins:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import type { Plugin } from "@/plugins/core/types";
|
|
||||||
|
|
||||||
const efficientPlugin: Plugin<typeof settings> = {
|
|
||||||
id: "efficient-example",
|
|
||||||
name: "Efficient Example",
|
|
||||||
description: "Shows performance best practices",
|
|
||||||
version: "1.0.0",
|
|
||||||
settings: {},
|
|
||||||
disableToggle: true,
|
|
||||||
|
|
||||||
run: async (api) => {
|
|
||||||
// ✅ Good: Use onMount
|
|
||||||
const { unregister } = api.seqta.onMount(".timetable", (el) => {
|
|
||||||
el.classList.add("enhanced");
|
|
||||||
});
|
|
||||||
|
|
||||||
// ❌ Bad: Don't use intervals
|
|
||||||
// const interval = setInterval(() => {
|
|
||||||
// const el = document.querySelector('.timetable');
|
|
||||||
// if (el) el.classList.add('enhanced');
|
|
||||||
// }, 100);
|
|
||||||
|
|
||||||
// ✅ Good: Cache DOM elements
|
|
||||||
const header = document.querySelector(".header");
|
|
||||||
if (header) {
|
|
||||||
// Reuse header instead of querying again
|
|
||||||
}
|
|
||||||
|
|
||||||
// ✅ Good: Batch DOM updates
|
|
||||||
const fragment = document.createDocumentFragment();
|
|
||||||
for (let i = 0; i < 10; i++) {
|
|
||||||
const div = document.createElement("div");
|
|
||||||
fragment.appendChild(div);
|
|
||||||
}
|
|
||||||
document.body.appendChild(fragment);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
unregister();
|
|
||||||
// clearInterval(interval); // If you used the bad approach
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default efficientPlugin;
|
|
||||||
```
|
|
||||||
|
|
||||||
Each plugin should be in its own file and exported as the default export. The plugin should:
|
|
||||||
|
|
||||||
1. Import necessary types and helpers
|
|
||||||
2. Define settings if needed
|
|
||||||
3. Create a settings class if using settings
|
|
||||||
4. Create the plugin object with proper type annotation
|
|
||||||
5. Export the plugin as default
|
|
||||||
|
|
||||||
Remember to always:
|
|
||||||
|
|
||||||
- Use proper TypeScript types
|
|
||||||
- Clean up when your plugin is disabled
|
|
||||||
- Handle errors gracefully
|
|
||||||
- Follow the plugin structure shown above
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import type { Plugin } from "vite";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Previously touched CSS mtimes on JS HMR to force style refresh.
|
|
||||||
* That raced with CRXJS runtime reload and corrupted Vite's module graph
|
|
||||||
* (missing named/`default` exports until `npm run dev` was restarted).
|
|
||||||
*
|
|
||||||
* Style updates are now covered by `stabilizeCrxDevHmr` full reloads.
|
|
||||||
*/
|
|
||||||
export default function touchGlobalCSSPlugin(): Plugin {
|
|
||||||
return {
|
|
||||||
name: "touch-global-css",
|
|
||||||
apply: "serve",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -183,7 +183,6 @@ function isTrustedSender(sender?: browser.Runtime.MessageSender): boolean {
|
|||||||
try {
|
try {
|
||||||
if (isSeqtaOrigin(new URL(pageUrl).origin)) return true;
|
if (isSeqtaOrigin(new URL(pageUrl).origin)) return true;
|
||||||
} catch {
|
} catch {
|
||||||
// try next URL
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -335,7 +334,6 @@ function initCloudLoginCallbackListener() {
|
|||||||
const userId = url.searchParams.get("user_id");
|
const userId = url.searchParams.get("user_id");
|
||||||
|
|
||||||
if (token && refreshToken) {
|
if (token && refreshToken) {
|
||||||
// Store tokens
|
|
||||||
void (async () => {
|
void (async () => {
|
||||||
try {
|
try {
|
||||||
await browser.storage.local.set({
|
await browser.storage.local.set({
|
||||||
@@ -343,7 +341,6 @@ function initCloudLoginCallbackListener() {
|
|||||||
bsplus_refresh_token: refreshToken,
|
bsplus_refresh_token: refreshToken,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fetch full user info
|
|
||||||
const userRes = await fetch("https://accounts.betterseqta.org/api/auth/me", {
|
const userRes = await fetch("https://accounts.betterseqta.org/api/auth/me", {
|
||||||
headers: { Authorization: `Bearer ${token}` },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
});
|
});
|
||||||
@@ -354,7 +351,6 @@ function initCloudLoginCallbackListener() {
|
|||||||
await browser.storage.local.set({ bsplus_user: { id: userId } });
|
await browser.storage.local.set({ bsplus_user: { id: userId } });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger cloud settings download
|
|
||||||
void performCloudSettingsDownloadWithRetry(token).catch((err) => {
|
void performCloudSettingsDownloadWithRetry(token).catch((err) => {
|
||||||
console.warn("[Background] Cloud settings download after login:", err);
|
console.warn("[Background] Cloud settings download after login:", err);
|
||||||
});
|
});
|
||||||
@@ -363,7 +359,6 @@ function initCloudLoginCallbackListener() {
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// Close the callback tab
|
|
||||||
void browser.tabs.remove(tabId);
|
void browser.tabs.remove(tabId);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -11,10 +11,8 @@
|
|||||||
import { color } from '@uiw/codemirror-extensions-color'
|
import { color } from '@uiw/codemirror-extensions-color'
|
||||||
import { Compartment } from '@codemirror/state';
|
import { Compartment } from '@codemirror/state';
|
||||||
|
|
||||||
// Theme
|
|
||||||
import { githubLight, githubDark } from '@uiw/codemirror-theme-github';
|
import { githubLight, githubDark } from '@uiw/codemirror-theme-github';
|
||||||
|
|
||||||
// Language
|
|
||||||
import { css } from "@codemirror/lang-css";
|
import { css } from "@codemirror/lang-css";
|
||||||
|
|
||||||
let editor = $state<HTMLDivElement | null>(null)
|
let editor = $state<HTMLDivElement | null>(null)
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const formatKeyForDisplay = (key: string): string => {
|
const formatKeyForDisplay = (key: string): string => {
|
||||||
// Map keys to their display format
|
|
||||||
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
||||||
const keyMap: Record<string, string> = {
|
const keyMap: Record<string, string> = {
|
||||||
'ctrl': isMac ? '⌃' : 'Ctrl',
|
'ctrl': isMac ? '⌃' : 'Ctrl',
|
||||||
@@ -70,7 +69,6 @@
|
|||||||
if (parsed.alt) parts.push('alt');
|
if (parsed.alt) parts.push('alt');
|
||||||
if (parsed.shift) parts.push('shift');
|
if (parsed.shift) parts.push('shift');
|
||||||
|
|
||||||
// Add the main key
|
|
||||||
if (parsed.key) parts.push(parsed.key);
|
if (parsed.key) parts.push(parsed.key);
|
||||||
|
|
||||||
return parts;
|
return parts;
|
||||||
@@ -92,7 +90,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the hotkey string
|
|
||||||
const modifiers: string[] = [];
|
const modifiers: string[] = [];
|
||||||
let mainKey = '';
|
let mainKey = '';
|
||||||
|
|
||||||
@@ -131,7 +128,6 @@
|
|||||||
|
|
||||||
const key = formatKeyForHotkey(e.key);
|
const key = formatKeyForHotkey(e.key);
|
||||||
|
|
||||||
// Add modifiers
|
|
||||||
if (e.ctrlKey) addRecordedKey('ctrl');
|
if (e.ctrlKey) addRecordedKey('ctrl');
|
||||||
if (e.metaKey) addRecordedKey('cmd');
|
if (e.metaKey) addRecordedKey('cmd');
|
||||||
if (e.altKey) addRecordedKey('alt');
|
if (e.altKey) addRecordedKey('alt');
|
||||||
@@ -166,7 +162,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get the parts to display
|
|
||||||
const hotkeyParts = $derived(isRecording
|
const hotkeyParts = $derived(isRecording
|
||||||
? Array.from(recordedKeys).map(formatKeyForDisplay)
|
? Array.from(recordedKeys).map(formatKeyForDisplay)
|
||||||
: getHotkeyParts(value).map(formatKeyForDisplay));
|
: getHotkeyParts(value).map(formatKeyForDisplay));
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
onCategoriesChange: (categories: string[]) => void;
|
onCategoriesChange: (categories: string[]) => void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// Existing states
|
|
||||||
let backgrounds = $state<Background[]>([]);
|
let backgrounds = $state<Background[]>([]);
|
||||||
let error = $state<string | null>(null);
|
let error = $state<string | null>(null);
|
||||||
let selectedBackground = $state<string | null>(null);
|
let selectedBackground = $state<string | null>(null);
|
||||||
@@ -22,11 +21,9 @@
|
|||||||
let savedBackgrounds = $state<string[]>([]);
|
let savedBackgrounds = $state<string[]>([]);
|
||||||
let installingBackgrounds = $state<Set<string>>(new Set());
|
let installingBackgrounds = $state<Set<string>>(new Set());
|
||||||
let debugInfo = $state<string>('');
|
let debugInfo = $state<string>('');
|
||||||
// New state variables
|
|
||||||
let activeTab = $state<'all' | 'installed' | 'photos' | 'videos'>('all');
|
let activeTab = $state<'all' | 'installed' | 'photos' | 'videos'>('all');
|
||||||
let sortBy = $state<'newest' | 'popular' | 'name'>('newest');
|
let sortBy = $state<'newest' | 'popular' | 'name'>('newest');
|
||||||
|
|
||||||
// Existing functions
|
|
||||||
const loadStore = async () => {
|
const loadStore = async () => {
|
||||||
try {
|
try {
|
||||||
debugInfo = 'Fetching backgrounds...';
|
debugInfo = 'Fetching backgrounds...';
|
||||||
@@ -60,10 +57,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load data on mount
|
|
||||||
loadStore();
|
loadStore();
|
||||||
|
|
||||||
// Derived states
|
|
||||||
let filteredBackgrounds = $derived((() => {
|
let filteredBackgrounds = $derived((() => {
|
||||||
let filtered = backgrounds;
|
let filtered = backgrounds;
|
||||||
|
|
||||||
@@ -74,7 +69,6 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply category filtering
|
|
||||||
filtered = filtered.filter((bg: Background) => {
|
filtered = filtered.filter((bg: Background) => {
|
||||||
return selectedCategory === 'All'
|
return selectedCategory === 'All'
|
||||||
? true
|
? true
|
||||||
@@ -83,7 +77,6 @@
|
|||||||
: bg.category === selectedCategory;
|
: bg.category === selectedCategory;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Apply sorting
|
|
||||||
filtered.sort((a: Background, b: Background) => {
|
filtered.sort((a: Background, b: Background) => {
|
||||||
switch (sortBy) {
|
switch (sortBy) {
|
||||||
case 'name':
|
case 'name':
|
||||||
@@ -101,7 +94,6 @@
|
|||||||
})());
|
})());
|
||||||
|
|
||||||
let categories = $derived([...new Set(backgrounds.map(bg => bg.category))]);
|
let categories = $derived([...new Set(backgrounds.map(bg => bg.category))]);
|
||||||
// Background management functions
|
|
||||||
async function saveBackgroundFromUrl(url: string, id: string, fileType: string): Promise<void> {
|
async function saveBackgroundFromUrl(url: string, id: string, fileType: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
if (!isIndexedDBSupported()) {
|
if (!isIndexedDBSupported()) {
|
||||||
|
|||||||
@@ -1,40 +1,3 @@
|
|||||||
type BackgroundUpdateCallback = () => void;
|
import { createUpdateSignal } from "./updateSignal";
|
||||||
|
|
||||||
/**
|
export const backgroundUpdates = createUpdateSignal();
|
||||||
* A singleton class used to notify listeners about generic background updates or events.
|
|
||||||
* These updates typically signify that UI components or other parts of the application
|
|
||||||
* might need to refresh or re-evaluate background-related data (e.g., after a new background
|
|
||||||
* image is added, removed, or changed).
|
|
||||||
*/
|
|
||||||
class BackgroundUpdates {
|
|
||||||
private static instance: BackgroundUpdates;
|
|
||||||
private listeners: Set<BackgroundUpdateCallback> = new Set();
|
|
||||||
|
|
||||||
private constructor() {}
|
|
||||||
|
|
||||||
public static getInstance(): BackgroundUpdates {
|
|
||||||
if (!BackgroundUpdates.instance) {
|
|
||||||
BackgroundUpdates.instance = new BackgroundUpdates();
|
|
||||||
}
|
|
||||||
return BackgroundUpdates.instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public addListener(callback: BackgroundUpdateCallback): void {
|
|
||||||
this.listeners.add(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
public removeListener(callback: BackgroundUpdateCallback): void {
|
|
||||||
this.listeners.delete(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invokes all registered listener callbacks, signifying that a background update has occurred.
|
|
||||||
* This method should be called whenever a change to background data happens that requires
|
|
||||||
* other parts of the application to be notified.
|
|
||||||
*/
|
|
||||||
public triggerUpdate(): void {
|
|
||||||
this.listeners.forEach((callback) => callback());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const backgroundUpdates = BackgroundUpdates.getInstance();
|
|
||||||
@@ -1,40 +1,3 @@
|
|||||||
type ThemeUpdateCallback = () => void;
|
import { createUpdateSignal } from "./updateSignal";
|
||||||
|
|
||||||
/**
|
export const themeUpdates = createUpdateSignal();
|
||||||
* A singleton class used to notify listeners about theme-related updates.
|
|
||||||
* These updates can include events like theme changes, custom theme modifications,
|
|
||||||
* or any other event that might require UI components to refresh their appearance
|
|
||||||
* or re-apply theme styles.
|
|
||||||
*/
|
|
||||||
class ThemeUpdates {
|
|
||||||
private static instance: ThemeUpdates;
|
|
||||||
private listeners: Set<ThemeUpdateCallback> = new Set();
|
|
||||||
|
|
||||||
private constructor() {}
|
|
||||||
|
|
||||||
public static getInstance(): ThemeUpdates {
|
|
||||||
if (!ThemeUpdates.instance) {
|
|
||||||
ThemeUpdates.instance = new ThemeUpdates();
|
|
||||||
}
|
|
||||||
return ThemeUpdates.instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public addListener(callback: ThemeUpdateCallback): void {
|
|
||||||
this.listeners.add(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
public removeListener(callback: ThemeUpdateCallback): void {
|
|
||||||
this.listeners.delete(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invokes all registered listener callbacks, signifying that a theme-related update has occurred.
|
|
||||||
* This method should be called whenever a change related to themes happens that requires
|
|
||||||
* other parts of the application to be notified.
|
|
||||||
*/
|
|
||||||
public triggerUpdate(): void {
|
|
||||||
this.listeners.forEach((callback) => callback());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const themeUpdates = ThemeUpdates.getInstance();
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
export function createUpdateSignal() {
|
||||||
|
const listeners = new Set<() => void>();
|
||||||
|
return {
|
||||||
|
addListener: (callback: () => void) => void listeners.add(callback),
|
||||||
|
removeListener: (callback: () => void) => void listeners.delete(callback),
|
||||||
|
triggerUpdate: () => listeners.forEach((callback) => callback()),
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
section?: "all" | "themes" | "backgrounds";
|
section?: "all" | "themes" | "backgrounds";
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// backgrounds
|
|
||||||
let selectedBackground = $state<string | null>(null);
|
let selectedBackground = $state<string | null>(null);
|
||||||
let selectNoBackground = $state<() => void>(() => { });
|
let selectNoBackground = $state<() => void>(() => { });
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
// Import existing components
|
|
||||||
import CoverSwiper from '../components/store/CoverSwiper.svelte';
|
import CoverSwiper from '../components/store/CoverSwiper.svelte';
|
||||||
import ThemeGrid from '../components/store/ThemeGrid.svelte';
|
import ThemeGrid from '../components/store/ThemeGrid.svelte';
|
||||||
import SkeletonLoader from '../components/SkeletonLoader.svelte';
|
import SkeletonLoader from '../components/SkeletonLoader.svelte';
|
||||||
@@ -43,7 +42,6 @@
|
|||||||
return unsub;
|
return unsub;
|
||||||
});
|
});
|
||||||
|
|
||||||
// State variables
|
|
||||||
let themes = $state<Theme[]>([]);
|
let themes = $state<Theme[]>([]);
|
||||||
|
|
||||||
/** Grid/search/cover: hides flat-listed slaves when API sends them */
|
/** Grid/search/cover: hides flat-listed slaves when API sends them */
|
||||||
@@ -180,7 +178,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// On mount
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
window.addEventListener('bsplus:highlight-theme', onHighlightThemeEvent);
|
window.addEventListener('bsplus:highlight-theme', onHighlightThemeEvent);
|
||||||
themeUpdates.addListener(fetchCurrentThemes);
|
themeUpdates.addListener(fetchCurrentThemes);
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
import type { LoadedCustomTheme } from "@/types/CustomThemes";
|
|
||||||
import { buildThemeFromDraft, type ThemeBuilderDraft } from "./themeBuilderDraft";
|
|
||||||
|
|
||||||
export type SimpleThemeInput = ThemeBuilderDraft;
|
|
||||||
|
|
||||||
export { buildThemeBuilderCss as buildSimpleThemeCss } from "./themeBuilderDraft";
|
|
||||||
|
|
||||||
/** @deprecated Use buildThemeFromDraft */
|
|
||||||
export function buildSimpleTheme(input: SimpleThemeInput): LoadedCustomTheme {
|
|
||||||
return buildThemeFromDraft(input);
|
|
||||||
}
|
|
||||||
+4
-5
@@ -1,8 +1,7 @@
|
|||||||
import { buildSimpleTheme } from "./buildSimpleTheme";
|
import { buildThemeBuilderCss, buildThemeFromDraft } from "./themeBuilderDraft";
|
||||||
import { buildThemeBuilderCss } from "./themeBuilderDraft";
|
|
||||||
import { getFontPreset } from "@/seqta/ui/fonts/presets";
|
import { getFontPreset } from "@/seqta/ui/fonts/presets";
|
||||||
|
|
||||||
describe("buildSimpleTheme", () => {
|
describe("themeBuilderDraft", () => {
|
||||||
it("paints the tint above an opaque photo when blur is disabled", () => {
|
it("paints the tint above an opaque photo when blur is disabled", () => {
|
||||||
const css = buildThemeBuilderCss(
|
const css = buildThemeBuilderCss(
|
||||||
getFontPreset("inter"),
|
getFontPreset("inter"),
|
||||||
@@ -25,7 +24,7 @@ describe("buildSimpleTheme", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("creates a theme with photos as custom image variables", () => {
|
it("creates a theme with photos as custom image variables", () => {
|
||||||
const theme = buildSimpleTheme({
|
const theme = buildThemeFromDraft({
|
||||||
name: "Sunset",
|
name: "Sunset",
|
||||||
accentColor: "#ff6600",
|
accentColor: "#ff6600",
|
||||||
fontId: "rubik",
|
fontId: "rubik",
|
||||||
@@ -41,7 +40,7 @@ describe("buildSimpleTheme", () => {
|
|||||||
|
|
||||||
it("requires a name", () => {
|
it("requires a name", () => {
|
||||||
expect(() =>
|
expect(() =>
|
||||||
buildSimpleTheme({ name: " ", accentColor: "#000", photoBlobs: [] }),
|
buildThemeFromDraft({ name: " ", accentColor: "#000", photoBlobs: [] }),
|
||||||
).toThrow("Theme name is required");
|
).toThrow("Theme name is required");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -15,7 +15,7 @@ export type ThemeBuilderDraft = {
|
|||||||
themeId?: string;
|
themeId?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Keep the BetterSEQTA title bar opaque (generated themes must not use the old transparent #title hack). */
|
/** Keeps the BetterSEQTA title bar opaque in generated themes. */
|
||||||
const TITLEBAR_SOLID = `#title {
|
const TITLEBAR_SOLID = `#title {
|
||||||
background: var(--background-primary) !important;
|
background: var(--background-primary) !important;
|
||||||
}`;
|
}`;
|
||||||
|
|||||||
+2
-17
@@ -11,7 +11,6 @@ class ReactFiber {
|
|||||||
console.log("🔍 Found Fibers:", this.fibers);
|
console.log("🔍 Found Fibers:", this.fibers);
|
||||||
console.log("🛠 Found Components:", this.components);
|
console.log("🛠 Found Components:", this.components);
|
||||||
|
|
||||||
// Debug fiber info
|
|
||||||
this.fibers.forEach((fiber, index) => {
|
this.fibers.forEach((fiber, index) => {
|
||||||
if (fiber) {
|
if (fiber) {
|
||||||
console.log(`Fiber ${index}:`, {
|
console.log(`Fiber ${index}:`, {
|
||||||
@@ -43,12 +42,10 @@ class ReactFiber {
|
|||||||
'__reactInternalInstance'
|
'__reactInternalInstance'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Check for exact matches first
|
|
||||||
for (const key of possibleKeys) {
|
for (const key of possibleKeys) {
|
||||||
if (node[key]) return node[key];
|
if (node[key]) return node[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fall back to pattern matching
|
|
||||||
const fiberKey = Object.getOwnPropertyNames(node).find(
|
const fiberKey = Object.getOwnPropertyNames(node).find(
|
||||||
(name) =>
|
(name) =>
|
||||||
name.startsWith("__reactFiber") ||
|
name.startsWith("__reactFiber") ||
|
||||||
@@ -108,7 +105,6 @@ class ReactFiber {
|
|||||||
const fiber = this.fibers[0];
|
const fiber = this.fibers[0];
|
||||||
let state = null;
|
let state = null;
|
||||||
|
|
||||||
// Handle class components
|
|
||||||
if (component?.state) {
|
if (component?.state) {
|
||||||
state = component.state;
|
state = component.state;
|
||||||
}
|
}
|
||||||
@@ -273,10 +269,8 @@ class ReactFiber {
|
|||||||
|
|
||||||
setState(update) {
|
setState(update) {
|
||||||
this.components.forEach((component) => {
|
this.components.forEach((component) => {
|
||||||
// Handle class components
|
|
||||||
if (component?.setState) {
|
if (component?.setState) {
|
||||||
if (typeof update === "function") {
|
if (typeof update === "function") {
|
||||||
// Functional update
|
|
||||||
component.setState((prevState) => {
|
component.setState((prevState) => {
|
||||||
const newState = update(prevState);
|
const newState = update(prevState);
|
||||||
if (this.debug)
|
if (this.debug)
|
||||||
@@ -338,18 +332,15 @@ class ReactFiber {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makeSerializable(obj, visited = new WeakSet(), depth = 0, maxDepth = 10) {
|
function makeSerializable(obj, visited = new WeakSet(), depth = 0, maxDepth = 10) {
|
||||||
// Handle primitives first
|
|
||||||
if (obj === null || obj === undefined) {
|
if (obj === null || obj === undefined) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Catch ALL functions early
|
|
||||||
if (typeof obj === "function") {
|
if (typeof obj === "function") {
|
||||||
return `[Function: ${obj.name || 'anonymous'}]`;
|
return `[Function: ${obj.name || 'anonymous'}]`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof obj !== "object") {
|
if (typeof obj !== "object") {
|
||||||
// Handle other primitives
|
|
||||||
if (typeof obj === "symbol") return obj.toString();
|
if (typeof obj === "symbol") return obj.toString();
|
||||||
if (typeof obj === "bigint") return obj.toString() + "n";
|
if (typeof obj === "bigint") return obj.toString() + "n";
|
||||||
return obj;
|
return obj;
|
||||||
@@ -360,14 +351,12 @@ function makeSerializable(obj, visited = new WeakSet(), depth = 0, maxDepth = 10
|
|||||||
return "[Max Depth Reached]";
|
return "[Max Depth Reached]";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent circular references
|
|
||||||
if (visited.has(obj)) {
|
if (visited.has(obj)) {
|
||||||
return "[Circular Reference]";
|
return "[Circular Reference]";
|
||||||
}
|
}
|
||||||
visited.add(obj);
|
visited.add(obj);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Handle special objects first
|
|
||||||
if (obj instanceof HTMLElement) {
|
if (obj instanceof HTMLElement) {
|
||||||
return {
|
return {
|
||||||
type: "HTMLElement",
|
type: "HTMLElement",
|
||||||
@@ -411,15 +400,13 @@ function makeSerializable(obj, visited = new WeakSet(), depth = 0, maxDepth = 10
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle arrays
|
|
||||||
if (Array.isArray(obj)) {
|
if (Array.isArray(obj)) {
|
||||||
return obj.slice(0, 50).map((item, index) => {
|
return obj.slice(0, 50).map((item, index) => {
|
||||||
if (index >= 25) return "[...truncated]"; // Smaller limit
|
if (index >= 25) return "[...truncated]";
|
||||||
return makeSerializable(item, visited, depth + 1, maxDepth);
|
return makeSerializable(item, visited, depth + 1, maxDepth);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle regular objects
|
|
||||||
const serializableObj = {};
|
const serializableObj = {};
|
||||||
|
|
||||||
// Get own enumerable properties only to avoid prototype pollution
|
// Get own enumerable properties only to avoid prototype pollution
|
||||||
@@ -432,12 +419,11 @@ function makeSerializable(obj, visited = new WeakSet(), depth = 0, maxDepth = 10
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Limit number of properties to avoid huge objects
|
// Limit number of properties to avoid huge objects
|
||||||
const maxKeys = 30; // Smaller limit for safety
|
const maxKeys = 30;
|
||||||
const processedKeys = ownKeys.slice(0, maxKeys);
|
const processedKeys = ownKeys.slice(0, maxKeys);
|
||||||
|
|
||||||
for (const key of processedKeys) {
|
for (const key of processedKeys) {
|
||||||
try {
|
try {
|
||||||
// Skip problematic keys early
|
|
||||||
const dangerousKeys = [
|
const dangerousKeys = [
|
||||||
'parentNode', 'parentElement', 'ownerDocument', 'children', 'childNodes',
|
'parentNode', 'parentElement', 'ownerDocument', 'children', 'childNodes',
|
||||||
'return', 'child', 'sibling', 'alternate', 'ref', // React Fiber circular refs
|
'return', 'child', 'sibling', 'alternate', 'ref', // React Fiber circular refs
|
||||||
@@ -465,7 +451,6 @@ function makeSerializable(obj, visited = new WeakSet(), depth = 0, maxDepth = 10
|
|||||||
if (typeof value === "symbol") {
|
if (typeof value === "symbol") {
|
||||||
value = `[Symbol: ${value.description || 'anonymous'}]`;
|
value = `[Symbol: ${value.description || 'anonymous'}]`;
|
||||||
}
|
}
|
||||||
// Extra function check
|
|
||||||
else if (typeof value === "function") {
|
else if (typeof value === "function") {
|
||||||
value = `[Function: ${value.name || 'anonymous'}]`;
|
value = `[Function: ${value.name || 'anonymous'}]`;
|
||||||
} else if (value && typeof value === "object") {
|
} else if (value && typeof value === "object") {
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
async function handleFiles(files: FileList | null) {
|
async function handleFiles(files: FileList | null) {
|
||||||
const file = files?.[0]
|
const file = files?.[0]
|
||||||
if (!file) return
|
if (!file) return
|
||||||
// Accept WAV and MP3 files
|
|
||||||
const isSupported = file.type === 'audio/wav' || file.type === 'audio/mpeg' ||
|
const isSupported = file.type === 'audio/wav' || file.type === 'audio/mpeg' ||
|
||||||
file.name.toLowerCase().endsWith('.wav') || file.name.toLowerCase().endsWith('.mp3')
|
file.name.toLowerCase().endsWith('.wav') || file.name.toLowerCase().endsWith('.mp3')
|
||||||
if (!isSupported) {
|
if (!isSupported) {
|
||||||
@@ -36,7 +35,6 @@
|
|||||||
await store.setItem('audio-name', file.name)
|
await store.setItem('audio-name', file.name)
|
||||||
filename = file.name
|
filename = file.name
|
||||||
|
|
||||||
// Probe duration
|
|
||||||
try {
|
try {
|
||||||
const url = URL.createObjectURL(file)
|
const url = URL.createObjectURL(file)
|
||||||
const audio = new Audio(url)
|
const audio = new Audio(url)
|
||||||
|
|||||||
@@ -53,7 +53,6 @@
|
|||||||
|
|
||||||
let keydownHandler: ((e: KeyboardEvent) => void) | null = null;
|
let keydownHandler: ((e: KeyboardEvent) => void) | null = null;
|
||||||
|
|
||||||
// Listen for setting changes
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
const loadSettings = async () => {
|
const loadSettings = async () => {
|
||||||
const settings = await browser.storage.local.get('plugin.global-search.settings');
|
const settings = await browser.storage.local.get('plugin.global-search.settings');
|
||||||
@@ -65,7 +64,6 @@
|
|||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
// Listen for storage changes
|
|
||||||
const handleStorageChange = (changes: any, area: string) => {
|
const handleStorageChange = (changes: any, area: string) => {
|
||||||
if (area === 'local' && changes['plugin.global-search.settings']) {
|
if (area === 'local' && changes['plugin.global-search.settings']) {
|
||||||
const newSettings = changes['plugin.global-search.settings'].newValue as { searchHotkey?: string } | undefined;
|
const newSettings = changes['plugin.global-search.settings'].newValue as { searchHotkey?: string } | undefined;
|
||||||
@@ -299,7 +297,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleKeyNav = (e: KeyboardEvent) => {
|
const handleKeyNav = (e: KeyboardEvent) => {
|
||||||
// Handle regular navigation
|
|
||||||
if (e.key === 'ArrowDown') {
|
if (e.key === 'ArrowDown') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
selectNext();
|
selectNext();
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ export interface StaticCommandItem extends BaseCommandItem {
|
|||||||
keybindLabel?: string[];
|
keybindLabel?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to get current lesson
|
|
||||||
async function getCurrentLesson() {
|
async function getCurrentLesson() {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const todayFormatted = formatDate(date);
|
const todayFormatted = formatDate(date);
|
||||||
@@ -83,7 +82,6 @@ async function navigateToSpecificLesson(lesson: any) {
|
|||||||
const weeks = document.querySelectorAll(".course .navigator .week");
|
const weeks = document.querySelectorAll(".course .navigator .week");
|
||||||
|
|
||||||
for (const week of weeks) {
|
for (const week of weeks) {
|
||||||
// Look for lessons in this week
|
|
||||||
const lessons = week.querySelectorAll(".lesson");
|
const lessons = week.querySelectorAll(".lesson");
|
||||||
|
|
||||||
for (const lessonElement of lessons) {
|
for (const lessonElement of lessons) {
|
||||||
@@ -172,7 +170,6 @@ const staticCommands: StaticCommandItem[] = [
|
|||||||
action: async () => {
|
action: async () => {
|
||||||
const currentLesson = await getCurrentLesson();
|
const currentLesson = await getCurrentLesson();
|
||||||
if (currentLesson && currentLesson.programmeID !== 0) {
|
if (currentLesson && currentLesson.programmeID !== 0) {
|
||||||
// Navigate to course page first
|
|
||||||
window.location.hash = `?page=/courses/${currentLesson.programmeID}:${currentLesson.metaID}`;
|
window.location.hash = `?page=/courses/${currentLesson.programmeID}:${currentLesson.metaID}`;
|
||||||
|
|
||||||
await navigateToSpecificLesson(currentLesson);
|
await navigateToSpecificLesson(currentLesson);
|
||||||
|
|||||||
@@ -357,7 +357,6 @@ export const actionMap: Record<string, ActionHandler<any>> = {
|
|||||||
num("assessmentID") ??
|
num("assessmentID") ??
|
||||||
num("entityId") ??
|
num("entityId") ??
|
||||||
num("id");
|
num("id");
|
||||||
const messageId = num("messageId");
|
|
||||||
|
|
||||||
const navigateToAssessment = (): void => {
|
const navigateToAssessment = (): void => {
|
||||||
if (programme !== undefined && metaclass !== undefined) {
|
if (programme !== undefined && metaclass !== undefined) {
|
||||||
@@ -432,7 +431,7 @@ export const actionMap: Record<string, ActionHandler<any>> = {
|
|||||||
// same live hash navigation as the real message action instead of
|
// same live hash navigation as the real message action instead of
|
||||||
// forcing a fresh bootstrap, which can drop back to dashboard for
|
// forcing a fresh bootstrap, which can drop back to dashboard for
|
||||||
// context-only endpoints.
|
// context-only endpoints.
|
||||||
void messageId; // noqa — preserved for future deep-select work
|
|
||||||
navigateInCurrentSeqtaApp("/messages");
|
navigateInCurrentSeqtaApp("/messages");
|
||||||
return;
|
return;
|
||||||
case "people":
|
case "people":
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ const fetchUpcomingAssessments = async (student: number) => {
|
|||||||
const res = await fetchJSON("/seqta/student/assessment/list/upcoming?", {
|
const res = await fetchJSON("/seqta/student/assessment/list/upcoming?", {
|
||||||
student,
|
student,
|
||||||
});
|
});
|
||||||
// Match analytics.rs: payload is an array, return empty array if not found
|
|
||||||
return Array.isArray(res.payload) ? res.payload : [];
|
return Array.isArray(res.payload) ? res.payload : [];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("[Assignments job] Failed to fetch upcoming assessments:", e);
|
console.error("[Assignments job] Failed to fetch upcoming assessments:", e);
|
||||||
@@ -41,24 +40,18 @@ const fetchSubjects = async () => {
|
|||||||
const fetchPastAssessments = async (student: number, subjects: any[]) => {
|
const fetchPastAssessments = async (student: number, subjects: any[]) => {
|
||||||
const map: Record<number, any> = {};
|
const map: Record<number, any> = {};
|
||||||
|
|
||||||
// Fetch past assessments for all subjects in parallel (like assessmentsOverview does)
|
|
||||||
// This is much faster than sequential fetching
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
subjects.map(async (subject) => {
|
subjects.map(async (subject) => {
|
||||||
try {
|
try {
|
||||||
// Match analytics.rs exactly: parameter order is programme, metaclass, student
|
|
||||||
const res = await fetchJSON("/seqta/student/assessment/list/past?", {
|
const res = await fetchJSON("/seqta/student/assessment/list/past?", {
|
||||||
programme: subject.programme,
|
programme: subject.programme,
|
||||||
metaclass: subject.metaclass,
|
metaclass: subject.metaclass,
|
||||||
student,
|
student,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Past assessments API can return data in payload.tasks OR payload.pending (or both)
|
// Past assessments can come back in payload.tasks, payload.pending, or both.
|
||||||
// Based on analytics.rs fetch_past_assessments, we need to check both arrays
|
|
||||||
const processAssessment = (assessment: any) => {
|
const processAssessment = (assessment: any) => {
|
||||||
if (assessment && assessment.id) {
|
if (assessment && assessment.id) {
|
||||||
// Ensure programme and metaclass are included from the subject
|
|
||||||
// Use the assessment's IDs if available, otherwise fall back to subject's
|
|
||||||
map[assessment.id] = {
|
map[assessment.id] = {
|
||||||
...assessment,
|
...assessment,
|
||||||
programme: assessment.programme || assessment.programmeID || subject.programme,
|
programme: assessment.programme || assessment.programmeID || subject.programme,
|
||||||
@@ -69,13 +62,10 @@ const fetchPastAssessments = async (student: number, subjects: any[]) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Match analytics.rs: Check both pending and tasks arrays
|
|
||||||
// Check for pending array first (matching Rust code order)
|
|
||||||
if (res.payload?.pending && Array.isArray(res.payload.pending)) {
|
if (res.payload?.pending && Array.isArray(res.payload.pending)) {
|
||||||
res.payload.pending.forEach(processAssessment);
|
res.payload.pending.forEach(processAssessment);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for tasks array
|
|
||||||
if (res.payload?.tasks && Array.isArray(res.payload.tasks)) {
|
if (res.payload?.tasks && Array.isArray(res.payload.tasks)) {
|
||||||
res.payload.tasks.forEach(processAssessment);
|
res.payload.tasks.forEach(processAssessment);
|
||||||
}
|
}
|
||||||
@@ -101,7 +91,6 @@ export const assignmentsJob: Job = {
|
|||||||
|
|
||||||
let score = 0;
|
let score = 0;
|
||||||
|
|
||||||
// Boost upcoming assignments
|
|
||||||
if (item.metadata.dueDate) {
|
if (item.metadata.dueDate) {
|
||||||
const dueDate = new Date(item.metadata.dueDate).getTime();
|
const dueDate = new Date(item.metadata.dueDate).getTime();
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
@@ -115,7 +104,6 @@ export const assignmentsJob: Job = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boost if submitted
|
|
||||||
if (item.metadata.submitted) {
|
if (item.metadata.submitted) {
|
||||||
score += 0.02;
|
score += 0.02;
|
||||||
}
|
}
|
||||||
@@ -124,8 +112,7 @@ export const assignmentsJob: Job = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
run: async (ctx) => {
|
run: async (ctx) => {
|
||||||
// Don't filter by existing IDs - we want to process ALL assessments (both new and old)
|
// Process every assessment, not just new ones, so metadata stays current.
|
||||||
// to ensure metadata is up-to-date and all past assignments are indexed
|
|
||||||
const existingItems = await ctx.getStoredItems("assignments");
|
const existingItems = await ctx.getStoredItems("assignments");
|
||||||
const existingIds = new Set(existingItems.map((i) => i.id));
|
const existingIds = new Set(existingItems.map((i) => i.id));
|
||||||
|
|
||||||
@@ -133,7 +120,6 @@ export const assignmentsJob: Job = {
|
|||||||
|
|
||||||
verboseDebug("[Assignments job] Starting indexing - fetching all assessments (upcoming and past)...");
|
verboseDebug("[Assignments job] Starting indexing - fetching all assessments (upcoming and past)...");
|
||||||
|
|
||||||
// Fetch data in parallel
|
|
||||||
const [upcoming, subjects] = await Promise.all([
|
const [upcoming, subjects] = await Promise.all([
|
||||||
fetchUpcomingAssessments(student),
|
fetchUpcomingAssessments(student),
|
||||||
fetchSubjects(),
|
fetchSubjects(),
|
||||||
@@ -141,12 +127,10 @@ export const assignmentsJob: Job = {
|
|||||||
|
|
||||||
verboseDebug(`[Assignments job] Fetched ${upcoming.length} upcoming assessments and ${subjects.length} subjects`);
|
verboseDebug(`[Assignments job] Fetched ${upcoming.length} upcoming assessments and ${subjects.length} subjects`);
|
||||||
|
|
||||||
// Fetch past assessments for ALL subjects to ensure we get all historical assignments
|
|
||||||
const past = await fetchPastAssessments(student, subjects);
|
const past = await fetchPastAssessments(student, subjects);
|
||||||
|
|
||||||
verboseDebug(`[Assignments job] Fetched ${past.length} past assessments`);
|
verboseDebug(`[Assignments job] Fetched ${past.length} past assessments`);
|
||||||
|
|
||||||
// Create a lookup map from subject code to programme/metaclass
|
|
||||||
const subjectLookup = new Map<string, { programme: number; metaclass: number }>();
|
const subjectLookup = new Map<string, { programme: number; metaclass: number }>();
|
||||||
subjects.forEach((s: any) => {
|
subjects.forEach((s: any) => {
|
||||||
if (s.code && s.programme && s.metaclass) {
|
if (s.code && s.programme && s.metaclass) {
|
||||||
@@ -154,16 +138,13 @@ export const assignmentsJob: Job = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Combine and deduplicate
|
|
||||||
const allAssessments = new Map<number, any>();
|
const allAssessments = new Map<number, any>();
|
||||||
|
|
||||||
upcoming.forEach((a: any) => {
|
upcoming.forEach((a: any) => {
|
||||||
if (a && a.id) {
|
if (a && a.id) {
|
||||||
// Prioritize capital ID fields (programmeID, metaclassID) as that's what the API returns
|
|
||||||
let programme = a.programmeID || a.programme;
|
let programme = a.programmeID || a.programme;
|
||||||
let metaclass = a.metaclassID || a.metaclass;
|
let metaclass = a.metaclassID || a.metaclass;
|
||||||
|
|
||||||
// If missing, try to get from subject lookup
|
|
||||||
if ((!programme || !metaclass) && a.code) {
|
if ((!programme || !metaclass) && a.code) {
|
||||||
const subjectInfo = subjectLookup.get(a.code);
|
const subjectInfo = subjectLookup.get(a.code);
|
||||||
if (subjectInfo) {
|
if (subjectInfo) {
|
||||||
@@ -185,14 +166,11 @@ export const assignmentsJob: Job = {
|
|||||||
|
|
||||||
past.forEach((a: any) => {
|
past.forEach((a: any) => {
|
||||||
if (a && a.id) {
|
if (a && a.id) {
|
||||||
// Prioritize capital ID fields (programmeID, metaclassID) as that's what the API returns
|
|
||||||
let programme = a.programmeID || a.programme;
|
let programme = a.programmeID || a.programme;
|
||||||
let metaclass = a.metaclassID || a.metaclass;
|
let metaclass = a.metaclassID || a.metaclass;
|
||||||
|
|
||||||
const existing = allAssessments.get(a.id);
|
const existing = allAssessments.get(a.id);
|
||||||
if (existing) {
|
if (existing) {
|
||||||
// Merge past assessment data, ensuring programme/metaclass are preserved
|
|
||||||
// Use existing values if new ones are missing
|
|
||||||
programme = programme || existing.programme || existing.programmeID;
|
programme = programme || existing.programme || existing.programmeID;
|
||||||
metaclass = metaclass || existing.metaclass || existing.metaclassID;
|
metaclass = metaclass || existing.metaclass || existing.metaclassID;
|
||||||
|
|
||||||
@@ -219,17 +197,14 @@ export const assignmentsJob: Job = {
|
|||||||
const items: IndexItem[] = [];
|
const items: IndexItem[] = [];
|
||||||
const processedIds = new Set<string>();
|
const processedIds = new Set<string>();
|
||||||
|
|
||||||
// Process assessments in batches to avoid overwhelming the API
|
|
||||||
const assessmentArray = Array.from(allAssessments.values());
|
const assessmentArray = Array.from(allAssessments.values());
|
||||||
const pastCount = assessmentArray.filter(a => !a.isUpcoming).length;
|
const pastCount = assessmentArray.filter(a => !a.isUpcoming).length;
|
||||||
const upcomingCount = assessmentArray.filter(a => a.isUpcoming).length;
|
const upcomingCount = assessmentArray.filter(a => a.isUpcoming).length;
|
||||||
verboseDebug(`[Assignments job] Processing ${assessmentArray.length} total assessments (${upcomingCount} upcoming, ${pastCount} past)`);
|
verboseDebug(`[Assignments job] Processing ${assessmentArray.length} total assessments (${upcomingCount} upcoming, ${pastCount} past)`);
|
||||||
const batchSize = 15; // Increased batch size for better performance
|
const batchSize = 15;
|
||||||
|
|
||||||
// Skip fetching assessment details - the API endpoint doesn't exist or returns 404
|
// The assessment details endpoint 404s, so details aren't fetched.
|
||||||
// Details are optional and not critical for search functionality
|
|
||||||
|
|
||||||
// Process ALL assessments (both upcoming and past) to ensure everything is indexed
|
|
||||||
for (let i = 0; i < assessmentArray.length; i += batchSize) {
|
for (let i = 0; i < assessmentArray.length; i += batchSize) {
|
||||||
const batch = assessmentArray.slice(i, i + batchSize);
|
const batch = assessmentArray.slice(i, i + batchSize);
|
||||||
|
|
||||||
@@ -237,27 +212,21 @@ export const assignmentsJob: Job = {
|
|||||||
batch.map(async (assessment) => {
|
batch.map(async (assessment) => {
|
||||||
const id = `assignment-${assessment.id}`;
|
const id = `assignment-${assessment.id}`;
|
||||||
|
|
||||||
// Skip if already processed in this batch
|
|
||||||
if (processedIds.has(id)) {
|
if (processedIds.has(id)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
processedIds.add(id);
|
processedIds.add(id);
|
||||||
|
|
||||||
// Process ALL assessments (both new and existing, upcoming and past)
|
|
||||||
// This ensures all historical assignments are indexed and metadata is up-to-date
|
|
||||||
|
|
||||||
// Skip fetching details - API endpoint doesn't exist
|
|
||||||
const description = "";
|
const description = "";
|
||||||
|
|
||||||
const subjectName = assessment.subject || assessment.code || "Unknown Subject";
|
const subjectName = assessment.subject || assessment.code || "Unknown Subject";
|
||||||
const dueDate = assessment.due ? new Date(assessment.due).getTime() : null;
|
const dueDate = assessment.due ? new Date(assessment.due).getTime() : null;
|
||||||
|
|
||||||
// Prioritize capital ID fields (programmeID, metaclassID) as that's what the API returns
|
|
||||||
const programmeId = assessment.programmeID || assessment.programme;
|
const programmeId = assessment.programmeID || assessment.programme;
|
||||||
const metaclassId = assessment.metaclassID || assessment.metaclass;
|
const metaclassId = assessment.metaclassID || assessment.metaclass;
|
||||||
|
|
||||||
// Validate that we have the required IDs for navigation
|
|
||||||
if (!programmeId || !metaclassId || !assessment.id) {
|
if (!programmeId || !metaclassId || !assessment.id) {
|
||||||
console.warn(`[Assignments job] Skipping assignment ${assessment.id} - missing required IDs:`, {
|
console.warn(`[Assignments job] Skipping assignment ${assessment.id} - missing required IDs:`, {
|
||||||
programmeId,
|
programmeId,
|
||||||
@@ -272,7 +241,6 @@ export const assignmentsJob: Job = {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert to numbers, preserving 0 as valid
|
|
||||||
let finalProgrammeId: number | undefined;
|
let finalProgrammeId: number | undefined;
|
||||||
let finalMetaclassId: number | undefined;
|
let finalMetaclassId: number | undefined;
|
||||||
|
|
||||||
@@ -286,7 +254,6 @@ export const assignmentsJob: Job = {
|
|||||||
finalMetaclassId = isNaN(num) ? undefined : num;
|
finalMetaclassId = isNaN(num) ? undefined : num;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Final validation - check for actual numbers (including 0)
|
|
||||||
if (finalProgrammeId === undefined || finalMetaclassId === undefined || !assessment.id) {
|
if (finalProgrammeId === undefined || finalMetaclassId === undefined || !assessment.id) {
|
||||||
console.error(`[Assignments job] ❌ Skipping assignment ${assessment.id} - invalid IDs after conversion:`, {
|
console.error(`[Assignments job] ❌ Skipping assignment ${assessment.id} - invalid IDs after conversion:`, {
|
||||||
programmeId: finalProgrammeId,
|
programmeId: finalProgrammeId,
|
||||||
@@ -338,16 +305,14 @@ export const assignmentsJob: Job = {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Filter out nulls and add to items
|
|
||||||
batchItems.forEach(item => {
|
batchItems.forEach(item => {
|
||||||
if (item) {
|
if (item) {
|
||||||
items.push(item);
|
items.push(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Small delay between batches to avoid rate limiting
|
|
||||||
if (i + batchSize < assessmentArray.length) {
|
if (i + batchSize < assessmentArray.length) {
|
||||||
await delay(50); // Reduced delay
|
await delay(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,10 +323,8 @@ export const assignmentsJob: Job = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
purge: (items) => {
|
purge: (items) => {
|
||||||
// Keep ALL assignments - don't purge old ones as users may want to search for them
|
// Old assignments stay searchable; only items missing required metadata are dropped.
|
||||||
// Only remove items that are truly invalid (missing required metadata)
|
|
||||||
return items.filter((i) => {
|
return items.filter((i) => {
|
||||||
// Keep all items that have valid metadata
|
|
||||||
return i.metadata &&
|
return i.metadata &&
|
||||||
i.metadata.assessmentId &&
|
i.metadata.assessmentId &&
|
||||||
i.metadata.programmeId !== undefined &&
|
i.metadata.programmeId !== undefined &&
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ export const subjectsJob: Job = {
|
|||||||
|
|
||||||
const items: IndexItem[] = [];
|
const items: IndexItem[] = [];
|
||||||
|
|
||||||
// Process each semester
|
|
||||||
for (const semester of list.payload) {
|
for (const semester of list.payload) {
|
||||||
if (!semester.subjects || !Array.isArray(semester.subjects)) {
|
if (!semester.subjects || !Array.isArray(semester.subjects)) {
|
||||||
console.warn("[Subjects job] Skipping invalid semester:", semester);
|
console.warn("[Subjects job] Skipping invalid semester:", semester);
|
||||||
|
|||||||
@@ -342,11 +342,9 @@ export class VectorWorkerManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until the worker reports a terminal status. Previously this method
|
// Wait for the worker to finish, not just queue the job, so indexer.ts
|
||||||
// returned as soon as the job was queued, so indexers.ts continued into
|
// doesn't move on while vectorisation is still running and leave the
|
||||||
// stopHeartbeat/loadAll/loadDynamicItems on the main thread while
|
// progress chip stuck on "Vectorization in progress".
|
||||||
// vectorization was still running — blocking indexing-progress handlers
|
|
||||||
// and freezing the chip on “Vectorization in progress”.
|
|
||||||
this.vectorizationLockCount++;
|
this.vectorizationLockCount++;
|
||||||
this.clearIdleTimer();
|
this.clearIdleTimer();
|
||||||
this.clearUnloadTimer();
|
this.clearUnloadTimer();
|
||||||
|
|||||||
@@ -137,12 +137,10 @@ export async function hybridSearch(
|
|||||||
const opts = { ...DEFAULT_OPTIONS, ...options };
|
const opts = { ...DEFAULT_OPTIONS, ...options };
|
||||||
const trimmedQuery = query.trim().toLowerCase();
|
const trimmedQuery = query.trim().toLowerCase();
|
||||||
|
|
||||||
// If no BM25 results, return empty
|
|
||||||
if (bm25Results.length === 0) {
|
if (bm25Results.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit BM25 results to top K
|
|
||||||
const topBm25Results = bm25Results.slice(0, opts.bm25TopK);
|
const topBm25Results = bm25Results.slice(0, opts.bm25TopK);
|
||||||
|
|
||||||
if (trimmedQuery.length > 2) {
|
if (trimmedQuery.length > 2) {
|
||||||
@@ -221,15 +219,12 @@ export async function hybridSearch(
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sort by hybrid score descending
|
|
||||||
rerankedResults.sort((a, b) => b.score - a.score);
|
rerankedResults.sort((a, b) => b.score - a.score);
|
||||||
|
|
||||||
// Return top results
|
|
||||||
return rerankedResults.slice(0, opts.finalLimit);
|
return rerankedResults.slice(0, opts.finalLimit);
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("[Hybrid Search] Vector reranking failed, using BM25 only:", e);
|
console.warn("[Hybrid Search] Vector reranking failed, using BM25 only:", e);
|
||||||
// Fallback to BM25 only
|
|
||||||
return topBm25Results.slice(0, opts.finalLimit);
|
return topBm25Results.slice(0, opts.finalLimit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -310,7 +305,6 @@ export async function hybridSearchWithExpansion(
|
|||||||
// This is a semantic match that BM25 missed
|
// This is a semantic match that BM25 missed
|
||||||
const item = v.object;
|
const item = v.object;
|
||||||
|
|
||||||
// Calculate boosts
|
|
||||||
const recencyBoost = opts.recencyBoost
|
const recencyBoost = opts.recencyBoost
|
||||||
? calculateRecencyBoost(item, now) * opts.recencyWeight
|
? calculateRecencyBoost(item, now) * opts.recencyWeight
|
||||||
: 0;
|
: 0;
|
||||||
|
|||||||
@@ -92,12 +92,10 @@ export function getLexicalMatchQuality(item: IndexItem, query: string): number {
|
|||||||
|
|
||||||
if (title.includes(" " + q) || title.includes(q + " ")) return 8;
|
if (title.includes(" " + q) || title.includes(q + " ")) return 8;
|
||||||
|
|
||||||
// Token starts-with anywhere
|
|
||||||
for (const t of titleTokens) {
|
for (const t of titleTokens) {
|
||||||
if (t.startsWith(q)) return 3;
|
if (t.startsWith(q)) return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subject / curated metadata title
|
|
||||||
const md = (item.metadata ?? {}) as Record<string, unknown>;
|
const md = (item.metadata ?? {}) as Record<string, unknown>;
|
||||||
const subjectName = normalize(
|
const subjectName = normalize(
|
||||||
typeof md.subjectName === "string" ? md.subjectName : "",
|
typeof md.subjectName === "string" ? md.subjectName : "",
|
||||||
|
|||||||
@@ -185,12 +185,11 @@ export function createSearchIndexes() {
|
|||||||
const commands = getStaticCommands();
|
const commands = getStaticCommands();
|
||||||
const dynamicItems = dedupeIndexItemsForSearch(getDynamicItems());
|
const dynamicItems = dedupeIndexItemsForSearch(getDynamicItems());
|
||||||
|
|
||||||
// Optimized command search options
|
|
||||||
const commandOptions = {
|
const commandOptions = {
|
||||||
keys: ["text", "category", "keywords"],
|
keys: ["text", "category", "keywords"],
|
||||||
includeScore: true,
|
includeScore: true,
|
||||||
includeMatches: true,
|
includeMatches: true,
|
||||||
threshold: 0.35, // Slightly more permissive for better recall
|
threshold: 0.35,
|
||||||
minMatchCharLength: 2,
|
minMatchCharLength: 2,
|
||||||
useExtendedSearch: false,
|
useExtendedSearch: false,
|
||||||
ignoreLocation: false,
|
ignoreLocation: false,
|
||||||
@@ -317,7 +316,6 @@ export function searchDynamicItems(
|
|||||||
|
|
||||||
let score = fuseScore;
|
let score = fuseScore;
|
||||||
|
|
||||||
// Recency boost
|
|
||||||
const ageInDays = (now - item.dateAdded) / (1000 * 60 * 60 * 24);
|
const ageInDays = (now - item.dateAdded) / (1000 * 60 * 60 * 24);
|
||||||
const recencyBoost = sortByRecent ? 1 / (ageInDays + 1) : 0;
|
const recencyBoost = sortByRecent ? 1 / (ageInDays + 1) : 0;
|
||||||
score += recencyBoost;
|
score += recencyBoost;
|
||||||
@@ -390,7 +388,6 @@ export async function performSearch(
|
|||||||
): Promise<CombinedResult[]> {
|
): Promise<CombinedResult[]> {
|
||||||
const trimmedQuery = query.trim().toLowerCase();
|
const trimmedQuery = query.trim().toLowerCase();
|
||||||
|
|
||||||
// Check cache first
|
|
||||||
if (trimmedQuery.length > 2) {
|
if (trimmedQuery.length > 2) {
|
||||||
const cached = getCachedResults(trimmedQuery);
|
const cached = getCachedResults(trimmedQuery);
|
||||||
if (cached) {
|
if (cached) {
|
||||||
@@ -464,7 +461,6 @@ export async function performSearch(
|
|||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("[Search] Hybrid search failed, using BM25 only:", e);
|
console.warn("[Search] Hybrid search failed, using BM25 only:", e);
|
||||||
// Fallback to BM25 only
|
|
||||||
dynamicResults = bm25Results.slice(0, 20);
|
dynamicResults = bm25Results.slice(0, 20);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ export function formatHotkeyForDisplay(hotkeyString: string): string {
|
|||||||
const parsed = parseHotkey(hotkeyString);
|
const parsed = parseHotkey(hotkeyString);
|
||||||
const parts: string[] = [];
|
const parts: string[] = [];
|
||||||
|
|
||||||
// Detect platform
|
|
||||||
const isMac = (navigator.platform.toUpperCase().indexOf('MAC') >= 0);
|
const isMac = (navigator.platform.toUpperCase().indexOf('MAC') >= 0);
|
||||||
|
|
||||||
if (parsed.ctrl) {
|
if (parsed.ctrl) {
|
||||||
@@ -100,7 +99,6 @@ export function matchesHotkey(event: KeyboardEvent, hotkeyString: string): boole
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check modifiers
|
|
||||||
if (parsed.ctrl && !event.ctrlKey) return false;
|
if (parsed.ctrl && !event.ctrlKey) return false;
|
||||||
if (parsed.meta && !event.metaKey) return false;
|
if (parsed.meta && !event.metaKey) return false;
|
||||||
if (parsed.alt && !event.altKey) return false;
|
if (parsed.alt && !event.altKey) return false;
|
||||||
@@ -112,7 +110,6 @@ export function matchesHotkey(event: KeyboardEvent, hotkeyString: string): boole
|
|||||||
if (!parsed.alt && event.altKey) return false;
|
if (!parsed.alt && event.altKey) return false;
|
||||||
if (!parsed.shift && event.shiftKey) return false;
|
if (!parsed.shift && event.shiftKey) return false;
|
||||||
|
|
||||||
// Check the key
|
|
||||||
return event.key.toLowerCase() === parsed.key.toLowerCase();
|
return event.key.toLowerCase() === parsed.key.toLowerCase();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('Error matching hotkey:', hotkeyString, error);
|
console.warn('Error matching hotkey:', hotkeyString, error);
|
||||||
|
|||||||
@@ -308,25 +308,21 @@ export class ThemeManager {
|
|||||||
// Use view transition for the theme change
|
// Use view transition for the theme change
|
||||||
if (applyViewTransition) {
|
if (applyViewTransition) {
|
||||||
await this.applyViewTransition(async () => {
|
await this.applyViewTransition(async () => {
|
||||||
// Remove current theme if exists
|
|
||||||
if (this.currentTheme) {
|
if (this.currentTheme) {
|
||||||
verboseDebug("[ThemeManager] Removing current theme");
|
verboseDebug("[ThemeManager] Removing current theme");
|
||||||
await this.removeThemeWithoutTransition(this.currentTheme);
|
await this.removeThemeWithoutTransition(this.currentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply new theme
|
|
||||||
await this.applyTheme(theme);
|
await this.applyTheme(theme);
|
||||||
this.currentTheme = theme;
|
this.currentTheme = theme;
|
||||||
settingsState.selectedTheme = themeId;
|
settingsState.selectedTheme = themeId;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Remove current theme if exists
|
|
||||||
if (this.currentTheme) {
|
if (this.currentTheme) {
|
||||||
verboseDebug("[ThemeManager] Removing current theme");
|
verboseDebug("[ThemeManager] Removing current theme");
|
||||||
await this.removeThemeWithoutTransition(this.currentTheme);
|
await this.removeThemeWithoutTransition(this.currentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply new theme
|
|
||||||
await this.applyTheme(theme);
|
await this.applyTheme(theme);
|
||||||
this.currentTheme = theme;
|
this.currentTheme = theme;
|
||||||
settingsState.selectedTheme = themeId;
|
settingsState.selectedTheme = themeId;
|
||||||
@@ -362,7 +358,6 @@ export class ThemeManager {
|
|||||||
this.lastSyncedImageKey = null;
|
this.lastSyncedImageKey = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply theme settings
|
|
||||||
if (shouldForceThemeAppearance(theme)) {
|
if (shouldForceThemeAppearance(theme)) {
|
||||||
const dark = getForcedDarkMode(theme);
|
const dark = getForcedDarkMode(theme);
|
||||||
verboseDebug("[ThemeManager] Setting dark mode:", dark);
|
verboseDebug("[ThemeManager] Setting dark mode:", dark);
|
||||||
@@ -446,7 +441,6 @@ export class ThemeManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore original settings
|
|
||||||
if (settingsState.originalSelectedColor) {
|
if (settingsState.originalSelectedColor) {
|
||||||
verboseDebug(
|
verboseDebug(
|
||||||
"[ThemeManager] Restoring original color:",
|
"[ThemeManager] Restoring original color:",
|
||||||
@@ -781,7 +775,6 @@ export class ThemeManager {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
verboseDebug("[ThemeManager] Installing theme:", themeData.name);
|
verboseDebug("[ThemeManager] Installing theme:", themeData.name);
|
||||||
try {
|
try {
|
||||||
// Validate required fields
|
|
||||||
if (!themeData.id || !themeData.name) {
|
if (!themeData.id || !themeData.name) {
|
||||||
throw new Error("Theme is missing required fields (id or name)");
|
throw new Error("Theme is missing required fields (id or name)");
|
||||||
}
|
}
|
||||||
@@ -818,7 +811,6 @@ export class ThemeManager {
|
|||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("[ThemeManager] Failed to process cover image:", e);
|
console.warn("[ThemeManager] Failed to process cover image:", e);
|
||||||
// Continue without cover image
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1014,7 +1006,6 @@ export class ThemeManager {
|
|||||||
...themeBasics
|
...themeBasics
|
||||||
} = theme;
|
} = theme;
|
||||||
|
|
||||||
// Convert images to base64
|
|
||||||
const finalImages = await Promise.all(
|
const finalImages = await Promise.all(
|
||||||
CustomImages.map(async (image) => ({
|
CustomImages.map(async (image) => ({
|
||||||
id: image.id,
|
id: image.id,
|
||||||
@@ -1023,7 +1014,6 @@ export class ThemeManager {
|
|||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Convert cover image to base64
|
|
||||||
const coverImageBase64 = coverImage
|
const coverImageBase64 = coverImage
|
||||||
? await blobToBase64Data(coverImage)
|
? await blobToBase64Data(coverImage)
|
||||||
: null;
|
: null;
|
||||||
@@ -1035,7 +1025,6 @@ export class ThemeManager {
|
|||||||
coverImage: coverImageBase64,
|
coverImage: coverImageBase64,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Save theme file
|
|
||||||
this.saveThemeFile(shareableTheme, theme.name || "Unnamed_Theme");
|
this.saveThemeFile(shareableTheme, theme.name || "Unnamed_Theme");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("[ThemeManager] Error sharing theme:", error);
|
console.error("[ThemeManager] Error sharing theme:", error);
|
||||||
@@ -1071,7 +1060,6 @@ export class ThemeManager {
|
|||||||
});
|
});
|
||||||
this.lastSyncedImageKey = this.imageSyncKey(CustomImages);
|
this.lastSyncedImageKey = this.imageSyncKey(CustomImages);
|
||||||
|
|
||||||
// Apply theme settings
|
|
||||||
if (shouldForceThemeAppearance(theme)) {
|
if (shouldForceThemeAppearance(theme)) {
|
||||||
settingsState.DarkMode = getForcedDarkMode(theme);
|
settingsState.DarkMode = getForcedDarkMode(theme);
|
||||||
}
|
}
|
||||||
@@ -1205,7 +1193,6 @@ export class ThemeManager {
|
|||||||
|
|
||||||
clearCustomThemeAdaptiveCssVariables();
|
clearCustomThemeAdaptiveCssVariables();
|
||||||
|
|
||||||
// Restore original settings
|
|
||||||
const storedColor = localStorage.getItem("originalPreviewColor");
|
const storedColor = localStorage.getItem("originalPreviewColor");
|
||||||
|
|
||||||
if (storedColor) {
|
if (storedColor) {
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ async function handleTimetable(): Promise<void> {
|
|||||||
/* timetable body may render after the shell */
|
/* timetable body may render after the shell */
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert time format if needed
|
|
||||||
if (settingsState.timeFormat == "12") {
|
if (settingsState.timeFormat == "12") {
|
||||||
const times = document.querySelectorAll(".timetablepage .times .time, .timetablepage .entry.new");
|
const times = document.querySelectorAll(".timetablepage .times .time, .timetablepage .entry.new");
|
||||||
for (const time of times) {
|
for (const time of times) {
|
||||||
@@ -98,7 +97,6 @@ function handleTimetableZoom(): void {
|
|||||||
|
|
||||||
verboseLog("Initializing timetable zoom controls");
|
verboseLog("Initializing timetable zoom controls");
|
||||||
|
|
||||||
// Create zoom controls
|
|
||||||
const zoomControls = document.createElement("div");
|
const zoomControls = document.createElement("div");
|
||||||
zoomControls.className = "timetable-zoom-controls";
|
zoomControls.className = "timetable-zoom-controls";
|
||||||
|
|
||||||
@@ -118,7 +116,6 @@ function handleTimetableZoom(): void {
|
|||||||
const toolbar = document.getElementById("toolbar");
|
const toolbar = document.getElementById("toolbar");
|
||||||
toolbar?.appendChild(zoomControls);
|
toolbar?.appendChild(zoomControls);
|
||||||
|
|
||||||
// Store event listener references
|
|
||||||
const zoomInHandler = () => {
|
const zoomInHandler = () => {
|
||||||
const seqtaZoomIn = document.querySelector('.uiButton.zoom.in') as HTMLElement;
|
const seqtaZoomIn = document.querySelector('.uiButton.zoom.in') as HTMLElement;
|
||||||
if (seqtaZoomIn) {
|
if (seqtaZoomIn) {
|
||||||
@@ -136,7 +133,6 @@ function handleTimetableZoom(): void {
|
|||||||
zoomIn.addEventListener("click", zoomInHandler);
|
zoomIn.addEventListener("click", zoomInHandler);
|
||||||
zoomOut.addEventListener("click", zoomOutHandler);
|
zoomOut.addEventListener("click", zoomOutHandler);
|
||||||
|
|
||||||
// Store references for cleanup
|
|
||||||
zoomHandlers.set(zoomControls, {
|
zoomHandlers.set(zoomControls, {
|
||||||
zoomIn: zoomInHandler,
|
zoomIn: zoomInHandler,
|
||||||
zoomOut: zoomOutHandler,
|
zoomOut: zoomOutHandler,
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ function createSEQTAAPI(): SEQTAAPI {
|
|||||||
|
|
||||||
window.addEventListener("hashchange", handler);
|
window.addEventListener("hashchange", handler);
|
||||||
|
|
||||||
// Return an unregister function
|
|
||||||
return {
|
return {
|
||||||
unregister: () => {
|
unregister: () => {
|
||||||
window.removeEventListener("hashchange", handler);
|
window.removeEventListener("hashchange", handler);
|
||||||
@@ -60,7 +59,6 @@ function createSettingsAPI<T extends PluginSettings>(
|
|||||||
const storageKey = `plugin.${plugin.id}.settings`;
|
const storageKey = `plugin.${plugin.id}.settings`;
|
||||||
const listeners = new Map<keyof T, Set<(value: any) => void>>();
|
const listeners = new Map<keyof T, Set<(value: any) => void>>();
|
||||||
|
|
||||||
// Initialize with default values
|
|
||||||
const settingsWithMeta: any = {
|
const settingsWithMeta: any = {
|
||||||
onChange: <K extends keyof T>(
|
onChange: <K extends keyof T>(
|
||||||
key: K,
|
key: K,
|
||||||
@@ -85,7 +83,6 @@ function createSettingsAPI<T extends PluginSettings>(
|
|||||||
loaded: Promise.resolve(), // will be replaced below
|
loaded: Promise.resolve(), // will be replaced below
|
||||||
};
|
};
|
||||||
|
|
||||||
// Fill with defaults first
|
|
||||||
for (const key in plugin.settings) {
|
for (const key in plugin.settings) {
|
||||||
if (plugin.settings[key].type !== 'component' && plugin.settings[key].type !== 'button') {
|
if (plugin.settings[key].type !== 'component' && plugin.settings[key].type !== 'button') {
|
||||||
settingsWithMeta[key] = plugin.settings[key].default;
|
settingsWithMeta[key] = plugin.settings[key].default;
|
||||||
@@ -250,7 +247,6 @@ function createStorageAPI<T = any>(
|
|||||||
return loadStoragePromise;
|
return loadStoragePromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Direct property access
|
|
||||||
return target[prop];
|
return target[prop];
|
||||||
},
|
},
|
||||||
set(target, prop: string, value: any) {
|
set(target, prop: string, value: any) {
|
||||||
@@ -262,7 +258,6 @@ function createStorageAPI<T = any>(
|
|||||||
target[prop] = value;
|
target[prop] = value;
|
||||||
browser.storage.local.set({ [prefix + prop]: value });
|
browser.storage.local.set({ [prefix + prop]: value });
|
||||||
|
|
||||||
// Notify listeners
|
|
||||||
listeners.get(prop)?.forEach((callback) => callback(value));
|
listeners.get(prop)?.forEach((callback) => callback(value));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -153,7 +153,6 @@ export class PluginManager {
|
|||||||
const api = createPluginAPI(plugin);
|
const api = createPluginAPI(plugin);
|
||||||
this.apiDisposers.set(pluginId, api.dispose);
|
this.apiDisposers.set(pluginId, api.dispose);
|
||||||
|
|
||||||
// Inject plugin styles if provided
|
|
||||||
if (plugin.styles) {
|
if (plugin.styles) {
|
||||||
const styleElement = document.createElement("style");
|
const styleElement = document.createElement("style");
|
||||||
styleElement.textContent = plugin.styles;
|
styleElement.textContent = plugin.styles;
|
||||||
@@ -183,7 +182,6 @@ export class PluginManager {
|
|||||||
this.runningPlugins.set(pluginId, true);
|
this.runningPlugins.set(pluginId, true);
|
||||||
verboseInfo(`Plugin "${pluginId}" started successfully`);
|
verboseInfo(`Plugin "${pluginId}" started successfully`);
|
||||||
|
|
||||||
// Process any backlogged events
|
|
||||||
await this.processBackloggedEvents(pluginId);
|
await this.processBackloggedEvents(pluginId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.removePluginStyles(pluginId);
|
this.removePluginStyles(pluginId);
|
||||||
@@ -332,7 +330,6 @@ export class PluginManager {
|
|||||||
// For button or component, keep the functions
|
// For button or component, keep the functions
|
||||||
result = { ...settingObj };
|
result = { ...settingObj };
|
||||||
} else {
|
} else {
|
||||||
// For others, strip functions
|
|
||||||
result = Object.fromEntries(
|
result = Object.fromEntries(
|
||||||
Object.entries(settingObj).filter(
|
Object.entries(settingObj).filter(
|
||||||
([_, value]) => typeof value !== "function",
|
([_, value]) => typeof value !== "function",
|
||||||
|
|||||||
@@ -19,10 +19,8 @@ import gradeAnalyticsPluginLazy from "./built-in/gradeAnalytics/lazy";
|
|||||||
import errorPageKittenPlugin from "./built-in/errorPageKitten";
|
import errorPageKittenPlugin from "./built-in/errorPageKitten";
|
||||||
import timetableClassmatesPluginLazy from "./built-in/timetableClassmates/lazy";
|
import timetableClassmatesPluginLazy from "./built-in/timetableClassmates/lazy";
|
||||||
|
|
||||||
// Initialize plugin manager
|
|
||||||
const pluginManager = PluginManager.getInstance();
|
const pluginManager = PluginManager.getInstance();
|
||||||
|
|
||||||
// Register built-in plugins
|
|
||||||
pluginManager.registerPlugin(themesPlugin);
|
pluginManager.registerPlugin(themesPlugin);
|
||||||
pluginManager.registerPlugin(animatedBackgroundPlugin);
|
pluginManager.registerPlugin(animatedBackgroundPlugin);
|
||||||
pluginManager.registerPlugin(notificationCollectorPlugin);
|
pluginManager.registerPlugin(notificationCollectorPlugin);
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
// Third-party libraries
|
|
||||||
import browser from "webextension-polyfill";
|
import browser from "webextension-polyfill";
|
||||||
|
|
||||||
// Internal utilities and functions
|
|
||||||
import { GetThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
import { GetThresholdOfColor } from "@/seqta/ui/colors/getThresholdColour";
|
||||||
import { waitForElm } from "@/seqta/utils/waitForElm";
|
import { waitForElm } from "@/seqta/utils/waitForElm";
|
||||||
import { delay } from "@/seqta/utils/delay";
|
import { delay } from "@/seqta/utils/delay";
|
||||||
@@ -14,7 +12,6 @@ import { StorageChangeHandler } from "@/seqta/utils/listeners/StorageChanges";
|
|||||||
import { eventManager } from "@/seqta/utils/listeners/EventManager";
|
import { eventManager } from "@/seqta/utils/listeners/EventManager";
|
||||||
import debounce from "@/seqta/utils/debounce";
|
import debounce from "@/seqta/utils/debounce";
|
||||||
|
|
||||||
// UI and theme management
|
|
||||||
import { isSeqtaEngageExperience, isSeqtaLoginPage } from "@/seqta/utils/isSeqtaEngage";
|
import { isSeqtaEngageExperience, isSeqtaLoginPage } from "@/seqta/utils/isSeqtaEngage";
|
||||||
import RegisterClickListeners from "@/seqta/utils/listeners/ClickListeners";
|
import RegisterClickListeners from "@/seqta/utils/listeners/ClickListeners";
|
||||||
import { AddBetterSEQTAElements } from "@/seqta/ui/AddBetterSEQTAElements";
|
import { AddBetterSEQTAElements } from "@/seqta/ui/AddBetterSEQTAElements";
|
||||||
@@ -38,14 +35,11 @@ import {
|
|||||||
} from "@/seqta/utils/updateTimetableTimes";
|
} from "@/seqta/utils/updateTimetableTimes";
|
||||||
import { attachTimetableColorisRecovery } from "@/seqta/utils/patchSeqtaMenuUpdateColours";
|
import { attachTimetableColorisRecovery } from "@/seqta/utils/patchSeqtaMenuUpdateColours";
|
||||||
|
|
||||||
// JSON content
|
|
||||||
import { observeMenuItemPosition } from "@/seqta/utils/sidebarMenuIcons";
|
import { observeMenuItemPosition } from "@/seqta/utils/sidebarMenuIcons";
|
||||||
|
|
||||||
// Icons and fonts
|
|
||||||
import IconFamily from "@/resources/fonts/IconFamily.woff";
|
import IconFamily from "@/resources/fonts/IconFamily.woff";
|
||||||
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
import { resolveExtensionAssetUrl } from "@/lib/extensionAssetUrl";
|
||||||
|
|
||||||
// Stylesheets
|
|
||||||
import iframeCSS from "@/css/iframe.scss?raw";
|
import iframeCSS from "@/css/iframe.scss?raw";
|
||||||
|
|
||||||
import { applyMenuItemVisibility } from "@/seqta/utils/menuItemVisibility";
|
import { applyMenuItemVisibility } from "@/seqta/utils/menuItemVisibility";
|
||||||
|
|||||||
+1
-5
@@ -1,14 +1,10 @@
|
|||||||
// Third-party libraries
|
|
||||||
import browser from "webextension-polyfill";
|
import browser from "webextension-polyfill";
|
||||||
|
|
||||||
// Internal utilities and functions
|
|
||||||
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
import { settingsState } from "@/seqta/utils/listeners/SettingsState";
|
||||||
|
|
||||||
// UI and theme management
|
|
||||||
import pageState from "@/pageState.js?script&iife";
|
import pageState from "@/pageState.js?script&iife";
|
||||||
import { extensionPageScriptUrl } from "@/lib/extensionPageScriptUrl";
|
import { extensionPageScriptUrl } from "@/lib/extensionPageScriptUrl";
|
||||||
|
|
||||||
// Stylesheets
|
|
||||||
import injectedCSS from "@/css/injected.scss?inline";
|
import injectedCSS from "@/css/injected.scss?inline";
|
||||||
|
|
||||||
export async function main() {
|
export async function main() {
|
||||||
@@ -17,7 +13,7 @@ export async function main() {
|
|||||||
if (settingsState.onoff) {
|
if (settingsState.onoff) {
|
||||||
injectPageState();
|
injectPageState();
|
||||||
|
|
||||||
// Rather permanent 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
|
// CRXJS can't hot-reload ?inline CSS, so dev imports the stylesheet directly.
|
||||||
if (import.meta.env.MODE === "development") {
|
if (import.meta.env.MODE === "development") {
|
||||||
import("@/css/injected.scss");
|
import("@/css/injected.scss");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ function adjustLuminance(color: any, lum: any) {
|
|||||||
let adjustedColor = Color(color.toLowerCase());
|
let adjustedColor = Color(color.toLowerCase());
|
||||||
const rgbObj = adjustedColor.rgb().object();
|
const rgbObj = adjustedColor.rgb().object();
|
||||||
|
|
||||||
// Adjust luminance
|
|
||||||
adjustedColor = Color.rgb(
|
adjustedColor = Color.rgb(
|
||||||
Math.min(Math.max(0, rgbObj.r + rgbObj.r * lum), 255),
|
Math.min(Math.max(0, rgbObj.r + rgbObj.r * lum), 255),
|
||||||
Math.min(Math.max(0, rgbObj.g + rgbObj.g * lum), 255),
|
Math.min(Math.max(0, rgbObj.g + rgbObj.g * lum), 255),
|
||||||
@@ -26,7 +25,6 @@ export default function ColorLuminance(color: any, lum = 0) {
|
|||||||
|
|
||||||
let uniqueColorSet = new Set();
|
let uniqueColorSet = new Set();
|
||||||
|
|
||||||
// Extract all unique color stops
|
|
||||||
let match;
|
let match;
|
||||||
while ((match = colorRegex.exec(color)) !== null) {
|
while ((match = colorRegex.exec(color)) !== null) {
|
||||||
uniqueColorSet.add(match[0]);
|
uniqueColorSet.add(match[0]);
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ const LOGO_STYLE_ID = "bsplus-logo-style";
|
|||||||
let colorTransitionRafId: number | null = null;
|
let colorTransitionRafId: number | null = null;
|
||||||
let lastInterpolatedHex: string | null = null;
|
let lastInterpolatedHex: string | null = null;
|
||||||
|
|
||||||
// Helper functions
|
|
||||||
const setCSSVar = (varName: any, value: any) =>
|
const setCSSVar = (varName: any, value: any) =>
|
||||||
document.documentElement.style.setProperty(varName, value);
|
document.documentElement.style.setProperty(varName, value);
|
||||||
const applyProperties = (props: any) =>
|
const applyProperties = (props: any) =>
|
||||||
@@ -169,7 +168,6 @@ function applyColorsWith(selectedColor: string) {
|
|||||||
: ColorLuminance(selectedColor, 0.95),
|
: ColorLuminance(selectedColor, 0.95),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Apply all the properties
|
|
||||||
applyProperties({ ...commonProps, ...modeProps, ...dynamicProps });
|
applyProperties({ ...commonProps, ...modeProps, ...dynamicProps });
|
||||||
|
|
||||||
if (settingsState.selectedTheme) {
|
if (settingsState.selectedTheme) {
|
||||||
|
|||||||
@@ -20,11 +20,9 @@ export function GetThresholdOfColor(color: any) {
|
|||||||
parseInt(r) ** 2 + parseInt(g) ** 2 + parseInt(b) ** 2,
|
parseInt(r) ** 2 + parseInt(g) ** 2 + parseInt(b) ** 2,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Store the computed threshold
|
|
||||||
gradientThresholds.push(threshold);
|
gradientThresholds.push(threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the average threshold
|
|
||||||
const averageThreshold =
|
const averageThreshold =
|
||||||
gradientThresholds.reduce((acc, val) => acc + val, 0) /
|
gradientThresholds.reduce((acc, val) => acc + val, 0) /
|
||||||
gradientThresholds.length;
|
gradientThresholds.length;
|
||||||
|
|||||||
@@ -856,7 +856,6 @@ export default function hideSensitiveContent() {
|
|||||||
mutations.forEach((mutation) => {
|
mutations.forEach((mutation) => {
|
||||||
// Check for both childList and subtree changes
|
// Check for both childList and subtree changes
|
||||||
if (mutation.type === 'childList') {
|
if (mutation.type === 'childList') {
|
||||||
// Check added nodes
|
|
||||||
if (mutation.addedNodes.length > 0) {
|
if (mutation.addedNodes.length > 0) {
|
||||||
mutation.addedNodes.forEach((node) => {
|
mutation.addedNodes.forEach((node) => {
|
||||||
if (node.nodeType === Node.ELEMENT_NODE) {
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ export async function getAdaptiveColour(): Promise<string | null> {
|
|||||||
const colour = await getSubjectColour(subjectCode, userId);
|
const colour = await getSubjectColour(subjectCode, userId);
|
||||||
if (!colour || typeof colour !== "string") return null;
|
if (!colour || typeof colour !== "string") return null;
|
||||||
|
|
||||||
// Basic hex validation
|
|
||||||
if (/^#([0-9A-Fa-f]{3}){1,2}$/.test(colour)) return colour;
|
if (/^#([0-9A-Fa-f]{3}){1,2}$/.test(colour)) return colour;
|
||||||
if (/^[0-9A-Fa-f]{6}$/.test(colour)) return `#${colour}`;
|
if (/^[0-9A-Fa-f]{6}$/.test(colour)) return `#${colour}`;
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ const handleNotificationClick = async (target: HTMLElement) => {
|
|||||||
selected: new Set([matchingNotification.message.messageID]),
|
selected: new Set([matchingNotification.message.messageID]),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close the notifications panel
|
|
||||||
const notificationButton = document.querySelector(
|
const notificationButton = document.querySelector(
|
||||||
'[class*="notifications__notifications___"] > button',
|
'[class*="notifications__notifications___"] > button',
|
||||||
) as HTMLButtonElement | null;
|
) as HTMLButtonElement | null;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { settingsState } from "./SettingsState";
|
|||||||
import { updateAllColors } from "@/seqta/ui/colors/Manager";
|
import { updateAllColors } from "@/seqta/ui/colors/Manager";
|
||||||
import { applySelectedFont } from "@/seqta/ui/fonts/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 { FilterUpcomingAssessments } from "@/seqta/utils/FilterUpcomingAssessments";
|
||||||
import { registerHomeUpcomingSettingsListeners } from "@/seqta/utils/loaders/LoadHomePage";
|
import { registerHomeUpcomingSettingsListeners } from "@/seqta/utils/loaders/LoadHomePage";
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ export async function fetchTermsOfService(): Promise<LegalDocumentPayload> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated Use {@link fetchTermsOfService}. */
|
|
||||||
export const fetchPrivacyTerms = fetchTermsOfService;
|
|
||||||
|
|
||||||
function termsVersionIsNewer(
|
function termsVersionIsNewer(
|
||||||
remoteLastUpdated: string,
|
remoteLastUpdated: string,
|
||||||
|
|||||||
@@ -138,7 +138,6 @@ function startUrlMonitoring(): void {
|
|||||||
window.addEventListener('hashchange', handleUrlChange, { signal });
|
window.addEventListener('hashchange', handleUrlChange, { signal });
|
||||||
window.addEventListener('popstate', handleUrlChange, { signal });
|
window.addEventListener('popstate', handleUrlChange, { signal });
|
||||||
|
|
||||||
// Initial check
|
|
||||||
handleUrlChange();
|
handleUrlChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +145,6 @@ function stopUrlMonitoring(): void {
|
|||||||
if (!isInitialized) return;
|
if (!isInitialized) return;
|
||||||
isInitialized = false;
|
isInitialized = false;
|
||||||
|
|
||||||
// Abort all event listeners at once
|
|
||||||
if (abortController) {
|
if (abortController) {
|
||||||
abortController.abort();
|
abortController.abort();
|
||||||
abortController = null;
|
abortController = null;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export interface SettingsState {
|
|||||||
/** Google Font preset id for SEQTA interface typography (`rubik` default). */
|
/** Google Font preset id for SEQTA interface typography (`rubik` default). */
|
||||||
selectedFont?: string;
|
selectedFont?: string;
|
||||||
|
|
||||||
// depreciated keys
|
// Deprecated keys
|
||||||
animatedbk: boolean;
|
animatedbk: boolean;
|
||||||
bksliderinput: string;
|
bksliderinput: string;
|
||||||
lettergrade: boolean;
|
lettergrade: boolean;
|
||||||
|
|||||||
+2
-5
@@ -1,7 +1,7 @@
|
|||||||
import { defaultClientConditions, defineConfig, loadEnv } from "vite";
|
import { defaultClientConditions, defineConfig, loadEnv } from "vite";
|
||||||
import { join, resolve } from "node:path";
|
import { join, resolve } from "node:path";
|
||||||
|
|
||||||
import touchGlobalCSSPlugin from "./lib/touchGlobalCSS.ts";
|
|
||||||
import InlineWorkerPlugin from "./lib/inlineWorker.ts";
|
import InlineWorkerPlugin from "./lib/inlineWorker.ts";
|
||||||
import { base64Loader } from "./lib/base64loader.ts";
|
import { base64Loader } from "./lib/base64loader.ts";
|
||||||
import type { BuildTarget, Manifest } from "./lib/types.ts";
|
import type { BuildTarget, Manifest } from "./lib/types.ts";
|
||||||
@@ -54,8 +54,7 @@ function withDevManifestCsp(manifest: Manifest, command: string): Manifest {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const mode = process.env.MODE || "chrome"; // Check the environment variable to determine which build type to use.
|
const mode = process.env.MODE || "chrome";
|
||||||
//const sourcemap = (process.env.SOURCEMAP === "true") || false; // Check whether we want sourcemaps.
|
|
||||||
const repoRoot = import.meta.dirname;
|
const repoRoot = import.meta.dirname;
|
||||||
|
|
||||||
export default defineConfig(({ command, mode: viteMode }) => {
|
export default defineConfig(({ command, mode: viteMode }) => {
|
||||||
@@ -95,7 +94,6 @@ export default defineConfig(({ command, mode: viteMode }) => {
|
|||||||
}),
|
}),
|
||||||
fixCrxWorkerLiveReload(),
|
fixCrxWorkerLiveReload(),
|
||||||
stabilizeCrxDevHmr(),
|
stabilizeCrxDevHmr(),
|
||||||
touchGlobalCSSPlugin(),
|
|
||||||
...(command === "build" ? [firefoxStripFunctionProbe()] : []),
|
...(command === "build" ? [firefoxStripFunctionProbe()] : []),
|
||||||
],
|
],
|
||||||
root: resolve(repoRoot, "./src"),
|
root: resolve(repoRoot, "./src"),
|
||||||
@@ -144,7 +142,6 @@ export default defineConfig(({ command, mode: viteMode }) => {
|
|||||||
outDir: resolve(repoRoot, "dist", mode),
|
outDir: resolve(repoRoot, "dist", mode),
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
minify: true,
|
minify: true,
|
||||||
//sourcemap: sourcemap,
|
|
||||||
chunkSizeWarningLimit: 4000,
|
chunkSizeWarningLimit: 4000,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: {
|
input: {
|
||||||
|
|||||||
Reference in new issue
Block a user