One use case would be to use your DarkMode javascript from time to time. For example I can run send that Javascript from Shortcuts.app to the browser, for example triggering it from spotlight, and make the page dark.
https://github.com/OrionBrowser/DarkMode/blob/main/oriondark.js
Thank you. and the Applescript version would be
tell application "Safari" do JavaScript "alert('example javascript')" in document 1 end tell
I'm automating some stuff by sending javascript to the browser by running AppleScripts, which I trigger from various places such as voice commands or other productivity apps. The other browsers have option to enable this functionality usually in their top menu.