I need a script edit

Can you provide some magical software thingy that, before saving my edit, checks for some combination of {[, [{, ]}, or }] and prevents the edit being saved? Preferably with a friendly message along the lines of "hey moron, you just did it again". If I felt like it was other people besides me, I'd suggest an edit filter (I don't think those characters in that order would ever make sense). But I think it's just me.

In other news: hey stranger, how are things? Floquenbeam (talk) 15:38, 23 April 2024 (UTC)Reply

@Floq: Okay, that was harder than I was expecting, but here you go: User:Writ_Keeper/Scripts/syntaxChecker.js. As usual, install by inserting the line mw.loader.load("/w/index.php?title=User:Writ_Keeper/Scripts/syntaxChecker.js&action=raw&ctype=text/javascript"); into your common.js page. If you mismatch square and curly braces next to each other, it should give you a popup when you try to save the edit, alerting you and asking if you're sure you want to save the edit. If you hit cancel, it should then highlight the mismatched braces for you in the text field. It's designed to do its best to *not* ask you about any mismatched braces that are already in the page before you started editing, but the detection algorithm is fairly primitive, so false positives are likely in complex scenarios. Also, I have it disabled in article space, but let me know if you either want to enable it there too, or if there are any other namespaces you would like disabled.
In other news: things are going all right. Some positive IRL developments. Keeping half an eye on Wikipedia as time permits. Same ol', same ol', I suppose. Writ Keeper  21:11, 23 April 2024 (UTC)Reply
Sorry for the trouble; thanks so much for the effort, WK. I always forget that WP doesn't save what I type, it saves the entire page again; I can see how that complicates things. I'll install it in a bit, and it will likely be triggered at least once by the end of the week! Glad to hear things IRL are going well. Floquenbeam (talk) 16:13, 25 April 2024 (UTC)Reply
{[shouldn't be able to save this.}} Floquenbeam (talk) 16:35, 25 April 2024 (UTC)Reply
It works fine when editing the source, but doesn't seem to handle using the reply-to link. BUT this is going to help me about 95% of the time, since it most frequently happens when I'm archiving a thread or handling an unblock request, where I'm not using reply-to. So thank you, and please don't spend any time trying to handle this edge case. This will help a lot. Floquenbeam (talk) 16:37, 25 April 2024 (UTC)Reply