mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-05 19:24:39 +00:00
fix: fix adaptive themeing to support current year subjects
This commit is contained in:
@@ -2,12 +2,17 @@ import { getUserInfo } from "@/seqta/ui/AddBetterSEQTAElements";
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the current page from window.location.hash.
|
* Parses the current page from window.location.hash.
|
||||||
* Returns { programme, metaclass } for /courses/SEMESTER/X:Y or /assessments/SEMESTER/X:Y, or null.
|
* Supports both old and current URL formats, e.g.
|
||||||
* e.g. #?page=/courses/2023S/4804:11066 or #?page=/assessments/2023S/4621:10772
|
* /courses/SEMESTER/X:Y and /courses/X:Y
|
||||||
|
* /assessments/SEMESTER/X:Y and /assessments/X:Y
|
||||||
|
* e.g. #?page=/courses/2023S/4804:11066,
|
||||||
|
* #?page=/courses/4804:11066,
|
||||||
|
* #?page=/assessments/2023S/4621:10772,
|
||||||
|
* #?page=/assessments/4621:10772
|
||||||
*/
|
*/
|
||||||
function parsePageContext(): { programme: number; metaclass: number } | null {
|
function parsePageContext(): { programme: number; metaclass: number } | null {
|
||||||
const hash = window.location.hash || "";
|
const hash = window.location.hash || "";
|
||||||
const match = hash.match(/[?&]page=\/(courses|assessments)\/[^/]+\/(\d+):(\d+)/);
|
const match = hash.match(/[?&]page=\/(courses|assessments)\/(?:[^/]+\/)?(\d+):(\d+)/);
|
||||||
if (!match) return null;
|
if (!match) return null;
|
||||||
const programme = parseInt(match[2], 10);
|
const programme = parseInt(match[2], 10);
|
||||||
const metaclass = parseInt(match[3], 10);
|
const metaclass = parseInt(match[3], 10);
|
||||||
|
|||||||
Reference in New Issue
Block a user