MediaWiki talk:Gadget-HotCat.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search


Could a warning popup appear when adding a DAB cat while using HotCat?[edit]

The problem: If you try to add a Disambiguation category (DAB category) to a file or category using HotCat, you cannot see that it is a DAB category. It is undesirable to have files or categories in DAB categories. So a lot of DAB categories have files and/or subcategories, see Category:Non-empty disambiguation categories (not only due to HotCat). This problem is being discussed on Commons:Village pump#How to make a structural solution for not empty disambigious pages?, issue 2.

Possible solution: If you try to add a DAB cat via the edit tab, a warning pop-up appears. Could such a warning pop-up also appear when you try to add a DAB cat via HotCat? JopkeB (talk) 04:55, 20 October 2022 (UTC)[reply]

Yes, it’s technically possible. The question is only whether there will be someone who implements it. 🙂 —Tacsipacsi (talk) 22:11, 20 October 2022 (UTC)[reply]
How can we reach people who might implement this request? JopkeB (talk) 04:27, 21 October 2022 (UTC)[reply]

I have made a proposal on the Wishlist 2023, see meta:Community Wishlist Survey 2023/Multimedia and Commons#A warning popup when adding a DAB cat while using HotCat. --JopkeB (talk) 05:25, 25 January 2023 (UTC)[reply]

we actually dont need a warning.--RZuo (talk) 19:55, 20 March 2023 (UTC)[reply]
RZuo: Why do we not need a warning? It happens to me regularly that I add unintentionally a DAB category using HotCat, and many more editors do so. I would like to prevent that from happening. --JopkeB (talk) 05:28, 21 March 2023 (UTC)[reply]
It is requested that an edit or modification be made to this protected page.
Administrators: Please apply <nowiki> or {{Tl}} to the tag after the request is fulfilled.

Pdanese

change line 87 to disambig_category: 'Disambiguation categories',
because some jokers did these without announcing them to the whole commons community https://commons.wikimedia.org/w/index.php?title=Template:Disambig&diff=prev&oldid=582141057 https://commons.wikimedia.org/w/index.php?diff=582136498 . RZuo (talk) 19:55, 20 March 2023 (UTC)[reply]
@Jon (WMF) could you please help with changing line 87? thx! RZuo (talk) 08:12, 21 May 2023 (UTC)[reply]
I’ll try to summarize the status of this edit request as I understand it:
  • HotCat has a feature to warn when adding categories that are marked as disambiguation categories.
  • The feature, I assume, used to work as intended (and as requested above) on Commons.
  • Later, Category:Disambiguation categories was split off from Category:Disambiguation on Commons, which broke the feature.
  • For a while, nobody realized this had happened.
  • People started to realize again that this would be a useful feature to have; this edit request was made, and eventually even added to the community wishlist survey, without (apparently?) anybody realizing (or at least mentioning) that the feature already existed and used to work.
  • Either Category:Disambiguation categories needs to be merged back into Category:Disambiguation on Commons, or HotCat needs to use Category:Disambiguation categories rather than Category:Disambiguation as the marker category on Commons.
“On Commons” is a key phrase in that last bullet point – I assume that we should not change this on other wikis. But I don’t understand the HotCat config system well enough to judge whether the edit suggested by RZuo would have that effect or not; therefore, I won’t be applying this edit request at this time. But I hope that this clarification enables some other interface admin more familiar with HotCat to fix the situation. Lucas Werkmeister (talk) 20:54, 5 November 2023 (UTC)[reply]
@Lucas Werkmeister they always have localised settings "on other wikis", because except enwp all others dont write in english. for example, Category:Disambiguation pages (Q1982926).
line 42 Localize these messages to the main language of your wiki.
lines 83-85 are the instructions for disambig_category.
disambig_category is used only in lines 991 and 997. i assume that's the part of the dab functionality. RZuo (talk) 21:04, 5 November 2023 (UTC)[reply]

Cursor jumping to the end (discussion restored from Archive 04)[edit]

I keep having trouble with the cursor jumping to the end of the input. It seems that whenever it automatically uppercases the first letter or removes leading whitespace/underscores, it moves the cursor to the end regardless of where the cursor was before. For example, if the current name is "Example" and the cursor is at the beginning:

  • Pressing "a" turns into "AExample"
  • Pressing the delete key turns into "Xample"
  • Pasting a lowercase word like "another" turns into "AnotherExample"
  • Pressing the space bar removes the space

and then the cursor moves to the end.

