User talk:Majr/hydra.js

Blank the "Other/additional reason" field when deleting pages
If you're looking to improve this script more, one thing I never got around to adding to it was capturing any delete reasons from a Delete template. It shouldn't be too difficult to do this naively (I think a pretty simple regex should suffice), but it won't properly capture cases where a template is used within the delete template. Not necessarily a huge concern, but it's been enough to keep me from sitting down and working on it. =) 「 ディノ 奴 千？！ 」? · ☎ Dinoguy1000 07:23, 27 July 2012 (UTC)


 * Done. (I forgot how difficult regex is when regexpal.com is down...) –ultradude25 (T&#124;C) at 08:16, 27 July 2012 (UTC)


 * Cool. Are you intending to update the Common.js script with your version at some point? 「 ディノ 奴 千？！ 」? · ☎ Dinoguy1000 15:27, 27 July 2012 (UTC)


 * Yes, that's why I replaced my normal js here. That way I can test it live (with common.js disabled by adblocking it), to make sure I'm not breaking anything. Especially useful for the collapsible script, since that's completely re-written from scratch, so I could've easily broken something there.
 * Also, I don't think it'll work with a template in the delete reason, but I don't think we ever have or will use a template in the delete reason, so it probably doesn't matter. –ultradude25 (T&#124;C) at 17:27, 27 July 2012 (UTC)


 * Yeah, I've never seen a template used like that here; the main reason I worry about stuff like that is because I'm minded towards being able to reuse stuff across wikis (which isn't surprising, considering I originally got into wikis via Wikipedia and then moved to Wikia, where I started reusing Wikipedia's templates and such and so really started getting a taste for all the ways that can go wrong). =) 「 ディノ 奴 千？！ 」? · ☎ Dinoguy1000 18:29, 27 July 2012 (UTC)


 * I don't know how the regex would even work. It's not meant for bracket matching, especially when the end brackets might not be there (delete summary is cut off). –ultradude25 (T&#124;C) at 19:20, 27 July 2012 (UTC)


 * It wouldn't; as you said, regex isn't designed for that type of stuff. It would require a parser (or at least very naively counting opening and closing braces, but even that would miss edge cases that only a proper parser could catch). As for a Delete rationale running out past the end of the delete summary, the solution there is to load the page text and check that for any delete template, instead of just looking at the summary (this is the other big thing that kept me from working on it). 「 ディノ 奴 千？！ 」? · ☎ Dinoguy1000 20:11, 27 July 2012 (UTC)


 * Well right now I've just let it use the cut off text, don't know if loading the page text is really worth it, since once you'd removed the template and "content was:", you'd only be able to fit a few extra characters. –ultradude25 (T&#124;C) at 20:27, 27 July 2012 (UTC)


 * Right. Ultimately, it's probably better to just let the deleting admin decide if they want to change the delete summary up any instead of trying to guess all the work for them (how's that for a 180? =D ). 「 ディノ 奴 千？！ 」? · ☎ Dinoguy1000 20:58, 27 July 2012 (UTC)


 * Luckily, JavaScript's changes to the summary are counted in history, so they can press undo to restore the original summary.
 * Shame we don't have Gadgets installed here, then this could be opt in. The only other way it could be done is with a global var that can be set to 1 to opt out, but that's not a particularly nice way to do it... –ultradude25 (T&#124;C) at 21:08, 27 July 2012 (UTC)


 * Particularly nice, no. The way Wikipedia used to do (and possibly still does; I haven't checked in a while) it, yes. =D 「 ディノ 奴 千？！ 」? · ☎ Dinoguy1000 21:24, 27 July 2012 (UTC)


 * Alright, putting disableDeleteBlanking = true; (or 1) in your js should disable it. Seems to work for me as long as it's outside any onload functions... –ultradude25 (T&#124;C) at 22:01, 27 July 2012 (UTC)