Wikibooks:Reading room/Technical Assistance
Discussions | Assistance | Requests | Announcements |
---|---|---|---|
General | Proposals | Projects | Featured books | General | Technical | Administrative | Deletion | Undeletion | Import | Permissions | Bulletin Board |
Welcome to the Technical Assistance reading room. Get assistance on questions related to MediaWiki markup, CSS, JavaScript, and such as they relate to Wikibooks. This is not a general-purpose technical support room.
To submit a bug notice or feature request for the MediaWiki software, visit Phabricator.
To get more information about the MediaWiki software, or to download your own copy, visit MediaWiki
There are also two IRC channels for technical help: #mediawikiconnect for issues about the software, and #mediawiki-coreconnect for WMF server or configuration issues.
move request
[edit source]Trouble with printable book
[edit source]CollectionParser gadget doesn't work
[edit source]And I think I fixed it here. If I succeeded, please replace the text of the gadget page with mine. JJPMaster (she/they) 03:56, 8 December 2024 (UTC)
- Also, make sure to remove it from the "broken gadgets" section of MediaWiki:Gadgets-definition. JJPMaster (she/they) 04:33, 8 December 2024 (UTC)
- Courtesy ping: @Leaderboard. JJPMaster (she/they) 04:02, 17 December 2024 (UTC)
┌─────────┘
@Leaderboard: Edit request: Please replace all content below and including the current addPediapressLinks
function with the following:
function addPediapressLinks($content) {
if ( mw.config.get('wgArticleId') && (mw.config.get('wgNamespaceNumber') == 0 || mw.config.get('wgNamespaceNumber') == 102 || mw.config.get('wgNamespaceNumber') == 110) ) {
$(mw.util.addPortletLink ('p-personal', '#', 'Get collection')).click(function() {
getCollection($content);
});
}
}
$(function() { addPediapressLinks() });
This fixes two bugs: (a) a bug where whenever the DOM was reloaded (e.g. when you press the "Reload" button in the live preview), the link would be duplicated, and (b) the link appears on nonexistent pages, causing an error. JJPMaster (she/they) 21:45, 20 December 2024 (UTC)
- Done Leaderboard (discuss • contribs) 03:16, 21 December 2024 (UTC)
- @Leaderboard: Oh, I think you missed the removal of the "
mw.hook...
" part. JJPMaster (she/they) 03:22, 21 December 2024 (UTC)- @JJPMaster Apologies, that's done. Leaderboard (discuss • contribs) 03:27, 21 December 2024 (UTC)
- @Leaderboard: While trying to use the updated version, I noticed another problem (an outdated CSS class name was being used), so I made a series of changes here to resolve it (and I also partially reversed the above change due to a problem involving what happens if the content of the page changes). I would like to request that that be made the content of MediaWiki:Gadget-collectionparser.js. JJPMaster (she/they) 04:35, 21 December 2024 (UTC)
- Done Leaderboard (discuss • contribs) 05:13, 21 December 2024 (UTC)
- @Leaderboard: Also, please change the
collectionParserPortletLink
declaration tovar collectionParserPortletLink = mw.config.get('wgArticleId') > 0 ? mw.util.addPortletLink ('p-personal', '#', 'Get collection', 'pediapress') : null;
to avoid the creation of a nonfunctional link on nonexistent pages. JJPMaster (she/they) 00:49, 22 December 2024 (UTC)
- @Leaderboard: Also, please change the
- Done Leaderboard (discuss • contribs) 05:13, 21 December 2024 (UTC)
- @Leaderboard: While trying to use the updated version, I noticed another problem (an outdated CSS class name was being used), so I made a series of changes here to resolve it (and I also partially reversed the above change due to a problem involving what happens if the content of the page changes). I would like to request that that be made the content of MediaWiki:Gadget-collectionparser.js. JJPMaster (she/they) 04:35, 21 December 2024 (UTC)
- @JJPMaster Apologies, that's done. Leaderboard (discuss • contribs) 03:27, 21 December 2024 (UTC)
- @Leaderboard: Oh, I think you missed the removal of the "
Proposal: Adopt OneClickWelcomer as a gadget
[edit source]Title blacklist request
[edit source]Low contrast with Template:hidden begin in dark mode
[edit source]Dark mode is coming and we need to prepare for it. Text wrapped in {{hidden begin}} {{hidden end}} looks like this:
Lorum ipsum
Notice that you can barely distinguish the text from the background if you enabled dark mode in Special:Preferences#mw-prefsection-rendering. To fix this, an administrator should replace background:{{{bg1|transparent}}}
with {{#if:{{{bg1|}}}|background:{{{bg1}}};}}
(analogous for bg2
) in Template:hidden begin to comply with the recommendations for night mode.
Also, the text "Expand me!" in the example above has CSS class "title", which makes the text appear in dark gray on a dark background due to the rule .collapsible .title { color:#4D4D4D; }
in MediaWiki:Common.css/Nav.css. This rule should probably be replaced by something like .collapsible .title { color:var(--color-subtle,#4D4D4D); }
(inspired by this recommendation). Dexxor (discuss • contribs) 15:53, 11 December 2024 (UTC)
- @Dexxor Done Leaderboard (discuss • contribs) 06:22, 14 December 2024 (UTC)
- Thanks for editing Template:hidden begin! The other issue with MediaWiki:Common.css/Nav.css is still open. Dexxor (discuss • contribs) 08:44, 14 December 2024 (UTC)
- @Dexxor I'm not seeing that exact string on the file - am I missing something? Leaderboard (discuss • contribs) 02:19, 18 December 2024 (UTC)
- @Leaderboard: I believe they accidentally omitted most of line 4, which has the following:
.collapsible .title, .collapsible tr:first-child th, .collapsible tr:first-child td { cursor:pointer; padding-right:16px; color:#4D4D4D; }
- They want it to be changed to
- JJPMaster (she/they) 02:36, 18 December 2024 (UTC)
.collapsible .title, .collapsible tr:first-child th, .collapsible tr:first-child td { cursor:pointer; padding-right:16px; color:var(--color-subtle,#4D4D4D); }
- @JJPMaster That's line 3 though - is this supposed to be on both lines? Leaderboard (discuss • contribs) 02:51, 18 December 2024 (UTC)
- @Leaderboard: Sorry, I just said the wrong number. It is line 3. JJPMaster (she/they) 03:00, 18 December 2024 (UTC)
- @JJPMaster Correct, and am I supposed to do this on line 4 as well? Just want to have this explicitly clarified as the purpose of both lines seem to be similar. Leaderboard (discuss • contribs) 03:07, 18 December 2024 (UTC)
- @Leaderboard: No, because only line 3 has the color set to be 4D4D4D. JJPMaster (she/they) 03:08, 18 December 2024 (UTC)
- @JJPMaster I get a warning:
Warning: Expected (<color>) but found 'var(--color-subtle , #4D4D4D)'.
- is this expected? Leaderboard (discuss • contribs) 03:10, 18 December 2024 (UTC)- @Leaderboard: I decided to investigate a little bit and found mw:Recommendations for night mode compatibility on Wikimedia wikis#Use CSS variables or CSS design tokens with fallback for background and text where possible, which has nearly identical code, so I would assume that this is expected. JJPMaster (she/they) 03:17, 18 December 2024 (UTC)
- @JJPMaster I get a warning:
- @Leaderboard: No, because only line 3 has the color set to be 4D4D4D. JJPMaster (she/they) 03:08, 18 December 2024 (UTC)
- @JJPMaster Correct, and am I supposed to do this on line 4 as well? Just want to have this explicitly clarified as the purpose of both lines seem to be similar. Leaderboard (discuss • contribs) 03:07, 18 December 2024 (UTC)
- @Leaderboard: Sorry, I just said the wrong number. It is line 3. JJPMaster (she/they) 03:00, 18 December 2024 (UTC)
- @JJPMaster That's line 3 though - is this supposed to be on both lines? Leaderboard (discuss • contribs) 02:51, 18 December 2024 (UTC)
- @Dexxor I'm not seeing that exact string on the file - am I missing something? Leaderboard (discuss • contribs) 02:19, 18 December 2024 (UTC)
- Thanks for editing Template:hidden begin! The other issue with MediaWiki:Common.css/Nav.css is still open. Dexxor (discuss • contribs) 08:44, 14 December 2024 (UTC)
Some changes to MediaWiki:Gadget-markAdmins
[edit source]The markAdmins gadget has had some problems. I have forked the markAdmins gadget and added some more groups, but that doesn't completely solve the problem; the problem is that the information here is incredibly out-of-date. To solve this, I have adapted MDanielsBot's source code for User:JJPMaster (bot), which will automatically update User:JJPMaster (bot)/markAdmins-Data.js. The source code for my bot can be found here, and it's on Toolforge here. JJPMaster (she/they) 04:43, 14 December 2024 (UTC)
- Courtesy ping: @Leaderboard. JJPMaster (she/they) 04:47, 14 December 2024 (UTC)
- @JJPMaster A bot available for Gadgets should not be pulling data from userspace in my opinion; do you think it could be placed somewhere else? Leaderboard (discuss • contribs) 06:25, 14 December 2024 (UTC)
- @Leaderboard: I think there are three possible alternatives here:
- Store the data on an external site - I believe this would be very inefficient, and probably also insecure
- Store the data in another non-MediaWiki namespace - There would need to be some measure taken to prevent anyone other than my bot from editing the page, otherwise it would be insecure
- Store the data alongside the gadget in the MediaWiki namespace - This would probably be the most secure, but would require my bot, and thus me, to have interface admin privileges, unless you or JackPotte maintained it instead.
- JJPMaster (she/they) 06:30, 14 December 2024 (UTC)
- @JJPMaster Can you do this on Meta-Wiki (eg have a page like metawiki:MarkAdmins/enwikibooks)? This can be useful if you plan to run this on many wikis. Leaderboard (discuss • contribs) 06:32, 14 December 2024 (UTC)
- @Leaderboard: I feel like that might have the same problem as option 2 here, on top of the fact that we would need a Meta administrator to change the content model of that page to JavaScript (since it doesn't have the .js extension). Also, I will courtesy ping the maintainer of the Wikipedia bot here. JJPMaster (she/they) 06:37, 14 December 2024 (UTC)
- I'll wait for some comments then - ping me in a week if you don't get any. Leaderboard (discuss • contribs) 06:40, 14 December 2024 (UTC)
- @Leaderboard: I have not received a reply. JJPMaster (she/they) 02:23, 21 December 2024 (UTC)
- @JJPMaster Plus make
markAdmins-Data
a JSON file, not a JS file - the former is significantly safer. Leaderboard (discuss • contribs) 05:28, 21 December 2024 (UTC)- @Leaderboard: Done. My bot actually already produced a JSON file (User:JJPMaster (bot)/markAdmins-Data.json), but the script does not fetch from it—it fetches from User:JJPMaster (bot)/markAdmins-Data.js. What I've done is disabled the part of my bot that automatically updates that page, and replaced its content with a short script that just fetches the JSON data directly rather than reimplementing it. JJPMaster (she/they) 05:54, 21 December 2024 (UTC)
- @JJPMaster So replacing the code of the gadget with User:JJPMaster/markAdmins-core.js is enough? Leaderboard (discuss • contribs) 06:21, 21 December 2024 (UTC)
- @Leaderboard: Yes, that will be good, as well as the deletion of the outdated MediaWiki:Gadget-markAdmins-data.js. Also, I should ask, should I request the bot flag for User:JJPMaster (bot)? JJPMaster (she/they) 06:27, 21 December 2024 (UTC)
- @JJPMaster Done; regarding your other question, this is up to you. While a good idea to request bot status, this is not required in most cases. Leaderboard (discuss • contribs) 06:38, 21 December 2024 (UTC)
- @Leaderboard: And please also remove the deleted page from MediaWiki:Gadgets-definition (and for the bot flag request, should I go to WB:PERM for that, or m:SRBS since we have no bureaucrats)? JJPMaster (she/they) 06:48, 21 December 2024 (UTC)
- @JJPMaster What do you mean by "deleted page"? Regarding your second question, it would be WB:PERM; the fact that we don't have bureaucrats means that after getting approval on PERM, someone goes to m:SRBS and ask the stewards to grant bot status. Leaderboard (discuss • contribs) 10:18, 21 December 2024 (UTC)
- @Leaderboard: The outdated data.js file you deleted. JJPMaster (she/they) 16:35, 21 December 2024 (UTC)
- @JJPMaster Got it, Done. Leaderboard (discuss • contribs) 16:42, 21 December 2024 (UTC)
- @Leaderboard: And two final changes:
- Add
mediawiki.api
as a dependency - replace
api = new mw.Api()
on L29 withvar api = new mw.Api()
to avoid'use strict'
errors.
- Add
- JJPMaster (she/they) 17:03, 21 December 2024 (UTC)
- Done Leaderboard (discuss • contribs) 21:15, 21 December 2024 (UTC)
- @Leaderboard: The gadget unfortunately no longer works because "mediawiki.api" was incorrectly added. Here is what was intended:
* markAdmins [ResourceLoader|dependencies=mediawiki.util,mediawiki.api]|markAdmins.js
- You put the new dependency outside of the square brackets by mistake. JJPMaster (she/they) 21:26, 21 December 2024 (UTC)
- Done Leaderboard (discuss • contribs) 21:15, 21 December 2024 (UTC)
- @Leaderboard: And two final changes:
- @JJPMaster Got it, Done. Leaderboard (discuss • contribs) 16:42, 21 December 2024 (UTC)
- @Leaderboard: The outdated data.js file you deleted. JJPMaster (she/they) 16:35, 21 December 2024 (UTC)
- @JJPMaster What do you mean by "deleted page"? Regarding your second question, it would be WB:PERM; the fact that we don't have bureaucrats means that after getting approval on PERM, someone goes to m:SRBS and ask the stewards to grant bot status. Leaderboard (discuss • contribs) 10:18, 21 December 2024 (UTC)
- @Leaderboard: And please also remove the deleted page from MediaWiki:Gadgets-definition (and for the bot flag request, should I go to WB:PERM for that, or m:SRBS since we have no bureaucrats)? JJPMaster (she/they) 06:48, 21 December 2024 (UTC)
- @JJPMaster Done; regarding your other question, this is up to you. While a good idea to request bot status, this is not required in most cases. Leaderboard (discuss • contribs) 06:38, 21 December 2024 (UTC)
- @Leaderboard: Yes, that will be good, as well as the deletion of the outdated MediaWiki:Gadget-markAdmins-data.js. Also, I should ask, should I request the bot flag for User:JJPMaster (bot)? JJPMaster (she/they) 06:27, 21 December 2024 (UTC)
- @JJPMaster So replacing the code of the gadget with User:JJPMaster/markAdmins-core.js is enough? Leaderboard (discuss • contribs) 06:21, 21 December 2024 (UTC)
- @Leaderboard: Done. My bot actually already produced a JSON file (User:JJPMaster (bot)/markAdmins-Data.json), but the script does not fetch from it—it fetches from User:JJPMaster (bot)/markAdmins-Data.js. What I've done is disabled the part of my bot that automatically updates that page, and replaced its content with a short script that just fetches the JSON data directly rather than reimplementing it. JJPMaster (she/they) 05:54, 21 December 2024 (UTC)
- @JJPMaster Plus make
- @Leaderboard: I have not received a reply. JJPMaster (she/they) 02:23, 21 December 2024 (UTC)
- I'll wait for some comments then - ping me in a week if you don't get any. Leaderboard (discuss • contribs) 06:40, 14 December 2024 (UTC)
- @Leaderboard: I feel like that might have the same problem as option 2 here, on top of the fact that we would need a Meta administrator to change the content model of that page to JavaScript (since it doesn't have the .js extension). Also, I will courtesy ping the maintainer of the Wikipedia bot here. JJPMaster (she/they) 06:37, 14 December 2024 (UTC)
- @JJPMaster Can you do this on Meta-Wiki (eg have a page like metawiki:MarkAdmins/enwikibooks)? This can be useful if you plan to run this on many wikis. Leaderboard (discuss • contribs) 06:32, 14 December 2024 (UTC)
- @Leaderboard: I think there are three possible alternatives here:
- @JJPMaster A bot available for Gadgets should not be pulling data from userspace in my opinion; do you think it could be placed somewhere else? Leaderboard (discuss • contribs) 06:25, 14 December 2024 (UTC)
Interface page edit request
[edit source]Reclassifying markblocked
[edit source]Recent changes improvements
[edit source]I would like to propose the following changes on recent changes in dark mode:
- Tag has too low contrast in dark mode, so a change of background to rgba(255,51,51,0.25) would improve contrast.
- Revision size colors (+0-500 bytes, -0-500 bytes, lower than -500 bytes) are too dark in DM. Remove CSS that causes this problem, to revert to default CSS.
Thanks Xeverything11 (discuss • contribs) 20:22, 20 December 2024 (UTC)
- See MediaWiki:Common.css/Recentchanges.css. Xeverything11 (discuss • contribs) 20:38, 20 December 2024 (UTC)
- @Xeverything11 Can you share the code that would fix both issues? Leaderboard (discuss • contribs) 06:39, 21 December 2024 (UTC)
- Replace with:
- @Xeverything11 Can you share the code that would fix both issues? Leaderboard (discuss • contribs) 06:39, 21 December 2024 (UTC)
/* Hide [unchecked page] from Flagged Rev */ span.flaggedrevs-unreviewed { display: none; } /* Highlight review link */ span.flaggedrevs-pending {background-color: yellow;} /* Highlight edit filter tags */ span.mw-tag-markers {background-color: rgba(255,51,51,0.25);}
- Thanks. Xeverything11 (discuss • contribs) 07:12, 21 December 2024 (UTC)
- @Xeverything11 Done Leaderboard (discuss • contribs) 10:41, 21 December 2024 (UTC)
- Thank you! Xeverything11 (discuss • contribs) 10:45, 21 December 2024 (UTC)
- @Xeverything11 Done Leaderboard (discuss • contribs) 10:41, 21 December 2024 (UTC)
- Thanks. Xeverything11 (discuss • contribs) 07:12, 21 December 2024 (UTC)
OneClickWelcomer edit requests
[edit source]Please replace the content of MediaWiki:Gadget-OneClickWelcomer.js with User:JJPMaster/OneClickWelcomer/unstable.js, which allows the "welcome" and "warn" links to persist after reloading recent changes. Also, please add Special:Watchlist to the list of pages the links display on in MediaWiki:Gadget-OneClickWelcomer. JJPMaster (she/they) 02:26, 21 December 2024 (UTC)
- Courtesy ping: Leaderboard. JJPMaster (she/they) 02:26, 21 December 2024 (UTC)
- Done Leaderboard (discuss • contribs) 03:14, 21 December 2024 (UTC)
- @Leaderboard: Please perform a similar replacement (User:JJPMaster/OneClickWelcomer/unstable.js → MediaWiki:Gadget-OneClickWelcomer.js) to fix a newly discovered bug where a warning can be malformed if no level number is indicated. JJPMaster (she/they) 19:57, 22 December 2024 (UTC)
- Done Leaderboard (discuss • contribs) 03:14, 21 December 2024 (UTC)
Archiver bot and Wikibooks:Reading room/Assistance
[edit source]Do we know why User:ArchiverBot has stopped archiving threads at Wikibooks:Reading room/Assistance? The last archive on that page was in 2022. —Kittycataclysm (discuss • contribs) 15:59, 21 December 2024 (UTC)
The current mechanism that {{Script doc auto}}
uses is (a) needlessly complicated, (b) out of date, and (c) doesn't account for common.js
files, since it says that "Documentation for this script can be added at User:JJPMaster/common." Please replace its contents with those of {{Script doc auto/sandbox}}
, which uses a more updated Lua implementation, and works with common.js. JJPMaster (she/they) 23:33, 21 December 2024 (UTC)
- Courtesy ping: Leaderboard JJPMaster (she/they) 23:37, 21 December 2024 (UTC)
- @JJPMaster I tried to make the fix, but that results in errors with the documentation page. As a result, I've temporarily reduced the protection level of this page so that you can fix it yourself - once that's done, let me know and I'll put it back. Leaderboard (discuss • contribs) 12:10, 22 December 2024 (UTC)
- @Leaderboard: Implemented, but the problem in question was actually intended behavior, as the module is not designed to be able to handle nonexistent pages. I just fixed the documentation to use an existent page instead. JJPMaster (she/they) 17:07, 22 December 2024 (UTC)
- @JJPMaster I tried to make the fix, but that results in errors with the documentation page. As a result, I've temporarily reduced the protection level of this page so that you can fix it yourself - once that's done, let me know and I'll put it back. Leaderboard (discuss • contribs) 12:10, 22 December 2024 (UTC)
Interface page edit request 2
[edit source]Please remove the last sentence ("Also, selecting 'all'...") from MediaWiki:Import-interwiki-text, as it appears to refer to a part of the Special:Import interface that no longer exists. JJPMaster (she/they) 00:38, 22 December 2024 (UTC)
- Courtesy ping: Leaderboard JJPMaster (she/they) 00:38, 22 December 2024 (UTC)
markAdmins bug fix
[edit source]The original markAdmins script on enwiki had a bug involving improper Vector 2022 support, and I have just applied the patch on the unstable branch. Please apply the patch to production. Courtesy ping: Leaderboard. JJPMaster (she/they) 03:03, 22 December 2024 (UTC)
This gadget appears to use an unusual and out-of-date importation of MediaWiki:Gadget-langcode2name.js to get the names of the languages, when a more simple means, used by Wiktionary (after they stopped using the old method), just gets the "title" property from the interwiki link itself, requiring no updating. Either import the Wiktionary gadget directly in MediaWiki:Gadget-sidebartranslate.js, or replace its content with the following:
// Copied from Wiktionary, see [[wikt:MediaWiki:Gadget-WiktSidebarTranslation.js]]
$(function() {
$("#p-lang .interlanguage-link a").each(function(){
var langnameMatch = $(this).attr("title").match(/(.*) – (.*)/);
var langname = $(this).attr("title"); // Some Wikibooks have '' as their main page
if (langnameMatch && langnameMatch.length >= 3) langname = langnameMatch[2];
$(this).text(langname)
.attr("lang", "en"); // This line breaks compact languages
});
$("#p-lang .interlanguage-link").sort(function(lia, lib){
return $(lia).children().first().text() < $(lib).children().first().text() ? -1 : 1;
}).appendTo("#p-lang>div>ul");
});
Courtesy ping: Leaderboard. JJPMaster (she/they) 06:22, 22 December 2024 (UTC)