# The Stack Overflow Unofficial Patch (SOUP)

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

SOUP can be installed either as a stand-alone browser extension or via a user script manager such as Greasemonkey, Tampermonkey or Violentmonkey.

SOUP has been mainly developed and tested on Firefox and Chrome. It may also run on other browsers with user script support (via Tampermonkey or other compatible extensions), but has not been fully tested on them. Any reports of cross-browser issues are welcome.

### Installing as a browser extension

Users of Chrome or Firefox (including Firefox Mobile) can install SOUP as a browser extension:

Note that updates to the extension packages available at Firefox Add-ons and Chrome Web Store may take a few days to appear, even after a new stable user script version is released, due to review and other delays.

### Installing as a user script

To install SOUP as a user script, you first need to install a user script manager such as Greasemonkey (for Firefox), Tampermonkey or Violentmonkey. (Other Greasemonkey compatible user script managers 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".

View source / List of fixes / Change log / GitHub repo

NOTE: Tampermonkey on Chrome may suffer from a race condition that can cause some fixes that rely on early loading to fail to apply properly. To avoid this, you should either use the stand-alone SOUP Chrome extension or set Inject Mode to "Instant" in Tampermonkey preferences (in the Experimental section, only visible when Config Mode is set to "Advanced" above). Other user script managers on Chrome may also be subject to similar issues.

### Installing the development version

If you like living on the edge, you can also install the development version of SOUP, 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!

View source / List of fixes / Change log / GitHub repo

Note that the development version of SOUP is currently only available as a user script.

## Included fixes

The list of issues fixed by the latest version of SOUP is available on GitHub (also for the development branch). You can also browse the change log (development) to see which fixes have been added and removed in recent versions of SOUP.

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.

SOUP 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? Feb 6, 2015 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.) Feb 6, 2015 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 Feb 6, 2015 at 11:45
• I was thinking about promoting your awesome work using Community Ads. What do you think? Jan 28, 2016 at 14:11
• (Fonts, colors and text are open for discussion. I guess I'll recreate it with Inkscape instead of GIMP to get the alignments right.) Jan 28, 2016 at 14:26
• @Raphael: That's... pretty awesome. :o Jan 28, 2016 at 15:09
• @IlmariKaronen I'm glad you like it! I'll start using this then, and maybe update later. If you have any wishes regarding the design, please let me know! (You may obviously use it yourself, too. I can send you the XCF if you want.) Jan 28, 2016 at 18:06
• Can I port this script to a Chrome extension? Aug 20, 2016 at 16:13
• @Peanut: That's been on my "to do" list for quite some time; any assistance would certainly be welcome. The biggest obstacle for me has been that I'm not really familiar with the process of putting a browser extension together and publishing it. Aug 20, 2016 at 20:23
• I'm making a pull request to add Chrome extension capability. Do you use any external libraries for SOUP? Aug 20, 2016 at 20:33
• I've made the pull request Chrome extension support that adds Chrome extension support. Also added a hidden install message in the footer. Aug 20, 2016 at 21:24
• meta.math.stackexchange.com/questions/11392/… is fixed natively now Sep 14, 2016 at 8:30
• @TobiasKienzler: Thanks for the heads-up. The SOUP fix will be removed in the next stable version (which I really should release soon... trying to get the Chrome / Firefox extensions to their proper distribution channels has been one source of delay, although not the only one). Sep 14, 2016 at 11:01
• @SirCumference: Yes, although not nearly as actively as I used to. As a not-so-subtle hint, if you find a problem with SOUP or if you'd like to suggest a new fix to be included, you can submit bug reports and suggestions for new features and even contribute code to SOUP at GitHub. :) Mar 5, 2017 at 17:22
• "mse143973: Images can be pushed outside the boundaries of a post by using nested lists" This has been marked as status completed, so the functionality can be removed. Oct 16, 2017 at 14:42

# 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.

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

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

### Declined:

These issues are out of scope for SOUP, or cannot be easily fixed:

### Proposed:

Feel free to add new proposals here.

• @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? Jan 19, 2014 at 20:06
• @IlmariKaronen, OK, I've posted this question concerning the noErrors extension. Jan 19, 2014 at 21:58
• @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). Jan 19, 2014 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. Jan 20, 2014 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. Jan 20, 2014 at 9:03
• @IlmariKaronen, nice solution to the begingroup issue. I'll be interested in your solution to the label problem. Jan 20, 2014 at 13:13
• @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. Jan 24, 2014 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?). Jan 29, 2014 at 18:55
• @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! Jan 29, 2014 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. Jul 3, 2014 at 11:01
• @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. Jul 3, 2014 at 11:12
• @AstroCB: Thanks! A fix for mse266852: Bar between “add a comment” and “show more comments” is inconsistent, loosely based on your script, is now included in the just released SOUP v1.20. Jul 28, 2014 at 14:07
• @IlmariKaronen Great: thanks. It doesn't appear to be getting much traction over at MSO, so I don't see it happening officially anytime soon. Jul 28, 2014 at 14:09
• Regarding comment management: bulk operations might be doable by userscript? Aug 14, 2014 at 20:00
• @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). Aug 17, 2014 at 19:30

