User talk:Phlsph7/HighlightUnreferencedPassages

Request automatic highlighting
If it doesn't take too long to code, you could give an option to automatically highlight, so you don't need to click on the left-hand side, instead it automatically highlights on loading any article? This would prompt more attention to unreferenced passages and hopefully even more reference-adding, Tom B (talk) 15:04, 17 December 2023 (UTC)


 * Thanks for letting me know. I implemented a fast fix, which wasn't too much work. To activate automatic highlighting, you need to modify your common.js. Replace
 * with
 * with


 * Effectively, this just adds one line. To deactivate it, remove the last line again. Properly implementing this option with a user interface would take more time. Have a look if it works for you like this. Phlsph7 (talk) 16:29, 17 December 2023 (UTC)
 * thanks very much indeed! yes that seems to work. to be honest, i've fallen down a rabbit-hole researching a topic, after one of your other scripts blew my mind. thanks very much for all your work here at the pedia. if you've any editing tips or need help on anything, do not hesitate to hit me up, Tom B (talk) 16:54, 17 December 2023 (UTC)
 * Thanks for the feedback! If you have other ideas or questions regarding the scripts then please let me know. I'm currently looking for reviewers of the featured article nomination of the article Education. If the topic interests and you have the time, your comments would be welcome at Featured article candidates/Education/archive1. But chances are that this is not up your alley so please feel under no obligation. Phlsph7 (talk) 08:37, 18 December 2023 (UTC)
 * thanks! will hopefully be able to though very under the weather today. i just did this: Talk:United_States. could have put more warnings but i did put the essay at the start. i didn't advertise your tool, but we could put a link to it if you think that's a good idea, thanks again, Tom B (talk) 08:47, 18 December 2023 (UTC)
 * Thanks for taking a look. I think there is a lot of potential there for LLM-assisted improvements and a lot of it has not been explored in detail. However, one always needs to check their suggestions against reliable sources since they are also known for generating plausible-sounding nonsense. You might be interested in a current RFC about a new guideline/policy to regulate/ban LLMs, see Wikipedia_talk:Large_language_model_policy. Phlsph7 (talk) 10:04, 18 December 2023 (UTC)
 * thanks very much, i didn't know about it and am very interested! i've commented. one of my few 'votes' in 20 years. education isn't exactly my bag, but i've done a couple of edits and will hopefully go back. pls continue to hit me up, Tom B (talk) 11:34, 18 December 2023 (UTC)

