23

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>
16
  • 4
    where the scripts are validated by the community to be safe-to-use How? Or is that just voting?
    – rene
    Oct 13, 2018 at 8:39
  • I like the Easy part. Specially because that doesn't seem to offer separation between scripts.
    – rene
    Oct 13, 2018 at 8:42
  • 7
    The irony is that all of this feature request could be first implemented as a userscript. Did you see the SOUP userscript?
    – rene
    Oct 13, 2018 at 8:44
  • 1
    @rene - not voting but more like closing scripts that are below some threshold in regards to security, code efficiency and so on
    – vsync
    Oct 13, 2018 at 8:44
  • I know some scripts that have been removed that way, so that part is done.
    – rene
    Oct 13, 2018 at 8:47
  • I didn't know about SOUP, thanks. That's a good example of why such a thing should be built-in.. if I didn't know, probably others don't know also
    – vsync
    Oct 13, 2018 at 8:48
  • 3
    One thing I really like about this proposal is that I could finally use userscripts on a locked-down browser that doesn't allow for add-ons.
    – Erik A
    Oct 13, 2018 at 12:25
  • Stack Overflow wouldn't have to store the scripts. Just store the links to the scripts, then load the script once and store it in localStorage 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.
    – user4639281
    Oct 13, 2018 at 19:10
  • @TinyGiant - it does need to store them because not all scripts are links, some I propose people could write directly inside the 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. No localStorage, that isn't desirable at all. you want consistent behavior per-profile on all computers and browsers.
    – vsync
    Oct 14, 2018 at 7:14
  • @vsync well stack overflow probably isn't going to provide hosting for the scripts. 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.
    – user4639281
    Oct 14, 2018 at 15:53
  • 2
    While this would be possible for many scripts, the userscript environment is, potentially, significantly different than for scripts that run in the page context (i.e. everything a website serves as JavaScript). Those userscripts which use the expanded userscript capabilities can not function loaded by the website. That doesn't mean such scripts couldn't be re-written to work, just that they won't work as-is. Re-witting such scripts would have to be done on a case-by-case basis and may change functionality. Any userscript with @grant none in the userscript meta block would work.
    – Makyen Mod
    Oct 14, 2018 at 23:46
  • Any system that allows its own improvement/changes (per user), in a built-in way, by the community is doing the right thing. See Asana, Gmail, jQuery (at the time) I don't have more examples at the top of my head, but what I do know is that supporting such built-in customization was historically a good path.
    – vsync
    Oct 15, 2018 at 7:01
  • 2
    Why do you consider the current method (userscripts) as "not so easy"? It's a de facto standard method of modifying/enhancing websites, and I find both installation and management of userscript is straightforward. Your proposal feels like it tries to solve a non-existing problem while costing significant development time.
    – user247702
    Oct 15, 2018 at 9:50
  • @Stijn - only power users know if this. Stack Exchange is a vast network and a big portion of its users are non-programmers. These non-tech users might benefit a lot from a more personalized-customized system but they are unaware of this possibility and arguably do not have the skills or courage to start "raping" their browser with suspicious 3rd-party addons. the development time seems perhaps significant to you, but not to me. I've done more complex things in less than a week, for complex websites.
    – vsync
    Oct 15, 2018 at 10:07
  • 1
    As the author of some of those scripts, I heartily support this proposal. Oct 17, 2018 at 1:38

0

You must log in to answer this question.

Browse other questions tagged .