There are many third-party scripts which provide enhancements to Stack Exchange.
I would like to propose a way for Stack Exchange to extend its core code with third-party script from Stack Apps. The proposed system is easier to manage & install scripts, is not browser-based, and allows live script customization:
Current way of working with scripts:
Currently scripts work as browser extensions and are not so easy to manage nor install.
New way of managing scripts:
I propose that third-party scripts that are on Stack Apps will work like an "official" "Google Play" store, where the scripts are validated by the community to be safe-to-use and there will be an integrated "Install" button for each thread (threads that are script-based to showcase a specific script).
I imagine a new submenu in Profile → Settings
called Scripts
where I would be able to see a list of my scripts (name, link to Stack Apps's thread, version..) and I could add new script by pasting in code.
This way one can live-change scripts, seeing feedback immediately.
How would Installing a script work:
It is advisable to post scripts on GitHub, so others could potentially collaborate on them (providing improvements) via a GitHub link, a package.json
(via main
property) will be read on the server and the script will be added to the Stack Exchange profile for the user.
Another way would be: if a script author does not wish to use GitHub, is for the server to parse a link to the Stack Apps thread and extract the "question's" code from there and add that as a script for the user.
Next to each thread there will be an "add script" button, if that script hasn't been added yet, or "remove script" if it has been added.
How will scripts load once "installed" (per profile)?
Easy, since the scripts are "hosted" as strings in a user's settings Object, these Strings (scripts) can be concatenated & injected into the website after all other core scripts.
<script>... user's selected scripts here...</script>
closing
scripts that are below some threshold in regards to security, code efficiency and so onlocalStorage
as well as the version number of the script that is "installed", then periodically check to see if new versions are available. All of this can be done using client side JavaScript, which would reduce processing and data storage costs on the server side.scripts
page in their profile, just a textarea (with code highlight) where one could paste/write code and save it, just like Gists on Github. NolocalStorage
, that isn't desirable at all. you want consistent behavior per-profile on all computers and browsers.localStorage
does not preclude consistent behavior per-profile on all computers and browsers. If you log in on a computer where the scripts haven't been stored, it would treat it as a first run and store them. My point being that the more that has to be done and stored on the back end, the less likely that Stack Overflow will implement it.@grant none
in the userscript meta block would work.