diff --git a/README.md b/README.md index d4c1a8c..a489752 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ A Chrome extension for the SchoolBox LMS with integrations for the Box of Books ## Features -### **SchoolTape users: Please enable __SchoolTape compatibility__ in the extension settings to ensure proper styling of elements created by modules in this extension!** -> This is a temporary workaround while automatic SchoolTape detection is still work in progress. +### **Schooltape users: Please enable __Schooltape compatibility__ in the extension settings to ensure proper styling of elements created by modules in this extension!** +> This is a temporary workaround while automatic Schooltape detection is still work in progress. - Launcher: A search bar for quick access to news articles and classes, as well as textbooks from Box of Books. - Search through book headings in Box of Books. diff --git a/bun.lock b/bun.lock index 8f47dcb..2b08466 100644 --- a/bun.lock +++ b/bun.lock @@ -9,7 +9,7 @@ "@babel/preset-env": "^7.27.2", "@babel/preset-react": "^7.27.1", "@babel/preset-typescript": "^7.27.1", - "@types/chrome": "^0.0.320", + "@types/chrome": "^0.1.38", "@types/html-to-text": "^9.0.4", "babel-loader": "^10.0.0", "copy-webpack-plugin": "^13.0.0", @@ -34,7 +34,7 @@ "bun-types": "^0.1.0", "prettier": "3.5.3", "semantic-release": "^25.0.3", - "typescript": "^4.5.4", + "typescript": "^6.0.2", }, }, }, @@ -313,7 +313,7 @@ "@sindresorhus/merge-streams": ["@sindresorhus/merge-streams@4.0.0", "", {}, "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ=="], - "@types/chrome": ["@types/chrome@0.0.320", "", { "dependencies": { "@types/filesystem": "*", "@types/har-format": "*" } }, "sha512-LD0O6hqayM4/InMUB2fOGSh7lFkUlusa40mk6iUAxs0RHfvRYjjsDoRGsDh2DEJWP4Ckccf00FVhkhDHHIqy7g=="], + "@types/chrome": ["@types/chrome@0.1.38", "", { "dependencies": { "@types/filesystem": "*", "@types/har-format": "*" } }, "sha512-5aK4m9wZqoWAoB98aElESLm/5pXpqJnFWMNoiCs/XdPsXR6wNdVkJFSdQ9Wr4PnTuUrxD0SuNuDHh3EG5QeBzA=="], "@types/eslint": ["@types/eslint@9.6.1", "", { "dependencies": { "@types/estree": "*", "@types/json-schema": "*" } }, "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag=="], @@ -1029,7 +1029,7 @@ "type-fest": ["type-fest@4.41.0", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="], - "typescript": ["typescript@4.9.5", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g=="], + "typescript": ["typescript@6.0.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ=="], "uglify-js": ["uglify-js@3.19.3", "", { "bin": { "uglifyjs": "bin/uglifyjs" } }, "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ=="], diff --git a/package.json b/package.json index 2030ea4..c7debb8 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@babel/preset-env": "^7.27.2", "@babel/preset-react": "^7.27.1", "@babel/preset-typescript": "^7.27.1", - "@types/chrome": "^0.0.320", + "@types/chrome": "^0.1.38", "@types/html-to-text": "^9.0.4", "babel-loader": "^10.0.0", "copy-webpack-plugin": "^13.0.0", @@ -49,6 +49,6 @@ "bun-types": "^0.1.0", "prettier": "3.5.3", "semantic-release": "^25.0.3", - "typescript": "^4.5.4" + "typescript": "^6.0.2" } } diff --git a/src/content/inject_css_tools.ts b/src/content/inject_css_tools.ts index 9c222cb..191bc8e 100644 --- a/src/content/inject_css_tools.ts +++ b/src/content/inject_css_tools.ts @@ -1,4 +1,4 @@ -import { darken } from "./functions/darken" +import { darken } from "./modules/launcher/functions/darken" function set_timetable_bg() { const timetable_elements = Array.from( diff --git a/src/content/modules/launcher/display_results.ts b/src/content/modules/launcher/display_results.ts index 312e1f4..49a8406 100644 --- a/src/content/modules/launcher/display_results.ts +++ b/src/content/modules/launcher/display_results.ts @@ -1,7 +1,7 @@ import type { FuseResultMatch } from "fuse.js" import { IndexedItem } from "../../../types/indexed_item" -import { lighten } from "../../functions/lighten" -import { darken } from "../../functions/darken" +import { lighten } from "./functions/lighten" +import { darken } from "./functions/darken" import { Settings } from "../../../types/settings" import { check_in_schoolbox_domain } from "../../../background/functions/utls/is_page" import { get_theme, rgb_to_hex } from "./detect_dark_theme" diff --git a/src/content/functions/darken.ts b/src/content/modules/launcher/functions/darken.ts similarity index 100% rename from src/content/functions/darken.ts rename to src/content/modules/launcher/functions/darken.ts diff --git a/src/content/functions/lighten.ts b/src/content/modules/launcher/functions/lighten.ts similarity index 100% rename from src/content/functions/lighten.ts rename to src/content/modules/launcher/functions/lighten.ts diff --git a/src/popup/popup.html b/src/popup/popup.html index f2ea167..597f731 100644 --- a/src/popup/popup.html +++ b/src/popup/popup.html @@ -66,14 +66,14 @@

Settings

