From f4040d1f48212c7910a0ac7f0d963c675a13696e Mon Sep 17 00:00:00 2001 From: Aaron Opell Date: Tue, 28 May 2024 20:47:09 -0700 Subject: [PATCH] Version 10.0.1 multiple load bugfix --- package.json | 2 +- postcss.config.js | 5 ----- src/scripts/content.ts | 26 +++++++++++++++++++------- src/static/manifest.json | 2 +- 4 files changed, 21 insertions(+), 14 deletions(-) delete mode 100644 postcss.config.js diff --git a/package.json b/package.json index 04324182..ac287a36 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/postcss.config.js b/postcss.config.js deleted file mode 100644 index a47ef4f9..00000000 --- a/postcss.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - plugins: { - autoprefixer: {}, - }, -}; diff --git a/src/scripts/content.ts b/src/scripts/content.ts index a56b4935..481c5fcd 100644 --- a/src/scripts/content.ts +++ b/src/scripts/content.ts @@ -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)); @@ -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({ @@ -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(); diff --git a/src/static/manifest.json b/src/static/manifest.json index 686bd27b..45223b50 100644 --- a/src/static/manifest.json +++ b/src/static/manifest.json @@ -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": {