It looks like the problem is caused by sanitizeInput and makeActive in the textchange function. The former changes the capitalisation and strips leading whitespace/underscores, and the latter moves the cursor to the end if actualValue.indexOf( expectedInput ) is false, which is the case when the values are the same (indexOf is 0) or when the capitalisation is different (indexOf is -1).

- Nikki (talk) 18:18, 27 July 2021 (UTC)[reply]

+1, this bug is annoying. Let's hope it will be solved eventually. --Enyavar (talk) 13:58, 27 January 2022 (UTC)[reply]
+1 indeed! -- Tuválkin 22:07, 28 January 2022 (UTC)[reply]
+1 Can we please get some action on this - I mistakenly long thought it was an esoteric 'feature' PeterWD (talk) 11:01, 21 May 2022 (UTC)[reply]
+1 This bug is indeed annoying. Please try to solve this. (Other than that it's a great tool!) JopkeB (talk) 04:18, 20 October 2022 (UTC)[reply]

I have restored this topic discussion, that was archived by archiveBot on 24April2023. The historic bug remains unresolved, and I hope that someone can help fix it.PeterWD (talk) 08:13, 1 June 2023 (UTC)[reply]

{{Edit request}} About 2100 lines into the script the following line of code can be found:

if ( this.text.value !== null && this.text.value !== v ) this.text.value = v;

This is what makes the cursor jump to the end. To avoid this please change it as follows:

if ( this.text.value !== null && this.text.value !== v ) {
	var cursorPos = this.text.selectionStart;
	this.text.value = v;
	this.text.setSelectionRange( cursorPos, cursorPos );
}

Requested via de:WP:Reparatursommer#HotCat. Additional notes: Works in all supported browsers. You might wonder why I don't use selectionEnd, i.e. why I collapse the selection to a single cursor position. This is intentional so the user doesn't overwrite more and more stuff when they continue typing. --Thiemo Kreuz (WMDE) (talk) 14:04, 25 September 2023 (UTC)[reply]

✓ Done@Nikki, Enyavar, Tuvalkin, PeterWD, Ain92, and JopkeB: Should be fixed now, sorry for the delay. (I mainly react to edit requests via watching the category, so if the template is added or removed to a page that already has another edit request so that the category doesn’t actually change, I’m liable to miss it, I’m afraid. No idea if other interface admins deal with this differently.) --Lucas Werkmeister (talk) 21:46, 2 November 2023 (UTC)[reply]
looks good at first test, thanks a lot! --Enyavar (talk) 21:54, 2 November 2023 (UTC)[reply]
Thanks, it works now good. JopkeB (talk) 03:35, 3 November 2023 (UTC)[reply]

Utilize `wpIgnoreBlankSummary`[edit]

{{Edit request}} When the gadget is used with autocommit disabled, it displays the diff, showing changes that are to be saved. The summary field is pre-filled by HotCat and usually there's no need to alter it. However, MediaWiki prompts user that he hasn't entered the summary. This can be avoided if HotCat sends wpIgnoreBlankSummary=1 on its POST request to display the diff (documentation here). I'd be grateful if that field gets incorporated to the gadget (in function createCommitForm as far I as understand the code). Msz2001 (talk) 15:07, 21 June 2023 (UTC)[reply]

@Msz2001: I looked into this a bit, but I’m not very familiar with HotCat and wasn’t able to reproduce the issue you described. When I disabled autocommit, removing a category from File:PNG_Test.png sent me to the edit form (which I think is the expected behavior of disabling autocommit?), and then I was able to directly submit the edit there (without touching any of the fields) – MediaWiki didn’t complain about the edit summary, as (IIUC) you described above. Can you describe the steps to reproduce in more detail for me? Then I’ll try to see if wpIgnoreBlankSummary=1 helps. Lucas Werkmeister (talk) 22:32, 3 November 2023 (UTC)[reply]
@Lucas Werkmeister: You need to enable Prompt me when entering a blank edit summary (or the default undo summary) in your preferences. —Tacsipacsi (talk) 11:27, 5 November 2023 (UTC)[reply]
@Tacsipacsi: Thanks – I’ve tried that, but still got the same behavior…
What I did:
  1. enabled Prompt me when entering a blank edit summary (or the default undo summary) in my preferences
  2. added window.hotcat_no_autocommit = true; to my common.js
  3. went to File: PNG Test.png
  4. clicked the “-” button after Category:ISA test
  5. on the resulting edit form, pressed Alt+Shift+S (s accesskey, i.e. save / publish)
and it was saved directly. Lucas Werkmeister (talk) 14:38, 5 November 2023 (UTC)[reply]
@Lucas Werkmeister: Oh, I just realized – it’s not a problem on Commons, probably because the using [[Help:Gadget-HotCat|HotCat]] part of the edit summary is replaced by a tag, and removing that bit from the summary apparently counts as not using the “default undo summary”. Either you need to unset window.HotCat.changeTag, or test on a wiki where it’s not set (I believe it’s not set on dewiki, and I know for sure that it’s not set on huwiki). —Tacsipacsi (talk) 17:51, 5 November 2023 (UTC)[reply]
@Tacsipacsi: I tried to reproduce the issue on dewiki (w:de:Benutzer:Lucas Werkmeister/common.js) but still wasn’t successful. If you can reproduce it on huwiki, and are able to test an edited version of the gadget yourself (if you can figure out where the wpIgnoreBlankSummary goes), I’d be willing to deploy that even if I can’t test the fix myself (assuming that the code change should be reasonably small). Lucas Werkmeister (talk) 19:09, 5 November 2023 (UTC)[reply]
@Lucas Werkmeister Hi and sorry for not responding earlier. The request originally came from one of plwiki community members. Since we import HotCat from Commons, I posted it here (but, my bad, I didn't check that on Commons the summary logic works a bit different). The intent was to add another hidden input field to createCommitForm function (from line 3132). The modified version of HotCat (just forked) can be found on w:pl:Wikipedysta:Msz2001/HotCat.js. The only change is addition of line 3151. Msz2001 (talk) 20:09, 5 November 2023 (UTC)[reply]
I see, thanks – I’m assuming that pl:Special:Diff/71715787 represents a successful test of the edited version. ✓ Done. --Lucas Werkmeister (talk) 20:17, 5 November 2023 (UTC)[reply]
Yeah, exactly (didn't prompt for the summary, so went as expected after the changes). Msz2001 (talk) 20:21, 5 November 2023 (UTC)[reply]

Intercepting HotCat to set watchlist expiry period[edit]

When using JavaScript to intercept the page edit that HotCat makes, is it possible to set the watchlist expiry period with code? I use a script that presets this for edits made with VE, but it would be nice if I could have HotCat work in a similar manner. StefenTower (talk) 22:53, 16 October 2023 (UTC)[reply]

TypeError: ip.insertRow is not a function[edit]

@Jon (WMF): Why did you include && ip in this hotfix? If it was falsy, the function has already done an early return at line 2868.

By the way, I think the proper fix was removing || document.getElementById( 'wpDestFile' ) in line 2863 – #wpDestFile is an <input>, every other code path should find <table>s (and HTMLTableElement should have an insertRow method in all major browsers released in the past nine years). —Tacsipacsi (talk) 10:43, 28 October 2023 (UTC)[reply]

HotCat adds page status and does strange things in de.wikisource[edit]

I created a new project-category for a text where this has been forgotten. Then I added the category via HotCat to the pages. Then something strange happened: The header and footer got shifted into the main textbox and an additional "Seitenstatus" was added... Both shouldn't have happened. Can someone look into it? Example: Diff-link --Jenne1504 (talk) 08:26, 30 November 2023 (UTC)[reply]

This is the internal representation of a Page-namespace page: it begins with a <noinclude> section containing the <pagequality> element and the header, then the page body, then the footer in another <noinclude>. HotCat inserted the category below this <noinclude> section, which is certainly not good (the <noinclude> section should be at the very end).
Honestly I don’t see the point in categorizing Page-namespace pages (categories should be placed on the mainspace pages transcluding these Page-namespace pages), so I’d probably just disable HotCat in the Page namespace instead of putting probably considerable effort into fixing it. (But if anyone else thinks it’s worth being fixed, I’m not opposed to that.) —Tacsipacsi (talk) 21:20, 30 November 2023 (UTC)[reply]
They are categorized so that one can get a quick overview about the status of a project (petscan-links are automatically put on every index-page; but that only works if all pages from a project are in one project-category. The page-category is added automatically if the category is put on the index page. But has to be added if someone forget to fill the field… Jenne1504 (talk) 21:54, 1 December 2023 (UTC)[reply]

Deleting a category sortkey does not work[edit]

If I were to use HotCat to change "Abc|Foo" (Category:Abc, sortkey Foo) to "Abc" (Category:Abc, no sortkey), the edit would seemingly work, but no change would be made. Could someone please fix this? Thanks! —Ivi104 22:31, 30 December 2023 (UTC)[reply]

@Ivi104 you need to leave "Abc|" in the input field and then click ok. if you enter "Abc", the gadget thinks you didnt modify the sortkey. "Abc|" means sortkey is changed to nothing. RZuo (talk) 12:52, 31 December 2023 (UTC)[reply]

If one category is a redirect, other categories are not saved[edit]

Hi,
When you open a file in Commons and try to add two or more categories one of which is a redirect, only the redirect is added and other categories are ignored. Michgrig (talk) 19:11, 4 January 2024 (UTC)[reply]

Can't scroll list if bangs into top[edit]

Here the user cannot scroll the list down. It has banged into the top...

The user tugs on the grey scrollbar, but alas...

Yes, the user has chosen to put the categories at the top of the page.

Jidanni (talk) 07:49, 7 January 2024 (UTC)[reply]

Allow tool to operate on red categories (that don't exist yet.)[edit]

Let's say we click a red category link. OK, now we are editing a category that doesn't exist yet. It would be great if the tool appeared to help us assign this red category page to categories, so it would no longer be red. Currently one must manually place the first category in the category and save it to get the ball rolling, if you know what I mean. Jidanni (talk) 07:38, 14 January 2024 (UTC)[reply]

The gadget works only in read view. If you enter the read view by exiting the editor (Cancel button in the wikitext editor, Escape key in the visual editor), you’ll be able to use HotCat to create categories. —Tacsipacsi (talk) 07:44, 15 January 2024 (UTC)[reply]

Link from gadget itself[edit]

There should be a little link to this discussion area from the gadget itself.

Currently we must remember it is a gadget. And then we must look in our preferences under gadgets, and try to remember the name of this tool, to find the link.

I'm saying that right there, after the list of categories and + - signs, on every wiki page, there should be a link, to more information about the tool, including this discussion area. Jidanni (talk) 07:42, 14 January 2024 (UTC)[reply]

Adds 10+ seconds of load time to Wikitionary pages[edit]

When I open Wiktionary in Chrome on a definition such as goose when I'm logged in with HotCat enabled, there's a good 10+ seconds after I open the page where I can't click on any links. Opening up the Performance tab in the Dev Tools I can see that it's running find_category for literally 10.8 seconds, the last call in the call graph is en_wiktionary_category_name_detect twice for 5 seconds each. Disabling HotCat fixes the issue. Akeosnhaoe (talk) 20:28, 6 February 2024 (UTC)[reply]

Feature request: Ignore square brackets[edit]

If a user enters (e.g. by pasting from the clipboard) [[Category:Foobar]], HotCat should understand this as intended to be Foobar (as it does when the user enters Category:Foobar). Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 19:07, 8 February 2024 (UTC)[reply]

 Support Marsupium (talk) 01:15, 16 February 2024 (UTC)[reply]
i think the code to change is probably the part from line 991. RZuo (talk) 07:34, 16 February 2024 (UTC)[reply]

Where is the category bar?[edit]

The instructions state, "It augments the category bar". Where is the category bar? (Be gentle, please -- I'm having a bad day.  :-) SCHolar44 (talk) 06:24, 21 February 2024 (UTC)[reply]

near bottom
for example. RZuo (talk) 09:10, 21 February 2024 (UTC)[reply]

Support for Timeless Skin[edit]

HotCat doesn't seem to work at all on the Timeless skin. Since it's one of the official skins offered for Wikis, it should be supported. It's annoying when I want to use HotCat and have to switch back to Vector to use it and I don't think it would be that hard to implement. 128.82.20.2 20:59, 5 March 2024 (UTC)[reply]

As a point of information, Timeless isn't an officially-supported skin; Vector 2010, Vector 2022, and Minerva are the only supported skins. Jdforrester (WMF) (talk) 21:15, 5 March 2024 (UTC)[reply]
I'm not sure if you are the maintainer of HotCat (or if there is even such a thing as a maintainer for these types of add-ons), but it might be helpful to add the skin-dependency to the introductory documentation. Also, apologies if that is written somewhere and I missed it. Thank you. Pdanese (talk) 14:49, 17 April 2024 (UTC)[reply]

Keyboard shortcut (accessKey) for "Save" button?[edit]

Hi, when using HotCat heavily, it's a little bit fiddly to switch between mouse and keyboard. This is required when you've to use the "Save" button. Thus, it would be great if that button would have an accessKey property assigned (maybe this is possible client-side, but i don't know how...). TIA! Fl.schmitt (talk) 11:49, 29 March 2024 (UTC)[reply]