MediaWiki talk:Gadget-HotCat.js/Archive01

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

Installation info

Using HotCat
Using HotCat in the upload form

People not using popups and not on Monobook skin should also insert this code:

// From [[en:User:Lupin/autoedit.js]]
function getParamValue(paramName) {
	var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
	var h=document.location;
	var m=cmdRe.exec(h);
	if (m) {
	try {
		return decodeURIComponent(m[1]);
	} catch (someError) {}
	}
	return null;
}

You can set "hotcat_no_autocommit=1" before the inclusion to prevent auto-saving.


For the configuration item to show up HotCat.js would have to be included in the default JS. We could make it disabled on default. What do you think? --Dschwen 12:29, 15 July 2007 (UTC)

Bug

Hello, please have a look at this bug, a bit worrying isn't it ? Thanks, le Korrigan bla 22:59, 14 August 2007 (UTC)

Adapt this for Wikipedia

Hello,

I was wondering if it is possible to adapt this tool for the French Wikipédia. What needs to be changed ?

Thank you, le Korrigan bla 20:17, 22 August 2007 (UTC)

It may work "as is", but it may have problems removing Categories beginning with Catégorie. You may also want to use Catégorie: instead of Category: on adding the tags. Platonides 10:42, 27 August 2007 (UTC)
OK, I'll try to copy it and adapt it for the French Wikipedia. Thanks, le Korrigan bla 10:59, 27 August 2007 (UTC)

I'd like to see it adapted for the English wikipedia... anyone try yet? the corresponding pages there are empty. Maybe I'll give it a go. ++Lar: t/c 15:38, 11 September 2007 (UTC)

For information, I adapted it for fr.wikipedia.org here and it works quite well on IE/Fx (note : the blacklisting function has been removed). It should only need a translation to work on en.wikipedia.org. I can help if necessary. Magnus, if you're interested, I corrected a few bugs of encoding which would cause hotcats not work well with IE --fr:User:Zelda 12:28, 22 November 2007 (UTC)
I have adapted the fr.wikipedia version to de.wikipedia at de:MediaWiki:Gadget-HotCat.js using the Gadgets MediaWiki extension. If the text strings were defined in an extra array adoption to other Wikipedias would be even easier. Arnomane 15:33, 3 December 2007 (UTC)

stopped working for me

I have a lot of scripts but HotCat was working great for me till recently. I see Magnus added "if ( hotcat_no_autocommit ) prevent_autocommit = 1 ;" on 8 september. I'm getting an error relating to this, do I need to purge or change something? (er, I think Bryan maybe just fixed it? ) ++Lar: t/c 14:56, 11 September 2007 (UTC)

Bryan's change sorted it. He added something to make sure the variable was defined before it was used. Thanks Bryan! ++Lar: t/c 15:03, 11 September 2007 (UTC)

Bug if the gallery is named with an underscore

I recently tried to change (±) a category, but it failed because the category was included as [[Category:Foo_bar]] and HotCat was looking for [[Category:Foo bar]]. --bdesham  22:00, 21 September 2007 (UTC)

Another bug

HotCat seems to have clobbered some data in this revision. --bdesham  22:03, 21 September 2007 (UTC)

"stuttering"

What causes HotCat to do the same thing more than once? Looking through some histories I see 3 to 5 identical edit summaries for some of the categories I added (or that were added by people I know)... anyone else see this? ++Lar: t/c 03:46, 22 September 2007 (UTC)


Hi, could HotCat removes {{uncat}} (Sometime it must delete the comment <!-- Remove this line once you have added categories -->) when it adds a categories.--OsamaK 11:39, 17 November 2007 (UTC)

Could the same be done for {{Uncategorized}}? Thanks --Rooivalk 09:18, 24 February 2008 (UTC)

Thanks

This seems like just what I was looking for. I haven't experienced any bugs thus-far. Superm401 22:16, 2 December 2007 (UTC)

Sortkey

Is there a way to show and edit the sortkey? Liesel 16:36, 3 December 2007 (UTC)

hotcat_no_autocommit

Regarding hotcat_no_autocommit, which controls whether HotCat autosaves, can:

if ( typeof hotcat_no_autocommit != "undefined" ) prevent_autocommit = 1 ;

please be changed to:

if ( hotcat_no_autocommit == 1 ) prevent_autocommit = 1 ;

I don't think an undefined ("undefinition?") can be overridden, but with the second line I can still say:

hotcat_no_autocommit = 0;

in my monobook. Superm401 18:19, 10 December 2007 (UTC)

Bug: JSconfig undefined

Does not work at all for me, because the script first start by using a reference to "JSconfig" to call the method "registerKey()", however "JSconfig" is still undefined on Commons ! The whole script stops running immediately because of this. Where is the variable "JSconfig" supposed to be defined and loaded ? Which script should come first? Verdy p 16:00, 2 January 2008 (UTC)

To fix this, just comment lines
 //JSconfig.registerKey('HotCatDelay', 100, 'HotCat autocompletion delay (ms):', 5);
and
 //text.onkeyup = function () { window.setTimeout("hotcat_text_changed();", JSconfig.keys['HotCatDelay'] ); } ;

of your MediaWiki:Gadget-HotCat.js

11:25, 25 July 2008 (UTC)

Duplicate categories

