Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix(script): remove flaky window load event listener
Browse files Browse the repository at this point in the history
  • Loading branch information
adil192 committed Dec 11, 2023
1 parent 3c2ed70 commit 37c0b71
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Here I will outline the changes I've made over time...

### 20231211

- Fixed the add_course_images script sometimes not working

### 20231204

- Added popup icons when you play/pause a video (just like on YouTube)
Expand Down
18 changes: 8 additions & 10 deletions scripts/add_course_images.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name UoM Blackboard: Add course images
// @namespace http://tampermonkey.net/
// @version 20231129.00.00
// @version 20231211.00.00
// @description An optional accompanying script for https://github.com/adil192/BlackboardTheme, which adds course images to the Blackboard homepage.
// @author adil192
// @match https://online.manchester.ac.uk/webapps/portal/*
Expand Down Expand Up @@ -69,15 +69,13 @@ function labelCourses() {
'use strict';

console.log("UoM Blackboard: Add course images");
window.addEventListener("load", () => {
findCoursesDivs().then(() => {
labelCourses();
findCoursesDivs().then(() => {
labelCourses();

coursesDivs.forEach((coursesDiv) => {
coursesDiv.addEventListener("DOMSubtreeModified", () => {
labelCourses();
}, { passive: true });
});
coursesDivs.forEach((coursesDiv) => {
coursesDiv.addEventListener("DOMSubtreeModified", () => {
labelCourses();
}, { passive: true });
});
}, { once: true, passive: true });
});
})();

0 comments on commit 37c0b71

Please sign in to comment.