Tool broken?
@Phlsph7, hiya, all good? this tool has stopped working for me. i've tried uninstalling and reinstalling, refreshing cache hard etc. Perhaps it's just me? i think it stopped a few weeks ago but i've only just noticed as i wasn't doing citations, instead trimming so didn't need it. but it's useful e.g. for scanning to assess if something is a b or c. Any ideas pls? let me know if you need any help with anything you've usually got a few at GA or FA! Tom B (talk) 17:54, 2 June 2024 (UTC)


 * Thanks for letting me know. I just tried the script now on Primary source and it is working for me (tested on chrome and edge). What happens when you use the script on Primary source? Does the script work if you do not use the automatic function but open it via the tool menu, as described at User:Phlsph7/HighlightUnreferencedPassages?
 * I slightly modified the script just now to avoid potential naming conflicts with other scripts but I don't think this was the issue. One thing you could try to identify the error (not as a permanent solution) would be to remove all other scripts from your your common.js except for this one and see if the problem remains. Phlsph7 (talk) 08:01, 3 June 2024 (UTC)
 * As an alternative, you could try the more recent script User:Phlsph7/ListUnreferencedParagraphs. It also has a function to highlight unreferenced paragraphs. It's main drawback, compared to User:Phlsph7/HighlightUnreferencedPassages, is that it only highlights paragraphs that have no references at all while User:Phlsph7/HighlightUnreferencedPassages also highlights passages in half-referenced paragraphs. It shouldn't be to difficult to add an automatic highlight function in case you intend to use it. Phlsph7 (talk) 08:07, 3 June 2024 (UTC)
 * thank you, i tried in edge too, no joy. it doesn't work if i use the tool menu. i removed all my other scripts, then a hard refresh, still doesn't work. I tried the paragraph tool that didn't work either! A mystery. It stopped working a few weeks ago I think and i can't fathom what changed. Strange it works for you and not me. The only other thing i can think of some other change e.g. a gadget i've switched on but i don't think i've changed gadgets in months, Tom B (talk) 10:13, 3 June 2024 (UTC)
 * it does colour the citation needed inline tags pinks though. is that a clue? Very strange! Tom B (talk) 10:17, 3 June 2024 (UTC)
 * Hm, that is curious. The script works by making various mostly invisible modifications to the html-text needed to change the background color of some sentences. If the html-text was already modified by another process, that could explain why it is not working as intended or not at all. Since you disabled all other user scripts, it could be that you recently installed a chrome extension that does this. However, this is probably not the case since the problem occurs on the edge browser as well. It's also strange that both passage-script and the paragraph-script are not working since they use very different methods to perform their tasks.
 * But maybe you are right that the interference comes a WP:GADGET. You could try logging out of your account, visiting Primary source as an IP user, and then executing the script. As an IP user, you can execute the script by opening the chrome console (usually by pressing F12) and entering the following command:
 * importScript('User:Phlsph7/HighlightUnreferencedPassages.js'); highlightUnreferencedPassagesAutomatic = true;
 * You could try the same thing while in incognito mode, which could disable website settings for wikipedia that might interfere. There should be a lot of pink in the article, especially in the section Primary source. Let's see if any of these steps make a difference. Phlsph7 (talk) 11:57, 3 June 2024 (UTC)
 * thanks very much, yes it instantly worked as an anon IP, does that narrow it down to gadgets or something else? Tom B (talk) 13:22, 3 June 2024 (UTC)
 * If it is the first time you use the console, you have to type "allow pasting" before you can copy-paste the command. I just tried the IP method on a second computer and the script works there for the article Primary source. Phlsph7 (talk) 12:05, 3 June 2024 (UTC)
 * it looks like i've found the issue. i was using monobook which it appears to have stopped working in. i switched to Vector 2022 default and it works there. Don't know if I like Vector. Which one do you think is best or is it just visual preference? Tom B (talk) 13:32, 3 June 2024 (UTC)
 * it doesn't work on Timeless either, but works on the others, Tom B (talk) 14:19, 3 June 2024 (UTC)
 * Ah, that's good to know, I adjusted the list of supported skins. After a short look at the HTML code, it seems monobook handles the headings differently, which could be the reason why the script misbehaves. I'm not sure if there is a quick fix. Personally, I use Vector 2022. Vector legacy (2010) looks relatively similar to monobook and the script seems to work with it. Phlsph7 (talk) 17:25, 3 June 2024 (UTC)
 * i got obsessed so just spent 3 hours getting AI to fix it! which it mostly has but it only does whole paragraphs and incorrectly colours section headings, Tom B (talk) 17:37, 3 June 2024 (UTC)
 * it's here if you can see it: https://en.wikipedia.org/wiki/User:Tpbradbury/monobook.js Tom B (talk) 17:39, 3 June 2024 (UTC)

Tool not working
Yesterday, this tool stopped highlighting unreferenced text in Wikipedia articles. I tried the solutions mentioned in the thread above, including using different browsers, incognito mode on Chrome (my default browser), reinstalling the script, uninstalling all other scripts and just keeping this one, changing the skin (it doesn't work on Vector 2022, Vector 2011 or MinervaNeue) and clearing the cache. I did not install new scripts in the weeks proceeding this breadk. When I use the script on primary source it highlights the citation needed tag at the beginning of the "Other fields" section of the article, but does not highlight any uncited text. Let me know if you can have possible solutions, because I really like this tool and use it almost everyday. Z1720 (talk) 15:08, 19 July 2024 (UTC)


 * Thanks for letting me know! I tried it and I encountered the same problem. It seems that something changed with how Wikipedia renders HTML. I implemented a fix, which makes it work for me again. I tried it on Primary source and it highlights what I would expect it to highligh. Could you check whether this also solves the problem for you? Phlsph7 (talk) 15:59, 19 July 2024 (UTC)
 * It works for me again, the same way it did before. Thank you very much! Z1720 (talk) 16:00, 19 July 2024 (UTC)
 * Lucky the solution was not too complicated. It seems other scripts I wrote stopped working as well so I'll have to fix them too. Phlsph7 (talk) 16:18, 19 July 2024 (UTC)