Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
}
2 changes: 1 addition & 1 deletion src/content/inject_css_tools.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/content/modules/launcher/display_results.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ <h2>Settings</h2>

<div class="setting">
<div class="setting-container toggle-setting" data-setting-var="schooltape_compatibility">
<label for="schooltapeCompatibility">SchoolTape compatibility</label>
<label for="schooltapeCompatibility">Schooltape compatibility</label>
<label class="toggle-switch">
<input type="checkbox" id="schooltapeCompatibility" name="schooltapeCompatibility" />
<span class="toggle-slider"></span>
</label>
</div>
<div class="setting-description">
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.
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/popup/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/storage/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function get_all_news_channels(): Promise<string[]> {

export async function get_news_channel(channel_name: string): Promise<ItemRecord[]> {
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(
Expand Down
2 changes: 1 addition & 1 deletion src/storage/revisions/revision_get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { get_storage_key } from "./common"
export async function get_revision(rev_id: string): Promise<RevisionHistoryEntry | null> {
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
}
14 changes: 7 additions & 7 deletions src/storage/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 => {
Expand All @@ -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
Expand All @@ -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 => {
Expand All @@ -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[] = []
Expand All @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/storage/viewed_pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function add_url_to_recents(url: string, name: string): Promise<voi
url = url.split("#")[0].split("?")[0]

let data = await chrome.storage.local.get(RECENTS_KEY)
let recents: RecentsEntry[] = data[RECENTS_KEY]
let recents: RecentsEntry[] = data[RECENTS_KEY] as RecentsEntry[] || []
const now = Date.now()

let existing_entry: RecentsEntry | undefined = recents.find(entry => entry.url === url)
Expand Down Expand Up @@ -46,7 +46,7 @@ export async function get_recents(): Promise<RecentsEntry[]> {
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
}

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"lib": ["DOM", "ESNext"],
"types": ["chrome"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
Expand Down
Loading