User talk:Magog the Ogre/cleanup.js/Archive 3

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
← Archive 2 Archive 3 Archive 4 →

category error

the script changed here [1] the correct Category:Uploaded by Jean-Pol GRANDMONT to the non-existing Category:Jean-Pol GRANDMONT, don't know why it happens, but it is wrong. I tried other images from the category with preview and the script do this repeatedly. Holger1959 (talk) 00:37, 16 April 2015 (UTC)

@Holger1959: ✓ Done Magog the Ogre (talk) (contribs) 21:37, 28 April 2015 (UTC)

very small request

Hello Magog the Ogre, can you please remove the whitespace at =={{int:filedesc}}== and =={{int:license-header}}==. It would be a bit inconsistent to the "official" one. GreetingsUser: Perhelion (Commons: = crap?)  17:02, 28 April 2015 (UTC)

I re-inserted the spaces as IMHO is makes it more clear for newbies. --Leyo 20:31, 28 April 2015 (UTC)
Hm* I ever remove it, I only understand this for normal text. Where it is also in En. normal to remove the whitespaces. Then we need a consensus? It makes no sense that 2 scripts (+ the standard Uploadform/UploadWizard) do the contrary and reverting the other.User: Perhelion (Commons: = crap?)  20:40, 28 April 2015 (UTC)

Automatic summary again

Hello Magog the Ogre, this feature is not working as expected. It always add his own one in all versions, if the only changes are by myself (which is a bit unnerving in the long run). RegardsUser: Perhelion (Commons: = crap?)  22:07, 29 April 2015 (UTC)

@Perhelion: I don't understand what you're saying. Magog the Ogre (talk) (contribs) 22:11, 29 April 2015 (UTC)
I mean "cleanup using [[User:Magog the Ogre/cleanup.js|cleanup v2]]" is added although this is in effect not true (this in the JS and TS version). Would it be possible to make a better check? PS: I mean in effect a really check can only be done with Ajax!? But in the first time it would be sufficient if the script only apply on the current text if the script has the text really/self changed.User: Perhelion (Commons: = crap?)  22:15, 29 April 2015 (UTC)
PPS: The strange thing is that this is only sometimes. I think I must do give you a more specific report!?User: Perhelion (Commons: = crap?)  22:35, 29 April 2015 (UTC)
What I noticed for the toollabs version is that any existing edit summary (e.g. from HotCat) is replaced. This is not the case for the JS version. --Leyo 23:01, 29 April 2015 (UTC)
@Leyo: ✓ Done.
@Perhelion: I'm still not sure what you're asking. Did I just address it with the fix I made for Leyo? Magog the Ogre (talk) (contribs) 01:56, 30 April 2015 (UTC)

@Perhelion: Formuliere bitte Dein Anliegen auf Deutsch. Ich werde das dann gerne für Dich übersetzen. (I am asking Perhelion to comment in German and I am offering to translate his comments into English.) --AFBorchert (talk) 14:45, 30 April 2015 (UTC)

