-
-
Notifications
You must be signed in to change notification settings - Fork 4
Extraction
In SassyNic, the extension will only extract the class details where their DOM DO NOT have these attributes or content:
-
.psc_disabled- normally inCliC, classes that are not able to enroll will be added with this attribute. -
status === 'Close'- it makes sense to only extract classes where their status === 'Open' as those are the only classes that students are able to enroll into.
Due to service_worker/background scripts and content_scripts each having different behaviors:
-
service_worker/background scriptsin SassyNic are used to monitor web browser's tabs changes, such as tab's "updated", "refreshed", "closed" info and more. It also uses dynamic script injection withexecuteScriptto interact with DOM's elements as some of the DOM's elements are generated dynamically or restricted by CSP (Content Security Policy). -
content_scriptsare pre-injected into the DOM, in SassyNic they are mainly used to interact with DOM's elements by utilisingMutationObserverto observe and detect the associated element(s). -
The key concepts of detection(s) and navigation(s) in SassyNic resolves around these
3things:
In SassyNic,service_worker/background scripts, popup scripts and content_scripts communicates and passing data to each other using Message Passing API, the message(s) usually contains data such as "selected term", "subject/course total", "current extracting index" and more. By using Message Passing for each steps, it's much more easier to debug, implement and also scale the extension.
In SassyNic, there's a helper function within extraction.js called waitForElement, it utilises a built-in function in JavaScript to watch for changes being made to the DOM (Document Object Model) tree. By implementing this helper function, it reduce redundancy of recreating MutationObserver object manually everytime and offers parameters to setup MutationObserver more easily. (checkout the function's header in extraction.js for more detail information regarding how to use it)
In SassyNic chrome.scripting.executeScript / browser.scripting.executeScript (Chrome / Mozilla Firefox) are mainly used to dynamically injecting script(s) into the DOM as some of the element(s) are dynamically generated and some of the elements are restrcited by CSP (Content Security Policy), hence we couldn't interact those elements with content_scripts as they are pre-injected before the DOM is fully loaded.
In SassyNic extraction.js, there's a part that utilise Promise.race() to take actions accordingly based on the first promise being resolved, as extraction process within SassyNic are not sequential execution.
SassyNic | © 2025 FramedStone
Home
Tutorial
Timetable Tool Tutorial
Auto Subjects Grouping Tutorial
Auto OTP Extractor Tutorial
How To Contribute
Development Guide
Disclaimer
Index
Future Roadmap
Index
Tutorial
Timetable Tool TutorialAuto Subjects Grouping Tutorial
Auto OTP Extractor Tutorial
How To Contribute
Development Guide