User talk:Theleekycauldron/DYK promoter

bugs 'n' stuff go here!

Changelog
Project start: 2022 May 2
 * 1) 2022 May 4:
 * 2) Added buttons to close and mark nominations as withdrawn
 * 3) Added function to require users to select a hook and hook slot before submitting
 * 4) Disabled using the program on already-closed nominations
 * 5) Bold and italics in hooks now display in the promoter, instead of   and
 * 6) Stopped image file selector from breaking things
 * 7) The nompage is now edited before the prep set, to allow for reloading
 * 8) When the button to load the prep set is clicked, it is temporarily disabled to prevent double-clicking
 * 9) Added alert to discourage user from promoting a nomination they've edited
 * 10) Added functionality to automatically scrub anything between italicized parentheses if the hook is promoted without an image
 * 11) 2022 May 5: fixed detection of the   parameter in checking for approval
 * 12) 2022 May 10: Fixed bug causing the program to delete everything in the prep set, starting from the bottom credit, whenever a hook was promoted to the quirky slot
 * 13) 2022 May 19: Fixed bug from the imported Regex causing the program to read to the farthest possible question mark for the hook (often including parts of the source)
 * 14) 2022 June 15: Fixed bug causing a crash if the image file has no   parameter

I am aware of these bugs!
Sorry I haven't gotten around to fixing them yet; but rest assured, I am "monitoring the situation very carefully"...
 * The script kinda nukes the bottom half of the prep set when a hook is promoted the quirky slot fixed; I misplaced a singular parenthesis.
 * The regex that detects hooks on the nompage is a little broken (thanks, Wugapodes!) theleekycauldron (talk • contribs) (she/they) 05:43, 10 May 2022 (UTC)

Error
I received the error Uncaught (in promise) TypeError: imgfiles is not iterable at HTMLInputElement.load (index.php?title=user:theleekycauldron/DYK_promoter.js&action=raw&ctype=text/javascript:232:17) when trying to promote Template:Did you know nominations/Dancing with Dandelions (sculpture) to prep 6. SL93 (talk) 22:58, 10 May 2022 (UTC)


 * hmmph, that'd be because of the multiple detected image files. I'll figure it out sometime today, ping you when it's fixed. theleekycauldron (talk • contribs) (she/they) 23:02, 10 May 2022 (UTC)
 * My web page freezes on Edge and Chrome when I click submit using the tool at Template:Did you know nominations/Takogo kak Putin. SL93 (talk) 11:27, 30 May 2022 (UTC)
 * I promoted it manually and a javascript error message was never shown. I was able to promote a different nomination just fine using the tool. SL93 (talk) 19:09, 30 May 2022 (UTC)
 * sorry, SL93, I can't reproduce the error- sometimes the webpage freezes for random noms, and I reload and it's fine. theleekycauldron (talk • contribs) (she/they) 09:21, 3 June 2022 (UTC)

that button
It says: clicking the large, blue button to the right, labelled "install" There is no button for me.  Schwede 66  01:40, 10 June 2022 (UTC)


 * @Schwede66: This method requires a gadget: under "Advanced", check "Install scripts without having to manually edit JavaScript files". theleekycauldron (talk • contribs) (she/they) 01:44, 10 June 2022 (UTC)
 * I somehow skipped that line. Hand me that trout!  Schwede 66  01:47, 10 June 2022 (UTC)

Approved API
Regarding Special:Diff/1121753497, I could expose an API where you give it a nomination template and it tells you if it's approved or not. I'm thinking something like  and it gives you a little json blob:

{ 'page': 'Template%3ADid+you+know+nominations%2FDavlos', 'is_approved': true, }

If the goal is to verify that a hook is approved before promoting it, this makes more sense than looking at Category:Approved hook or whatever because it would always be up to the moment. If you would use that, let me know and I'll code it up. The hard part is already done; wrapping an API route around it would be trivial. -- RoySmith (talk) 22:45, 25 December 2022 (UTC)

