MediaWiki talk:Gadget-HotCat.js
This script, HotCat, is a JavaScript gadget which can be enabled or disabled in your Preferences. The documentation page is located at Help:Gadget-HotCat. |
i18n | Gadget translations:
|
Threads older than 180 days days may be archived. |
Cursor jumping to the end[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)
- +1, this bug is annoying. Let's hope it will be solved eventually. --Enyavar (talk) 13:58, 27 January 2022 (UTC)
- +1 indeed! -- Tuválkin ✉ ✇ 22:07, 28 January 2022 (UTC)
- +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)
API deprecation notice about rvslots[edit]
The response contains an api deprecation notice.
"Because "rvslots" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
For both use of rvprop=content
the param rvslots=main
should be added. Also page.revisions[ 0 ][ '*' ]
must changed to page.revisions[ 0 ][ 'slots' ][ 'main' ][ '*' ]
.
The mediainfo slot does not support categories and is ignored in that case. This is untested. Der Umherirrende (talk) 21:29, 14 January 2022 (UTC)
Dropped-categories bug[edit]
As first reported here, there is an annoying tendency to change and then drop user-input categories, seemingly at random. Upon confirming the new HotCategorized categories with the "Save" button, it may happen that the first of the new categories gets exchanged for another new category; which then leads subsequently to dropping the one that gets changed in the Edit dialog. This may or may not have something to do with the editing line still open (it gets closed automatically when you use the Save button). This bug has undone some work from me for months, but I couldn't reproduce it until today, in the case of the attached screenshot-series. Sorry that I cannot provide any technical insight into the problem. --Enyavar (talk) 23:00, 4 February 2022 (UTC)
- @Enyavar: Did you mean this bug? Standardly, when categories are edited using HotCat, more fields can be opened (without OK click) and the "Save" button saves all changes correctly. However, when more than one target categories are redirected, the screen displays all of them correctly redirected at first, but in the next step when the whole source page is opened to edit, only the last of the redirected category tags is kept and all the previous are disappeared. Multiple redirects don't work correctly. Probably, some variable used for redirects is not distinguished and is ovewritten by the next one. To prevent this, the user must first confirm each category change separately with the OK button before pressing Save button for the entire change group (if he is not sure that none of the newly linked categories is redirected).
- @Lupo: Unfortunately, Phabricator reportedly has no project in which this bug could be solved. I was referred here to this local site.--ŠJů (talk) 15:01, 11 June 2022 (UTC)
- It makes sense to me now that the category-redirects have to do with this. I am treading much more carefully with this already and more often needlessly click "ok". The rate this bug happens to me has dropped to only once a day or so, and I usually catch it after it happened. What I am not sure about is that bit with "more than one target categories are redirected". I am certain I have had this bug two days ago with just two categories, and only the latter one was a redirect which I had confirmed, and the first one was the correct category which was still dropped upon saving. --Enyavar (talk) 16:45, 11 June 2022 (UTC)
Global Localization for Thai[edit]
HotCat: Global Thai Localization
Based upon w:th:MediaWiki:Gadget-HotCat.js/local_defaults (Diff ID 9337615), which is the main localization of HotCat for Thai language Wikis. Most of the texts below are unchanged from the original.
//<syntaxhighlight lang="javascript">
/*
* HotCat: Global Thai Localization
*
* Based upon //th.wikipedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js/local_defaults
* , which is the main localization of HotCat for Thai language Wikis. Most of the texts are
* unchanged from the original in the first revision of this JS page.
*
* As of the creation of this page, some sister projects localization have not been updated
* to the current revision (ID 9337615) of Thai Wikipedia's localization yet.
*
* (Credits according to local_defaults' history in each projects)
* Credits WP: B20180, Jutiphan, Nullzero
* Credits WS: Sasakubo1717, Geonuch
* Credits WB: Sasakubo1717, Geonuch
* Credits WikT: Sasakubo1717, Octahedron80
* Credits WQ: Sasakubo1717, B20180
* Credits UN: Patzagorn Y? (Patsagorn Y.)
*/
/* global HotCat */
// Layout from ../en
// Localizations of a few HotCat user interface texts.
if (window.HotCat) {
HotCat.messages.commit = 'บันทึก';
HotCat.messages.ok = 'ตกลง';
HotCat.messages.cancel = 'ยกเลิก';
HotCat.messages.multi_error = 'ไม่สามารถดึงข้อความที่ต้องแก้ไขจากระบบได้ การเปลี่ยนหมวดหมู่ไม่สามารถดำเนินการได้ ขออภัยในความไม่สะดวก';
HotCat.categories = 'หมวดหมู่';
HotCat.engine_names.searchindex = 'ดัชนีการค้นหา';
HotCat.engine_names.pagelist = 'รายการหน้าทั้งหมด';
HotCat.engine_names.combined = 'ค้นหารวมกลุ่ม';
HotCat.engine_names.subcat = 'หมวดหมู่ย่อย';
HotCat.engine_names.parentcat = 'หมวดหมู่หลัก';
HotCat.tooltips.change = 'แก้ไข';
HotCat.tooltips.remove = 'นำออก';
HotCat.tooltips.add = 'เพิ่มหมวดหมู่ใหม่';
HotCat.tooltips.restore = 'ย้อนการแก้ไข';
HotCat.tooltips.undo = 'ย้อนการแก้ไข';
HotCat.tooltips.down = 'เปิดหน้าต่างแก้ไขและแสดงหมวดหมู่ย่อย';
HotCat.tooltips.up = 'เปิดหน้าต่างแก้ไขและแสดงหมวดหมู่หลัก';
HotCat.multi_tooltip = 'แก้ไขหลายหมวดหมู่พร้อมกัน';
// Localize these messages to the main language of your Wiki.
//
// TODO FOR LOCAL: According to //commons.wikimedia.org/wiki/Help:Gadget-HotCat#Localization , this should be
// copied over to ((wgServer + /w/index.php?title=MediaWiki:Gadget-HotCat.js/local_defaults))
// TODO FOR LOCAL: Replace next line with: if (window.HotCat) {
if (mw.config.get('wgContentLanguage') === 'th') {
HotCat.messages.cat_removed = 'ลบ[[:หมวดหมู่:$1]]';
HotCat.messages.template_removed = ''; // According to original local localization, this is unused and is set as null.
HotCat.messages.cat_added = 'เพิ่ม[[:หมวดหมู่:$1]]';
HotCat.messages.cat_keychange = 'เปลี่ยนการเรียงลำดับใน[[:หมวดหมู่:$1]] ให้เรียงด้วย "$2"'; // $2 is the new key
HotCat.messages.cat_notFound = 'ไม่พบหมวดหมู่ "$1"';
HotCat.messages.cat_exists = 'มีหมวดหมู่ $1 อยู่แล้ว ไม่เพิ่มหมวดหมู่';
HotCat.messages.cat_resolved = ' (แก้เปลี่ยนทางของ[[:หมวดหมู่: $1]]แล้ว)';
HotCat.messages.uncat_removed = 'ลบป้าย {{ต้องการหมวดหมู่}}';
// ----
// Some text to append to the edit summary (tagline). Named 'using' for historical reasons.
// --
// TODO FOR LOCAL: Uncomment |HotCat.messages.using| and edit it for each sister projects
// Use local_defaults, below is from Thai Wikipedia, but sister projects use different ones
// HotCat.messages.using = 'ด้วย[[วิกิพีเดีย:ฮอทแคต|ฮอทแคต]]';
// ----
// $1 is replaced by a number. If your language has several plural forms (c.f. [[:en:Dual (grammatical form)]]);
// you can set this to an array of strings suitable for passing to mw.language.configPlural().
// If that function doesn't exist, HotCat will simply fall back to using the last
// entry in the array.
HotCat.messages.multi_change = '$1 หมวดหมู่';
// These are in the local localization, but not on global en loc. These are probably
// still in use to this day due to regex difference in |HotCat.uncat_regexp|
HotCat.category_regexp = 'หมวดหมู่'; //ไม่ใช้ Regex เพราะปกติการเพิ่มหมวดหมู่พิมพ์เป็นภาษาไทย แต่หากเดิมเนมสเปซนี้พิมพ์เป็นชื่ออื่น HotCat จะไม่แก้หมวดหมู่หรือแก้คำให้
HotCat.category_canonical = 'หมวดหมู่';
HotCat.disambig_category = 'แก้ความกำกวม';
HotCat.redir_category = 'หมวดหมู่เปลี่ยนทาง';
HotCat.uncat_regexp = /\{\{(uncategorized|ต้องการหมวดหมู่)\}\}|\{\{(((article|multiple)\ )?issues?|ข้อควรปรับปรุงของบทความ|ขคปป\.)\|(uncategorized|ต้องการหมวดหมู่)=yes\}\}|\|(uncategorized|ต้องการหมวดหมู่)=yes/i ;
HotCat.template_regexp = 'แม่แบบ';
HotCat.template_categories = {};
}
}
//</syntaxhighlight>
Add it to MediaWiki:Gadget-HotCat.js/th please. Thanks. --Bebiezaza (talk) 15:53, 26 May 2022 (UTC)