Skip to content

Commit

Permalink
Version 10.0.1 multiple load bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
aopell committed May 29, 2024
1 parent 6f0f046 commit f4040d1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "schoology-plus",
"version": "10.0.0",
"version": "10.0.1",
"description": "Schoology Plus enhances your Schoology experience with numerous interface improvements",
"scripts": {
"build": "rm -rf dist/* && webpack --config webpack.config.js --mode=development",
Expand Down
5 changes: 0 additions & 5 deletions postcss.config.js

This file was deleted.

26 changes: 19 additions & 7 deletions src/scripts/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@ import * as pages from "./pages";
import * as utils from "./utils";
import { getAnalyticsUserId, initializeAnalytics } from "./utils/analytics";
import { getBrowser } from "./utils/dom";
import { Logger } from "./utils/logger";
import { Setting, generateDebugInfo } from "./utils/settings";

declare global {
var SchoologyPlus: any;
}

globalThis.SchoologyPlus = {
Setting,
utils,
pages,
debug: JSON.parse(generateDebugInfo()),
};

// checks to see if the current page matches the given path pattern
function matchPage(...patterns: RegExp[]) {
return patterns.some(pattern => pattern.test(globalThis.location.pathname));
Expand All @@ -32,6 +26,17 @@ function ready() {
}

async function load() {
Logger.debug(`Current value of SchoologyPlus variable:`, globalThis.SchoologyPlus);

if (globalThis.SchoologyPlus) {
Logger.warn(
`SchoologyPlus is already loaded. Aborting content script load to prevent conflicts.`
);
return;
}

globalThis.SchoologyPlus = {};

await pages.all.preload();

await initializeAnalytics({
Expand Down Expand Up @@ -127,6 +132,13 @@ async function load() {
await pages.course.load();
await pages.courses.load();
}

globalThis.SchoologyPlus = {
Setting,
utils,
pages,
debug: JSON.parse(generateDebugInfo()),
};
}

load();
2 changes: 1 addition & 1 deletion src/static/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Schoology Plus",
"description": "Schoology Plus enhances your Schoology experience with numerous interface improvements",
"version": "10.0.0",
"version": "10.0.1",
"homepage_url": "https://schoologypl.us?utm_source=ext-homepage-link",
"action": {
"default_icon": {
Expand Down

0 comments on commit f4040d1

Please sign in to comment.