- +
- Enable style compatibility with SchoolTape. This disables some styles and uses SchoolTape styles instead. + Enable style compatibility with Schooltape. This disables some styles and uses Schooltape styles instead.
diff --git a/src/popup/popup.ts b/src/popup/popup.ts index 27b7181..f9124de 100644 --- a/src/popup/popup.ts +++ b/src/popup/popup.ts @@ -52,7 +52,7 @@ function applyTheme(theme: string) { // Load settings chrome.storage.sync.get(["settings", "theme"], result => { - const settings: Settings = result.settings + const settings = result.settings as Settings | undefined if (!settings) return // load input settings diff --git a/src/storage/get.ts b/src/storage/get.ts index a6a1c71..560beef 100644 --- a/src/storage/get.ts +++ b/src/storage/get.ts @@ -9,7 +9,7 @@ export async function get_all_news_channels(): Promise { export async function get_news_channel(channel_name: string): Promise { const news_channel = await chrome.storage.local.get(`news_channel_${channel_name}`) - return news_channel[`news_channel_${channel_name}`] || [] + return news_channel[`news_channel_${channel_name}`] as ItemRecord[] || [] } export async function get_news_item( diff --git a/src/storage/revisions/revision_get.ts b/src/storage/revisions/revision_get.ts index fbe7dcc..3d80fd1 100644 --- a/src/storage/revisions/revision_get.ts +++ b/src/storage/revisions/revision_get.ts @@ -4,5 +4,5 @@ import { get_storage_key } from "./common" export async function get_revision(rev_id: string): Promise { const item_name = get_storage_key(rev_id) const result = await chrome.storage.local.get([item_name]) - return result[item_name] || null + return result[item_name] as RevisionHistoryEntry || null } diff --git a/src/storage/set.ts b/src/storage/set.ts index 7c0a152..67d74e1 100644 --- a/src/storage/set.ts +++ b/src/storage/set.ts @@ -30,7 +30,7 @@ export async function add_item_to_channel(channel_name: string, item: ItemRecord return false } - const channel_items: ItemRecord[] = channel_data[channel_key] || [] + const channel_items: ItemRecord[] = channel_data[channel_key] as ItemRecord[] || [] // Check if the item already exists in the channel const item_exists = channel_items.some(existing_item => existing_item.guid === item.guid) @@ -59,7 +59,7 @@ export async function update_item_properties( return } - let channel_items: ItemRecord[] = channel_data[channel_key] || [] + let channel_items: ItemRecord[] = channel_data[channel_key] as ItemRecord[] || [] // Update the item properties channel_items = channel_items.map(item => { @@ -83,7 +83,7 @@ export async function update_item_vc_and_lvt(channel_name: string, item_guid: st return null } - let channel_items: ItemRecord[] = channel_data[channel_key] || [] + let channel_items: ItemRecord[] = channel_data[channel_key] as ItemRecord[] || [] // Increment the view count for the specified item let updated_view_count: number | null = null @@ -109,7 +109,7 @@ export async function increment_item_bounce_count(channel_name: string, item_gui return } - let channel_items: ItemRecord[] = channel_data[channel_key] || [] + let channel_items: ItemRecord[] = channel_data[channel_key] as ItemRecord[] || [] // Increment the bounce count for the specified item channel_items = channel_items.map(item => { @@ -132,7 +132,7 @@ export async function add_revision_history_entry(channel_name: string, item_guid return [] } - let channel_items: ItemRecord[] = channel_data[channel_key] || [] + let channel_items: ItemRecord[] = channel_data[channel_key] as ItemRecord[] || [] // Add the revision ID to the item's revision history let updated_rev_history: string[] = [] @@ -159,7 +159,7 @@ export async function remove_item_from_channel(channel_name: string, item_guid: return } - let channel_items: ItemRecord[] = channel_data[channel_key] || [] + let channel_items: ItemRecord[] = channel_data[channel_key] as ItemRecord[] || [] // Remove the item from the channel channel_items = channel_items.filter(item => item.guid !== item_guid) @@ -180,7 +180,7 @@ export async function add_if_not_exists( return false } - let channel_items: ItemRecord[] = channel_data[channel_key] || [] + let channel_items: ItemRecord[] = channel_data[channel_key] as ItemRecord[] || [] // Check if the item already exists in the channel const item_exists = channel_items.some(existing_item => existing_item.guid === item_guid) diff --git a/src/storage/viewed_pages.ts b/src/storage/viewed_pages.ts index e19be54..8c06855 100644 --- a/src/storage/viewed_pages.ts +++ b/src/storage/viewed_pages.ts @@ -16,7 +16,7 @@ export async function add_url_to_recents(url: string, name: string): Promise entry.url === url) @@ -46,7 +46,7 @@ export async function get_recents(): Promise { await ensure_recents_exists() let data = await chrome.storage.local.get(RECENTS_KEY) - let recents: RecentsEntry[] = data[RECENTS_KEY] + let recents: RecentsEntry[] = data[RECENTS_KEY] as RecentsEntry[] || [] return recents } diff --git a/tsconfig.json b/tsconfig.json index 9ae8c4d..e29c2b5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,8 +2,9 @@ "compilerOptions": { "target": "ESNext", "module": "ESNext", - "moduleResolution": "node", + "moduleResolution": "bundler", "lib": ["DOM", "ESNext"], + "types": ["chrome"], "strict": true, "esModuleInterop": true, "skipLibCheck": true,