# Change log

The SOUP change log has grown too long for a StackApps post. You may view it on GitHub instead.

# Known bugs

## Browser specific issues

### Opera

Note: These issues mainly apply to older versions of the Opera browser. Since version 15, Opera has switched to the the Blink rendering engine also used by Chrome, so some of these issues may be gone (but some of the Chrome-specific issues listed below may apply instead). More testing is needed.

• 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 old Opera versions, so SOUP falls back to polling for changes at ½ second intervals. This works, but is less efficient.

### Chrome

• The 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.

## Other compatibility issues

• SOUP does not work (at all) on the Scriptish user script extension for Firefox, version 0.1.11, because document.documentElement is not available at document-start. Apparently, this is a bug in Scriptish that has been fixed in Scriptish 0.1.12, but that version was never properly approved for distribution on addons.mozilla.org. As Scriptish seems to have not been maintained since 2013, I recommend switching to another user script extension such as Greasemonkey.

• The Dude, where's my cursor? user script by balpha is incompatible with the mso300679 fix as currently implemented in SOUP v1.36+, and may generate spurious warning dialogs about malformed HTML code. These warnings are harmless, but potentially annoying. (Thanks to Nathan Tuggy for the report.)

# Bug reports

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

• Not sure if this is necessarily a problem caused by the patch but using it seems to be a huge contributing factor in FF's memory leaks (at least in my case). This has caused problems for me since for a long time and I'm only now trying to keep Grease Monkey disabled. So far, memory usage is pretty low (~600MB) even after a day or two. It used to go up to and beyond 2.5GB in that same amount of time. And this is considering I keep 2 pinned tabs of SE sites, refreshing every 15 minutes (5 for SO). This might be for the GM team or something but just thought you should know. Apr 5, 2016 at 2:43
• @JeffMercado: Thanks for the notice, I'll try to look into it. If you have time, is there any chance you could test how the memory usage behaves with GM on but SOUP disabled? Apr 5, 2016 at 8:44
• GM is on. I'll let you know in a day or two how much of a change there is. Apr 5, 2016 at 16:05
• Back in v1.16 you patched mse229797. The issue was brought back up recently and fixed by SE. However, SE also changed the height of the hover background effect, which is different to the smaller height of active background enforced by SOUP. So if you remove the code from SOUP for that fix, everything will work properly. Apr 9, 2016 at 4:11
• Comparison: No SOUP (default), vs with SOUP (broken). Apr 9, 2016 at 4:17
• @angussidney: It's already removed from the devel branch. If I don't have time to make a whole new stable release this weekend, I'll backport the removal to the stable branch. Apr 9, 2016 at 11:17
• So after having GM on for 2 days, memory usage is still low. I'm going to restart FF with the script enabled. Apr 9, 2016 at 11:21
• @JeffMercado: Thanks! I'll try to run some tests myself, although I probably won't have time to do it for a few days at least. Apr 9, 2016 at 11:47
• I can't say this conclusively yet since I've had to restart a couple of times and couldn't have FF running as long, but I did notice just before resetting this morning (after about 1.5 days), memory usage was a little high. (~1GB instead of ~700MB) I'll have to retry the test again. Apr 14, 2016 at 14:29
• @JeffMercado: I tried to reproduce this issue, but after leaving half a dozen SE tabs pinned overnight and using about:memory to compare things before and after, I'm not seeing any obvious leakage. (In fact, the memory usage dropped by 60 MB or so overnight, presumably because Firefox ran a GC pass at some point.) Looking at your original report above, could you tell me what kind of pages you have pinned (front page / question page / chat? or just give URLs)? Also, you say you have them "refreshing every 15 minutes (5 for SO)"; how are you doing that? With an extension? Apr 15, 2016 at 9:15
• I have 3 tabs pinned, no others, maximized and the browser left on all day. Things tend to start to deteriorate after day 2. (1) Google Inbox (no reload), (2) gaming.SE Home (15min reload), (3) SO Home (5min reload). Tab reloading is done via Tab Mix Plus. I'm not watching about:memory, but memory usage in task manager. Memory without it sits at 700MB. With, it rises to about 1GB after a day, 1.5GB after about two, then things start to fail at around 2.5GB usage. Apr 16, 2016 at 1:58
• HTML comments trigger the "Bad HTML that will be silently removed" warning, which is dumb, since they're supposed to be removed. The parser doesn't actually support them directly, so this is understandable, but an irritating glitch all the same. Apr 29, 2016 at 23:13
• @NathanTuggy: That's not supposed to happen, as long as the comments are correctly formatted (i.e. <!-- some text here -->). Can you show me a test case where that fails (like a post that gives the warning when edited, or some Markdown I can paste into the editor to trigger it)? Apr 30, 2016 at 9:28
• @IlmariKaronen: I have a lot, but after a bit of tedious binary searching I narrowed to down to balpha's stackapps.com/questions/3894/dude-wheres-my-cursor (although I still don't know exactly how that interferes — there are no error messages). Sorry to bother you with a report that turned out bogus. May 3, 2016 at 6:21
• @IlmariKaronen Sure! Screenshots here: chat.meta.stackexchange.com/transcript/message/6667141#6667141 Feb 6, 2018 at 21:29