Issue
I received these errors when trying to promote Template:Did you know nominations/Mimi Kilgore to the quirky slot of prep 6. SL93 (talk) 14:30, 7 January 2023 (UTC)

mw.loader.implement.css @ load.php?lang=en&modules=jquery%7Cjquery.ui&skin=monobook&version=8mvm5:145 /w/index.php?title=User:Fox_Wilson/delsort-monobook.js&action=raw&ctype=text/javascript:1 Failed to load resource: the server responded with a status of 403 Mimi_Kilgore#:1 Refused to execute script from 'https://en.wikipedia.org/w/index.php?title=User:Fox_Wilson/delsort-monobook.js&action=raw&ctype=text/javascript' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. SL93 (talk) 14:30, 7 January 2023 (UTC)
 * SL93 (talk) 14:31, 7 January 2023 (UTC)
 * It looks like I figured it out. A credit was missing from the prep. SL93 (talk) 22:23, 7 January 2023 (UTC)
 * @SL93: Yeah, that tends to be the issue a lot these days :) I wonder if there's something I could do about that... theleekycauldron (talk • contribs) (she/her) 01:16, 8 January 2023 (UTC)

What am I doing wrong?
I'm not a regular user of this tool; today, attempting to replace a pulled hook in Queue 1, I decided to give it a try. I selected Queue, 1, checked the slot, checked the desired hook; and the tab froze on me. I can quite believe there's something wrong with my settings, or my order of operations, but I'm wondering what it might be. Vanamonde (Talk) 01:20, 8 January 2023 (UTC)


 * @Vanamonde93: would you mind linking me to the nomination page? theleekycauldron (talk • contribs) (she/her) 01:25, 8 January 2023 (UTC)
 * @Vanamonde93: Ah, I see. So, when you pull a hook from prep or queue, you need to replace the credit with a blank credit slot. Those look like this:
 * If you're pulling the bottom hook, you also need to add this:
 * PSHAW looks for those blanks when adding credits, it doesn't know what to do otherwise – hope this helps! theleekycauldron (talk • contribs) (she/her) 01:28, 8 January 2023 (UTC)
 * PSHAW looks for those blanks when adding credits, it doesn't know what to do otherwise – hope this helps! theleekycauldron (talk • contribs) (she/her) 01:28, 8 January 2023 (UTC)
 * PSHAW looks for those blanks when adding credits, it doesn't know what to do otherwise – hope this helps! theleekycauldron (talk • contribs) (she/her) 01:28, 8 January 2023 (UTC)


 * I see, that makes sense; thanks. Vanamonde (Talk) 01:29, 8 January 2023 (UTC)

I tried using it and all I got was a message that PSHAW is under development. Am I doing something wrong? Hawkeye7  (discuss)  21:41, 25 January 2023 (UTC)


 * @Hawkeye7: Sorry I missed this! Instead of clicking on PSHAW from a prep, navigate to PSHAW from the nomination you want to promote – that'll show you the correct screen. theleekycauldron (talk • contribs) (she/her) 20:39, 28 January 2023 (UTC)

Page refresh
Have installed. Will probably never use! Looks well handy though. Just a thing, whichever method of installing one chooses, the page must be refreshed—I think?—so that note about FF/Chrome/Safari could be useful here? Thanks again for this! ——Serial Number 54129 14:03, 20 March 2024 (UTC)

Uncaught TypeError: mw.Api is not a constructor
Steps to reproduce: install script, then visit any page, add ?debug=1 in the URL, then refresh.

Fix: load the library mediawiki.api somewhere in your code. Can probably just do this by adding it to line 13.

Motivation: reduce JavaScript console log spam while I am debugging other scripts with this script installed.

Thanks in advance. Happy coding. – Novem Linguae (talk) 16:43, 7 May 2024 (UTC)