User talk:Headbomb/unreliable
| If you're curious about why a source is highlighted, first check common cleanup and non-problematic cases and limitations, which should answer most questions. Feel free to make requests for various tweaks or more sources to be covered below and I'll address things as best I can. − Headbomb {t · c · p · b} |
Republic TV
[edit]It looks like the second deprecated URL listed for WP:REPUBLICTV is not yet added. Thanks again for the great script. - Amigao (talk) 02:30, 1 September 2025 (UTC)
Dark mode compatibility
[edit]Hello! I've been trying out your neat script. Unrelatedly, a few days later I switched to dark mode. 99% of the site looks fine, and I just realized what the other 1% is.
Long-winded explanation
|
|---|
|
Templates like Template:One source section, Template:Expand section, Template:Wiktionary redirect wind up odd. This section relies largely or entirely upon a single source. Relevant discussion may be found on the talk page. Please help improve this article by introducing citations to additional sources at this section. (September 2025) (Learn how and when to remove this message)
This section needs expansion. You can help by adding to it. (September 2025)
Search for Floccinaucinihilipilification in Wikipedia to check for alternative titles or spellings.
You categorize edit and search links as .plainlinks a.external{background:none !important;padding:0 !important}
html.skin-theme-clientpref-night .mw-parser-output [style*='background']{color:#202122}
As far as I understand:
I initially wanted to customize the rules to use borders without backgrounds like in your example. Then I realized I'd have to copy every rule. |
After a lot of confusion I fixed the color for my account. I don't know if you'd be willing to add separate colors for dark mode, but maybe you could
- skip Wikimedia links inside info/maintenance templates,
- add
!importantlike Vector does, - or mention that dark mode is weird in your examples section?
Blepbob (talk) 00:17, 14 September 2025 (UTC)
- @Blepbob: Where would the !important go? Like so:
css: {"background-color": "#ffdddd" !important;},etc? Headbomb {t · c · p · b} 01:07, 14 September 2025 (UTC)
- @Headbomb: It would go in two places.
- #1) One line in the rule:
{ comment: 'Wikimedia-related website', filter: mw.config.get('wgNamespaceNumber') === 0 || mw.config.get('wgNamespaceNumber') === 118, regex: /\b(?:test\.wiki\.org|wikidata\.org|wikinews\.org|wikipedia\.org|wiktionary\.org|w\.wiki)/i, css: { "background-color": "#ffdddd" }, // NEW STUFF HERE important: true, // NEW STUFF COMPLETE },
- #2) A few new lines in the highlight:
var highlight = function() { // Check each external link on the page against each regex $('.mw-parser-output a.external').each(function(_, link) { $.each(rules, function(_, rule) { if (typeof rule.filter !== 'undefined' && !rule.filter) { return true; } if (rule.regex.test(link.href)) { $(link).css(rule.css); $(link).attr('title', rule.comment || ''); // NEW STUFF HERE if (rule.important) { for (var property in rule.css) { link.style.setProperty(property, rule.css[property], 'important'); } } // NEW STUFF COMPLETE }
- There are other ways to do it, but this is the smallest change that would work.
- Blepbob (talk) 03:48, 14 September 2025 (UTC)
- @Blepbob: Does this work for you? Headbomb {t · c · p · b} 09:21, 14 September 2025 (UTC)
- Unfortunately it doesn't work without both changes.
setPropertyis the part that updates the colors. Sorry if I was unclear. Blepbob (talk) 12:59, 14 September 2025 (UTC)- @Blepbob: how about now. Do I need to add something similar to User:Headbomb/unreliable.js#L-221? Headbomb {t · c · p · b} 16:08, 14 September 2025 (UTC)
- That works perfectly! Thank you.
- Yes, I think adding similar lines there (with
li.style.setPropertyin place oflink.style.setProperty) is a good idea. Your script is more likely to keep working even if Wikimedia changes the skins. Blepbob (talk) 16:52, 14 September 2025 (UTC)- I think I did it right. Trout me if otherwise. Headbomb {t · c · p · b} 17:15, 14 September 2025 (UTC)
- @Blepbob: how about now. Do I need to add something similar to User:Headbomb/unreliable.js#L-221? Headbomb {t · c · p · b} 16:08, 14 September 2025 (UTC)
- In the last day or two I've noticed that a lot of links, at least in AfC templates (don't know where else), to Wikipedia/-media pages have suddenly been highlighted in pink. This includes eg. usernames, links to policy pages, etc. I'm wondering if it might be because of the above changes to this script? The reason I think that is, this seems to have been recently updated, and when I temporarily disable the script the pinkness (is that a word?) goes away. -- DoubleGrazing (talk) 11:19, 15 September 2025 (UTC)
- @DoubleGrazing: Wikipedia.org URLs should only be highlighted from the main/draft spaces. They shouldn't be highlighted anywhere else. Headbomb {t · c · p · b} 11:36, 15 September 2025 (UTC)
- Sorry, I could have been clearer. By "AfC templates", I meant templates on draft pages in the draft namespace, like Draft:Image in Islam. When I switch this script on, it turns links like the "ask us a question" etc., as well as the previous reviewers' names (ClaudineChionh, MCE89) pink. It's the usernames which is my main issue here, because this script overrules User:Novem Linguae/Scripts/UserHighlighterSimple which gives usernames role-based colours which now don't show (although in some cases I can still see them in the user's talk page link). Anyway, it's not a biggie, just thought I'd mention it. -- DoubleGrazing (talk) 12:25, 15 September 2025 (UTC)
- @DoubleGrazing: Wikipedia.org URLs should only be highlighted from the main/draft spaces. They shouldn't be highlighted anywhere else. Headbomb {t · c · p · b} 11:36, 15 September 2025 (UTC)
- Unfortunately it doesn't work without both changes.
- @Blepbob: Does this work for you? Headbomb {t · c · p · b} 09:21, 14 September 2025 (UTC)
@DoubleGrazing: In User:DoubleGrazing/common.js, instead of
importScript('User:Headbomb/unreliable.js'); // Backlink: [[User:Headbomb/unreliable.js]]
followed by
importScript( 'User:Novem Linguae/Scripts/UserHighlighterSimple.js' ); // Backlink: [[User:Novem Linguae/Scripts/UserHighlighterSimple.js]]
try
mw.loader.getScript("/w/index.php?title=User:Headbomb/unreliable.js&action=raw&ctype=text/javascript").then( function () { //Backlink: [[User:Headbomb/unreliable.js]]
mw.loader.getScript("/w/index.php?title=User:Novem Linguae/Scripts/UserHighlighterSimple.js&action=raw&ctype=text/javascript"); // Backlink: [[User:Novem Linguae/Scripts/UserHighlighterSimple.js]]
} );
Headbomb {t · c · p · b} 12:38, 15 September 2025 (UTC)
- Yeah, I've no idea what to do with that... do I just replace the existing two lines of code with an exact copypaste of the above? -- DoubleGrazing (talk) 12:41, 15 September 2025 (UTC)
- Yes remove the two lines, then copy-paste that at the bottom of your .js page. Headbomb {t · c · p · b} 12:58, 15 September 2025 (UTC)
- I've done that, but nothing's changed. -- DoubleGrazing (talk) 13:20, 15 September 2025 (UTC)
- Even with a WP:PURGE? Headbomb {t · c · p · b} 13:26, 15 September 2025 (UTC)
- No, not even after multiple ones. I also tried another browser, just in case, but still no joy. -- DoubleGrazing (talk) 13:38, 15 September 2025 (UTC)
- Can you replace your lines with this? It should make sure AfC templates only highlight user colors.
mw.loader.getScript("/w/index.php?title=User:Headbomb/unreliable.js&action=raw&ctype=text/javascript").then(() => { //Backlink: [[User:Headbomb/unreliable.js]] setTimeout(() => { document.querySelectorAll('.mw-parser-output :is(.wikipedia-languages-langs, .afc-submission-header, .afc-submission-g13, .afc-submission-advice, .afc-submission-pending, .afc-submission-declined, .afc-submission-rejected, .afc-submission-reviewing, .afc-submission-declined-comment) a.external') .forEach(link => { link.style.setProperty('background-color', ''); link.style.setProperty('border', ''); link.removeAttribute('title'); }); mw.loader.getScript("/w/index.php?title=User:Novem Linguae/Scripts/UserHighlighterSimple.js&action=raw&ctype=text/javascript"); // Backlink: [[User:Novem Linguae/Scripts/UserHighlighterSimple.js]] }, 500); });
- Blepbob (talk) 01:49, 16 September 2025 (UTC)
- Yes, that seems to work – thanks @Blepbob! -- DoubleGrazing (talk) 07:51, 16 September 2025 (UTC)
- Even with a WP:PURGE? Headbomb {t · c · p · b} 13:26, 15 September 2025 (UTC)
- I've done that, but nothing's changed. -- DoubleGrazing (talk) 13:20, 15 September 2025 (UTC)
- Yes remove the two lines, then copy-paste that at the bottom of your .js page. Headbomb {t · c · p · b} 12:58, 15 September 2025 (UTC)
Overreaction
[edit]I think your script is starting to overreact. On the Main Page, it highlights all the main language links at the bottom despite the fact that those are not even URLs. Mox Eden (talk) 14:36, 15 September 2025 (UTC)
Simple Flying
[edit]Hi @Headbomb. Simple Flying was recently deprecated following a discussion RS/N. Could the source status be updated? Thanks. Aviationwikiflight (talk) 11:17, 7 October 2025 (UTC)
- @Aviationwikiflight: Added. Headbomb {t · c · p · b} 13:15, 7 October 2025 (UTC)