Danke, ich bin zurzeit aber etwas deprimiert.User: Perhelion (Commons: = crap?)  17:00, 30 April 2015 (UTC)
Das tut mir sehr leid zu hören, Perhelion. Hoffentlich geht es Dir bald besser. Wenn Du auf das Angebot zurückkommen möchtest, pinge mich einfach an. (Perhelion is feeling down at the moment. I've asked Perhelion to ping me when he wants to get back to my offer.) --AFBorchert (talk) 17:40, 30 April 2015 (UTC)
@AFBorchert vielen Dank, mir gehts besser. @Magog the Ogre Ich weiß nun was es ist. Ich benutze u.a weitere Cleaning-Tools (z.B. autoFormatter per Fliegelflagel von Schnark) welches die letzte Leerzeile löscht. Dein Tool fügt am Ende wieder eine an und sieht dies als "eigene" Verbesserung!? So schlage ich vor, das Hinzufügen einer Leerzeile am Ende für einen Summary-Eintrag zu ignorieren!?User: Perhelion (Commons: = crap?)  16:46, 2 May 2015 (UTC)
Translation: @Magog the Ogre: Now I know what this is about. I am using cleaning tools (like, for example, autoFormatter via Fliegelflagel by Schnark) that remove the trailing empty line. Your tool re-adds it again and considers this as its “own” improvement!? I suggest to avoid the addition of an empty line at the end for the summary. --AFBorchert (talk) 22:11, 2 May 2015 (UTC) (link added by me)
The problem seems only at the JS-version on executing "cleanup after editing" (which can sometimes useful, and the TS seems don't do this!?). But as I'm now aware of this behavior I can handle this (so it's your decision what is to do). But let me make an last declaration, an real check for change need Ajax (as the TS version it does) and current text "same time". But as far I know, you don't like the JS-version anymore. :-/ It would be good if you can make a short description of the 3 versions of "cleanup" (and maybe give it a proper name!?). (Danke AFBorchert für deine Unterstützung, ich kann/möchte es dir aber nicht zumuten soviel Text zu übersetzen. ^^ Evtl. kannst du ja Grammatik korrigieren?). LG and best regardsUser: Perhelion (Commons: = crap?)  11:19, 3 May 2015 (UTC)
Hallo Perhelion, um die Grammatik zu korrigieren, müsste ich den Sinn verstehen und das fällt mir zugegebenermaßen bei Deinen englischsprachigen Texten recht schwer. Mein Problem ist hier auch, dass ich die hier zum Einsatz kommenden Werkzeuge nicht kenne und somit auch kaum erraten kann, was Du gerne zum Ausdruck bringen möchtest. Wenn Du willst, kann ich gerne hier noch den einen oder anderen Punkt für Dich übersetzen. Viele Grüße, AFBorchert (talk) 15:57, 3 May 2015 (UTC)

┌───────────────┘
@Perhelion: If you want AJAX, please add the following script to Special:MyPage/common.js:

mw.hook('gadget.magog.cleanup').add(function() {
    addCleanupFunction("fast_cleanup", fast_cleanup, "cleanup AJAX");
});

You can change the last function argument to any text you'd like to identify it. Magog the Ogre (talk) (contribs) 16:40, 3 May 2015 (UTC)

Error with handling dates

i found at this file that when you use cleanup.js the script tries wrongly to replace a date string with a template.

1908-02-01 in this case is part of the filename and it is linked in |other_versions=<gallery>File:1908-02-01 Centralheizungswerke…. The script changes it to …File:{{Date|1908|02|01}} Centralheizungswerke… which will break the file display in the gallery tags. It also tried to replace the correct [[Category:1908-02-01]] with [[Category:{{Date|1908|02|01}}]]. Perhaps it is possible to restrict the "replace dates" function to the date field only?

@Leyo: as Magog is currently not available, maybe you can take care? Holger1959 (talk) 15:38, 25 May 2015 (UTC)

I don't have the JS skills that would be required to fix this issue. --Leyo 15:55, 25 May 2015 (UTC)
ok, only thought so. I will wait for Magog then and be careful with date-filenames in the meantime. Holger1959 (talk) 16:55, 25 May 2015 (UTC)

A second issue with dates I wondering about: for example the date standard 09.02.1979 (in De) get not converted.User: Perhelion (Commons: = crap?)  09:50, 3 June 2015 (UTC)

$.escapeRE → mw.RegExp.escape

{{Editprotected}} Hello Magog the Ogre,

Could someone update this script to not use the deprecated $.escapeRE? See fix example. All my scripts breaks run due this error Uncaught TypeError: $.escapeRE is not a functionUser: Perhelion (Commons: = crap?)  11:21, 7 July 2015 (UTC)

✓ Done - User:Rillke, can you please verify? --Sreejith K (talk) 15:37, 7 July 2015 (UTC)
I guess Magog the Ogre isn't around so I have permission to edit the script? The explicit dependency to mediawiki.RegExp is missing, although this shouldn't be an issue for most of the people. -- Rillke(q?) 21:21, 7 July 2015 (UTC)
I strongly suggest yes, please do it. It's a wiki. Thank you.User: Perhelion (Commons: = crap?)  08:11, 11 July 2015 (UTC)

error with handling dates (2)

also see User_talk:Magog_the_Ogre/cleanup.js/Archive_3#Error_with_handling_dates

Hello Magog the Ogre, can you please have a look at File:2012-02-22-Fotoflugkurs-Cuxhaven-Einsamer-Schütze-182-a.jpg, and then try your "cleanup JS"? On preview you see that in the "author" line a filename is wrongly changed. Hopefully you find a way to fix. Holger1959 (talk) 22:57, 24 July 2015 (UTC)

I do not maintian this code anymore. I keep it for legacy reasons only. Please use the TS version. Magog the Ogre (talk) (contribs) 23:09, 24 July 2015 (UTC)

Special:Diff/103635476 created a duplicate argument in a template. Could you check if there are (many) other such cases in the above-mentioned category? --Leyo 10:44, 14 April 2016 (UTC)

I see this and I've located the problem, but the fix isn't easy on my laptop, so it may be a while. Magog the Ogre (talk) (contribs) 00:40, 2 May 2016 (UTC)

OTRS template

@Magog the Ogre: Is there any way the OTRS template could be placed under the Summary section on the Permissions line when using User:Magog_the_Ogre/cleanup.js ? It's currently placed in the License sections which is technically not true, just trying to make things more consistent. Thank you Mlpearc (open channel) 16:31, 2 April 2016 (UTC)

@Leyo, Sreejithk2000: do you have any objections? I would do this on the Javascript version. Magog the Ogre (talk) (contribs) 23:53, 11 April 2016 (UTC)
No, I don't. --Leyo 06:48, 12 April 2016 (UTC)
MediaWiki:Gadget-PermissionOTRS.js adds it in Information template as a permission. So I agree with the change suggested. --Sreejith K (talk) 15:31, 12 April 2016 (UTC)
I've seen this request and I'll work on it. I will do it in JS because doing it by bot in the TS version will upset users who intentionally put the tag in another field. Magog the Ogre (talk) (contribs) 00:39, 2 May 2016 (UTC)

You may want to consider also moving {{LicenseReview}} into the permission field. Kelly (talk) 08:15, 26 May 2016 (UTC)

 Oppose, it best fits into the license section. --Leyo 08:39, 26 May 2016 (UTC)

n/a

What about having “n/a” changed into {{unknown|author}} by the script? See insource:/| *author *= *n\/a/i. --Leyo 10:50, 18 April 2016 (UTC)

I will put this into the TS (i.e., bot) version once I can work out my workspace issues. Magog the Ogre (talk) (contribs) 00:43, 2 May 2016 (UTC)
@Leyo: ✓ Done Magog the Ogre (talk) (contribs) 17:25, 12 June 2016 (UTC)
Thank you. Of the 153 remaining occurrences, many are inside nowiki tags or “n/a” is followed by other text. --Leyo 20:57, 12 June 2016 (UTC)
I was directed here after leaving a message on Magog's talk page. I'm not sure that changing "N/A" to "{{unknown|author}}" in author fields is such a great idea, because the term "N/A" is ambiguous. Sometimes "N/A" means "not available" (in which case it's probably safe to assume that the author really is unknown) but sometimes it means "not applicable", meaning that there is no meaningful sense in which the resource can be attributed to a particular author. That is, for the second case, the author is not unknown; rather, it is known that there is no author. Since there is no way for a bot to distinguish between the two senses of "N/A", I don't think these authorship tags should be changed automatically. I think it would be a good idea to undo the changes recently made by Magog's bot. —Psychonaut (talk) 15:02, 13 June 2016 (UTC)
@Leyo: can you please comment? Magog the Ogre (talk) (contribs) 15:18, 13 June 2016 (UTC)
Could you please list a few examples? I assume this case occurs quite rarely. In any case, “n/a” needs to be eliminated from the Author field since—among other reasons—it is neither i18ed nor easily understandable. --Leyo 22:24, 13 June 2016 (UTC)
Under Swedish law, the author is someone who contributes something to the file which meets certain quality conditions. If the file lacks such quality, then it is more correct to change "n/a" into "none". For example, if a logo has been correctly tagged as {{PD-textlogo}}, then the logo doesn't have an author under Swedish law. --Stefan2 (talk) 22:55, 13 June 2016 (UTC)
Stefan2 beat me to it—works that do not cross the threshold of originality do not have authors. If I scan in an isolated word or phrase from a book or newspaper, and upload this as an image here, then it doesn't make sense to include any authorship information. (Simple letterforms aren't subject to copyright, so I can't credit the font designer as the author. Words, names, and short phrases aren't subject to copyright, so I can't credit the author of the book or newspaper article as the author. And the rote act of scanning doesn't contribute any copyrightable content, so I can't credit myself as the author.) Contrary to what you say, Leyo, I don't think cases like these are very rare.
I agree that instances of "N/A" should be replaced with an internationalized message, though which message to use is context-dependent. Sometimes it should be an internationalized "unknown" and sometimes it should be an internationalized "none". This determination usually needs to be made on a case-by-case basis, though there are some heuristics which could be used to automatically handle the more obvious cases. (For example, if the author is listed as "N/A" but the page also contains a {{PD-text}} or {{PD-shape}} template, then it can be assumed that "N/A" means "none".) —Psychonaut (talk) 12:42, 14 June 2016 (UTC)
I do not agree with either Stefan or Psychonaut that ineligible works don't have authors. Every work has an author, it just might not be creative.
The problem is that N/A is can actually mean several different things in English (unlisted but probably applicable too: not any). IMHO none of these should ever be used on an author field, and unknown is a good enough approximation.
But I admit I don't feel terribly strongly about this. Magog the Ogre (talk) (contribs) 23:11, 14 June 2016 (UTC)
Every work has an author, but a PD-textlogo isn't a work as a PD-textlogo doesn't satisfy the quality conditions of works. --Stefan2 (talk) 23:20, 14 June 2016 (UTC)
Magog, who would you list as the author in the scenario I described? (That is, a scan of a single word or name from running text in a book or newspaper.) —Psychonaut (talk) 07:02, 15 June 2016 (UTC)
@Psychonaut: I think that's an edge case. How often do people scan a single letter in a book and upload it to Commons? I have literally never seen that happen. Every time I can remember seeing a PD-textlogo, it's had an author of some sort - corporate or otherwise. Are you really going to say that this file doesn't have an author? Magog the Ogre (talk) (contribs) 01:32, 16 June 2016 (UTC)
Even with single letters or words, it happens often enough; you can see some examples at Category:ß. I've personally uploaded scans consisting of nothing but a person's name, in order to demonstrate a disputed spelling from reliable sources. And no, I am not claiming that every image tagged as being in the public domain due to simplicity has no author. My only argument has been that those images which have such a PD tag, and which the uploader has actually or presumably marked as having no author, should not be retagged as having an "unknown" author. —Psychonaut (talk) 07:56, 16 June 2016 (UTC)

┌─────────────────────────────────┘
@Psychonaut: each one of the images in that category has an author. Nevertheless, I can remove this functionality if you still believe it causes trouble. I try to make the bot only do non-controversial changes. Does anyone have any better ideas? Magog the Ogre (talk) (contribs) 02:39, 17 June 2016 (UTC)

Yes, I think the functionality should be changed or removed. As for better ideas, how about searching for media with "N/A" authors and then leaving a message on the uploader's user talk page pointing out the problems with this term (i.e., that it's ambiguous and not internationalized) and suggesting that they replace it with {{unknown|author}} or {{none|author}} as appropriate? (Someone would need to create the latter template; I'm not familiar with the markup syntax.) —Psychonaut (talk) 08:36, 17 June 2016 (UTC)
✓ Removed Magog the Ogre (talk) (contribs) 03:23, 20 June 2016 (UTC)

More deprecated vars + feature

Hello Magog the Ogre, I've made some syntax cleanup and JSHint validity:[2] (you have really big work done on this).

I removed deprecated wgScript and getParamValue and (some other) put few config.get together, so there are no global var's needed anymore. (It is also recommended to indent with tab, after the MediaWiki JS Coding conventions. So I would be happy if you insert this code. Best regards User: Perhelion 10:09, 24 May 2016 (UTC)

@New feature: Because my toolbox navigation is nearly 2 pages long and this script adds 5 or more links to it in randomly order. So I added also his own section (which is inserted only in one go DOM access, not for every link). User: Perhelion 11:15, 24 May 2016 (UTC)

@Perhelion: first off, whoever recommended the use of tabs for whitespace should be slapped with a wet trout. Anyway, this code is actually a complete mess so any improvements are welcome. Feel free to make changes if you see a need. Magog the Ogre (talk) (contribs) 17:47, 12 June 2016 (UTC)
Just to clarify, I took your changes anyway, because the whitespace wasn't a big deal. I forgot to add that sentence. Magog the Ogre (talk) (contribs) 00:04, 15 June 2016 (UTC)
Many thanks Magog, as I get the last years some more JS experience and I see your accommodating agreement, I'll try to improve the code more... fix personal script-fails. Friendly regards User: Perhelion 13:01, 19 June 2016 (UTC)

Commons Helper seems to have messed up the self template by putting half of it in the licensing section and half of it in the English-language description. Is there something you could improve here to identify and fix this situation? --Stefan2 (talk) 16:00, 13 June 2016 (UTC)

@Stefan2: I've informed Magnus but he is MIA. So far I've been using VisualFileChange to catch them by hand. I'd rather go this route for now as it involves less work for me. Magog the Ogre (talk) (contribs) 23:12, 14 June 2016 (UTC)
@Stefan2: I will look to see what I can do. I may just put them all into a category for manual fixing, or I may have the bot fix them, depending on which is easier. Magog the Ogre (talk) (contribs) 02:36, 17 June 2016 (UTC)
@Stefan2: ✓ Done [3] Magog the Ogre (talk) (contribs) 00:23, 26 June 2016 (UTC)

Small suggestion

Hello Magog the Ogre, can you please convert such code {{w|xxx|zzz}} to native Wiki syntax [[w:xxx|zzz]]⁉ Example: File: Lichtenstein.jpg I mean also {{w|xxx|zzz|ll}} can converted to [[:ll:xxx|zzz]]User: Perhelion 18:08, 12 August 2016 (UTC)

 Not done this is a stylistic choice which many editors prefer. In fact, I once had someone ask me to do the opposite. Magog the Ogre (talk) (contribs) 19:52, 13 August 2016 (UTC)
There is definitely no usefully reason for this, except of "stylistic choice". It is only ongoing waste of server resources... and spoof of the own (native) Wiki-syntax.User: Perhelion 19:25, 15 August 2016 (UTC)
This is a micro-optimization. Magog the Ogre (talk) (contribs) 02:37, 16 August 2016 (UTC)

Date template

Hello Magog the Ogre, I mean this change is not needed, because the text after the date get already correct ignored (for the automatic formation)⁉ User: Perhelion 16:01, 7 September 2016 (UTC)

PS: Or for simply example 1911.06.06. get to {{Date|1911|06|06}}.. User: Perhelion 11:08, 8 September 2016 (UTC)
"because the text after the date get already correct ignored (for the automatic formation)" - I'm sorry, I'm afraid I don't understand what you're saying. Why do you believe this is unnecessary? Magog the Ogre (talk) (contribs) 01:38, 9 September 2016 (UTC)
Hm okay (I'm a bit wondering that I must tell you that again), but I see now this "fix" only happen on the JS version (it seems both TS versions don't fix any date!). Simple version compare:normally withoutfix with template (result is it looks the same). The same is for template {{ISOdate}} for example 2014-03-02 01:05:07 get unnecessary to {{ISOdate|2014-03-02 01:05:07}}. So it is right you main support is only to the TS version? Greetings User: Perhelion 00:33, 10 September 2016 (UTC)
You just failed to answer my question and you just brought up a completely separate issue in your response. Please stick to one issue at a time, and please answer my question. Magog the Ogre (talk) (contribs) 17:03, 10 September 2016 (UTC)
No, that was my answer. It is unnecessary because there is no different in functional and display, what is there not understandable?? Okay maybe the Date and the ISOdate are completely separate issues (but I don't see this here). I give you also two links to the Date example, so I think you missed something? So if you not understand what I mean, what is the functional reason for the Date and the ISOdate? But actually I don't really care anymore, do what you think is right. I'm very sorry if I have missed something, I do not understand you (I think I look now some episodes of Little Britain - Fat Fighters).User: Perhelion 21:01, 10 September 2016 (UTC)
Except that it's not different. The information template cannot parse ISOdates unless they are exact. So if you try to stick "2011-03-11." into the date field, you will get exactly that, whereas "{{date|2011|03|11}}." will have the parsed date followed by a period.
With regards to the ISOdate thing, you are correct. This has always been a bug in the JS script. Magog the Ogre (talk) (contribs) 22:35, 10 September 2016 (UTC)
@Perhelion: this is now done. Magog the Ogre (talk) (contribs) 01:54, 20 October 2016 (UTC)
OK Thank you. User: Perhelion 18:12, 20 October 2016 (UTC)

Adding rule

@Magog the Ogre: Category:Uploaded with UploadWizard is no longer needed and should be removed from the filedescription page, as per CFD. Thank you --Steinsplitter (talk) 18:05, 17 October 2016 (UTC)

@Steinsplitter: is this somehow actual still needed? As we can see now this is doing by bots now. User: Perhelion 23:52, 27 November 2016 (UTC)
Adding it wouldn't hurt, i think. --Steinsplitter (talk) 12:22, 28 November 2016 (UTC)
Maybe Magog can merge it, I've added it here. User: Perhelion 14:00, 28 November 2016 (UTC)
@Perhelion: please merge intermediate edits into your script. Magog the Ogre (talk) (contribs) 01:18, 29 November 2016 (UTC)
✓ Done As we can see the Cat issue is now solved and can be removed again. @Magog: And yes I understand your claim, I fixed only the issue (bug) with an infinite loop (on a while (true) through Cats, but I can't say what was exactly the reason). User: Perhelion 12:12, 12 December 2016 (UTC)

Cleanup script has stopped working

Not sure why, but it quit working for me yesterday - is my common.js set correctly? Kelly (talk) 08:51, 28 April 2017 (UTC)

@Kelly: that is almost certainly due to an error in another script. Add ?debug=1 to the URL, and open the developer console, and it should tell you where the error is. Magog the Ogre (talk) (contribs) 02:33, 29 April 2017 (UTC)

Example of freezing

Sometimes the JS script is freezing (not often), here an example: File:TG Viktoria Augsburg.png Maybe you can comprehend and find the failure. -- User: Perhelion 16:19, 21 May 2017 (UTC)

That's definitely a bug. I'll have a look ASAP. Magog the Ogre (talk) (contribs) 05:11, 23 May 2017 (UTC)
This is done. Sorry it took so long. Magog the Ogre (talk) (contribs) 23:53, 4 July 2017 (UTC)

Bug with date-like part of URL

Please apply cleanup.js to File:Rice Ridge Fire Images2.jpg to reproduce the bug. --Leyo 10:31, 17 September 2017 (UTC)

@Leyo: ✓ Done Magog the Ogre (talk) (contribs) 03:30, 2 October 2017 (UTC)

Scans

What about implementing Template:Self-scanned, Template:Scan and Template:Photo scan? See e.g. Special:Diff/288078851 or Special:Diff/288078655. --Leyo 09:26, 19 February 2018 (UTC)

Uncategorized?

@Magog the Ogre: , Cleanup V2 added {{Uncategorized}} to already-categorized file. Phương Linh (talk) 04:31, 5 April 2024 (UTC)