MediaWiki talk:Gadget-popups.js
This page is for gadget-specific discussion. For most issues, please visit Wikipedia talk:Tools/Navigation popups. This gadget also has a Phabricator workboard used for implementation-related discussion. |
To help centralize discussions and keep related topics together, MediaWiki talk:Gadget-navpop.css redirects here. |
This page has archives. Sections older than 365 days may be automatically archived by Lowercase sigmabot III when more than 4 sections are present. |
MediaWiki:Gadget-navpop.css should be renamed to MediaWiki:Gadget-popups.css
[edit]This gadget uses a second file called MediaWiki:Gadget-navpop.css. Idea: Shouldn't have to look at the gadgets definition file to figure out what this gadget's CSS file is named. It'd probably make more sense for all files related to this gadget to start with MediaWiki:Gadget-popups. So I propose renaming MediaWiki:Gadget-navpop.css to MediaWiki:Gadget-popups.css –Novem Linguae (talk) 10:34, 15 August 2023 (UTC)
- Support. No reason in having this oddity. Chlod (say hi!) 14:48, 18 August 2023 (UTC)
- I’m not opposed to the renaming, but please make sure to maintain backward compatibility. There are probably quite a few people and wikis who load the NavPopups CSS directly rather than as part of the ResourceLoader module, so it’s important that https://en.wikipedia.org/enwiki/w/index.php?title=MediaWiki:Gadget-navpop.css&action=raw&ctype=text/css continues to load the necessary styles. —Tacsipacsi (talk) 17:22, 19 August 2023 (UTC)
- @Tacsipacsi. Would replacing MediaWiki:Gadget-navpop.css with
importStylesheet('MediaWiki:Gadget-popups.css');
be an acceptable solution? –Novem Linguae (talk) 20:47, 7 December 2023 (UTC)- @Novem Linguae: Apart from it not working, yes. 🙂 You try to put JavaScript in a CSS file, which of course won’t work, but a working solution along these lines would be acceptable. Please also make sure to use absolute URLs because many – probably even most – affected imports are not on the English Wikipedia (
importStylesheet
uses a URL relative to the wiki it’s executed on, not to the wiki it’s defined on, which would be wrong). —Tacsipacsi (talk) 15:25, 8 December 2023 (UTC)
- @Novem Linguae: Apart from it not working, yes. 🙂 You try to put JavaScript in a CSS file, which of course won’t work, but a working solution along these lines would be acceptable. Please also make sure to use absolute URLs because many – probably even most – affected imports are not on the English Wikipedia (
- @Tacsipacsi. Would replacing MediaWiki:Gadget-navpop.css with
Use native string repetition function
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
This gadget uses custom string repetition function. It should be replaced with native String.prototype.repeat() which is significantly faster and well supported by modern browsers. – Ammarpad (talk) 05:20, 20 September 2023 (UTC)
- It seems to be used only for formatting time. So it would probably only help in optimization of the history page preview (if at all significant). Not sure if that is something worth optimizing. You know "premature optimization..." etc Nux (talk) 22:51, 24 September 2023 (UTC)
- I see this as more refactoring than optimizing. I have no objections to the idea. But it needs someone to write and test the patch. –Novem Linguae (talk) 23:42, 24 September 2023 (UTC)
- Refactoring when you loose compatibly, do a lot of work and gain nothing in practice is a bad idea IMHO. When you would start refactoring that you would never finish ;). When you go up the stack you also have a custom `map` function. Nux (talk) 11:50, 25 September 2023 (UTC)
- If both behave identically, using internal functions is always better than writing your own. 1) More standardized so more readable. 2) Less lines of code. 3) More performant. –Novem Linguae (talk) 19:33, 1 December 2023 (UTC)
- To be a bit more constructive here... I think a better refactoring effort might be to be to move Popups to Github (e.g. with Wikipedia:Wiki-to-Git). Then do a split to separate files. And then either use e.g. browserify to combine it again. I've been thinking abut this for a while for plwiki, not sure if such update would be accepted here. Nux (talk) 12:19, 25 September 2023 (UTC)
- I'd be open to this if this page gets more activity. With current activity levels though, moving to GitHub may just result in the GitHub being neglected and the versions getting out of sync. And also adds deploy complexity. https://github.com/wikimedia-gadgets/ would be a good spot for this if popups development gets more active (more folks working on this would justify the added complexity of an off-site repo). –Novem Linguae (talk) 19:36, 1 December 2023 (UTC)
- Refactoring when you loose compatibly, do a lot of work and gain nothing in practice is a bad idea IMHO. When you would start refactoring that you would never finish ;). When you go up the stack you also have a custom `map` function. Nux (talk) 11:50, 25 September 2023 (UTC)
- I see this as more refactoring than optimizing. I have no objections to the idea. But it needs someone to write and test the patch. –Novem Linguae (talk) 23:42, 24 September 2023 (UTC)
- Not done this doesn't appear to be a ready-to-go release, and may need additional discussion as well. Please prepare a current version to proposed version in a sandbox, such as at Special:MyPage/Gadget-popups-sandbox.js for the proposed code. IF this section is just to discuss strategies and proposals of course you may continue the discussion below. Best regards, — xaosflux Talk 03:17, 8 October 2023 (UTC)
Live preview refactor
[edit]@Novem Linguae I've done another round of refactoring and have ended up with this diff. The salient highlights are:
- Removed the custom wikitext parsing engine at
wiki2html()
and replaced it a call to the parsing API - Removed
defaultPopupsContainer()
and replaced it with a lookup to#mw-content-text
(since that is the stable way to identify where the content starts) - Refactored the
generateLink()
to not use raw HTML manipulation
Sohom (talk) 22:37, 5 December 2023 (UTC)
- You shouldn't remove `defaultPopupsContainer`. You should add new selector on top of the selectors, not remove fallbacks. You've also removed `popupOnlyArticleLinks` options by removing `defaultPopupsContainer`. I use popus on e.g. history tab. Nux (talk) 23:28, 5 December 2023 (UTC)
- I've added back the function in my version, the updated diff should be this (lmk if you find any other issues). That being said, I did test the refactoring on quite a few cases (including the history tab, edit and preview usecases) and did not find any noticable difference in behaviour with
#mw-content-text
. Sohom (talk) 23:45, 5 December 2023 (UTC)- Thanks. I like the idea behind the changes. So I hope you don't mind me looking over your shoulder, but this is a popular gadget, which I'm also using :). Some thoughts upon review:
- `
.bind( this )
` is not needed most of the time. The `this
` keyword is not used inside of most calls to `makePreview
`. - `
APIimagepagePreviewHTML
` doesn't have the same flow. At least looking at the code after `if (typeof content === 'string')
` is another if (not else if). So `return ret;
` below will not be correct (probably, quite likely). - `
APIsharedImagePagePreviewHTML
` is in `pg.fn
`, so it is exposed to other gadgets and user scripts (possibly scripts on meta.wiki). Not sure if you can just change it from a synchronous function to async. I would at least expose thePromise
. - This is mostly nit picking, but I think `
// STARTFILE: livepreview.js
` should be preserved. I still hope some bold dev, with admin rights, will one day cut the code to files ;).
- `
- In any case, I think large changes like this should go through beta process. Even if the code would mostly be equivalent, there might be some cases that are not easy to test. Nux (talk) 00:10, 6 December 2023 (UTC)
- @Sohom Datta I also noticed I think you've missed how
htmlGenerator
is used. Seems likeshowAPIPreview
shouldn't work. Seems to expect non-async function. Nux (talk) 00:34, 6 December 2023 (UTC)- @Nux No issues, in fact the more issues we find the better :)
- I've gone ahead and fixed the issue with
APIimagepagePreviewHTML
(lmk if there are any issues) - I did a global search for
APIsharedImagePagePreviewHTML
and the only instances are popup clones, so I'm assuming this should be fine. - I've added
// STARTFILE: livepreview.js
though, only the wrapper wiki2html function remains. - I've removed the unnecessary
.bind( this )
calls :)
- I've gone ahead and fixed the issue with
- Regarding the beta process, I'm happy to wait a while for y'all to test and review the code. I'll put up a post at WP:VPT and WP:IANB to solicit more beta testers/people who might want to review the code :) Sohom (talk) 00:56, 6 December 2023 (UTC)
- For anyone willing to betatest this, please disable the gadget in your settings and add the following to your common.js
- Sohom (talk) 01:05, 6 December 2023 (UTC)
importStylesheet( 'MediaWiki:gadget-navpop.css' ); importScript('User:Sohom_Datta/popups.js');
- The gadget definition is
Navigation_popups[ResourceLoader|dependencies=mediawiki.api,mediawiki.user,mediawiki.util,user.options,mediawiki.jqueryMsg|type=general]|popups.js|navpop.css
- So we probably need something more like this for testing, right? ("w:" added so that this works on testwiki)
- –Novem Linguae (talk) 06:16, 6 December 2023 (UTC)
mw.loader.using(['mediawiki.api', 'mediawiki.user', 'mediawiki.util', 'user.options', 'mediawiki.jqueryMsg']).then(function() { importScript('w:User:Sohom_Datta/popups.js'); importStylesheet('w:MediaWiki:Gadget-navpop.css'); });
- Very nice work. Getting rid of the 769 lines of InstaView code (which is some of the smellier code in the codebase, with one letter variable names,
for (; remain(); )
, etc.) is definitely a maintainability win. - May I suggest splitting this into three patches? Want to diff out the "Removed the custom wikitext parsing engine at wiki2html() and replaced it a call to the parsing API" in a new section and tag it with {{IAER}}? Smaller patches spaced out over time means easier testing, and easier to tell what caused bugs if this talk page starts getting bug reports. –Novem Linguae (talk) 07:43, 6 December 2023 (UTC)
- @Nux No issues, in fact the more issues we find the better :)
- @Sohom Datta I also noticed I think you've missed how
- One thing this will complicate might be section previews. Take for instance formal tone. We also have to think about other content models like User:TheDJ/common.css and analyze a bit the performance for very big pages, with something like Barack Obama. —TheDJ (talk • contribs) 08:29, 6 December 2023 (UTC)
- @TheDJ Section previews appears to work similarly to how it worked previously. User:TheDJ/common.css does fail, but it does so on the old navpopups code as well (we should fix that in a later request?). Barack Obama seems fine since Navpopups truncates the preview to only show a small portion of the wikitext before it reaches the preview code. There is some additional latency since we are moving to a API call from a synchronous parsing of HTML, but overall it should be a performance win if we are parsing long peices of wikitext since we are keeping the main thread free instead of busy parsing multiple bytes of wikitext :) Sohom (talk) 10:48, 6 December 2023 (UTC)
- Thanks. I like the idea behind the changes. So I hope you don't mind me looking over your shoulder, but this is a popular gadget, which I'm also using :). Some thoughts upon review:
- I've added back the function in my version, the updated diff should be this (lmk if you find any other issues). That being said, I did test the refactoring on quite a few cases (including the history tab, edit and preview usecases) and did not find any noticable difference in behaviour with
Create a GitHub repo?
[edit]I guess if Sohom is going to be submitting complex patches like the above, it might be time to think about moving to a GitHub repo. I'm still not completely sold on it, but wanted to start a discussion. Here's some of my thoughts: User:Novem Linguae/Essays/Pros and cons of moving a gadget to a repo. –Novem Linguae (talk) 08:00, 6 December 2023 (UTC)
- gitlab.wikimedia.org —TheDJ (talk • contribs) 08:16, 6 December 2023 (UTC)
- I would add copyright to pros. Most of the time, I see patches applied, admins don't use the name of the person who authored the patch. Most of the time, patches are small, but for bigger patches, that might be copyvio. I assume when exporting one would use Wikipedia:Wiki-to-Git or similar to preserve authors :) (at least authors applying patches). And then when you do pull requests the authors are automatically preserved.
- Also to pros I would add blame. Use that very often to figure when and why particular code was added. Making blame work after splitting to files might be a bit hard on git (no built in copy function). But there are ways to do that with a bit of branch and merge magic. Nux (talk) 10:35, 6 December 2023 (UTC)
- I would definitely support a repository. Amongst other things, it will allow for much better code review. Another nice feature would be the ability to migrate to a sane linting system and potentially migrating to using the ResourceLoader package file system in the future (instead of one
bighuge 8000 line file). - I don't have any issues with eithier Wikimedia Gitlab or Github (as long as Gerrit is not considered), though it might be worthwhile to ask for a specific
repos/gadgets
namespace in Gitlab if we want to do it longterm :) Sohom (talk) 11:35, 6 December 2023 (UTC)- How will visibility concerns be addressed? Where will changes be discussed? Will the .js code overleaf always be the live code? -- Michael Bednarek (talk) 12:37, 6 December 2023 (UTC)
- @Michael Bednarek I don't think there are any visibility issues as such, the code needs to be onwiki and in plaintext for the gadget to be able to run at all regardless of whether we use a single huge file or multiple small files with the packagefile directive. Regarding the code review process, it would happen primarily on the platform Gitlab/Github similar to how the Twinkle code review model currently works. Sohom (talk) 14:47, 6 December 2023 (UTC)
- While code review would happen on GitLab, reporting bugs and requesting features could continue to happen here on Wikipedia, as issues are intentionally disabled on gitlab.wikimedia.org. (I prefer gitlab.wikimedia.org to GitHub to keep the code in-house and make it easier to link Git users to Wikipedia users.) —Tacsipacsi (talk) 15:28, 8 December 2023 (UTC)
- @Michael Bednarek I don't think there are any visibility issues as such, the code needs to be onwiki and in plaintext for the gadget to be able to run at all regardless of whether we use a single huge file or multiple small files with the packagefile directive. Regarding the code review process, it would happen primarily on the platform Gitlab/Github similar to how the Twinkle code review model currently works. Sohom (talk) 14:47, 6 December 2023 (UTC)
- How will visibility concerns be addressed? Where will changes be discussed? Will the .js code overleaf always be the live code? -- Michael Bednarek (talk) 12:37, 6 December 2023 (UTC)
- I would definitely support a repository. Amongst other things, it will allow for much better code review. Another nice feature would be the ability to migrate to a sane linting system and potentially migrating to using the ResourceLoader package file system in the future (instead of one
Refactor parsing of wikitext
[edit]This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Per the above discussion, the following changes [1] are proposed :) Sohom (talk) 11:02, 6 December 2023 (UTC)
- This is just the "Removed the custom wikitext parsing engine at wiki2html() and replaced it a call to the parsing API" part of your above code, and not the other two items, correct? Also, what is a good test procedure for this? –Novem Linguae (talk) 11:15, 6 December 2023 (UTC)
- Yep, it is only that wrt to testing,
mw.loader.using(['mediawiki.api', 'mediawiki.user', 'mediawiki.util', 'user.options', 'mediawiki.jqueryMsg']).then(function() { importScript('w:User:Sohom Datta/parsingchange-popups.js'); importStylesheet('w:MediaWiki:Gadget-navpop.css'); });
- should work :) Sohom (talk) 11:17, 6 December 2023 (UTC)
- For testing, I meant, what modules should we be clicking to exercise this part of the code? :) –Novem Linguae (talk) 11:31, 6 December 2023 (UTC)
- Oh, okay :) Since this is the preview module, anything that shows a preview would work (articles, userpages, images). I've put together a set of links at User:Sohom_Datta/sandy-box in case you want to test it out :) Sohom (talk) 11:55, 6 December 2023 (UTC)
- Sandy box. Love that. Haha. In my testing, I found two differences between the old and the new.
- Templates now render, instead of displaying the wikicode. You can see this in your sandy box image examples. I think this is a feature not a bug. I think folks will like this.
- Headings now have [ edit | edit section ] links that they didn't have before. And they are showing up a bit too big. I think they are the same size as the headings rather than body text. I think this should either be shrunk or hidden before we deploy this patch. This may involve changing MediaWiki:Gadget-navpop.css.
- Now that the other patch was merged, needs a rebase.
- –Novem Linguae (talk) 20:27, 7 December 2023 (UTC)
- I won’t like if templates are rendered. Templates are not rendered for a reason: how templates making heavy use of parameters happen to render on their own page doesn’t say much about what they’re really are. They are oftentimes even partly or entirely
<includeonly>
d, so parts are left out from the preview. Couldn’t the namespace condition moved to before making the API request, so that the request is sent only for non-template pages, continuing to display template wikitext verbatim? —Tacsipacsi (talk) 15:37, 8 December 2023 (UTC)- I intend to take another stab at this next week, it seems to be fairly complicated to have templates not be rendered, I will see if we can maybe only the show the documentation somehow. Sohom (talk) 15:59, 15 December 2023 (UTC)
- I won’t like if templates are rendered. Templates are not rendered for a reason: how templates making heavy use of parameters happen to render on their own page doesn’t say much about what they’re really are. They are oftentimes even partly or entirely
- Sandy box. Love that. Haha. In my testing, I found two differences between the old and the new.
- Oh, okay :) Since this is the preview module, anything that shows a preview would work (articles, userpages, images). I've put together a set of links at User:Sohom_Datta/sandy-box in case you want to test it out :) Sohom (talk) 11:55, 6 December 2023 (UTC)
- For testing, I meant, what modules should we be clicking to exercise this part of the code? :) –Novem Linguae (talk) 11:31, 6 December 2023 (UTC)
Article title hyperlinks in previews are black, not blue
[edit]Steps to reproduce: 1) vector 2010, not tested on other skins, 2) turn off navigation popups in Special:Preferences gadgets, 3) add the below code to User:abc/common.js, 4) hover over a valid article. What happens? Article title link is black. What should happen instead? Article title link is blue.
mw.loader.using(['mediawiki.api', 'mediawiki.user', 'mediawiki.util', 'user.options', 'mediawiki.jqueryMsg']).then(function() {
importScript('w:User:Sohom Datta/parsingchange-popups.js');
importStylesheet('w:MediaWiki:Gadget-navpop.css');
});
Looking at the code for .popup_mainlink a { color: #000; }
, I think the devs intend for it to be black everywhere.
In the situation above, there are two CSS styles competing with each other. In one situation, .popup_mainlink a { color: #000; }
wins out over the other styles. In the other situation, a:link, .mw-parser-output a.extiw, .mw-parser-output a.external, .vector-menu-portal .vector-menu-content li a { color: rgb(0,0,238); }
wins out over the other styles.
Anyway, I think we should pick one color, then get it to be used consistently. Whether it's blue or black. I'm leaning blue.
I'm also curious why loading it as a non-gadget changes the CSS order of precedence, even though the two sets of selectors are identical. Perhaps there's a bug in the load code above? –Novem Linguae (talk) 20:37, 7 December 2023 (UTC)
Other talk page, and Phabricator
[edit]Looks like this gadget has another talk page at Wikipedia talk:Tools/Navigation popups, and also a tag on Phabricator. Just an FYI for folks who only know about this page. I only discovered these today. –Novem Linguae (talk) 08:20, 30 December 2023 (UTC)
History preview failed
[edit]can we change:
return 'History preview failed :-(';
to something like:
return popupString('History preview failed :-(');
for localization purpose? valepert (talk) 10:22, 31 January 2024 (UTC)
- Want to sandbox it somewhere and make sure it works? Then tag this with {{IAER}}? Also, searching for "preview failed" reviews 5 spots we could apply this pattern to. –Novem Linguae (talk) 10:29, 31 January 2024 (UTC)
- I made some test here, without CSS, and hovering "hist" on this page. I hope it's enough to evaluate the change. --valepert (talk) 13:57, 31 January 2024 (UTC)
- @Valepert. Don't forget to tag this with {{IAER}} when it's ready to go. Also please provide a steps to test, and a diff of what you changed. This makes it easy for the reviewer. –Novem Linguae (talk) 22:36, 28 February 2024 (UTC)
- I made some test here, without CSS, and hovering "hist" on this page. I hope it's enough to evaluate the change. --valepert (talk) 13:57, 31 January 2024 (UTC)
This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
- please change "'History preview failed :-('" with "popupString('History preview failed')", adding "'History preview failed': 'History preview failed :-('," before "last:".
- see diff.
- step to test:
- visit Special:Contributions/2A02:C7F:745F:6400:69E1:8FB2:A675:2199
- hovering on "hist" of "100%" page
- expected message: "History preview failed :-("
- --valepert (talk) 22:57, 28 February 2024 (UTC)
- Implemented, thanks valepert. However, two things of note: first, there are a ton more error messages that are not similarly isolated. Second, I notice there's an unrelated bug in your example, where the % in the article title display is being unnecessarily URI-encoded, which breaks the link to the article itself. Writ Keeper ⚇♔ 14:03, 29 February 2024 (UTC)
Feature request: Show Block reason
[edit]Is it possible to add the most recent block log entry (for currently blocked users) into the popup? Similar to how MediaWiki:Gadget-markblocked.js puts the reason in the tooltip. I have both scripts enabled, and it does strikethrough the username but Popups overrides the markblocked tooltip for blocked editors so I can't see the block reason without navigating away from the page I'm on to check the block log. I'd try building it myself based on the markblocked gadget, but my Javascript knowledge is very limited. The WordsmithTalk to me 21:11, 28 February 2024 (UTC)
Certain user permissions (extended confirmed, global renamer) not showing
[edit]Usually when you hover over a username, popups shows all their local permissions in regular text, and all their global permissions in italics. However, I've noticed a couple permissions are not showing up. In particular, extended confirmed (local) and global renamer (global). I propose fixing these two, and doing an audit to make sure there's not any other permissions being missed. If there's some hard-coded list in the code somewhere, I propose switching to something that is not hard-coded so that new permissions can be reliably detected without code modifcations. –Novem Linguae (talk) 04:13, 16 April 2024 (UTC)
- I believe extendedconfirmed is an intentional omission. (No opinion in whether it should be.) Global renamer is, technically speaking, a local right on Meta, not a global right. See e.g. Special:CentralAuth/Tamzin. As a global renamer, I'd definitely find it useful to have that included here, but I'd think it'd require an extra API call just for that check? -- Tamzin[cetacean needed] (they|xe) 04:21, 16 April 2024 (UTC)
- Yeah, looks like global renamer is local to meta and would require its own API call. Good find, thank you. –Novem Linguae (talk) 04:36, 16 April 2024 (UTC)
- There could be a case for a no-permissions global group for global renamers, similar to VRT permissions agents, but I guess that would be a matter for Meta. -- Tamzin[cetacean needed] (they|xe) 04:38, 16 April 2024 (UTC)
- "I believe extendedconfirmed is an intentional omission." correct. there are several groups (not permissions btw) that are filtered out because almost everyone has them. —TheDJ (talk • contribs) 08:22, 16 April 2024 (UTC)
- Yeah, looks like global renamer is local to meta and would require its own API call. Good find, thank you. –Novem Linguae (talk) 04:36, 16 April 2024 (UTC)
eslint-config-wikimedia autofixes
[edit]In a sandbox, I ran the official wikimedia javascript linter on the popups code. Here's the diff.
- ran eslint-config-wikimedia autofixes
extends { "wikimedia/client/es6", "wikimedia/jquery", "wikimedia/mediawiki" }
- excluding
- controversial ones such as space-in-parens and max-len
- no-var (changing var to let/const). this would be fine to do since Grade A support is on ES6 now, but will save for a future patch
- unicorn/prefer-string-slice. I'm not sure the suggested
.slice( 0, Math.max(
is more readable/better than the existing.substring(
- some rules that weren't auto-fixing well when I manually reviewed the code
- including rules such as comma-dangle, no-unneeded-ternary, no-useless-concat, operator-linebreak, semi-style, unicorn/prefer-date-now, dot-notation, jsdoc/check-tag-names, jsdoc/check-types, and others
- removed some comments
Will self-merge in a couple days if no objections.
Note to self: Manually test a bit on testwiki before deploying. –Novem Linguae (talk) 06:36, 25 April 2024 (UTC)
- I really dislike the
"comma-dangle": "never"
setting, it makes subsequent diffs less readable (and accounts for a large part of the current diff as well). Could you change it toonly-multiline
(oralways-multiline
if you prefer) and revert your changes that removed trailing commas? Thanks in advance! - Also, I don’t see any reference to this ESLint rule set in the code. Could you add a comment (even if not machine-readable) that informs future maintainers what they should lint the code with? —Tacsipacsi (talk) 19:41, 26 April 2024 (UTC)
- Thanks for the feedback. I'll avoid comma-dangle for now. Although it's in the official Wikimedia JavaScript linter, so I'm sure they have their reasons.
- It'd be a pretty big comment, so I will probably have to keep it out of the code for now. The file I am using is...
- –Novem Linguae (talk) 13:14, 4 May 2024 (UTC)
{ "extends": [ "wikimedia/client/es6", "wikimedia/jquery", "wikimedia/mediawiki" ], "globals": { "mw": "readonly" }, "parserOptions": { "ecmaVersion": "latest", "sourceType": "module" }, "rules": { "camelcase": "off", "es-x/no-array-prototype-includes": "off", "es-x/no-async-functions": "off", "es-x/no-class-fields": "off", "es-x/no-optional-catch-binding": "off", "es-x/no-regexp-lookbehind-assertions": "off", "es-x/no-regexp-s-flag": "off", "es-x/no-rest-spread-properties": "off", "es-x/no-string-prototype-matchall": "off", "es-x/no-string-prototype-replaceall": "off", "jsdoc/require-param": "off", "jsdoc/require-param-type": "off", "jsdoc/require-returns": "off", "max-len": "off", "mediawiki/class-doc": "off", "no-jquery/no-class-state": "off", "no-jquery/no-global-selector": "off", "no-jquery/no-parse-html-literal": "off", "no-jquery/variable-pattern": "off", "no-shadow": "off", "no-underscore-dangle": "off", "security/detect-non-literal-regexp": "off", "security/detect-unsafe-regex": "off", "unicorn/prefer-string-slice": "off", "space-in-parens": "off", "computed-property-spacing": "off", "eqeqeq": "off", "no-var": "off", "spaced-comment": "off", "array-bracket-spacing": "off", "jsdoc/no-multi-asterisks": "off", "no-alert": "off", "no-tabs": "off", "jsdoc/require-asterisk-prefix": "off", "jsdoc/check-alignment": "off" } }
- Done. –Novem Linguae (talk) 15:14, 4 May 2024 (UTC)
- @Novem Linguae: Thanks for excluding
comma-dangle
! Although it's in the official Wikimedia JavaScript linter, so I'm sure they have their reasons.
- I guess simply legacy. According to ECMAScript version history#5th Edition – ECMAScript 2009, a trailing comma in object literals is accepted only since ES5, and Wikipedia used to support ES3.
It'd be a pretty big comment, so I will probably have to keep it out of the code for now.
- I see. Then maybe a subpage or a collapsible box on the top of this talk page? I fear a random talk page topic will get lost in the archives.
- (Sorry for the late reply, I missed notifications due to a bot archival, which stopped watchlist emails despite not sending one itself.) —Tacsipacsi (talk) 10:32, 18 May 2024 (UTC)
- I was reading a random Phab ticket today and found out why comma-dangle is in eslint-config-wikimedia. It's for easier copy-pasting to JSON. I guess this use case was important to Wikimedia developers back when they decided on this rule. Today I learned. –Novem Linguae (talk) 15:53, 1 June 2024 (UTC)
- What is that random Phab task? I find this hard to believe (or at least not well thought through) because at the same time we have
"quotes": "single"
, which is exactly the non-JSON-compatible version, and it’s even much more work to replace all the single quotes with double ones than deleting some commas. —Tacsipacsi (talk) 21:47, 1 June 2024 (UTC)- phab:T222707#5164890 and phab:T222707#5165095
(the developer community has had this conversation before and decided that easier portability to JSON is more important than cleaner diffs)
–Novem Linguae (talk) 00:08, 2 June 2024 (UTC)
- What is that random Phab task? I find this hard to believe (or at least not well thought through) because at the same time we have
- I was reading a random Phab ticket today and found out why comma-dangle is in eslint-config-wikimedia. It's for easier copy-pasting to JSON. I guess this use case was important to Wikimedia developers back when they decided on this rule. Today I learned. –Novem Linguae (talk) 15:53, 1 June 2024 (UTC)
- @Novem Linguae: Thanks for excluding
- Done. –Novem Linguae (talk) 15:14, 4 May 2024 (UTC)
Updates for dark mode
[edit]This edit request to MediaWiki:Gadget-navpop.css has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Can an interface admin please copy User:The wub/popups sandbox.css to MediaWiki:Gadget-navpop.css (comparison). This updates the styling to work in the new dark mode (phab:T365749), following the guidance at mw:Recommendations for night mode compatibility on Wikimedia wikis. the wub "?!" 20:32, 26 May 2024 (UTC)
- Done * Pppery * it has begun... 01:55, 27 May 2024 (UTC)
- Thanks very much! the wub "?!" 09:07, 27 May 2024 (UTC)
This edit request to MediaWiki:Gadget-navpop.css has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
- @Pppery: Another edit, sorry. It was reported that forcing the diff text color clashes with the "Blackskin" gadget. I figured out some new diff background colors for dark mode which work with the white text color, avoiding the issue with Blackskin and I think looking better on the whole. Can you update from my sandbox again please? Here's the diff. the wub "?!" 21:43, 27 May 2024 (UTC)