# Feature request

Please allow disabling of specific fixes; even a textbox that lets me add fix names per line would be helpful.

This would let me remove fixes I'd not want applied on a case by case basis. Sometimes, I want to make sure that a specific fix doesn't accidentally make it harder for me to understand another user's view on the site, and sometimes I don't agree with a fix (such as the 'accepted answer' unpinning fix, mse178439).

• This isn't a bad idea. Perhaps a textbox that you can simply search something like mse178439 (as opposed to having hundreds of checkboxes to chose from). Typing mse178 would bring up all the matches for mse178###, and a toggle-switch that lets your turn this on or off. The way to access this is to place a link in the site's footer, similar to how Advanced Flagging US does. Nov 23, 2018 at 21:40

## SOUP for Chrome Install Test

The owner of SOUP made an install guide in a comment on this post.

I'll include it here for more attention, but if you upvote this, you should upvote that comment as well.

Just for clarity, note that the official SOUP Chrome extension does not display this notice. The easiest way to tell that the SOUP extension is installed is by the presence of the grayed-out SOUP icon in the Chrome toolbar (unless you've hidden it). You can also press F12 to open Developer Tools, and switch to the Console tab; with SOUP installed, this tab should contain (at least) the lines soup injecting fixes, soup init complete, soup setup complete and soup JS fixes applied.

## SOUP for ChromeAlpha Install Test

You can see if SOUP is installed by scrolling to the bottom of the page.

There is hidden text saying "Successfully installed SOUP!".

• Just for clarity, note that the official SOUP Chrome extension does not display this notice. The easiest way to tell that the SOUP extension is installed is by the presence of the grayed-out SOUP icon in the Chrome toolbar (unless you've hidden it). You can also press F12 to open Developer Tools, and switch to the Console tab; with SOUP installed, this tab should contain (at least) the lines soup injecting fixes, soup init complete, soup setup complete and soup JS fixes applied. Feb 11, 2017 at 19:39
• @IlmariKaronen I added this to my post. Feb 14, 2017 at 21:03