The Stack Overflow Unofficial Patch (SOUP) is a project to collect various minor client-side bug fixes, work-arounds and usability improvements for Stack Overflow and other Q&A sites on the Stack Exchange Network into a single user script.

The intent of SOUP is not to make any substantial or controversial changes to the Stack Exchange user interface, but to fix minor problems and omissions that the SE developers have overlooked or haven't got around to fixing yet. By combining these minor patches into a single user script, they become easier to install and maintain.

Installing

The easiest way to install SOUP is to use the Greasemonkey (for Firefox) or Tampermonkey (for Chrome) extension for managing user scripts. (Other similar extensions, like Scriptish or NinjaKit, should also work.) After installing the extension, clicking the "download / install" button below should bring up a dialog asking you if you want to install SOUP. Answer "yes".

The "install" link above is for the stable branch of SOUP. If you like living on the edge, you can also install the development version, which gets all the latest fixes and updates as soon as they're written. Of course, it also gets all the latest bugs, too. If you do install the development version, please report any bugs or regressions you may find in it below!

SOUP can also be used on other browsers with compatible user script support, such as Opera or Safari. For detailed instructions on how to enable and install user scripts on different browsers, see the "script" tag wiki on Stack Apps.

Notes:

When installing SOUP on Opera, please remove the ".user" part from the file name to disable Greasemonkey compatibility mode. While SOUP can run in either native or compatibility mode, a few MathJax-related fixes require native mode.

SOUP has not yet been tested on Safari, but in principle it should work. If you do try to use it, please let me know how / if it works.

Included fixes

SOUP v1.28 includes fixes or workarounds for the following issues:

CSS-only fixes

These are pure CSS fixes. They will be applied even if JavaScript is disabled on the site.

Site-specific CSS fixes

These pure CSS fixes are for issues specific to certain sites on the Stack Exchange network. Most of them are applied on on the affected site(s), although a few are applied globally, even though the issue they fix is only apparent on some sites.

Site-specific fixes

These non-CSS fixes are applied only on specific SE sites. There's a lot fewer of these, since the SE JavaScript framework is shared between all sites, whereas CSS is different for each site. Thus, these fixes generally involve either rare site-specific customizations, or simply design fixes that cannot be implemented in pure CSS.

License

SOUP is distributed under the ISC license, a permissive BSD-style open source license.

In addition, permission is given to Stack Exchange, Inc. to make use of SOUP code in any way they see fit, including but not limited to incorporating all or parts of it within the Stack Exchange codebase, with or without credit.

This SOUP version includes a copy of the punycode.js library v1.2.4 by Mathias Bynens, distributed under the MIT license. The additional permissions granted above do not apply to this library.

Credits

SOUP is currently maintained by Ilmari Karonen. Some of the fixes are based on suggestions or earlier user scripts made by others; see the source code and/or the meta.SO links above for details.

Contributing

If you know a user script or stylesheet patch for SO or other SE sites that would be suitable for inclusion in SOUP, or an unfixed issue that you believe might be worth patching, please let me know (e.g. by posting a comment or an answer the SOUP page on Stack Apps).

If you'd like to help me out by contributing new fixes directly to SOUP, the SOUP wiki on GitHub has some useful tips. Any and all contributions will be appreciated!

After I install it, I can't see what have changed. Do we have a GUI panel so that I can turn on and off features?
–
OokerFeb 6 at 3:16

