diff --git a/.eslintrc.json b/.eslintrc.json
index 2b4f6c4e..ed490983 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -10,5 +10,22 @@
"ecmaVersion": "latest",
"sourceType": "module" // add this line to allow 'import' and 'export' statements
},
- "rules": {}
+ "rules": {
+ // allow importing ts extensions
+ "sort-imports": ["error", {
+ "ignoreCase": true,
+ "ignoreDeclarationSort": true,
+ "ignoreMemberSort": false,
+ "memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
+ }],
+ "import/extensions": [
+ "error",
+ "ignorePackages",
+ {
+ "js": "never",
+ "ts": "never",
+ "tsx": "never"
+ }
+ ]
+ }
}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 9ce31bc0..0c9c0154 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,9 @@ node_modules/
package-lock.json
bun.lockb
pnpm-lock.yaml
+yarn.lock
+
+.parcel-cache
# Build
package.zip
diff --git a/.postcssrc.json b/.postcssrc.json
new file mode 100644
index 00000000..d42c370f
--- /dev/null
+++ b/.postcssrc.json
@@ -0,0 +1,5 @@
+{
+ "plugins": {
+ "tailwindcss": {}
+ }
+}
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index 77b76387..530f15e2 100644
--- a/manifest.json
+++ b/manifest.json
@@ -4,23 +4,24 @@
"version": "3.2.2",
"description": "Make SEQTA usable and beautiful! A fork of BetterSEQTA to continue development and add WAY more features!!!",
"icons": {
- "32": "icons/icon-32.png",
- "48": "icons/icon-48.png",
- "64": "icons/icon-64.png"
+ "32": "src/resources/icons/icon-32.png",
+ "48": "src/resources/icons/icon-48.png",
+ "64": "src/resources/icons/icon-64.png"
},
"action": {
"browser_style": true,
"default_popup": "src/interface/index.html#settings",
"default_icon": {
- "32": "icons/icon-32.png",
- "48": "icons/icon-48.png",
- "64": "icons/icon-64.png"
+ "32": "src/resources/icons/icon-32.png",
+ "48": "src/resources/icons/icon-48.png",
+ "64": "src/resources/icons/icon-64.png"
}
},
"permissions": ["tabs", "notifications", "storage"],
"host_permissions": ["https://newsapi.org/", "*://*/*"],
"background": {
- "service_worker": "src/background.ts"
+ "service_worker": "src/background.ts",
+ "type": "module"
},
"content_scripts": [
{
@@ -32,11 +33,8 @@
"web_accessible_resources": [
{
"resources": [
- "icons/*",
- "fonts/*",
- "images/*",
- "resources/*",
- "backgrounds/*"
+ "public/*",
+ "src/*"
],
"matches": ["*://*/*"]
}
diff --git a/package.json b/package.json
index 23a8b4fe..603fd43c 100644
--- a/package.json
+++ b/package.json
@@ -3,8 +3,9 @@
"version": "3.2.2",
"type": "module",
"description": "BetterSEQTA+ is a browser extension that adds features to SEQTA.",
- "main": "webpack.config.js",
"scripts": {
+ "start": "parcel watch manifest.json --host localhost --config @parcel/config-webextension",
+ "build-test": "parcel build manifest.json --config @parcel/config-webextension",
"build": "vite build",
"dev": "vite dev",
"build-old": "webpack --config webpack.config.js --mode production && sh ./package.sh",
@@ -16,22 +17,31 @@
"license": "MIT",
"devDependencies": {
"@crxjs/vite-plugin": "latest",
- "copy-webpack-plugin": "^11.0.0",
- "css-loader": "^6.8.1",
- "dompurify": "^3.0.6",
+ "@parcel/config-webextension": "^2.10.3",
+ "@parcel/optimizer-data-url": "2.10.3",
+ "@parcel/transformer-inline-string": "2.10.3",
+ "@parcel/transformer-sass": "2.10.3",
+ "assert": "^2.0.0",
+ "browserify-zlib": "^0.2.0",
+ "crypto-browserify": "^3.12.0",
"eslint": "^8.48.0",
"eslint-config-prettier": "^9.0.0",
"eslint-webpack-plugin": "^4.0.1",
- "file-loader": "^6.2.0",
- "mini-css-extract-plugin": "^2.7.6",
+ "https-browserify": "^1.0.0",
+ "os-browserify": "^0.3.0",
+ "parcel": "^2.10.3",
+ "path-browserify": "^1.0.0",
"prettier": "3.0.2",
+ "querystring-es3": "^0.2.1",
"sass": "^1.69.5",
"sass-loader": "^13.3.2",
+ "stream-browserify": "^3.0.0",
+ "stream-http": "^3.1.0",
"style-loader": "^3.3.3",
- "vite": "^5.0.10",
- "webextension-polyfill": "^0.10.0",
- "webpack": "^5.88.2",
- "webpack-cli": "^5.1.4"
+ "tty-browserify": "^0.0.1",
+ "url": "^0.11.0",
+ "util": "^0.12.3",
+ "yarn": "^1.22.21"
},
"dependencies": {
"@sentry/browser": "^7.85.0",
@@ -45,6 +55,7 @@
"@types/webextension-polyfill": "^0.10.7",
"autoprefixer": "^10.4.15",
"color": "^4.2.3",
+ "dompurify": "^3.0.6",
"framer-motion": "^10.16.16",
"install": "^0.13.0",
"localforage": "^1.10.0",
@@ -58,6 +69,7 @@
"sortablejs": "^1.15.0",
"tailwindcss": "^3.3.3",
"ts-loader": "^9.5.1",
- "typescript": "^5.2.2"
+ "typescript": "^5.2.2",
+ "webextension-polyfill": "^0.10.0"
}
}
diff --git a/postcss.config.cjs b/postcss.config.cjs
deleted file mode 100644
index 34b1c5eb..00000000
--- a/postcss.config.cjs
+++ /dev/null
@@ -1,6 +0,0 @@
-module.exports = {
- plugins: [
- require("tailwindcss"),
- require("autoprefixer"),
- ],
-};
\ No newline at end of file
diff --git a/src/SEQTA.ts b/src/SEQTA.ts
index e5c57694..b1c75c2f 100644
--- a/src/SEQTA.ts
+++ b/src/SEQTA.ts
@@ -3,6 +3,14 @@ import * as Sentry from "@sentry/browser"
import { animate, spring, stagger } from 'motion'
import loading, { AppendLoadingSymbol } from './seqta/ui/Loading'
+import updateVideo from 'url:./resources/update-video.mp4'
+import IconFamily from 'url:./resources/fonts/IconFamily.woff'
+import LogoLight from 'url:./resources/icons/betterseqta-light-icon.png'
+import LogoLightOutline from 'url:./resources/icons/betterseqta-light-outline.png'
+import icon48 from 'url:./resources/icons/icon-48.png'
+
+import Popup from 'url:./interface/index.html'
+
import Color from 'color'
import MenuitemSVGKey from './seqta/content/MenuItemSVGKey.json'
import { MessageHandler } from './seqta/utils/MessageListener'
@@ -16,7 +24,7 @@ import browser from 'webextension-polyfill'
import coursesicon from './seqta/icons/coursesIcon'
import { delay } from "./seqta/utils/delay"
import { enableCurrentTheme } from './seqta/ui/Themes'
-import iframeCSS from "./css/iframe.scss?inline"
+import iframeCSS from "url:./css/iframe.scss"
import { onError } from './seqta/utils/onError'
import stringToHTML from './seqta/utils/stringToHTML'
import { updateAllColors } from './seqta/ui/colors/Manager'
@@ -53,7 +61,8 @@ document.addEventListener(
import('./css/injected.scss')
import('./css/documentload.scss')
- /* const link = GetCSSElement()
+
+ /* const link = GetCSSElement()
document.getElementsByTagName('html')[0].appendChild(link); */
enableCurrentTheme()
@@ -123,7 +132,7 @@ function OpenWhatsNewPopup() {
imagecont.classList.add('whatsnewImgContainer')
let video = document.createElement('video')
let source = document.createElement('source')
- source.setAttribute('src', browser.runtime.getURL('resources/update-video.mp4'))
+ source.setAttribute('src', updateVideo)
source.setAttribute('type', 'video/mp4')
video.autoplay = true
video.muted = true
@@ -253,7 +262,7 @@ function OpenWhatsNewPopup() {
{ easing: spring({ stiffness: 220, damping: 18 }) }
)
- animate(
+ /* animate(
'.whatsnewTextContainer *',
{ opacity: [0, 1], y: [10, 0] },
{
@@ -261,7 +270,7 @@ function OpenWhatsNewPopup() {
duration: 0.5,
easing: [.22, .03, .26, 1]
}
- )
+ ) */
browser.storage.local.remove(['justupdated'])
@@ -280,6 +289,7 @@ function OpenWhatsNewPopup() {
async function finishLoad() {
try {
+ document.querySelector('.legacy-root')!.classList.remove('hidden')
var loadingbk = document.getElementById('loading')
loadingbk!.style.opacity = '0'
await delay(501)
@@ -366,7 +376,7 @@ export function waitForElm(selector: any) {
})
}
-export function GetCSSElement (file: string) {
+export function GetCSSElement(file: string) {
const cssFile = browser.runtime.getURL(file)
const fileref = document.createElement('link')
fileref.setAttribute('rel', 'stylesheet')
@@ -678,6 +688,8 @@ function main(storedSetting: SettingsState) {
console.log('[BetterSEQTA+] Enabled')
if (DarkMode) document.documentElement.classList.add('dark')
+ document.querySelector('.legacy-root')?.classList.add('hidden')
+
new StorageListener()
new MessageHandler()
@@ -697,14 +709,13 @@ function main(storedSetting: SettingsState) {
function InjectCustomIcons() {
console.log('[BetterSEQTA+] Injecting Icons')
- const fontURL = browser.runtime.getURL('fonts/IconFamily.woff')
const style = document.createElement('style')
style.setAttribute('type', 'text/css')
style.innerHTML = `
@font-face {
font-family: 'IconFamily';
- src: url('${fontURL}') format('woff');
+ src: url('${IconFamily}') format('woff');
font-weight: normal;
font-style: normal;
}`
@@ -790,7 +801,7 @@ function addExtensionSettings() {
document.body.appendChild(extensionPopup)
const extensionIframe: HTMLIFrameElement = document.createElement('iframe')
- extensionIframe.src = `${browser.runtime.getURL('src/interface/index.html')}#settings/embedded`
+ extensionIframe.src = `${Popup}#settings/embedded`
extensionIframe.id = 'ExtensionIframe'
extensionIframe.setAttribute('allowTransparency', 'true')
extensionIframe.setAttribute('excludeDarkCheck', 'true')
@@ -1600,13 +1611,14 @@ function callHomeTimetable(date: string, change?: any) {
})
}
} else {
- console.log(DayContainer)
- if (DayContainer.innerText || change) {
- DayContainer.innerText = ''
+ if (DayContainer == null) {
+
+ } else (!DayContainer.innerHTML || change); {
+ DayContainer.innerHTML = ''
var dummyDay = document.createElement('div')
dummyDay.classList.add('day-empty')
let img = document.createElement('img')
- img.src = browser.runtime.getURL('icons/betterseqta-light-icon.png')
+ img.src = LogoLight
let text = document.createElement('p')
text.innerText = 'No lessons available.'
dummyDay.append(img)
@@ -2141,12 +2153,10 @@ async function loadHomePage() {
// Remove all current elements in the main div to add new elements
var main = document.getElementById('main')
- main!.innerHTML = ''
+ main!.innerHTML = '';
- const titlediv = document.getElementById('title')!.firstChild;
- ((titlediv!) as HTMLElement).innerHTML = 'Home';
- (document.querySelector('link[rel*="icon"]')! as HTMLLinkElement).href =
- browser.runtime.getURL('icons/icon-48.png')
+ const icon = document.querySelector('link[rel*="icon"]')! as HTMLLinkElement
+ icon.href = icon48
currentSelectedDate = new Date()
@@ -2154,36 +2164,30 @@ async function loadHomePage() {
var html = stringToHTML('
')
// Appends the html file to main div
- // Note : firstChild of html is done due to needing to grab the body from the stringToHTML function
+ // Note: firstChild of html is done due to needing to grab the body from the stringToHTML function
main!.append(html.firstChild!)
// Gets the current date
const date = new Date()
// Formats the current date used send a request for timetable and notices later
- var TodayFormatted =
+ const TodayFormatted =
date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + (date.getDate() < 10 ? '0' : '') + date.getDate()
- // Replaces actual date with a selected date. Used for testing.
- // TodayFormatted = "2020-08-31"
// Creates the shortcut container into the home container
- var ShortcutStr = '
')
// Appends the shortcut container into the home container
document.getElementById('home-container')!.append(Shortcut.firstChild!)
// Creates the container div for the timetable portion of the home page
- var TimetableStr = '