Post
Topic
Board Meta
Merits 10 from 5 users
Re: Tag a user to update their broken image links
by
PowerGlove
on 27/06/2024, 23:36:05 UTC
⭐ Merited by LoyceV (4) ,Pmalek (2) ,TryNinja (2) ,Igebotz (1) ,JayJuanGee (1)
I think there is problem in code line 157, 194 and 261.
Thanks for that, I think I see what the problem is.

I think this fix is what broke it. (I mean, it's an early 2023 topic, but I updated that code recently and theymos applied the fix in May 2024. Since that change, bodies and titles aren't laid out exactly as they were before on the post/topic history page.)

Actually, looking back, it's probably why ChiBitCTy also struggled to get it working before being advised to try the single-topic version instead...

I haven't tested TryNinja's script myself, because, honestly, it always struck me as a bad idea to allow a piece of code like this (that is, one that's relying on invariants that it really shouldn't be) to go and edit a bunch of my posts. That being said, TryNinja is a highly competent programmer and his script is just about the only sane way for most users to update their images, so, yeah, I get why people have been happily using it. Smiley

Take the following recommendation with a pinch of salt (like I said, I've never run the script), but it looks to me like one way for the script (v1.6) to cope with the patch I mentioned earlier would be for line 156 to change from this:

Code: (Before)
const titleElement = postElement.querySelector('tr[class=titlebg2] td:nth-child(2) a:last-child')

To this:

Code: (After)
const titleElement = postElement.parentElement.parentElement.querySelector('tr[class=titlebg2] td:nth-child(2) a:last-child')

N.B. I'm talking about the update-everything version of the script, not the single-topic version.