No, there currently isn't any control panel. I've thought of having one, and the code is structured to sort of support it, but so far it's been a fairly low priority for me. If you're just curious and want to see what the different fixes do, you can always click the links above: most of the linked bug reports / feature requests include instructions for reproducing the bug. Try it with SOUP on and off, and compare the behavior. (And if you find some cases where there no longer is any difference, please do tell me; it's been a while since I last did that myself.)
–
Ilmari KaronenFeb 6 at 10:24

Wow, i just have dug your GitHub and very impressed that you maintain and even write wikis. Have you think about make a Trello board for easier to maintain the script? An example of HabitRPG using Trello
–
OokerFeb 6 at 11:45

3 Answers
3

Change log

This is a list of new fixes and other changes made to SOUP during its continued development.

SOUP version numbering generally follows the major.minor.patch scheme. Odd minor versions (1.1.x, 1.3.x, 1.5.x, etc.) are reserved for unstable development versions ("devel" branch on GitHub), while even ones denote stable releases ("master" branch on GitHub). The change log below thus only includes even version numbers, as changes between development versions are too numerous to list.

1.28 (3 Feb 2015)

This version mainly features some older styling fixes that didn't make it into 1.26, released in preparation for a bunch of new fixes involving the Stack Overflow redesign.

1.26 (10 Dec 2014)

It's been a while since the last stable release, again. I'd been meaning to carry out more systematic browser compatibility and regression testing before the next release, and to find and prune away fixes that may have become unnecessary, but I never got around to finishing that. However, I've been using the devel version myself on both Firefox and Chrome long enough that I can probably consider it pretty well tested by now. Opera compatibility is currently untested; if you're using SOUP on Opera and find any issues with it, please let me know!

Most of the changes in this version are back-end tweaks meant to improve performance and stability. I've also partially rewritten the README page, and started documenting the SOUP internal structure and API at the SOUP wiki on GitHub to make third-party contributions easier. Any feedback is welcome!

Fixed a silly SOUP bug causing JS fixes to run before DOM was fully loaded on some browsers.

Changes in 1.26.3:

The mse217779 spoiler fix no longer breaks clicking the spoiler to toggle visibility.

1.24 (7 Oct 2014)

A relatively fast-track release for mse240485 and mse240486, which both involve loss of UI functionality. Also includes a couple of new lower priority fixes, and one internal fix to a SOUP-induced UI regression on Chrome.

1.22 (15 Sep 2014)

This is just an incremental release to push out a few updates that missed v1.20 and were stuck in the devel branch. More active development may or may not resume later in the year. As always, contributions are welcome.

The code has been reorganized into self-contained modules, each corresponding to one bugfix / workaround. Currently, this has little effect on functionality, but it could be used e.g. to allow toggling individual fixes on/off.

Utility functions like hookAjax() are now contained in a page-global SOUP object.

A new SOUP.hookEditPreview() utility function has been added to allow easier editing fixes.

CSS fixes are now injected before the document is loaded, reducing the risk of "flickering". As a side effect, a few selectors had to be adjusted to increase their specificity over conflicting SE default styles.

Known bugs

Markdown editor hooks (e.g. mse224533, math11392, boardgames1152, french347) sometimes fail to run on Opera, apparently due to a race condition where the editor gets initialized before SOUP has a chance to add the hook. Reloading the edit page usually fixes the problem.

The kluge used to monitor WebSocket messages on SE chat doesn't seem to work on Opera, so SOUP falls back to polling for changes at ½ second intervals. This works, but is less efficient.

The new mse154788 / stats1987 fix in SOUP v1.22 may sometimes add spurious scroll bars to comments on Chrome. This should hopefully be fixed in SOUP v1.24, but since I can't personally reproduce the bug, and since the underlying cause is uncertain (I suspect a bug in Chrome), it's hard to be sure. If it still happens for you, please let me know!

MathJax config fixes sometimes don't get applied on Chrome, apparently due to a race condition. Reloading the page usually fixes it. Investigating.

Bug reports

If you've found a bug in your SOUP, please post a comment below to notify me about it.

This includes any unwanted side effects or regressions due to changes in the SE codebase.

Feature requests

Know a fix that should be included in SOUP (or an issue that could be fixed)? List it here.

Future plans

Plans for the long-term future of SOUP 2.0:

Break up the monolithic SOUP.user.js file into multiple files, separating the actual fixes from the framework and metadata. Use a (Perl?) build script to assemble the pieces into the actual (minified?) user script file.

Build native browser extensions for Chrome and Firefox (and other browsers?) and distribute these through th appropriate official channels.

Create a UI to allow individual fixes to be toggled on and off at will (and maybe allow user-tweakable parameters for fixes)?

Possible additions

These issues might be fixed in a future SOUP 1.x release, but need some work first:

Apply the mse234680 punycode fix also to URLs pasted directly into the editor. Needs a back-end method to reliably detect and process pasted text.

Viewing single answers in math-heavy threads takes too long (MathJax): The fix itself is actually quite easy (just set the elements option in MathJax config), but it does no good — typesetting the rest of the page causes the text to jump up and down so much that you still have to wait for it to finish before you can actually read anything. Seems effectively unfixable. :-(

Proposed:

@DavideCervone: Thanks! Has the "disable noerrors extension while editing" thing even been feature-requested on meta? And if not, would you mind doing that so I'll have a request to link to?
–
Ilmari KaronenJan 19 '14 at 20:06

@IlmariKaronen, you may also want to call your MathJax reset function (I forget the exact name) in the Begin Process message handler, so that the definitions will be reset for each typeset pass (i.e., the definitions from the previous typeset will not be in effect for the next typeset).
–
Davide CervoneJan 19 '14 at 22:06

@DavideCervone: I already do that. However, I just realized that my earlier code had a race condition bug: it would break if the begingroup extension didn't get loaded before the initial typeset pass began. This never seemed to happen on Chrome, but it happens very often in Firefox. I've fixed it now, though.
–
Ilmari KaronenJan 20 '14 at 8:59

@DavideCervone: Also, I got your fixes working in the devel branch, but I have something slightly more ambitious yet in mind: making \labels in separate posts completely independent of each other. I think I know how to do this (it involves changing the formatID function), but the race condition bug mentioned above messed up my testing of it yesterday.
–
Ilmari KaronenJan 20 '14 at 9:03

@DavideCervone: Just FYI, I've been a bit slow with getting the improved \label fix done, so decided to just release SOUP v1.4 with your original fixes. I'm planning to get the improved fix done for v1.6.
–
Ilmari KaronenJan 24 '14 at 21:22

I had this idea for the new Android app but it applies to the browser version of SE, too. Is it possible to disable the preemptive compilation MathJax does and instead compile only when the user clicks on a piece of math? (On my Mini PC with an Atom Dxxx, long math-heady posts load a long time.) I guess that won't be exactly "consensus" for this here fix, but it may be an option for the proposed turning-off feature (with GUI?).
–
RaphaelJan 29 '14 at 18:55

1

@Raphael: That is doable, yes. (The trick is to use @run-at document-start to inject a custom MathJax config script before MathJax loads, just like SOUP does for the \newcommand fix.) It not something I'd consider suitable for SOUP, but I'll add it to my list of possible ideas for new user scripts. Thanks!
–
Ilmari KaronenJan 29 '14 at 20:47

I'm not sure if that's feasible, but moving discussions to chat would be great. The script would have to a) create a new chatroom, b) copy (selected) comments there and c) delete comments.
–
RaphaelJul 3 '14 at 11:01

1

@Raphael: Unless there's some way to hook into the existing comment migration feature (and I kind of doubt it, since it seems like it'd be a security hole), step c would have to be mod-only. And I'm not a mod on any SE site, so I can't really develop and test it myself. (There was one mod-only fix in SOUP once, but it was mostly developed by Manishearth, who is a mod.) That said, if somebody does come up with a nice and working user script to do that, I'd be glad to steal it for SOUP.
–
Ilmari KaronenJul 3 '14 at 11:12

@Raphael: Probably, but you'll need to find a mod with userscript skills to code and test it. I know there are a bunch, so it's doable, and I'd probably be happy to, ahem, borrow the code for SOUP if someone does write it (and it doesn't break the existing interface or have any other obvious issues, of course).
–
Ilmari KaronenAug 17 '14 at 19:30