I realized HotCat will allow you to add duplicate categories. The solution is to check whether a category is in the source before adding it again. A similar check is already used in the remove category code, though it's not perfect. If you have Category:SVG maps of Europe and Category:SVG maps (that order), and try to remove Category:SVG maps, HotCat won't be able to handle it (it will give the "not unique" error because it doesn't consider the end of the category name in its check.

This inspired me to write code to check, more accurately, if a category is actually present. The following function, based on code in HotCat, does that. There are a couple of remaining known problems; HotCat also currently has these issues, as far as I can tell. The code doesn't yet handle case correctly. The only part of the comparison that should actually be case-insensitive is the first letter of the category name. Category:Capital and Category:CAPITAL are different, which this code doesn't reflect (there aren't likely to be real categories for which this is a problem). Also, it doesn't consider underscores. [[Category:SVG_maps]] is just [[Category:SVG maps]], but the code doesn't handle that. Nevertheless, the code should be a useful step.

I'm planning to put this in soon, and use it to avoid duplicate categories. Let me know if there are any problems. It can be reworked/called for other purposes a bit later.

function hotcat_check_category(source, cat)
{
    var source_lowercase = source.toLowerCase();
    var cat_lowercase = cat.toLowerCase();
    var cat_regex = new RegExp("\\[\\[" + cat_lowercase + "(\\||\\]\\])");
    if(source_lowercase.match(cat_regex))
        return 1; //category found
}

Superm401 - Talk 02:32, 23 February 2008 (UTC)

Well, at least the blank vs. underscore problem could be solved using
var cat_lowercase = cat.toLowerCase().replace (/[ _]/g, "[ _]");
which should turn "Category:SVG maps" and "Category:SVG_maps" into "Category:SVG[ _]maps", which in a regexp matches either.
Furthermore, the test should allow for leading and trailing whitespace around the category name. The parser allows that and also turns "[[ category:SVG maps ]]" into a category link to Category:SVG maps. It's a pathological case, but still...
var cat_regex = new RegExp("\\[\\[\\s*" + cat_lowercase + "\\s*(\\||\\]\\])");
Finally, since we know we need a case-sensitive search, why toLowerCase() everything? I'd do something like
function hotcat_find_category (wikitext, category)
{
  var cat_name  = category.substring (10); // "Category:" is 10 characters
  var initial   = cat_name.substr (0, 1);
  var cat_regex = new RegExp ("\\[\\[\\s*[Cc]ategory:"
                              + "[" + initial.toUpperCase() + initial.toLowerCase() + "]"
                              + cat_name.substring (1).replace (/[ _]/g, "[ _]")
                              + "\\s*(\\||\\]\\])"
                             );
  return wikitext.match (cat_regex);
}
Could even add a second parameter to "new RegExp (..., 'g')" if you wanted all matches, as it is entirely possible (though maybe unlikely) that a page already contains one category multiple times. The code returns the matches instead of a flag, since you'll need the matches to do the replacement properly (assuming code like this is also to be used in the "remove" case to handle the problem you mentioned). With the matches, it also becomes possible to automatically clean-up categories included several times. (Warning: the above code is untested.) Lupo 23:00, 23 February 2008 (UTC)
Oh, and what about regexp special characters in the category name? We'd need to escape all of them... something like
var cat_name = category.substring (10).replace(/([\\\[\]\*\.\{\}])/g, "\\$1");
(add further special characters as needed; I'm too lazy to look them all up now.) Lupo 23:08, 23 February 2008 (UTC)
You solved most of the remaining issues, and some I didn't even think of. However, "Category:" is 9 characters. ;) The regex special characters are "[ \ ^ $ . | ? * + ( ) ] { }". But the characters "[ ] | { }" are blocked by MediaWiki, so we don't have to worry about them here. That leaves, "\ ^ $ . ? * + ( )".
var cat_name = category.substring (9).replace(/([\\\^\$\.\?\*\+\(\)])/g, "\\$1");
Also, since we now want the whole match, I think it should be like.

function hotcat_find_category(wikitext, category)
{
    var cat_name  = category.substring (9).replace(/([\\\^\$\.\?\*\+\(\)])/g, "\\$1");; // "Category:" is 9 characters
    var initial   = cat_name.substr (0, 1);
    var cat_regex = new RegExp ("\\[\\[\\s*[Cc]ategory:"
                              + "[" + initial.toUpperCase() + initial.toLowerCase() + "]"
                              + cat_name.substring (1).replace (/[ _]/g, "[ _]")
                              + "\\s*(\\|.*?)?\\]\\]", "g"
                             );
    return wikitext.match (cat_regex);
}
I also added the global flag. In the client code, we can just take the first element and ignore the other matches for now. Instead of using alternation, this regex makes the pipe part optional, and if there is a pipe part, it has repetition with laziness to ensure it stops at the end brackets. This code has been tested with several weird cats in my sandbox, though I could easily have missed some cases.
-- Superm401 - Talk 09:42, 24 February 2008 (UTC)
Re "10 characters"... look at the time stamp. For me, it was even later... (I'm at UTC+something). There's still a problem: what if the initial character is a regexp special character? As it stands now, initial always is a backslash in this case... Lupo 10:33, 24 February 2008 (UTC)

function hotcat_find_category(wikitext, category)
{
    var cat_name  = category.substring (9); // "Category:" is 9 characters 
    var initial   = cat_name.substr (0, 1);
    // Escape regexp special characters:
    cat_name = cat_name.substring (1).replace(/([\\\^\$\.\?\*\+\(\)])/g, "\\$1");
    initial  = initial.replace(/([\\\^\$\.\?\*\+\(\)])/g, "\\$1");
    var cat_regex = new RegExp ("\\[\\[\\s*[Cc]ategory\\s*:\\s*"
                              + "[" + initial.toUpperCase() + initial.toLowerCase() + "]"
                              + cat_name.replace (/[ _]/g, "[ _]")
                              + "\\s*(\\|.*?)?\\]\\]", "g"
                             );
    return wikitext.match (cat_regex);
}
Also note the minor modification to handle "[[Category : SVG maps ]]" (whitespace around the ":" is also allowed by the parser...) Lupo 11:01, 24 February 2008 (UTC)
I came up with an alternate solution before I saw that one, and just added your space fix. It relies on the fact that upper-casing the special characters has no effect.:

function hotcat_find_category(wikitext, category)
{
    var cat_name  = category.substring (9).replace(/([\\\^\$\.\?\*\+\(\)])/g, "\\$1");; // "Category:" is 9 characters
    var initial   = cat_name.substr (0, 1);
    var cat_regex = new RegExp ("\\[\\[\\s*[Cc]ategory\\s*:\\s*"
                              + (initial == "\\" ? initial : "[" + initial.toUpperCase() + initial.toLowerCase() + "]")
                              + cat_name.substring (1).replace (/[ _]/g, "[ _]")
                              + "\\s*(\\|.*?)?\\]\\]", "g"
                             );
    return wikitext.match (cat_regex);
}
--Superm401 - Talk 12:15, 24 February 2008 (UTC)

←Yup. I like that one even better. But HotCat passes only the category name, we can even do away with this stupid "substring (9)". Another problem is that match just returns the matched substrings, but not their positions. Hence it'll need to be more like this:

function hotcat_find_category(wikitext, category)
{
    var cat_name  = category.replace(/([\\\^\$\.\?\*\+\(\)])/g, "\\$1");
    var initial   = cat_name.substr (0, 1);
    var cat_regex = new RegExp ("\\[\\[\\s*[Cc]ategory\\s*:\\s*"
                              + (initial == "\\" ? initial : "[" + initial.toUpperCase() + initial.toLowerCase() + "]")
                              + cat_name.substring (1).replace (/[ _]/g, "[ _]")
                              + "\\s*(\\|.*?)?\\]\\]", "g"
                             );
    var result = new Array ();
    var curr_match  = null;
    while ((curr_match = cat_regex.exec (wikitext)) != null) {
      result [result.length] = {match : curr_match};
    }
    return result; // An array containing all matches, with positions, in result[i].match
}
function hotcat_check_action () {
 ...
 var cat_rm  = hotcatGetParamValue ('hotcat_removecat');
 var cat_add = hotcatGetParamValue ('hotcat_newcat');
 var cat_key = null;
 if (cat_rm != null && cat_rm.length > 0) {
   var matches = hotcat_find_category (t, cat_rm);
   if (!matches || matches.length == 0) {
     alert ('Category ' + cat_rm + 'not found; maybe it is in a template?');
   } else if (matches.length > 1) {
     alert ('Category ' + cat_rm + 'found several times; don't know which occurrence to remove.');
   } else {
     if (cat_add != null && cat_add.length > 0 && matches[0].match.length > 1)
       cat_key = matches[0].match[1]; // Remember the category key, if any.
     t = t.substring (0, matches[0].match.index) +
         t.substring (matches[0].match.index + matches[0].match[0].length);
     ret = 1;
   }
 } else {
   ret = 1;
 }
 if (ret == 1 && cat_add != null && cat_add.length > 0) {
   var matches = hotcat_find_category (t, cat_add);
   if (matches && matches.length > 0) {
     alert ('Category ' + cat_add + 'already exists; not added.');
     ret = 0;
   } else {
     t = t + '\n\[\[Category:' + cat_add + (cat_key != null ? cat_key : "") + '\]\]';
     t = t.replace(/\{\{[Uu]ncat\}\}/g, ""); // Remove "uncat" templates
   }
 }
 if (ret) {
   ...
 }
 ...
}

This should preserve a category key if the replaced category had one (such as when replacing "[[Category:Photographers|Perscheid, Nicola]]" by "[[Category:Photographers from Germany|Perscheid, Nicola]]". (Again, code is untested, but I guess you get the idea.) Lupo 15:23, 24 February 2008 (UTC)

Besides, there's another error: HotCat uses encodeURIComponent to encode the category name, but then in hotcatGetParamValue it uses decodeURI to decode it. That should be decodeURIComponent!! (It's a common mistake, also in Lupin's popup script. See en:User talk:Lupin#Bug in popups.js/autoedit.js...) Lupo 15:38, 24 February 2008 (UTC)
That looks good. Returning all the information that way saves the need to do indexOf's. However, I don't understand what you're doing with ret? Isn't it supposed to mean whether the wikitext has been changed (1 - has been changed, 0 - hasn't)? Thus, why is it being set to 1 regardless of whether a category is removed, and why should it already be 1 before adding a cat? Regardless, I think ret needs a more memorable name. Also, we need to put back the summary push's (one each for add, remove, and remove uncat).
Do you think we should make a devel page? It's not really that efficient to code on a talk page. Superm401 - Talk 03:09, 26 February 2008 (UTC)

I've now rewritten hotcat_check_action as outlined here (and fixed a number of other minor problems at the same time). Lupo 07:55, 28 February 2008 (UTC)

It looks good. There are a couple of minor issues. The whitespace code is a little complex. It seems that there are glitches in removing non-existent categories. The URL is sent without the category parameter, like, http://commons.wikimedia.org/w/index.php?title=User:Superm401/Sandbox&action=edit&hotcat_removecat=. But, if the (+/-) then Cancel is clicked it worked. I'm not sure if this issue existed before. And it would be useful to rename ret to wktxt_changed. Superm401 - Talk 03:48, 29 February 2008 (UTC)
Actually, I spoke too soon. It turned out it wasn't removing any categories (I had only tried a swap). The reason is that I was running popups, which removes the title attribute from all links. hotcat_remove used to be passed the category name directly, so that didn't matter. But since this edit, it is now relying on title to determine the category name. The easiest solution would be using "name" instead of title for the remove_link attribute. I've tested this, and it appears to work fine. Superm401 - Talk 04:42, 29 February 2008 (UTC)
Lupin's popups does what? That script is starting to seriously piss me off. This is the second time I'll have to code some workaround for strange behaviour from that popup script. I wouldn't want to use the name attribute. IE (in violation of the spec) also looks at the name attribute when getElementById is used, and no element with the desired ID exists. If it finds one with a matching name, it returns that one. So, using name might break something else. But there are other solutions. I'll take care of it.
Yes, the whitespace code is a little complex, but do you have a simpler way that correctly removes excessive whitespace, but leaves the line breaks intact? Just stripping all leading and trailing whitespace, as the old version did, sometimes moves two categories on the same line. I can live with the complexity of that code; it's not a performance bottleneck. Lupo 07:33, 29 February 2008 (UTC)
Fixed it by not storing the category name at all and reading it from the DOM tree directly in hotcat_remove. Lupo 07:52, 29 February 2008 (UTC)
I found this issue as well when i was porting it to en.wikipedia. I solved it by setting a different dummy "href" value. I replaced the value of #catlinks with "javascript:void();" which popups does not interpret and the problem was gone. There might be some other things in my port that might be useful btw. at the very least to know about their existence.

TheDJ 14:19, 29 February 2008 (UTC)

Thanks. Your fix for the popups issue is clean, and the script is working well. I wasn't saying we need to scrap the whitespace code, just that it may be an area for improvement in the future. Superm401 - Talk 17:54, 4 March 2008 (UTC)
Yeah, adding a category line when there were no categories was on my to-do list, too... if your code is tested at least on FF and IE 6, feel free to incorporate it yourself. Otherwise, I'll add that functionality somewhen in the next days. "uncategorized" can be handled easily enough in th regexp. Lupo 16:56, 29 February 2008 (UTC)
I'm not an admin, so I cannot :D. I added a fix to handle the case where you have hidden categories, but no visible categories btw. TheDJ 20:05, 29 February 2008 (UTC)
Doh! I keep forgetting that the MediaWiki namespace is admin-only... I've incorporated your changes to enable HotCat also when there are no categories yet. It's a bit strange to see an empty "category" line even on non-existing pages, but I guess it may make sense, so I have deliberately not caught that case and left it enabled. I've changed the "remove {{Uncategorized}}" code to handle all redirects to that template we currently have. Over at en-Wp, that regexp will be a monster, see the list of redirects at en-WP :-)) Lupo 20:09, 1 March 2008 (UTC)
I've also disabled HotCat on diff pages. Lupo 21:07, 1 March 2008 (UTC)
About the uncategorized regexp on en.wikipedia. Luckily, there are bots that fix all those redirects to the "proper" version. These bots also add the "date=|" param which is used there. As such it is an issue we luckily do not really need to concern ourselves with :D TheDJ 19:38, 4 March 2008 (UTC)

'Edit' Button?

Is it possible to have a button, along with OK and cancel that would, for the current page only, prevent the auto commit. An on demand equivalent of "hotcat_no_autocommit=1" --Rooivalk 09:37, 24 February 2008 (UTC)

I don't think a new button would be a good idea; this form should remain as small as possible. But you can control-click the "remove" link "(-)" or the OK button, or control-doubleclick in the suggestion list. I just added some code such that CTRL-clicks do not autocommit in any case. Normal clicks will autocommit, unless hotcat_no_autocommit is set. Lupo 13:24, 28 February 2008 (UTC)
Thank you --Rooivalk 19:02, 28 February 2008 (UTC)

HotCat.js for en.wikipedia.org

I have started a port of HotCat.js to the english wikipedia. You can see and test it here: en:User:TheDJ/Gadget-HotCat.js. TheDJ 13:06, 29 February 2008 (UTC)

ignore implicit categories

Is it possible for the gadget to ignore categories that show up due to the usage of a template? (for example, the licenses categories) Waldir talk 17:03, 6 March 2008 (UTC)

Yes, there is a "blacklist" for instance all PD categories are automatically ignored. What category do you think needs to be ignored ? TheDJ 08:34, 7 March 2008 (UTC)
I assume you came from the village pump, where I expressed the blacklist proposal. The idea is to ignore all license categories. The problem is, I found that the blacklist approach might not be the best one, because, one: people can still add the license category directly in the wikitext, as [[Category:GFDL]] instead of {{GFDL}}. In the former cases, the categories shouldn't be ignored; and two: there are many categories, besides the license ones, that are added to articles through templates (for example, several made-by-user-foo templates, and these too should be ignored. The blacklist could never be a complete solution since new templates that automatically add categories to pages could be created anytime.
The only real solution to this issue is for the js to detect whether the category is included directly in the wikitext, or added implicitly through a category. I suppose this might involve sending an edit request to the database (but I'm just guessing, here), and thus this solution wouldn't be feasible (not without consuming unnecessary server resources. Instead, maybe a bug can be filled that requests these categories be marked in the html, so instead of mw-normal-catlinks and mw-hidden-catlinks, we'd have something like mw-implicit-catlinks and mw-explicit-catlinks, and inside these divs, mw-visible-catlinks and mw-hidden-catlinks, where applicable... what do you think? --Waldir talk 18:35, 8 March 2008 (UTC)
I think the devs would think that such a change would be a bit over the top. Too be honest I see no good solution to this problem atm. I think only a real metadata backend for articles/files would help to really solve this. Lupo ? what do you think ? TheDJ 16:07, 11 March 2008 (UTC)
I'm not quite sure what exactly the problem is. Suppressing hotcat for categories that stem from transcluded templates? I don't see a way to do this with the current setup without making at least one additional call to the server to get the raw Wikitext of the page. Then we could compare the listed categories against those actually present in the Wikitext. Note, however, that one additional call per page to the servers is not going to bog them down: loading this very page here is already a whopping 42 requests to the servers (for images, CSS files, and scripts), and HotCat's autosuggestions generate more or less one call per keypress. So one single request per page isn't going to hurt, I suppose. (Don't know if it's cached, though... you could use "&action=raw" to get it, e.g. http://commons.wikimedia.org/w/index.php?title=MediaWiki_talk:Gadget-HotCat.js&action=raw for this page. I don't know of any API interface to get the wikitext... didn't see any at mw:API.) Any such request would need to occur at the very start of HotCat, if would need to be asynchronous, and HotCat should continue to function as it does now even if that request fails.
If you additionally wanted to suppress the ability to add certain categories via HotCat, that'd be more complicated because it is not clear (at least to me) which categories should not be allowed. Lupo 20:44, 12 March 2008 (UTC)
Actually, I would really like to see some kind of blacklist for both. Of course ideally the blacklist for removing a cat is anything that's wrapped up in a template. (Or for a real challenge, if it can't remove the category, get it add a empty category= parameter for the templates that allow that. yeah right :) As for what cats to blacklist from adding, all I can think of is licensing ones and redirects, but especially redirects. - Rocket000 10:11, 18 March 2008 (UTC)
Hmm,. just noticed there is one in place, but it still leaves the (-). - Rocket000 10:15, 18 March 2008 (UTC)

Lupo, thanks for the insights. My concern is indeed, as you put it, "suppressing hotcat for categories that stem from transcluded templates". If, as you say, "one [more] single request per page isn't going to hurt", then I'd strongly support this functionality to be implemented. I'd do it myself and paste the code here for an admin to add it, if I knew how to do it. And finally, no, it is not part of my proposal to "suppress the ability to add certain categories via HotCat", since that is not necessary in my opinion. It could be an extra feature and I believe some would support it, but to me the removal of the minus sign from non-explicit categories is more sort of a bug fix than a new feature implementation. Of course, not a true bug, since no error occurs, but still a usability problem, since it makes one think the category can be removed via HotCat, which is false. Waldir talk 16:41, 20 March 2008 (UTC)

Hmm, actually, I think I was mistaken. The 42 requests is only for a full reload, bypassing the browser's cache. But the style sheets and scripts are cached in the browser, so a normal reload of the page takes only one request (plus one for each image). So, unconditionally making one more call in all cases might increase the server load noticeably. Maybe we can get the devs to mark those categories that are indeed in the Wikitext up front (using <a href="..." title="..." class="wpDirectCategory"> or some such). Then we could do this without an extra request... Lupo 13:14, 27 March 2008 (UTC)

Titles with : in them.

Lupo or any other admin, I think this fix should be applied on commons as well. I was investigating why sometimes you have one term multiple times in the suggestion list, and the split( ":",2) was the cause of that. Though 2 will limit the split, it will not ignore the boundaries of the last split if a boundary is there. I chose to simply replace Category: because the results of the api.php should be normalized and thus consistent enough to do such a simple "replace". I also have some code that tries to find other "Category:" inclusions in pages and append our new cats to that. This was quite important for en.wikipedia as you can imagine. I might be adding detection for interwiki links there as well in the future. TheDJ 20:13, 12 March 2008 (UTC)

I've added the first fix (and corrected the blacklist code on the way), but without hardcoding "Category:". Other Wikis may have localized namespace names, see e.g. "Kategorie:" at de-WP. The second might also be worth including, but it's not that urgent, and right now I don't have too much time to improve HotCat, just bugfixing. Lupo 21:03, 12 March 2008 (UTC)

Avoid self-reference

Ideally, HotCat shouldn't allow you to add a category to itself. This can be easily implemented with:

if(s != wgTitle)
  titles.push ( s ) ;

The string compares do decrease performance, but not enough to matter in my opinion. The code has been tested just to make sure it works. Superm401 - Talk 03:24, 14 March 2008 (UTC)

You mean, you're on category page X and try to add category "X" itself? Your code will only stop HotCat from suggesting X, but what if the user enters X manually? Also, if you're on page (not category!) X (or on "Template:X", or on "Creator:X"), it wouldn't suggest category X anymore. I think the check should be done in function hotcat_ok: if (v == "" || wgNamespaceNumber == 14 && v == wgTitle) {hotcat_cancel (); return; }. Lupo 07:06, 14 March 2008 (UTC)
Right, that is what I meant. I did miss the page/cat distinction. However, I still think it shouldn't suggest Cat:X if you're already on Cat:X. There could be an additional check at submission time. Superm401 - Talk 03:15, 15 March 2008 (UTC)

Change in catlinks HTML

Last week the devs fixed the inconsistencies with the HTML in the different skins of Mediawiki. As a result these changes are needed to support HotCat on pages without categories once again. TheDJ 13:44, 20 March 2008 (UTC)

Doing away with this extra div is ceratinly an option. However, HotCat appears to work here at the Commons without this change, also on pages without categories. Lupo 15:04, 20 March 2008 (UTC)
✓ Done The problem appeared only on pages that had only hidden categories. On pages that had no categories at all, it worked. See bugzilla:13234. Fixed now. Lupo 15:28, 20 March 2008 (UTC)

Modern skin

This change makes HotCat work even if you are not using monobook. TheDJ 14:26, 20 March 2008 (UTC)

Done. What about the other skins? Lupo 15:05, 20 March 2008 (UTC)
I haven't tested them yet, but I think that all of them should now work. As far as I know all skins use either the monobook HTML structure or the modern HTML structure. I will probably test later this week to make sure. TheDJ 16:30, 20 March 2008 (UTC)

Images with only hidden categories

Category box and add category (+) link are not appeared for images included into hidden only categories. However I don't know what should be fixed: MediaWiki or Hot Cat script. --EugeneZelenko 14:59, 20 March 2008 (UTC)

Got me an example image so I can go look? Maybe that's related to DJ's proposed fix two sections above. Lupo 15:06, 20 March 2008 (UTC)
Ok, it is the same. I'm not happy with that. I have the preference for seeing hidden categories enabled, yet I'm not shown the categories if there are only hidden categories. Not good. Oh well... Lupo 15:26, 20 March 2008 (UTC)
Fixed. Lupo 15:26, 20 March 2008 (UTC)
Great! Thank you for help! --EugeneZelenko 15:16, 21 March 2008 (UTC)

Exclude some namespaces

I think will be good idea to disable HotCat on talks, User, Template/Creator (due includeonly/noinclude), MediaWiki namespaces. --EugeneZelenko 17:04, 23 March 2008 (UTC)

Agree on Template/Creator/MediaWiki, but why disable it on User and on talk pages? Lupo 11:22, 24 March 2008 (UTC)
How often User and talks page should be categorized? --EugeneZelenko 14:46, 24 March 2008 (UTC)

Multiple changes at once

Can this be used to do multiple edits (example: +1 cat & change other) in one edit? Seems not. Can this be changed to be able to do so? --Usp 12:37, 27 March 2008 (UTC)

No this is not possible atm, It is something that I have been thinking about implementing however. Might take a while, since i'm working on some other scripts atm. TheDJ 12:39, 27 March 2008 (UTC)

Removing uncategorized templates

Removing uncategorized templates is not working. Changing uncategorized templates is working. --EugeneZelenko 15:38, 20 May 2008 (UTC)

Just for the record: I don't remember what this was about, but I think it was resolved here. Lupo 05:51, 5 September 2008 (UTC)

Newbie needs help

Okay, prentend I am completely ignorant about most things technical and am from a Wikipedia where most users are (not quite the case, but we're pretending). Who can I approach (or where can I go) to get help with, first of all, the ability to have gadgets on a Wikipedia (mw:Extension:Gadgets is Greek to me). Then, how do I install this gadget? Any help or advice will be greatly appreciated. Anrie 08:59, 31 May 2008 (UTC)

Okay, I've managed to copy the German version and get it working, but theirs does not auto save after adding the category. What do I need to add to make that happen? Anrie 09:22, 31 May 2008 (UTC)
Got it. Anrie 18:13, 31 May 2008 (UTC)

Hidden cats

Is it possible to make this work for hidden cats as well? Currently I don't get the + or - signs by hidden cats, and if I try to add a hidden cat, it does add it but says that it's already added. -mattbuck (Talk) 10:51, 11 August 2008 (UTC)

Well, hotcat actually makes an effort not to handle hidden cats. Hidden cats are supposed to be maintenance categories most of them are license cats which are added using templates. Hotcat couldn't handle those. --Dschwen (talk) 12:10, 11 August 2008 (UTC)

Shouldn't let you change cat to itself

It shouldn't allow you to "change" Category:Foo to Category:Foo. This edit will go through, moving the category to the end of the page. A way to prevent this is put:

if (cat_rm != null && cat_rm.length > 0 && cat_add != null && cat_add.length > 0 && cat_rm == cat_add)
{
  ret = 0;
  return ret;
}

right before:

if (cat_rm != null && cat_rm.length > 0) {

Superm401 - Talk 06:14, 24 August 2008 (UTC)

✓ Done, but differently. Your proposed change would have opened the edit page and then done nothing. I prefer to catch that before we even open the edit page, i.e., in hotcat_close_form. Lupo 22:35, 4 September 2008 (UTC)
Thanks. I agree. Your implementation was much better from a UI point of view. Superm401 - Talk 03:00, 5 September 2008 (UTC)

Cf Commons talk:Category redirects suck

Hi,

Is-it possible to modify the script in order to not detecte the {{Category redirect}} ? It makes confusing for non-native English speakers with so many similar entries.

Cheers--Bapti 16:19, 24 August 2008 (UTC)

I don't understand the question. The script doesn't check for that tag. Lupo 15:25, 26 August 2008 (UTC)
What he means is "is it possible for the script to check for category redirects, and, if so, change the category to whatever it's being redirected to?" -mattbuck (Talk) 15:58, 26 August 2008 (UTC)

write-API

The write API has been enabled on all wikimedia wikis inccluding commons. This might be worth looking into, to streamline this gadget. --Dschwen (talk) 16:08, 26 August 2008 (UTC)

Yes, I've seen the announcement, too. In particular, this would allow us to finally rewrite this such that several categories can be added/removed/changed in one go. Lupo 06:50, 27 August 2008 (UTC)

The handling of hard and soft category redirects

One of the arguments used against category redirects is that they pop up as suggested category names for users, and since many users do not check the contents of a category, images end up in redirected categories. Would it be technically feasible to filter the list of suggested category names such that categories, which are hard or soft redirected are omitted from the list? -- Slaunger (talk) 19:29, 2 September 2008 (UTC)

yeh, see also #category redirect...--Bapti 19:31, 2 September 2008 (UTC)
Ah, that was meant above! Now I get it. I'll have to think about this... not sure it can be done without excessive overhead. Lupo 20:26, 2 September 2008 (UTC)
Ok, hard redirects (category pages that use #REDIRECT to redir to another category) are easy enough to omit, the API offers an option for this. Soft redirects are a bit more difficult. I don't see how it could be done without an extra request per suggestion, which is prohibitive. The API doesn't offer enough functionality to efficiently exclude soft redirects (i.e., category pages containing the {{Category redirect}} template, or being categorized in Category:Category redirects). Lupo 20:52, 2 September 2008 (UTC)
That's another reason why we should make the move to hard redirects. Once we get a reliable system in place with a redirect bot, there will be little reason they need to be soft. Humans won't need to see them. Even if a template is still needed (I don't know why), they can still be used after the #REDIRECT. I brought this up awhile ago, but for some reason all the hard redirects were converted to soft redirects instead. My idea was {{Category REDIRECT}} (see deleted history). It didn't work with the script after adding the template's name to it. If we do use hard redirects, or at least something the software recognizes as a redirect (right now they are just empty categories), that would solve part of the problem. If HotCat, the search auto-complete, and all the upload bots recognized those and respected them, that would solve 95% of our problems. (The other 5% is human error and we can't solve that). Rocket000(talk) 00:54, 3 September 2008 (UTC)
OK, so the hard redirects are easy to filter out. Then I suggest that we start out now by eliminating those from the lookup lists. I cannot see that can do any harm only benefit. We then still have a problem with the soft redirects, but as Rocket000 mentions it may be sensisble to maker a transistion from soft to hard redirects. The coolest thing would be if the hard redirected category names were available for the user, but was substituted to the correct category in the process of adding/editing it, perhaps notifying the user of the redirect. Then the user could learn something as well;-) The latter feature is in the nice to have category though. -- Slaunger (talk) 06:23, 3 September 2008 (UTC)
Now that's a different approach altogether, and it could be done since it would need only one additional call at the time the edit is made (and not one additional call per suggestion when the suggestion list is put together). But I wouldn't alert the user: they just selected a category from the suggestions, which were presented to them as valid. If we present redirects, allow them to be chosen, and substitute them at editing time by the category redirected to, we should do so silently.
So, what do you want? Filter out hard redirects from the suggestion list? (Takes me about five minutes to implement.) Or check at editing time and replace a redirect by its target then? (Would take a few days to implement and test, and might lead to efficiency problems if we ever rewrite this to allow multiple categories added, removed, or changed in one edit; see the comment above about the write API.) Lupo 07:22, 3 September 2008 (UTC)
I am pragmatic;-) By all means, do the easy, low risk, low maintenance, five minutes job and filter out the hard redirects from the list of suggestions. The value of that small piece of work will save a lot of later category changes on image pages. An if this has some side-effects, which we have not thought of, it is easy to remove again, i reckon. The latter suggestion is a nice to have, which can be added later, perhaps while doing some of the other cool things you mention. -- Slaunger (talk) 07:31, 3 September 2008 (UTC)
Ok. Can you point me to a hard-redirected category? I need one to quickly test the change. (See if it is listed now, make the change, then see if itn't listed anymore.) Lupo 07:39, 3 September 2008 (UTC)
Hmm.. It was actually hard for me to find one (don't know how to search for them). However, I have changed a previous soft redirected (currently empty) category, Category:Plants of Greenland into a hard redirect for testing purposes. Drop a note when you are done testing and I will re-revert to a soft redirect. -- Slaunger (talk) 08:20, 3 September 2008 (UTC)
Ok. I've corrected your example to really make it a hard redirect. :-) Ain't that easy, huh? Now off to coding... Lupo 08:27, 3 September 2008 (UTC)
✓ Done. Hard redirects aren't listed anymore in the suggestion list. Don't forget to force a reload: shift-reload in FF, ctrl-reload in IE. Lupo 08:31, 3 September 2008 (UTC)
That was quick. Cool! Cheers, -- Slaunger (talk) 08:34, 3 September 2008 (UTC)
Thanks Lupo! The only thing is most of the hard ones were converted to soft about a month ago. Here's a list that has (or had) all the hard ones listed. Rocket000(talk) 09:23, 3 September 2008 (UTC)

(←) I'll see if I can implement a meaningful soft redirect replacement at edit time (or at the time the "ok"-button is clicked). Is the list of redirects shown at Template:Category redirect complete? Because to check for a soft redirect, I'll have to get the raw wikitext of the category and search for things like "{{seecat|Flora of Greece}}". That search will have to account for all existing redirects. There's no other way. Lupo 09:41, 3 September 2008 (UTC)

Almost. Here's all of them. Rocket000(talk) 09:56, 3 September 2008 (UTC)
Oh yeah, I forgot about disambiguation categories. There's not that many so it's probably not worth it. Rocket000(talk) 10:32, 3 September 2008 (UTC)
If Lupo can handle the disambiguation categories as well, I recommend doing it. I just corrected an instance where it follows from the history that the disambiguation category was added with hotcat, so I guess this is usecase, which we might as well deal with as well, if possible. -- Slaunger (talk) 10:53, 3 September 2008 (UTC)
I'll think about how to best handle this. An automatic resolution is impossible, as HotCat cannot possibly know which of the targets would be the right one. Lupo 12:12, 3 September 2008 (UTC)
Oh yes, yes are right. It is non-trivial to select the right disambiguation category when clicking the OK button. Could the user be prompted to select the right one from a drop down box or something? It would be better if the disambiguation categories did not pop up on the suggested list, but as you have mentioned before this is more involved and complicated to do. -- Slaunger (talk) 12:19, 3 September 2008 (UTC)
I was just thinking of having HotCat not suggest them. The human disambiguating will happen naturally since they won't see the disambig one they'll have to pick a different one. Rocket000(talk) 12:27, 3 September 2008 (UTC)
Yes, this would be the preferred way to do it, if technically feasible. -- Slaunger (talk) 12:32, 3 September 2008 (UTC)
With the current API, I can't do that. For each single suggestion to be added to the list, the script would have to make another API call to find out whether the page was in Category:Disambiguation. That's prohibitively expensive in terms of speed. (Same reason why it can't omit soft redirects up front). It can do something about these cases when "ok" is clicked: one additional call to the server to check whether the selected category is a soft redirect (in that case, resolve the redirect if the target exists) or a dab category (in that case, one could pop up the list again, with all the possible target categories, but doing that right will complicate the logic of the script considerably because it needs to handle fringe cases).
If we really want to omit the redirects and dabs up front, we'd need an improved allpages query that would return only pages in (or not within) a given (set of) categories. I don't think we'll get that. I'm also not sure removing redirects from the suggestion list is a good thing. See the "Plants vs. Flora" discussion: I would have never even dreamt of looking for "Flora of...". I would have started typing "Plants of", and would've been baffled if I didn't get any results for that. Better to show them in the suggestion list, but make HotCat resolve them. Lupo 12:43, 3 September 2008 (UTC)
We're spoiled, aren't we? There's current discussion about a move away from having English only names... imagine trying to categorize that way when you have no idea what language a category might be in. There's about a 100 different languages used somewhere on Commons (there was 88 main pages last time I counted plus some random translations of templates), but yet we need 3 or 4 variations just for English. With the software the way it is currently, we simply can not rely that much on HotCat's auto-suggest. We just have to do it the old fashion way by searching, checking for blue links, and learning the naming conventions used (that is, if we can agree on some). Rocket000(talk) 13:17, 3 September 2008 (UTC)

(←) I've updated the gadget to resolve soft redirects and to also handle disambiguation categories. This was tested in the monobook skin on IE6, FF2, Opera 9.5, and Safari 3.0.4. I also expect it to work in FF3, of course. Report any problems or further improvements here, and if it wrecks havoc, feel free to undo this change of mine. Lupo 20:28, 3 September 2008 (UTC)

I just tested it with both soft redirects and disambiguation categories on FF3, and it works like a charm! You should pad yourself on the shoulder, take a beer, and go to bed knowing you have done good stuff today! -- Slaunger (talk) 20:42, 3 September 2008 (UTC)
Cool now I can categorize categories in themselves! (I don't know if this can be a problem since it's an infinite loop, but it's interesting). Also, try hitting back after adding a category. Rocket000(talk) 21:54, 3 September 2008 (UTC)
Nice example;-) But could you not categorize a category to itself before too? Yes, hitting back does strange things, but hotcat has behaved that way as long as I have used the tool, or did you notice a particular change? Having said that I guess it should be quite trivial to also check for self-categorizations when hitting OK? -- Slaunger (talk) 22:01, 3 September 2008 (UTC)
Hmmm.. maybe. I don't think I tried it before now that you mentioned it. :) The back used pop up a "already added"/"not found" message and that's it, now it recategorizes after you remove the category. Rocket000(talk) 22:19, 3 September 2008 (UTC)
Self-references always were possible with HotCat, see #Avoid self-reference above. I don't know why I never got 'round to implement the fix mentioned there... anyway, I just added it. On your back-button problem: that part of the code has remained unchanged. I still only get the "added already"/"not found" alert. Lupo 22:28, 3 September 2008 (UTC)
Then must a Firefox 3 thing. I just started using it a couple days ago. Rocket000(talk) 22:43, 3 September 2008 (UTC)
This is a great improvement. Thank you. Superm401 - Talk 18:10, 4 September 2008 (UTC)

(←) I've tweaked the implementation a little. It now lists hard redirects in the suggestion list again, but it also resolves them automatically. I think that's more consistent; now hard and soft redirects are handled alike. Lupo 07:24, 4 September 2008 (UTC)

I agree. It is yet another small and good improvement. -- Slaunger (talk) 08:53, 4 September 2008 (UTC)
Thanks again, Lupo. I really appreciate the fact we have someone that's technically able and willing to do these things for us. Rocket000(talk) 21:38, 4 September 2008 (UTC)

shows up not on all pages

On some pages, the buttons at the bottom for modifying the categories show up. But on many pages it doesn't work. For example: Image:Erofeyev greifswald.jpg.--Imz (talk) 13:19, 11 October 2008 (UTC)

It works for me on the particular example you gave. -- Slaunger (talk) 14:22, 11 October 2008 (UTC)
Ok, then it's good that I reported it. (I used to think that since this problem should be experienced by many people, it would be fixed soon.) This problem started about a month or two ago.
I viewed that page again now, and it has the problem. And that's the usual case: it's not a random problem, it is stable for a certain page (or a certain revision of that page, I am not sure about that).--Imz (talk) 14:46, 11 October 2008 (UTC)
OK. It would probably be useful for Lupo to know which internet browser and version, including OS and version you are experiencing this with as well as some more specific examples of pages where you experience this. -- Slaunger (talk) 23:02, 11 October 2008 (UTC)
So, I'm pressing the random link and listing here the ones where the plus-minuses, pluses don't appear at the bottom:
4 out of 15 random pages.
OS: GNU/Linux, browser: Firefox ("Mozilla/5.0 (X11; U; Linux i686; uk-UA; rv:1.8.1.11) Gecko/20071210 Firefox/2.0.0.11").--Imz (talk) 23:16, 11 October 2008 (UTC)
OK, and just to be sure, when you write in the beginning that the "buttons" for modifying the categories do not show up, I suppose you really mean the links with "minus", "plus/minus" and "plus"? The above examples all work for me on Firefox 3.0.3 on MS Vista Premium. -- Slaunger (talk) 23:27, 11 October 2008 (UTC)
Yes, exactly. If I try them in other browsers, I'll report the results here.--Imz (talk) 23:33, 11 October 2008 (UTC)
The same results on another system in Skipstone based on SeaMonkey 1.1.11 "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.16) Gecko/20080806 SeaMonkey/1.1.11".
More examples: Image:Stamp-Moscow International Film Festival-1975.jpg, Image:Tram-st-romain-3.jpg, Image:Verden.jpg, Image:Tihany1.jpg.--Imz (talk) 23:46, 11 October 2008 (UTC)
The same results in Konqueror "Version 4.1.1 (KDE 4.1.1) Using KDE 4.1.1 (KDE 4.1.1) ALT Linux i586". So it's not engine-specific. Perhaps, it's interaction of some of my prefeernces.--Imz (talk) 00:09, 12 October 2008 (UTC)
Probably. Try removing all of your monobook.js (except this if you're running it through monobook) and disabling your other gadgets. Superm401 - Talk 20:21, 12 October 2008 (UTC)
  • Strange... apparently nobody else has that problem. What other gadgets are you using? Which skin are you using? Also, open the error console in Firefox (in menu "Tools→error Console"). When you load any of these images, does it show an error? If so, what does the error message say? Lupo 20:54, 12 October 2008 (UTC)
The standard skin. A few other which I have selected in the Preferences menu.
From the console:
Ошибка: uncaught exception: [Exception... "Node was not found"  code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)"  location: "http://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-ImageBoxes.js&action=raw&ctype=text/javascript Line: 252"]
--Imz (talk) 12:04, 13 October 2008 (UTC)
Ok, problem solved as far as HotCat is concerned. You're getting an exception in MediaWiki:Gadget-ImageBoxes.js, line 252. Apparently this runs before HotCat, and when it crashes, HotCat is never run. I've never user ImageBoxes and don't even know what it does, and the code appears to be fine as far as I can see, so I can't help you. Even worse, when I enable this gadget, it works for the images you listed above. So it really seems to be some problem on your end. Lupo 13:12, 13 October 2008 (UTC)
Ok, thanks! I'll investigate this further. I simply haven't thought that en error in one "gadget" can stop another one to be processed.
It's not exactly on my end, it's somewhere in the middle, in the code of all the gadgets. Because if it were on my end (i.e., in the browser), it wouldn't reproduce itself in different browsers.--Imz (talk) 14:00, 13 October 2008 (UTC)
Yes, after disabling that gadget, the problem with HotCat on all those images is no longer there.
I've reported the problem there: MediaWiki talk:Gadget-ImageBoxes.js#an exception in it.--Imz (talk) 14:07, 13 October 2008 (UTC)

OpenSearch

I have switched the wikipedia version of HotCat to use the opensearch API. This is useful, because the search algorithms behind the opensearch api are much more advanced than the simple listing from the normal api. At the moment this just brings us non-casesensitive listing, but when i rip that hotcat_last_v comparison out, it should also handle diacritics, unicode, utf-8 and other non-literal compares that still might better reflect what the user is looking for. TheDJ (talk) 21:53, 21 October 2008 (UTC)

Edit Summary entries.

Please can this script be altered to make the entries in the edit summaries live. Just put the full category details in including the [[ and ]]. Railwayfan2005 (talk) 14:22, 25 January 2009 (UTC)

Changing summary.push ("Quick-adding category \"" + cat_add + "\"" + comment); to summary.push ("Quick-added to [[Category:" + cat_add + "]]" + comment); and summary.push ( "Removed category \"" + cat_rm + "\"" ) ; to summary.push ( "Removed from [[Category:" + cat_rm + "]]" ) ; should do it. Railwayfan2005 (talk) 14:57, 25 January 2009 (UTC)
✓ Done. Lupo 21:29, 25 January 2009 (UTC)
Cheers - hope my coding was ok...Railwayfan2005 (talk) 20:02, 26 January 2009 (UTC)
It was, but of course I couldn't resist to do it a little bit differently... :-) Lupo 07:02, 27 January 2009 (UTC)

> Suggestion...

How about adding a new function? Put a '>' by the side of each category. Clicking the '>' brings up a list of sub-categories to the chosen one. The user then selects from the list and HotCat.js moved the file to the selected category. This would be helpful for moving things which have been miscategorised down the tree, eg from a general to a more specific category. Railwayfan2005 (talk) 10:34, 3 February 2009 (UTC)

Sorry, but this functionality would be quite different from what HotCat normally offers, as it would require integration with the "Category Tree" functionality/API. Take a look at the Cat-a-lot gadget for re-categorisation tasks. Lupo 10:42, 3 February 2009 (UTC)
I'll give Cat-a-lot a go then. Cheers Railwayfan2005 (talk) 18:14, 3 February 2009 (UTC)

HotCat is offline

HotCat is not wokring for me anylonger, since 2 p.m. this day. I haven't changed anything in my preferences. Does anyone else have this problem? --High Contrast (talk) 21:17, 27 February 2009 (UTC)

Apparently not, otherwise there'd be more people asking about it. Let's see.
  • What exactly does "not working" mean? Is the category bar still there? Does it not display category suggestions? Does it not save? Is it missing on all pages? What about the upload page—does it work there?
  • What other gadgets are you using?
  • Is "2 p.m." 14:00 UTC?
  • What browser are you using?
  • If you're using Firefox, open the "error console" (in the "Tools" menu). When you load a Commons page, does it show any error messages? If so, what do they say?
Lupo 23:50, 27 February 2009 (UTC)


Hello Lupo! Thank you for your help!

  • I use firefox 3.0.1.
  • not working means it looks like HotCat is deactivated. More over other tools like checkusage don't work, too. The category bar is still there. Category suggestions are not shown because there is no "+" or "+/-" shown, where I could click, consequently no saving. Curiously the HotCat-Gadget is just missing on file-pages (images). For example I could set a category on this page, right now I have the "+" or "+/-" buttons and they work. Upload page is like it should be, no problem there, too. But not working are the "no source", "no permission", "no licence" and "nominate for deletion" button under Toolbox on the left hand side are gone, too.
  • other gadgets: What Is That, What Is That, Cat-a-lot, Hot Cat and Flickr Fixr.
  • Yes, "2 p.m." is 14:00 UTC?
  • Error log of firefix shows:
    if ( wgNamespaceNumber == 6 ) addOnloadHook(whatisthat) ; function whatisthat_open_html_window ( html ) { html = decodeURIComponent ( html ) ; html = unescape ( html ) ; OpenWindow=window.open("", "newwin", "height=550, width=800,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,status=yes") ; OpenWindow.document.write("<TITLE>" + wgTitle + "</TITLE>") ; OpenWindow.document.write("<BODY>") ; OpenWindow.document.write( html ) ; OpenWindow.document.write("</BODY>") ; OpenWindow.document.write("</HTML>") ; OpenWindow.document.close() ; self.name="main" ; return false ; } function whatisthat_call () { s = whatisthat_get_descriptions() ; // This function is included from the toolserver! whatisthat_open_html_window ( "<pre>" + s + "</pre>" ) ; } function whatisthat () { document.write('<script type="text/javascript" src="http://tools.wikimedia.de/~magnus/whatisthat.php?onlynew&raw&js&image='+encodeURIComponent(wgPageName)+'"><\/script>'); addLink('p-tb', 'javascript:whatisthat_call()', "WhatIsThat?", 'whatisthat', 'Add new language descriptions', null, null, '', 'en'); } }


Looks more than that there is a problem with the "what is that gadget". There are no more errors in the box. Do you think there could be a problem in my monobook.js? --High Contrast (talk) 07:48, 28 February 2009 (UTC)

All right, it was an error in MediaWiki:Gadget-WhatIsThat.js. It is fixed now. If you reload your browser's cache, it should work again. (Unfortunately, our setup is so stupid that one erroneous gadget may prevent other gadgets to load. That is something to fix some day...) Lupo 10:10, 28 February 2009 (UTC)
BTW, I meant the error message in the console window, not the contents of the JS file. My Firefox said "Error: addLink is not defined" and "Source File: http://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-WhatIsThat.js&action=raw&ctype=text/javascript Line: 27". That's the interesting info for tracking bugs. :-) Lupo 10:13, 28 February 2009 (UTC)
Again, thanks for your help! Everything's working again as it should. --High Contrast (talk) 13:23, 28 February 2009 (UTC)

Problem with redirected categories

Resolved

I was not aware of the existence of the presence of the present discussion page. So I wrote my message on the village pump instead : Commons:Village pump#"Hot cat" and category redirects. Teofilo (talk) 18:38, 11 April 2009 (UTC)

Actually there is no issue. This problem is already being solved in the present software. Teofilo (talk) 10:50, 15 April 2009 (UTC)

adding categories to template pages

I would like to propose to always bracket new categories added to template and creator namespaces with <noinclude></noinclude>. There seem to be a lot of cases (including mine) where users try to add categories to a template but end up adding categories to 100's of images (for another example see all images in Category:Creator templates with images) . --Jarekt (talk) 15:03, 17 April 2009 (UTC)

Managing sorting information

I think it would be nice if someone could develop this tool further to manage sorting information. Perhaps that would require adding a new edit box next to the category edit box, to input or change sorting keywords.

But perhaps the most convenient would be to use the "pipe" ("|") in the same edit box, as when you usually do when adding sorting keywords to a category manually.

Sometimes I input "Categoryname|sortingkeyword" directly in the Hotcats edit box, but more often than not, the "OK" button fails from answering to my clicks.

Also a {{DEFAULTSORT|...}} reading (because it is hidden) and editing edit box would be useful.

Teofilo (talk) 10:09, 21 April 2009 (UTC)

Feature request

I would very much appreciate if redirected categories in the edit box:

  • appear in another color
  • when OK is hit, they are replaced with the target category before the image is changed (needing a second OK or carriage return for image recategorisation). --Foroa (talk) 10:35, 21 April 2009 (UTC)

Changing more than one category in the same edit

An improvement of this tool enabling to Change more than one category in the same edit would be a useful gain of time. Teofilo (talk) 14:00, 21 April 2009 (UTC)

I've considered that one. I won't do it, as it would require state information to be cached and would need an interface change (some kind of "apply all my changes now"-button). Lupo 15:06, 21 April 2009 (UTC)
As an intermediate compromise: an edit summary text entry box that is copied in the edit summary and appended with the normal edit summary when the category OK is hit. --Foroa (talk) 17:32, 21 April 2009 (UTC)

CatBurn

I present to you a small preview of what I'm working for on en.wikipedia. Media:CatBurn-3.png TheDJ (talk) 15:05, 21 April 2009 (UTC)

How does this compare to HotCat? --Dschwen (talk) 15:50, 21 April 2009 (UTC)
It primarily solves #Changing more than one category in the same edit. Which is something that is a considered a big problem by some. I'm not sure if it can be easily converted to Commons (since it misses the uploadForm capabilities), but I do hope to make this the new HotCat for *.wikipedia.org. TheDJ (talk) 17:33, 21 April 2009 (UTC)

Edit box size

Is it possible to customize the edit box size ? The category names I use presently are very often longer than the edit box (or the AJAX suggestion tool)'s size.

An automaticly resizing tool like searchbar autosizer would be helpful.

Teofilo (talk) 10:21, 21 April 2009 (UTC)

Hm, dynamically adjusting the width of that input field might make it jump around when at the edge of the screen. Not sure this would be a good idea... Lupo 12:38, 21 April 2009 (UTC)
Perhaps that would require displaying only one category by line when the user starts typing a character in a Hotcats box. So let's call this "automatic rearrangement" rather than "automatic resizing". Or perhaps it would be more simple to have always only one category per line (and an edit box nearly as large as the page size), when a user is viewing a page with Hotcats turned on (or with a "wide boxes" Hotcats option turned on). Teofilo (talk) 13:54, 21 April 2009 (UTC)
But having an option to customize the edit box size would be perhaps the most simple and convenient for everybody. Teofilo (talk) 14:32, 21 April 2009 (UTC)
But would there be any problem if the box size was set to full page size for everybody, without customization ? Would anyone complain and say "I'd rather have the smaller box" ? Teofilo (talk) 14:37, 21 April 2009 (UTC)
In the search options of Special:Preferences, users can define their "Custom AJAX suggestion box width". Would it be possible to use this parameter to set the box width of Hotcats ? Teofilo (talk) 15:00, 21 April 2009 (UTC)
Now I'm confused. Are you talking about the width of the input box (has horizontal scrolling anyway), or about the width of the suggestion list (no horizontal scrolling there)? I was talking about the first. I you want the second, that's more easily doable. Lupo 15:04, 21 April 2009 (UTC)
Well, I want both to be as wide as possible. Making one wide, while the other remains narrow would not help much, I'm afraid. Primarily I wish the input typing box could be around 600 pixel wide or be able to display full category names like Category:Ancient Roman art in the Museo della città di Rimini (about 60 characters). How about setting the width to 90 characters ? Teofilo (talk) 23:11, 22 April 2009 (UTC)
  • Ok. Made the edit box width configurable, and made the suggestion list adapt its width to the width of its contents. To set the width of the edit box to something larger than 40 (40 is the minimum), add the following to your monobook.js or other skin-JS:
JSconfig.keys['HotCatEditBoxWidth'] = 90; // Or whatever other integer value you want.
HTH, Lupo 11:23, 23 April 2009 (UTC)

How to use?

I'm at odds on how I can use the script in the first place. How is it activated? What do I have to do to get it to work? --L.Willms (talk) 09:45, 22 April 2009 (UTC)

Go to your preferences, select "Gadgets", click on the checkbox next to "HotCat" (in the "Tools for categories" section), and save. On how to use it after that, see MediaWiki:Gadget-HotCat.js/Documentation. Lupo 09:53, 22 April 2009 (UTC)

Questions

Resolved

Question 1: I cannot use HotCat to remove non-existent (red) categories: is that related to a specific setting ? --Foroa (talk) 10:35, 21 April 2009 (UTC)

No. Do you have an example file where I might investigate the problem? Lupo 12:37, 21 April 2009 (UTC)
All images with references to the non-existing categories in Special:WantedCategories (I have no minus sign on the right side of red categories, IE 6, SP2) --Foroa (talk) 14:09, 21 April 2009 (UTC)
Ok, can reproduce. Seems to be a bug in the regular expression handling in IE6. Will investigate. Lupo 15:25, 21 April 2009 (UTC)
This one is solved. Don't forget to refresh your browser's cache to get the correction. Lupo 09:25, 22 April 2009 (UTC)

Question 2: Hotcat often has problems in replacing categories containing accents. Is this a "feature" or a system limitation ? --Foroa (talk) 10:50, 21 April 2009 (UTC)

Do you have an example file where I might investigate the problem? Lupo 12:37, 21 April 2009 (UTC)
Example: replacing category:Köln-Riehl to category:Cologne in category:Cologne Zoo : stops and message box states: Category "öln-Riehl" not found, maybe it is in a template. --Foroa (talk) 14:09, 21 April 2009 (UTC)
Ok, can reproduce. Seems like IE6 has a problem here. Will have to think about a workaround. Not good... Lupo 15:25, 21 April 2009 (UTC)
This one is nasty. The XHTML source contains a link <a href="/wiki/K%C3%B6ln-Riehl" ... >. "%C3%B6" is the UTF-8 encoding for "ö". It seems that no matter how I try to access this href in JS (a.href, a.getAttribute ('href')), IE6 insists on decoding this UTF-8 URL wrongly (apparently using a wrong charset) and delivers "Köln" instead of "K%C3%B6ln". This already happens on the plain access to this attribute, before the JS even tries to properly decode it!
Nevertheless it's solved now, but with a mighty ugly hack. Tested on FF3.0.7, Opera 9.63, Safari 3.2.2 (WebKit 525.28.1), and IE6. If this breaks on other browsers, feel free to undo my hack and to hell with UTF-8 problems on IE6! Again, don't forget to refresh your browser's cache. Lupo 09:25, 22 April 2009 (UTC)
Actually, after looking through the jQuery 1.3.2 sources and reading Microsoft's documentation on their version of getAttribute, I think this hack could be replaced by a somewhat less ugly hack doing just
var href = !!window.ActiveXObject                       // Test for IE...
             ? span.firstChild.getAttribute ('href', 2) // IE (non-standard)
             : span.firstChild.href                     // all others
         ;
instead of parsing innerHTML. Will test that later... I can't believe we don't run into this problem with IE normalizing hrefs wrongly anywhere else... Lupo 09:10, 24 April 2009 (UTC)
Actually, simply using var href = span.firstChild.getAttribute ('href', 2); does the trick, since extra parameters are ignored in Javascript. So IE will see the second parameter and give us the right value, and the other browsers will just ignore it and treat this like a call to simple getAttribute ('href') and will also return the right value. Lupo 08:55, 27 April 2009 (UTC)
P.S.: also see [1], especially the last comment. Lupo 09:06, 27 April 2009 (UTC)

(Reset) All problems seem resolved. Great job. --Foroa (talk) 11:01, 29 April 2009 (UTC)

Adding categories to a whole group of images?

Nice tool, I have now understood how to activate. My problem is that I have dozens of images (from the Deutsche Fotothek collection) which should all get the same category. Is there a tool which can do this? Sorry, if I ask this question here, because it does not concern HotCat, but I don't know where else to ask. :-(( -L.Willms (talk) 11:22, 22 April 2009 (UTC)

Try the other categorization tool, Cat-a-lot. Maybe that helps? (I wouldn't know, never tried it myself.) Lupo 11:26, 22 April 2009 (UTC)
It doesn't really work in a way which helps me. I need something which works on my selections on a Category display, or by searching for specific strings in the description. --L.Willms (talk) 12:20, 22 April 2009 (UTC)
The easiest way to add categories based on a sting in the image description is through Commons:AutoWikiBrowser tool. But you need to ask for permission to use it and it is a steep learning curve. --Jarekt (talk) 13:22, 27 April 2009 (UTC)

Adding categories to template pages

I asked this before, but got no replies. I would like to propose to always bracket new categories added to template and creator namespaces with <noinclude></noinclude>. There seem to be a lot of cases (including mine) where users try to add categories to a template but end up adding categories to 100's of images (for another example see all images in Category:Creator templates with images) --Jarekt (talk) 13:25, 27 April 2009 (UTC)

What if there are already categories inside a <noinclude> markup? Lupo 13:42, 27 April 2009 (UTC)
Can we have multiple <noinclude> markups? One for each category? The alternative is to disable HotCat in template and creator namespaces. --Jarekt (talk) 13:33, 29 April 2009 (UTC)

Suggestion : automatically remove unnecessary categories

This is a suggestion for Cat-a-lot too. When a category is crowded and when you need to dipatch pictures into more specific categories, problems like the following happen :

Now I change Category:Aerial photographs of Australia into Category:Aerial photographs of Brisbane. The result is the following category :

Category:Brisbane is unnecessary and should be removed. This could be done automatically if the tool was clever enough to find out that Category:Aerial photographs of Brisbane is a already a subcategory of Category:Brisbane. Teofilo (talk) 09:52, 27 May 2009 (UTC)

  • I don't think this is possible without traversing the category tree, possibly several levels, which would require several remote calls (HTTP requests). Doing this might complicate the code considerably (it's already quite a mess), and is beyond what I could within the time I currently have available for Wikimedia JS things. Besides, I'm not convinced this "categorize in leaf categories only" rule is good in all cases. Lupo 09:44, 28 May 2009 (UTC)
It should remain optional, or provide only a warning message, requiring case-by-case confirmation from the user. Maybe this easier to implement in Cat-a-lot, because cat-a-lot somehow is already using a software which explores category levels above (and below) a given category. Teofilo (talk) 11:47, 28 May 2009 (UTC)

Hotcateditboxwidth feedback

I am using hotcateditboxwidth = 75 and it works fine. Thank you. Teofilo (talk) 07:44, 28 May 2009 (UTC)

Some questions

  • First of all, are there any extentions needed - if not, there is another extention with categories enabled, will this break the new code?
  • How to enable the new script - I'm not that good in js issues. Is there a line to include in common.js/.css to say "inlude/enable MediaWiki:Gadget-HotCat.js"?
  • I tried to copy this - but it didn't work. So may I did not include all parts which were needed?

(...these were some questions, may I remember some more later.) I'm looking forward to hearing from you! Regards, Marc-Philipp (MtaÄ) Helper @ Wikia (Talk) 18:42, 30 May 2009 (UTC)

What exactly are you trying to do? Installing this at Wikia? Or using it here on your Commons account? Lupo 08:54, 31 May 2009 (UTC)
In Wikia. A user liked this and I wanted to install this, but nope, it won't work... Marc-Philipp (MtaÄ) Helper @ Wikia (Talk) 09:03, 31 May 2009 (UTC)
I guess you'll have to adapt it. It depends on JSconfig defined in out MediaWiki:Common.js. You can remove that dependency by replacing these dependencies with appropriately named variables. It also is written to work with our skins; for instance, it doesn't know about your "monaco" skin. I have no idea whether it'll conflict with your CategorySelect script. I don't know your upload mechanism, so I cannot say whether the upload-form part of the script would work over at Wikia. In short: it's probably easier to roll your own (in particular, since Wikia uses jQuery and the Yahoo libraries, you could do it quite differently , probably more elegant, and possibly with a niftier interface). Lupo 09:26, 31 May 2009 (UTC)
P.S.: Other dependencies are to wikibits.js (addOnloadHook) and to ajax.js (sajax_init_object). The category redirect handling might also need to be adapted; disambiguation category detection is Commons-specific. Launching stuff once the page is ready works differently on Wikia, so you'll have to rewrite that. The Ajax calls could be rewritten using the Yahoo API. Lupo 14:55, 31 May 2009 (UTC)

More than one action

Hello. In many cases it's badly needed to do more than one category-related change (removing a category, replacing existing one and adding another one). Now, this could be done by more than one edit which isn't really practical. Can someone make such change? This can be done by adding OK/Cancel buttons at the end of the categories and the (-) should do nothing until pressing OK button (that applies all adding, replacing and removing actions).--OsamaK 09:50, 16 June 2009 (UTC)

See MediaWiki talk:Gadget-HotCat.js/Archive01#CatBurn. Don't know if DJ ever finished that. Lupo 11:04, 16 June 2009 (UTC)
OK, if there are some people who still refuse such change, it could be an option just like "enableMultiedits = ture;". So please don't archive unless it's done.--OsamaK 12:15, 16 June 2009 (UTC)
Archiving is automatic. And it's not that someone was refusing such a change, it's more that nobody has found the time to write the code for it and to thoroughly test it on a wide variety of browsers and skins before deploying it. Lupo 13:20, 16 June 2009 (UTC)

Documentation

I think there is no point of putting a documentation in the MediaWiki namespace. So can anyone move MediaWiki:Gadget-HotCat.js/Documentation to something like Commons:HotCat? If it's really important page then please think or protecting it outside MediaWiki namespace.--OsamaK 09:52, 16 June 2009 (UTC)

I've just placed it here to keep it together with the code. Besides, why pollute the Commons namespace with software documentation? Lupo 11:02, 16 June 2009 (UTC)
HotCat is a popular tool in Commons, and there are already some few tools documented in the project namespace. I think nobody will say no for such move.--OsamaK 12:15, 16 June 2009 (UTC)
I guess it could be moved to the MediaWiki_talk namespace so non-admins can edit it (the point he was making), but I don't really see non-admins doing much in terms of documenting things they didn't write. Rocket000 (talk) 11:21, 16 June 2009 (UTC)
The general rule is that everybody should be able to edit. For example, many non-admin contributors can translate the documentation.--OsamaK 12:15, 16 June 2009 (UTC)

I can remove categories but not add nor change

Hi I'm running mediawiki 1.15.0 and Gadgets HotCat for the same version. CentOS 5,2. My Localsettings.php looks like:

require_once( "$IP/extensions/Gadgets/Gadgets.php" ); 
$wgEnableMWSuggest = true;

The + and - symbols appear and I can remove on the fly, but not add or change. I press the + and a textbox appear which shows me a suggested category based on the character I press, but when I press OK it is not saved. Maybe there is something that I have missed. Im not used to work with javascript and this is the first gadget I use. /Kindly Regards Claes Lindvall

Dunno. You evidently have the API enabled, otherwise you wouldn't even see a suggestion list based on your input, and you probably also have wiki.js and ajax.js identical to our versions, otherwise you wouldn't get nowhere at all. The script relies on extra URL parameters being passed through by the server. Does your server do that? If not, it's probably some configuration setting somewhere. Other than that, I can only suggest trying to step through the script using FireFox and FireBug and trying to figure out why it doesn't do anything. Lupo 10:36, 18 June 2009 (UTC)

Hm, I have never used firebug before but here is what I found. When I activated the Konsole and tried to add a category I got an error on line 560 in index.php with an error line as: params.query is undefined. When I click on that one it marks the following text

 // We should have at most one page here 
560 for (var page in params.query.pages) return resolve (params.query.pages[page]);
561 return true; // In case we have none.

In the script debug windows I got

hotcat_json_resolve({"error":{"code":"readapidenied","info":"You need read permission to use this module"}})

I have the webserver as owner and group on the extentions (Gadget) dir and files.

I added in the Localsettings.php the following line (a tip a read somewhere):

$wgEnableWriteAPI=true;

It did not help. Do you know what else to do? /Regards Claes

HotCat doesn't use the write API, so that last setting has no effect. I think I got it. Before submitting, HotCat makes another API call to check for category redirects and category disambiguations. In that call, it uses JSON with a callback parameter, which causes the API module to strip the user credentials. That doesn't work on closed Wikis where $wgGroupPermissions["*"]["read"] is false. Your Wiki is not open for anyone to see, right? I've made a change to our version here to make that call without callback. Get this version and try again. I'd appreciate any feedback whether that did the trick. Lupo 21:22, 20 June 2009 (UTC)

You were right about the $wdGroupPermissions-thing. I remove that line and it started to work. I also replaced the code with the new one, but it not work. Not with with $wgGroupPermissions-thing activated nor de-activated. The error in firebug was:

 JSconfig.registerKey('HotCatDelay', 10...'HotCat autocompletion delay (ms):', 5);

in index.php line 136. This time the inputbox that appear with the searchresult remains opened and the category is not added. /Thanks Claes

Looks like something else in your setup is borked. Do you have JSconfig somewhere in your JS? Here at the Commons it is at MediaWiki:Common.js. Did your previous code have any references to JSConfig? If not, where did you get your initial version of HotCat from? And if you could tell me where your wiki is (if it is accessible from the Internet at all), I could take a direct look. Without seeing what your Wiki does, I'm flying blind, and any hints I can give are in fact shot in the dark. If you don't want to tell everyone where to find your Wiki, log in here and e-mail me. Lupo 19:08, 21 June 2009 (UTC)

A mail has been sent with information on how to reach the wiki. /Claes

Thanks, ✓ Done. It works now. You had the en-WP version of HotCat, and indeed fixing the JSON callback solved the problem. Lupo 11:39, 22 June 2009 (UTC)

Mucho Gracias. Great. I'm not sure what an en-WP version is, but maybe that's not important (for me at least). We will be using this category feature at my company and it will solve a lot problem for us. Thanks again. /Claes

Oh, sorry. "en-WP" is shorthand for "English Wikipedia". Lupo 13:00, 22 June 2009 (UTC)

Step-by-step installation instructions

Exists step-by-step installation and configuration instructions for newbies? Thanks a lot!--Fpiraneo (talk) 15:42, 24 June 2009 (UTC)

What do you want to do?
  • Use HotCat here at the Commons: enable the gadget in your preferences, and see the documentation, prominently linked at the top of this page.
  • Use HotCat on some other site: no, there's no documentation. You're on your own.
Lupo 16:32, 24 June 2009 (UTC)
Lupo, thank you for your precious answers; unfortunately I'm in the second case, trying to integrate the gadget on my own wiki; unfortunately I don't know where to place all the javascript code and how to recall on my own upload page (may be with a tag... I don't know!); really there are no resources available that answer these simple questions? Is the wikipedia-commons upload page source viewable in some way (just to take inspiration of how to install / implement)? --Fpiraneo (talk) 17:15, 24 June 2009 (UTC)
All right. Let's see if we can put such a step-by-step guide together.
  1. Enable the API on your wiki. You don't need to enable the write API. $wgGroupPermissions["*"]["read"] may be set to false if you have a private Wiki (one that allows reading only if logged in).
  2. Make sure you have the Gadgets extension installed and enabled.
  3. Make sure your wiki includes ajax.js on all pages. If you're using some Javascript framework on your Wiki, either textually copy the function sajax_init_object into the HotCat file you'll copy in the next step, or rewrite HotCat to use your framework. If you're not using some framework, either set up your wiki to serve ajax.js, or again textually include function sajax_init_object in the HotCat source.
  4. Get HotCat from MediaWiki:Gadget-HotCat.js.
  5. Install that file, possibly modified as outlined in step 3, on your Wiki as MediaWiki:Gadget-HotCat.js.
  6. Write a definition for it in MediaWiki:Gadget-HotCat (on your Wiki), and add it to MediaWiki:Gadgets-definition (also on your Wiki).
  7. Go to Special:Preferences on your Wiki and check the gadgets section. HotCat should appear there. Select it and save your preferences.
  8. Done.
Hope I haven't forgotten anything. If so, please report back. But in any case, this should give you a good start.
Note that our HotCat implementation has some specialities concerning category redirect and disambiguation detection which may or may not be appropriate for your Wiki. The HotCat version at the English Wikipedia has been modified with respect to where it inserts categories, and it uses OpenSearch for its suggestions. If the Commons version of HotCat doesn't meet your needs, give the English Wikipedia version a try. The procedure remains the same. Lupo 18:47, 24 June 2009 (UTC)
I got it!! :-) Thank you very much Lupo! I think that we have to make an "official procedure" documented with picture to install step by step this tool! What you have written today has not to be lost or archived! Thank you again! PS: I'm not an enstabilished user on en wikipedia to access the upload page; I'm sure that this version of HotCat will meet my requirements, otherwise I'll begin again my search!--Fpiraneo (talk) 21:44, 24 June 2009 (UTC)
✓ Done See Help:Gadget-HotCat#Installing HotCat on another Wiki. Lupo 06:28, 25 June 2009 (UTC)
Great! About this sentence: "Also note that HotCat is an old script. It does not use any advanced framework like jQuery, and it does pollute the global namespace quite a bit. It works, but its code is rather messy." what are your suggestion about alternate tools? --Fpiraneo (talk) 07:16, 25 June 2009 (UTC)
None. It works, and unless there's a pressing reason (such as major changes in functionality), I'd refrain from refactoring this. "If it ain't broke, don't fix it". If the WMF at some time in the future serves a standard Javascript framework by default, one might reconsider re-writing this using whatever framework that'll be, but otherwise, I'd leave it alone. If you want to use some standard Javascript framework on your Wiki, there's tons of choices: jQuery, mootools, dojo, YUI, or the Google framework, possibly even combined, to name just a few. Wikia, for instance, uses jQuery and YUI. Lupo 08:41, 25 June 2009 (UTC)

Tolerating capital and non-capital letters

HotCat is a great tool that should actually be embedded in our wikis and shouldn't need the user to activate it. This however is another issue. Currently when typing a category name like "Bar Harbor, Maine" hotcat finds it. However if one types "Bar h" hotcat doesn't display results. Could the suggestion box tolerate case sensitivity? --Diaa abdelmoneim (talk) 08:58, 4 July 2009 (UTC)

Why does it kill text

I love this gadget, but it kills text on me! The moment I'm typing the first word of a category, I see a few letters I had typed are missing. Why does this happen? Sabbut (talk) 15:57, 7 August 2009 (UTC)

Hiya-is it possible for Hot Cat to recognise the {{Bad name}} template and treat it the same was as it would a {{Category redirect}}? Railwayfan2005 (talk) 20:50, 13 August 2009 (UTC)

Hot cat broken on Internet Explorer 6

Hot cat broken on Internet Explorer 6 ? I really miss it. Works on Firefox 3.5 When it disappears, one notices it tremendous value. --Foroa (talk) 06:26, 21 August 2009 (UTC)

Try reloading your browser's cache. If that doesn't work, try the procedure I've outlined at User talk:Ilmari Karonen#All scripts are gone. If it still doesn't work after that: do you have any more info? What exactly happens? Lupo 06:33, 21 August 2009 (UTC)
Tried it all several times. Disabled, enabled Hot cat. Got a fresh reboot this morning. Nothing changed: little + and - icons from hot cat are not there. --Foroa (talk) 06:58, 21 August 2009 (UTC)
Ok, found the problem. It was a syntax error that was recently introduced in MediaWiki:Common.js. It is fixed now, so if you reload your browser's cache now, the scripts should work again. Lupo 06:59, 24 August 2009 (UTC)

Feature request

If you added a category and go to preview, it would be nice if the plus-button was available so you could select another category and c&p it into the editing window. Otherwise you always have to open an extra window to do so. --Cwbm (commons) (talk) 13:10, 26 August 2009 (UTC)

HotCat in esperanto gives problems

Hi,

  1. if I try to delete a category in eo.wiki, a popup compares that tells me that the category is included in a template (it's wrong: it compares even with normal categories). Why?
  2. in eo.wiki, there is an extension which permits on writing some special characters (ĉ, ĝ, ĥ, ĵ, ŝ, ŭ) by adding the x-letter after the normal letter (so: cx, gx, hx, jx, sx and ux). If I type a category name, with a special characters it doesn't recognize the name, it seems like the category doesn't exist. Why?

--→ A[[Special:Contributions/Airon90|ir]--→ Airon Ĉ 16:15, 28 August 2009 (UTC)]on Ĉ 11:31, 27 August 2009 (UTC)

On (1): can you give a concrete example? On (2), I'd guess the problem is with your x-extension, which probably does not recognize input fields, but only textareas, or cannot deal with dynamically added fields such as HotCat's input box. Other than that, I have no idea. Lupo 19:45, 27 August 2009 (UTC)
There is a third one related to the first two: if I change a category, it doesn't remove the old cat but it adds only the new one. However, try to delete in Corinne Rey-Bellet the categories Sportistoj kaj Svisoj. It gives error (I translated the HotCat.js in Vikipediisto:Airon90/VarmaKato.js)
Thank you --→ Airon Ĉ 21:06, 27 August 2009 (UTC)
Vikipediisto:Airon90/VarmaKato.js is not the HotCat we use here, and it isn't the HotCat used at the English Wikipedia either. It seems to be an old version. I suggest you update your copy first to the one from the English Wikipedia. Then change the line reading
var hotcat_cnames=["[Cc]ategory"];
to read
var hotcat_cnames=["[Cc]ategory", "[Kk]ategorio"];
Then reload your browser's cache, and try again. Lupo 06:34, 28 August 2009 (UTC)
By now it works properly. If I find some errors I'l post there. Thank you! --→ Airon Ĉ 16:15, 28 August 2009 (UTC)
PS: I copied before the code in de.wiki!

Removing {{uncategorized}} warning

Is there any way we can stop this sending us a pop-up warning whenever we remove the {{Uncategorized}}? Rocket000 (talk) 08:29, 3 September 2009 (UTC)

Don't know what you mean. When HotCat removes a {{Uncategorized}}, it only mentions that in the edit summary. It only displays alerts if it can't find a category that is to be removed, or if it finds such a category multiple times, or if a category to be added already exists. Lupo 08:53, 3 September 2009 (UTC)
I guess I've been doing it differently. I always try changing the category the template adds instead of adding a new one. Rocket000 (talk) 09:37, 3 September 2009 (UTC)
Ah, now I see. In that case you do get an alert because that category is not found. We could omit that alert if the category is one of those added by this template. Unfortunately, this template adds different categories (even daily categories!), and it would make HotCat rather dependent on the implementation of that template. Lupo 10:26, 3 September 2009 (UTC)
Yeah, I was just doing it wrong. :) I thought that was how you remove the template, but the way it works makes sense now that I think about it. Rocket000 (talk) 10:01, 4 September 2009 (UTC)

hotcat simply doesn't work even though I have added JSconfig.keys['HotCatDelay'] = 200; // Or whatever other value you prefer and JSconfig.keys['HotCatDelay'] = 200; to my monobook JS. I am using firefox 3 Azkoitian-Brahman (talk) 01:10, 23 September 2009 (UTC)

Hidden Feature Request- Geotagging

Geotagging images is unnecessarily fiddly compared to adding categories using Hotcat.js. It is now possible to add a Geotag using Hotcat- by grabbing the location/coord using a bookmarklet and pasting it into the AddCategory edit box, and pressing OK. This puts the correct geotag onto the file but leaves messy orphan text. I would like to request a little patch (euphemism for major rewrite) to do the job cleanly.

So getting a little more specific: the editor selects [+] in hot cat, the edit box opens. When the text {{ is typed in, the Svg:tick changes to a svg:globe symbol, and text matching with the database is switched off. The editor completes the edit, and presses OK. The code is submitted: simple validation is done (or eventually more complex)- The code must contain {{Location'' and terminate with }}. The target page must not contain {{Location'' and terminate with }}: if these conditions are not met, the hotcat will gracefully silently ignore the edit or throw the error message Operation not possible. If accepted the {{Location'' }} will be appended raw to the file, and to the edit history.

When one is doing some category changing work using hotcat, one often discovers ungeotagged images- and having one tool to do both jobs is very attractive.

A bells and whistles tool would have a few other features, but suggesting them here would deflect from the main request. --ClemRutter (talk) 12:17, 6 November 2009 (UTC)

This is terrible. What does it have to do with HotCat at all? We already have tools to insert coordinates. This is not only reinventing the wheel, and reinventing it worse, this is abusing and cluttering HotCat with an obscure hack. I'm at a loss for words to express how bad of an idea this is. --Dschwen (talk) 13:45, 6 November 2009 (UTC)
Firstly- a word of thanks, jealousy and respect for all your fantastic code and deep knowledge of the software. In my world, reducing mouse clicks and keystrokes is everything. I have added the Coordinate conversion helper tool to my monospace.js, and as I remembered, it does a job well but the wrong job. I'll explain:
  • When hotcatting a large cat, say to subcat: one comes across many images to be moved- and many that are not geotagged.
  • Hotcatting allows you add a cat without opening the edit page, saving an edit summary, and closing/saving the edit page. That is the killer feature.
  • On the contrary Coordinate conversion helper does one job well, it allows the general editor to geotag without the need to set up bookmarklets, but has three significant problems for the way I work.
  • It takes up significant screen real estate while editing.
  • I use bookmarklets that code in decidegrees but display in dms. I have a set of them, one for commons, and 3 for en:wiki so I can vary the precision (dec places), so I already have the datum in the format of a location tag, which I can paste below the infomation box and crucially in the Edit summary.
  • It takes a further edit to change the precision or format if that is needed.
  • It doesn't do the edit summary
  • Hotcatting already allows you to geotag in the way I described above- its just the result is messy to human eyes- it does everything that I require except validation- but it will except any template and by default try to process it. At the moment, it reads Location tags and drops them onto the page- and the surrounding text just looks messy.
  • Looking at the current js code and the Archive suggests
  • that a new tool could be spawned
  • the guy who writes it must endure a steep learning curve
  • spawning a new tool would be idiotic when the extra facility could be easily integrated
  • trying to edit the code without years of scars and bruises maintaining the existing code would be a hopeless duplication of effort.
  • HotCat is too important to mutilate with an obscure hack- it would need to be quality code, and simplicity must be preserved.
I can't see any logical distinction between a cat on an image, such as Manchester Central and a shot taken from Location dec|53.475140|-2.248556. They are both just attributes of an image, while the cat is a collection of like objects, we use an external program to see the collection of similar locations. (An aside: many of the images in Manchester Central have not been tagged, and must therefore belong to a Category of images missing a geotag.)
Requesting a new feature at least stimulates discussion and hopefully assists understanding of other editors POVs.
As always, ideas can be discussed here or Google me and pop round for beer! --ClemRutter (talk) 20:24, 6 November 2009 (UTC)
Well, Rochester is a bit out of my way ;-). The problem I see is that this hack is "obscure". You are turning a tool with a clear purpose into something that is not obvious to the user. Why stop at geotags when you type {{. That doesn't do any checking and would allow you to enter any template. Nonexisting, or broken locations. I'd rather work on my conversion helper which can be extended with more magic to recognize more coordinate-bearing map-service URLs. Skipping a mouseclick and using the API to make the edit is not really a big deal (uh oh, I migh regret I said that ;-) ). --Dschwen (talk) 22:00, 6 November 2009 (UTC)

Bug

This gadget is using the localized name of "category" namespace: [2]. It should be using the site language instead of the user language. Helder 17:21, 11 November 2009 (UTC)

Nope, it doesn't. And the edit comment it generates is always in English, not in Portuguese. That's what you get when you cross-include stuff from different projects. You are not using our HotCat here, you're using the HotCat from the Portuguese Wikipedia. Lupo 09:08, 12 November 2009 (UTC)

Just out of curiosity: How do you use your local hotcat on commons? --Cwbm (commons) (talk) 09:34, 12 November 2009 (UTC)

He makes in his vector.js here an importScriptURI of a script at pt-Wikibooks, which in turn makes an importScriptURI of the HotCat at the pt Wikipedia. Lupo 09:42, 12 November 2009 (UTC)
I'm sorry about my mistake... =/ I'll try to be more careful... Helder 12:00, 12 November 2009 (UTC)

HotCat glitches

I guess that this inconsistency between content and edit summary is caused by the rather quick successive actions.

Using piped arguments with the new category names works sometimes, but sometimes results in very strange error messages (I guess when there is a blank after the pipe), such as category not found, could not be removed, ... It might be a good idea to document that properly. --Foroa (talk) 09:24, 30 September 2009 (UTC)

No idea at all what this strange edit summary was. Lupo 10:01, 12 November 2009 (UTC)
What do you mean about piped arguments? Do you enter "Some category|Key" in the input box? There is actually no support for that. Or do you mean removing or replacing a category that has a sort key in the wikitext on the page? Lupo 10:01, 12 November 2009 (UTC)
I meant entering "Some category|Key" in the input box. It seems to work (most of the time) when there is no blank after the pipe, but I can be wrong. Anyway, I seem to remember a strange behaviour when adding a blank after the pipe and the text following it. --Foroa (talk) 18:08, 12 November 2009 (UTC)
If that works, it's only by chance. But it wouldn't be too hard to support that properly... Lupo 19:03, 12 November 2009 (UTC)
✓ Done. Remember to reload your browser's cache if you want this functionality right away. Lupo 21:38, 12 November 2009 (UTC)

Put cats before interwikis

Can somebody perform that change or explain to me why this should not be the case. Cheers --Cwbm (commons) (talk) 10:26, 7 November 2009 (UTC)

Nobody has implemented this yet; it's as simple as that. The version at the English Wikipedia inserts new categories after the last existing category, if it finds one, or at the end otherwise. I could import that bit of code... Lupo 09:11, 12 November 2009 (UTC)

That would be good. I think in the german wikipedia the cats are always put before the iws, maybe you can have a look at that code. --Cwbm (commons) (talk) 09:34, 12 November 2009 (UTC)

I don't see anything in de:MediaWiki:Gadget-HotCat.js that would do that. Anyway, I've incorporated the code from en-WP. You'll need to reload your browser's cache to get the change right away. I consider this ✓ Done. If errors crop up, just tell me. Lupo 09:39, 12 November 2009 (UTC)
To the best of my knowledge, there is no rule/guide for Interwiki and category placement. I noticed that most bots have their own way of arranging categories and Interwiki's, so I gave up on trying to clean that up. It makes no sense to change one tool to do it in a certain way if other bots arrange it the other way. --Foroa (talk) 18:12, 12 November 2009 (UTC)
It doesn't matter much anyway. Yet placing new categories next to already existing categories in the wikitext is simple and is actually a pretty good strategy not to upset the last editor, and assuming editors follow whatever the consensus on a project is regarding such placement, the tool will automatically do the right thing and also follow that policy. Lupo 19:02, 12 November 2009 (UTC)

In all wikipedias interwikis are placed at the end of categroies by humans and by bots. I would considers this to be a standard. --Cwbm (commons) (talk) 12:50, 16 November 2009 (UTC)

A trail of Errors/searchable features

Several thousand edits down the road, I have noticed this error message on pages I have hotcatted on Commons. (Firefox 3.5.5/Ubuntu 9.10)

ReferenceError: addLink is not defined
http://commons.wikimedia.org/w/index.php?title=MediaWiki:Populate-category.js&action=raw&ctype=text/javascript&dontcountme=s (33)

say Category:Kinder Scout Several questions.

  • Causal link?
  • Why?
  • A fix?
  • A bot to fix the damaged pages which appear to work well?

--ClemRutter (talk) 11:37, 11 December 2009 (UTC)

This has got nothing whatsoever to do with HotCat. Ask the author of MediaWiki:Populate-category.js, User:Multichill, about it. I suspect the call to addLink should actually be a call to addPortletLink. Lupo 12:34, 11 December 2009 (UTC)

Edit summary

Currently changes to lengthy category names produce broken edit summaries. If the summary was changed from:

  • Removed category [[:Category:asdf|asdf]]; Quick-adding category [[:Category:1234|1234]] (using ..

to:

  • Removed [[:category:asdf]]; Quick-adding [[:category:1234]] (using ..

would it allow longer category names to be formatted? -- User:Docu at 12:02, 21 December 2009 (UTC)

BTW, "using Hotcat" could link Help:Gadget-HotCat instead of MediaWiki:Gadget-HotCat.js. -- User:Docu at 12:11, 21 December 2009 (UTC)

{{Editprotected}}

Changes to do

Changes (from the first line to the second line) below:

      summary.push ( "Removed category \[\[:Category:" + cat_rm + "|" + cat_rm + "\]\]" ) ;
      summary.push ( "removed \[\[category:" + cat_rm + "\]\]" ) ;
      
      summary.push ("Quick-adding category \[\[:Category:" + cat_add + "|" + cat_add + "\]\]" + comment);
      summary.push ("adding \[\[category:" + cat_add + "\]\]" + comment);
      
                                      + " (using [[MediaWiki:Gadget-HotCat.js|HotCat.js]])" ;
                                      + " (using [[Help:Gadget-HotCat|HotCat]])" ;

            ,(txt.value != original) ? " (redirect \[\[:Category:" + v + "|" + v + "\]\] resolved)" : null
            ,(txt.value != original) ? " (redirect \[\[Category:" + v + "\]\] resolved)" : null


Given the absence of any comments, requesting I'm adding {{Editprotected}}. -- User:Docu at 13:01, 23 December 2009 (UTC)

I think changing that makes sense. --Cwbm (commons) (talk) 20:29, 23 December 2009 (UTC)
✓ Done Lupo 08:14, 24 December 2009 (UTC)
Thanks, a bit less pretty, but it works. -- User:Docu at 03:05, 30 December 2009 (UTC)

Disable HotCat for Template and Creator namespaces

I would like to propose to disable HotCat for Template and Creator namespaces. Adding categories to pages which will be transcluded into other pages is tricky and requires some thought to decide if <includeonly>[[Category:X]]</includeonly>, <noinclude>[[Category:X]]</noinclude> or [[Category:X]] should be used. Adding/replacing/deleting a category on such pages will most likely result in incorrect outcome if done automatically by HotCat. Forcing the editors to do it the old-fashion way - by editing the whole page - can prevent such edits. --Jarekt (talk) 19:02, 11 November 2009 (UTC)

Probably that makes sense. Lupo 09:12, 12 November 2009 (UTC)

If you edit a template with hotcat you get a warning message. I'm not sure if deactivating is the better option. --Cwbm (commons) (talk) 09:34, 12 November 2009 (UTC)

What warning? I'm not aware of any. You do get alerts if the category you try to change or remove itself is not on the page, but is transcluded from elsewhere. But there's no warning in the code when you edit a template. Anyway, I've disabled it in the "Template", "Creator", and "TimedText" namespaces. Lupo 09:46, 12 November 2009 (UTC)

Yes, I got a warning when added or changed a cat on a template page with hotcat. --Cwbm (commons) (talk) 10:04, 12 November 2009 (UTC)

Hm, I wouldn't know where that warning came from. But I see that you have the autocommit switched off anyway. Maybe that'd be better: just disable autocommit instead of disabling the whole gadget. That way, a user can review the changes made and move the category to the right place manually before saving. Lupo 10:11, 12 November 2009 (UTC)

It would probably be best to diasable the autocommit by default and have people enable it via their monobooks. --Cwbm (commons) (talk) 12:50, 16 November 2009 (UTC)

How about allowing template programmers to provide an identifiable safe-for-hotcat spot? Like "{{YouMayHotCatHere}}"? Paradoctor (talk) 18:05, 3 January 2010 (UTC)

In a lot of cases hotcat would work with autocommit because there are already noinclude tags. Templates are not that often recategorized so to deactivate autocommit and the old warning message would be enough. --Cwbm (commons) (talk) 20:03, 18 January 2010 (UTC)

Small problem

See this edit with HotCat. --Smooth_O (talk) 16:12, 10 January 2010 (UTC)

I tried to reproduce it, but couldn't. I selected the category after starting to type "Embassies in Wash ..". -- User:Docu at 16:23, 10 January 2010 (UTC)
Neither could I. @Smooth_O: what skin are you using? What operating system, and what browser? What other gadgets do you have enabled? And what exactly did you do? Did you do anything differently the second time, when it worked? Lupo 21:20, 10 January 2010 (UTC)
I am using default skin (MonoBook), on Firefox 3.5.7 and Windows XP, i have no other gadgets enabled. I often use HotCat, and this is the first time this problem happened, so i wrote it here to let you know. I just entered category and press OK, after i saw what happened i just undo revision, and again enter category and press OK, and no problem second time. --Smooth_O (talk) 19:01, 11 January 2010 (UTC)

Feature that sucks - to agile name suggestions

Hey there, what suks me on HotCat is following. The script seems to be to agile when suggesting names right into the textbox (I am not talking about the list that appears above). Example: I want to categorize to "Category:Locks". I type "Locks", but even as the category exists, I get immediatelly suggested another existing category "Locksmiths" within the textbox, fortunatelly highliting the "miths" with a block. I have to hit "Delete" button on my keyboard twice to get rid of that "miths" and to be able to do for intended "Locks". I dont know whether this is a feature or a bug, but I think it sucks a lot. I use HotCat on regularly basis and I encounter this behaviour quite often.--Kozuch (talk) 14:32, 16 January 2010 (UTC)

Hmmm, this is side-effect of the new search backend. Looks like we'll have to re-sort the suggestions anyway, at least to make sure that suggestions that start with the search prefix come first. (Our autocompletion uses the first suggestion; in this particular case, the list starts with "Locksmiths" followed by "Locks". If "Locks" came first, it'd work better.) I'll look into this. Lupo 15:10, 16 January 2010 (UTC)
✓ Done. Lupo 15:31, 16 January 2010 (UTC)
Thanks for a fast fix, I really appreciate it!!!--Kozuch (talk) 16:04, 16 January 2010 (UTC)
Is it back again???--Kozuch (talk) 18:03, 19 January 2010 (UTC)
Not that I know of. Maybe you're using another browser that still has the HotCat from before the fix cached? Try reloading your browser's cache. Lupo 21:47, 19 January 2010 (UTC)

Feature requests

Hello - first, I wanted to tell you that this is an awesome gadget. I have been using it a lot recently to sort through the massive piles of badly categorised images that seem to be everywhere. Would it be possible to implement two additions though?

  • Provide support for multiple changes in one go - there should be the option of selecting multiple new categories (and as a lesser need, multiple changes of existing categories) as one, and then hit done. The great thing about Hotcat is really that it dispenses with hunting for the correct category name / for whether that category exists at all. By being able to do multiple cats at once, with one final click, images with lots of categories would be much faster. Otherwise, it is sometimes still feels quicker and tidier to do them by hand in one go if you know the new category names.
  • Provide ability to add an edit summary - I prefer to add an edit summary for changes that an inexperienced uploader might see as vandalism on his image, such as for example when I remove cats because the image already sits in a more specific cat. So if using the gadget also opened an optional comments box (maybe allowing only shorter comments so the tool itself can write its own comment as usual too) that would be great. Alternatively or additionally, one could maybe have a few check boxes where one can select typical edit types such as "Removed over-categorisationn" or "Inappropriate category" or "Modified to more specific category".

If you would consider these changes, that would be awesome. Ingolfson (talk) 13:41, 18 January 2010 (UTC)

 Support Excellent idea. Paradoctor (talk) 16:29, 18 January 2010 (UTC)

FYI: MediaWiki_talk:Gadget-HotCat.js/Archive01#More_than_one_action. I would also like to add that it would be nice to activate hotcat for hidden categories. --Cwbm (commons) (talk) 20:03, 18 January 2010 (UTC)

Concerning:
  • Multiple edits at once: would require a nearly complete rewrite of this ancient script to do properly. Since a replacement for HotCat is in the works (c.f. bugzilla:20678), I doubt anyone is going to seriously tackle this here. Some attempts were made by TheDJ at the English Wikipedia, but I don't know their status.
  • Edit summary: just control-click the "(-)"-Link or the "OK"-Button: that should make HotCat perform the edit, but then not save. Then you can change the edit summary to your needs, and submit the edit then. Or just set hotcat_no_autocommit = 1 in your monobook.js to never have HotCat save automatically.
  • Hidden categories: these usually are transcluded from templates anyway. Transcluded categories cannot be edited through HotCat.
Lupo 21:20, 18 January 2010 (UTC)
Thanks. An aside: Is there a way to get the category structure in a single package, or do you need to crawl? Paradoctor (talk) 21:47, 18 January 2010 (UTC)
I don't understand the question. What do mean by "category structure", "single package", and "crawl"? Lupo 22:17, 18 January 2010 (UTC)
Sorry. Crawl as in w:web crawler. Basically, I'd like a file listing all categories and the categories they're in. Paradoctor (talk) 23:00, 18 January 2010 (UTC)
You mean the category tree? You can get that, from any particular category, through an API call. For instance, the immediate parent categories of Category:Francisco de Goya y Lucientes are these. We also have the CategoryTree extension installed at the Commons; see e.g. {{Categorytree}}, used also at Category:Francisco de Goya y Lucientes. But I don't think there is anything that gets you the full graph. Would be pretty big anyway. If you want to analyze the full category graph in detail, it's probably best to get an account at the toolserver and query the database directly. I wouldn't use the API to systematically "crawl" the structure; it'd be too cumbersome. Navigating up and down through the API is fine, though, for user interactions like e.g. in the Cat-a-lot gadget.Lupo 23:45, 18 January 2010 (UTC)
I suspected as much, no easy way. Thanks for the info, I'll see what I can do with it. Paradoctor (talk) 00:39, 19 January 2010 (UTC)
  • Longer delay before suggestions hit textbox - I request a longer timeout. When I type wrong name and want to delete some chars, I get annoyed by the suggestions every single character is deleted... I can end up hitting "backspace" like 20 times for deleting three letters literally... I know you probably can not now if I am typing or deleting text, but could this be solved somehow? (maybe by detecting if I am typing or deleting already?)--Kozuch (talk) 17:33, 20 January 2010 (UTC)

Support of charactersets and diacritics

Hello. I am enjoying HotCat every day. Could you tell me what charactersets/diacritics are supported fully (I.e. é and ü) and which ones are only partially supported, such as in Category:Sídliště Lhotka . Is there any chance to improve on that because most people have only a very limited set of special characters on their keyboard while we are seeing more and more diacritics used on Commons.

Are the rules the same as for the wikipedia search box or do I have to search somewhere else ? Thank you. --Foroa (talk) 08:20, 22 December 2009 (UTC)

What exactly do you mean by "supported"? What you can type on your keyboard depends on the settings on your computer. How to enter other characters also depends on your computer. HotCat itself can handle any UTF-8 input. Lupo 11:04, 22 December 2009 (UTC)
My mistake, I thought that Hotcat did some filtering so that for example a é showed all the names with all the "e variants" in place. It seems to do only some conversion for the first character, so conversion of é to É (É is not available on my keyboard). Uppercases/lowercases must be entered correctly. Thank you for the information about UTF-8 characters. Is there any limitation in the UTF-8 characters supported, meaning up to 6 byte sequences ? --Foroa (talk) 11:43, 22 December 2009 (UTC)
Ah, you're talking about the suggestions. The suggestions are just the result of an API query ("show pages in the category namespace starting at the currently entered prefix"); it should be the same as the first entries when you go to Special:Prefixindex/Category: and enter the current text from the HotCat input field in the "Display pages with prefix" input field there. We could try using OpenSearch for the suggestion, like they do on en-WP, but I don't know what the results from that would be. The main advantage of OpenSearch seems to be case insensitivity also on later characters; though maybe that might produce unexpected results with our auto-completion. Neither method does equivalence mapping. Compare the results from the following links:
Other than that, HotCat doesn't do anything special with UTF-8 input, it relies on the built-in JavaScript support for that. So I would expect it to handle all UTF-8 properly. Lupo 13:30, 22 December 2009 (UTC)
So only open search could potentially improve marginally if no surprises appear with autocomplete. Search on sidliste will never return a usable result. On the side, what is the number of suggested items returned by HotCat (10 in a window of 5) and can this be customised ? To me, for example in Special:Prefixindex/Category:Buildings in B, the return of Hotcat is a bit short if you are not sure about spelling. The latter point is just a small detail.
Yes, HotCat does not specify a limit, so the server defaults to returning 10 entries. We could increase this a little, e.g. to 20 as in this HotCat search for "Sid" or in this OpenSearch for "Sid". Lupo 15:25, 22 December 2009 (UTC)
If you wanted equivalence folding in OpenSearch, I'd suggest opening a bug report at bugzilla, asking for it. Maybe the equivalence list from the AntiSpoof extension could be re-used for this. Lupo 15:28, 22 December 2009 (UTC)
2O items would probably be better. When looking in the results of OpenSearch for "Aia", OpenSearch for "Aid" and OpenSearch for "Aids", it looks clear to me that it returns results that would be next to impossible to find with the normal search.
To be honest, I have no clue what you mean with "equivalence folding in OpenSearch" and "antispoof extensions" in this context. Could you give me a pointer ? --Foroa (talk) 15:48, 22 December 2009 (UTC)
✓ Done. Using OpenSearch now, and increased the limit to at most 30 suggestions. Can't do anything about "Sidl" not suggesting stuff starting with "Sídl". (By "equivalence folding" I meant that the search engine should treat all characters in an equivalence class ("iíìîïīIÍÌÎÏΊίИЙийĪ" => "i") as identical. But see bugzilla:164...) Lupo 08:24, 23 December 2009 (UTC)
Update: since [3], opensearch actually does some kind of equivalence folding. But the results returned may now no longer be sorted alphabetically. See here: Search for S Search for Sid Search for Sidl Search for Sidliste. Lupo 12:12, 11 January 2010 (UTC)
+ new categories don't get added directly any more. -- User:Docu at 12:16, 11 January 2010 (UTC)
In the suggestion list? Yes, probably because the new search back-end uses an index that is computed off-line, not in real-time. Nothing we can do about this in HotCat, except going back (abandoning opensearch and using action=query again). We'd gain immediate update and alphabetical ordering (or rather: numeric ordering according to unicode code points), but we'd lose again case insensitivity and this "similar character matching". Lupo 15:40, 11 January 2010 (UTC)
Yes, in the suggestion list. I'm not sure if I mind or not.
I tend to add new categories to a series of images first and then create the category description. So it doesn't matter that much. Still, returning later, I was wondering if I mistyped the category name.
Anyways, the results in the normal search box are a bit more puzzling. -- User:Docu at 15:48, 11 January 2010 (UTC)

An option to switch between the two search engines could be helpful (in the gadget tab?). The other day I created a series of categories and was a bit annoyed that I couldn't find any of them. -- User:Docu at 17:45, 25 January 2010 (UTC)

Removal of uncategorized-template

Hi,

I noticed a little something today in my Watchlist when somebody used HotCat.js to add a category. The thing is that HotCat.js automaticly deletes {{Uncategorized}} when adding category. This is great, but it would be even better if it'd also got rid of the comment asociated with this Template. Example:

{{Uncategorized|year=2010|month=January|day=6}} <!-- Remove this line once you have added categories -->

Currently, it would end up like this:

 <!-- Remove this line once you have added categories -->

[[Category:New category]]

Instead of:

[[Category:New category]]

So, the request is to let the script also delete that comment, which in 99% of the cases is exactly the same due to it being generated by a bot, so it might aswell be hardcoded in the script for deletion. Krinkle (talk) 15:31, 21 January 2010 (UTC)

Problem

See this edit. --Smooth_O (talk) 15:55, 31 January 2010 (UTC)

Heh. A trailing category inside an HTML comment. Thanks for reporting that! I've amended the script to not insert inside HTML comments and <nowiki> "elements". Should be fixed now. ✓ Done (You may need to reload your browser's cache to get the correction.) Lupo 16:55, 31 January 2010 (UTC)
Another sample. -- User:Docu at 20:35, 31 January 2010 (UTC)
That won't happen anymore now. Lupo 20:50, 31 January 2010 (UTC)

Cache

How long is the cache for updating categories?--Kozuch (talk) 18:50, 31 January 2010 (UTC)

I think it depends on the update of the search index (generally in the early morning GMT). I made a request for an option to use the previous version (more convenient when creating new categories; see #Support_of_charactersets_and_diacritics.) -- User:Docu at 20:38, 31 January 2010 (UTC)

Search results with option -incategory:"category name"

To make it easier to categorize images, it might help if there was a link next to each result that allows to add the category that was excluded. The link could be hotcat based, e.g. http://commons.wikimedia.org/w/index.php?title={{urlencode:File:filename.jpg}}&action=edit&hotcat_newcat={{urlencode:category name}}

Personally I use an ugly hack to do that. It might help others if there was a new gadget that would add such a link to search results. -- User:Docu at 11:16, 5 February 2010 (UTC)

is this the same as

Is this the same as: [4]? Bud0011 (talk) 07:00, 23 February 2010 (UTC).

Yes and no. For most people using it on normal pages, yes, the functionality is the same. On a technical level, no: our version integrates with the upload form. The version used at the English Wikipedia was forked from ours, and then both were developed further independently. Though we did cross-import important improvements and/or fixes from there to here and vice versa, they two versions are not identical. Lupo 07:30, 23 February 2010 (UTC)

( ) Brackets

Hello, applying hotcat resulted in a warning and a new file was generated with title ( ) brackets changed into #'s , see File:Church of Marigny-l'Église #Nièvre,Fr#.JPG; this empty file had the hotcat-cat; at a second try the brackets in the description were changed into #'s, see File:Church of Marigny-l'Église (Nièvre,Fr).JPG. What happened here and how to avoid this to happen again? --Havang(nl) (talk) 12:25, 11 March 2010 (UTC).

I tried to reproduce this, but didn't succeed. There might have been some control character added to the category name. -- User:Docu at 12:59, 11 March 2010 (UTC)
Bizarre. What other gadgets do you have enabled? Which skin do you use? Do you have the beta usability stuff enabled? Lupo 13:05, 11 March 2010 (UTC)
Gadgets cat-a-lot and hotcat; beta not enabled. (skin? do you ask for this:) I have Windows XP and explorer (not chrome). --Havang(nl) (talk) 14:02, 11 March 2010 (UTC)
The message mentiones (translation): "This page has been changed in internet exporer to help prevent scripting on more pages". This time, the message came using hotcat after I had double-clicked accidentely on opening the File-page, but this time hotcat worked properly. --Havang(nl) (talk) 14:31, 11 March 2010 (UTC)
Stranger than strange. You didn't mention a message before. What message is this? In a small yellow bar at the top of the page? Or an alert box that pops up (a small Windows window with the text, and a button)? Do you have any add-ons installed in IE? And... is this IE6, 7, or 8? If it's IE8, is it running in "compatibility mode" or not? Did you change any security settings in IE?
I'm sorry to say, but all I can do is ask questions that may lead you to things to check on your computer. It seems nobody else has such problems, so it's most likely some setting on your machine. If you can figure out what it was, I might—just might—maybe figure out a work-around in the script for it, even though it doesn't appear to be a flaw in the script. Lupo 22:04, 11 March 2010 (UTC)
What a service, that you give time to this problem which may just be personal! I mentioned at first "warning" which I named later "message". This was a small yellow bar at the top. It comes frequently when using hotcat. I think I have Explorer 7 with settings dating from 2007. What I have had as problems lately: my monobook pages, which caused irregularities, Foroa has deleted these pages for me, see http://commons.wikimedia.org/wiki/User_talk:Foroa#Cat-a-lot. On those monobook pages, I had at first no problem with the template "category from gallery" but then I received a second program on my monobook js page and since then "Category from gallery" didn't work correctly. Later I installed cat-a-lot but it never worked. Lately I have been acquinted with the deletion menu but it gives sometimes irregularities in not saving the generated deletion subpages. And hotcat shows from time to time that warning message, but it doesn't temporarely after emptying the cache (ctr-F5). Maybe if you or he restores the deleted monobook pages including the history you may check what was wrong there. --Havang(nl) (talk) 21:23, 12 March 2010 (UTC)
That yellow bar is a message from IE; so the problem has got something to do with your settings.
IE sometimes has problems clearing its cache properly. To be really sure it's cleared, I usually have to do the following: first, use ctrl-f5. Then manually delete all "Temporary internet files" (there's a button for that somewhere under "Internet options..."). Then quit IE. Then restart it. Go to the Commons, and hit ctrl-F5 again. After that, at least you can be sure that your browser doesn't have some old stuff in its cache.
Next check that popups are allowed for *.wikimedia.org. HotCat doesn't need this, but the "nominate for deletion" links sure do. The popup blocker settings are also in some tab of the "Internet options". (Sorry that I cannot be more specific; I don't have an IE7 here.) In the "Security" tab, check that for the zone (either Internet or "Trustworthy sites", if you have added the Commons to that) "ActiveX-controls safe for scripting" and "ActiveX controls and plugins", and also "Binary and script behaviors" are activated.
If the problem still appears, it's some other setting in IE. Unfortunately I don't know which it might be. If you see any setting having to do with "XSS", try to disable it or to put the Commons (commons.wikimedia.org) on a whitelist, if there is one.
Other than that, I'm afraid I can't help you further. I have IE6 and IE8 at my disposition, but no IE7... Lupo 22:00, 12 March 2010 (UTC)

@ Lupo. I cleaned my computer, followed your other instructions, and installed explorer 8, and after a few tests, hotcat and deletion menu seem to work properly now. Thanks. --Havang(nl) (talk) 13:28, 13 March 2010 (UTC)

Hotcat on disambiguation categories

For disambiguation categories, hotcat sorts the list alphabetically and outputs the first ten. In general, I think it's preferable not to sort the list at all (generally it's already sorted by relative frequency) and present the full list. -- User:Docu at 18:46, 11 March 2010 (UTC)

I've raised the limit on the number of categories from the default 10 to 50. If you ever find a disambiguation category with a larger fan-out, I can raise the limit even further.
But I cannot do anything simple about the sorting as this is done on the server. HotCat does not sort these categories, the server already returns them in that order in response to the API query. Respecting the order they appear on the disambiguation page would mean HotCat would have to get the HTML output of the parsed wikitext of the disambiguation category page (API action=parse) and then extract links itself, which seems like overkill. It'd be a lot more work than the action=query&prop=info|categories|links&plnamespace=14 API query currently used. That query reads the links directly from the database, which does not contain information about the order in which these links occur on the page, and unconditionally orders the results by title of the linked-to page. Lupo 22:31, 11 March 2010 (UTC)
Ok, I see. 50 seems more than enough. Thanks. -- User:Docu at 22:38, 11 March 2010 (UTC)

Category names starting with "Category:"

It seems somewhat frequent that people add categories as [[Category:Category:''category name'']]. Currently it's possible to do this through HotCat, e.g. diff at File:Linderudkollen2.jpg.

Not sure if these are usually added by pasting categories into HotCat, but it happens frequently. My bot fixes them once in a while, but it could be worth changing HotCat to correct it directly. -- User:Docu at 09:17, 18 February 2010 (UTC)

A simple regex-replace would do it: input_field_value.replace(/^Category:/, ""); Sounds like a good idea. -- Krinkletalk 14:14, 11 March 2010 (UTC)
Not quite, because that wouldn't work on WMF wikis that have localized namespace names for the Category namespace. I'd like the code to be usable with as few changes as possible on other wikis, too. People just copy our code; various older versions are used at several other WMF wikis, and it's even used outside of the WMF world on MediaWiki installations. Would need some hacking to use hotcat_cnames_regexp instead of a hardcoded string "Category". But it's an idea... I'll see what I can do. (But it may take a couple of days.) Lupo 22:38, 11 March 2010 (UTC)
✓ Done. It also disallows (automatically removes) leading blanks and underscores. Lupo 23:27, 12 March 2010 (UTC)
Thanks. It seems to work. -- User:Docu at 00:00, 13 March 2010 (UTC)
And of course it had some mighty strange effects on IE8. Nothing is ever "simple" in cross-browser JavaScript development. :-( Anyway, it should work fine now also on that Microsoft contraption called IE8. Lupo 09:52, 14 March 2010 (UTC)