MediaWiki talk:Gadget-LicenseReview.js

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

Remove ArrangedLicenseReview automatically[edit]

{{Edit request}} Currently User:Eatcha's bot removes it. It can be done by the script.

Add the following line after line 138. tb1.value = tb1.value.replace(/\{\{ArrangedLicenseReview.*\}\}/g, );

Refer to history of File:李佳芯.jpg for an example.--Roy17 (talk) 13:30, 4 May 2020 (UTC)[reply]

✓ Done Awesome! Thank you! 4nn1l2 (talk) 13:48, 4 May 2020 (UTC)[reply]
Thx! It's working special:diff/417126765.--Roy17 (talk) 17:51, 4 May 2020 (UTC)[reply]
Thanks to both of you for improving the Workflow. // Eatcha (talk) 16:49, 5 May 2020 (UTC)[reply]
this code has a flaw and causes this: special:diff/432441725. to prevent this, change the Review.*\} to Review[^}]*\}, so the \}\} would match the first }} only.--RZuo (talk) 08:55, 4 August 2020 (UTC)[reply]
@RZuo: Is it not the ArrangedLicenseReview.*\} that is the problem here? If you see special:diff/417054424 then the script did not remove too much. --MGA73 (talk) 10:34, 4 August 2020 (UTC)[reply]
Why not use the non-greedy \{\{ArrangedLicenseReview.*?\}\}. // Eatcha (talk) 14:28, 4 August 2020 (UTC)[reply]
@Eatcha: Non-greedy is fine with me. I was only trying to find out what part of the code that was the problem. --MGA73 (talk) 14:58, 4 August 2020 (UTC)[reply]
That would be my fix as well. I did that in User:AntiCompositeNumber/LicenseReview.js (as well as updating some strings). Tested here. Could someone merge those changes into this script? --AntiCompositeNumber (talk) 20:04, 4 August 2020 (UTC)[reply]
✓ Done, @Roy17, RZuo, Eatcha, MGA73, and AntiCompositeNumber: please test! --Lucas Werkmeister (talk) 20:42, 6 August 2020 (UTC)[reply]

License migration[edit]

The code include stuff about license migration. What does the code actually do?

Per Commons_talk:License_Migration_Task_Force#Restart_2020 we still have files that needs to be fixed. Atm there are about 10 k. But the script does not seem to be useful when I check those files. --MGA73 (talk) 21:26, 20 June 2020 (UTC)[reply]

It's not a complaint. I'm just trying to find out how to use it (or improve it). --MGA73 (talk) 21:37, 20 June 2020 (UTC)[reply]

The number of files in Category:License migration candidates and subcategory is down to about 5k files. So if no one wants to or know how to fix the script I suggest that we remove the code to make the script more simple. --MGA73 (talk) 18:14, 4 August 2020 (UTC)[reply]

This edit should give an idea of what to remove if it can't be fixed. --MGA73 (talk) 19:08, 4 August 2020 (UTC)[reply]
Better get someone to fix the code or at least identify where the code stalls. It doesn't seem to be able to detect the license migration at all. --Denniss (talk) 19:16, 4 August 2020 (UTC)[reply]
@Denniss: yes but it seems we lack users to maintain the script and if license migration is not something many users care about its better to keep the code simple. At least we could use better description to help others understand what the different parts of the script does. --MGA73 (talk) 16:36, 5 August 2020 (UTC)[reply]
I added headings where the code starts and ends as far as I can tell. There are 2 blocks/parts. See this edit. --MGA73 (talk) 18:41, 8 September 2020 (UTC)[reply]

✓ Done I added div.LMR to activate the script and a div class to the template. So now the script will let users work on the files. --MGA73 (talk) 21:09, 11 September 2020 (UTC)[reply]

This edit did not work as planned. Problem is the template ends with 4x} and script can't place the code the right place. --MGA73 (talk) 21:34, 11 September 2020 (UTC)[reply]
✓ Done With this edit thanks to User:Acagastya. --MGA73 (talk) 17:15, 17 September 2020 (UTC)[reply]

As mentioned above MediaWiki:LicenseReview.js can be used to do a license migration review of files. If you go to a file that is a candidate or need review you will see some buttons and boxes where you can select the option you want in a drop down menu. Then you can click save. If you want you can add an extra edit summary before you save. --MGA73 (talk) 17:23, 17 September 2020 (UTC)[reply]

Needs support for {{INaturalistreview}} added[edit]

The {{INaturalistreview}} template works similar to other review templates, but isn't supported by the LicenseReview gadget. Kaldari (talk) 16:33, 22 June 2020 (UTC)[reply]

Don't we have a bot that should review those? --MGA73 (talk) 21:39, 22 June 2020 (UTC)[reply]
@AntiCompositeNumber: How are User:iNaturalistReviewBot doing? --MGA73 (talk) 21:41, 22 June 2020 (UTC)[reply]
I've made the changes that are required in User:AntiCompositeNumber/LicenseReview.js. --AntiCompositeNumber (talk) 19:06, 9 September 2020 (UTC)[reply]

✓ Done @AntiCompositeNumber: Added! --MGA73 (talk) 19:25, 9 September 2020 (UTC)[reply]

PDM[edit]

Per this:

The script needs to be updated. New template is {{PDMark-owner}}. --MGA73 (talk) 17:26, 27 August 2020 (UTC)[reply]

I think we need to change here:

// Change license
		LicenseReviewChange: function () {
...			<option value="PD">No known restrictions (Flickr only)</option>\
ADD:                    <option value="PDMo">PDMark owner (Flickr only)</option>\
...
					case 'PD' :
						doReplacement('{{Flickr-no known copyright restrictions}}', 'Flickr-no known copyright restrictions');
						break;
ADD:					case 'PDMo' :
ADD:						doReplacement('{{PDMark-owner}}', 'Flickr-PDMark owner');
ADD:						break;
...

Anything else? --MGA73 (talk) 18:29, 6 September 2020 (UTC)[reply]

I think we also need Cc-zero as an option. I think this change works.
I edited a file to PDMark owner and to Cc-zero (I know edit summary was bad). And after that a review. --MGA73 (talk) 19:20, 6 September 2020 (UTC)[reply]
Also see Commons_talk:License_review#PDM_and_SD. --MGA73 (talk) 10:46, 7 September 2020 (UTC)[reply]
✓ Done I added code for PDMark-owner and Cc-zero. See this edit. --MGA73 (talk) 18:41, 8 September 2020 (UTC)[reply]

YouTube review fail if reversed[edit]

Not really related to the edits above but it seems that YouTubereview fails if templates are reverser. See this edit. I got same result then reversed at got better result. If we are going to fix script perhaps we can fix that too. --MGA73 (talk) 14:16, 7 September 2020 (UTC)[reply]

Should we reverse the code in the regex from
\{\{YouTubeReview(.+?|)}}/ig,
to
\{\{YouTubeReview(|.+?)}}/ig,
or make it
\{\{YouTubeReview(.*?|)}}/ig,
(twice) --MGA73 (talk) 14:28, 7 September 2020 (UTC)[reply]
Blah blah blah talking to myself :-) It seems that this edit based on ".*?" instead of ".+?" works based on this edit and this edit. --MGA73 (talk) 14:34, 7 September 2020 (UTC)[reply]
✓ Done I made it non-greedy. See this edit. --MGA73 (talk) 18:41, 8 September 2020 (UTC)[reply]

Pixabay support[edit]

I have added support for files from Pixabay. I would hope people try and give me feedback if the script is working as inteded or not. Please see the patch. And if it looks all right, can you please update the script?
Acagastya (talk) 22:31, 9 September 2020 (UTC)[reply]

✓ Done @Acagastya: Thank you. I tested and some fixes was added so I copied the latest version of the script instead of the diff above. --MGA73 (talk) 20:35, 10 September 2020 (UTC)[reply]
Thank you for the feedback, helping me fix the required elements, MGA73!
Acagastya (talk) 20:40, 10 September 2020 (UTC)[reply]

Keyboard shortcuts[edit]

Can you please add the access keys + and - for license+ and license-? It will make it easier for users to do things by keyboard shortcuts. See this diff.
Acagastya (talk) 06:04, 19 September 2020 (UTC)[reply]

I think it sounds like a good idea. I will wait a little before I add it in case someone can think of a good reason not to do it. --MGA73 (talk) 09:18, 19 September 2020 (UTC)[reply]
@Acagastya: ✓ Done please test to see if it works as it should. --MGA73 (talk) 17:01, 21 September 2020 (UTC)[reply]
Seems like it is. Thanks, @MGA73:
Acagastya (talk) 08:46, 25 September 2020 (UTC)[reply]

iNaturalist[edit]

Seems can not match {{INaturalistreview}}, See [1]. (`・ω・´) (talk) 14:46, 9 March 2021 (UTC)[reply]

Hi (`・ω・´)! It seems that the problem was that there were no license? --MGA73 (talk) 18:13, 2 April 2022 (UTC)[reply]

Add support to GWOIA template[edit]

It is requested that an edit or modification be made to this protected page.
Administrators: Please apply <nowiki> or {{Tl}} to the tag after the request is fulfilled.

Tacsipacsi

{{GWOIA}} template is not currently supported by this gadget, see also their cat. I think currently there is not bot support this template. Stang 11:35, 24 January 2022 (UTC)[reply]

Problem with youtube review[edit]

Hi! It seems that something does not work. See Special:diff/646124528. Problem is that it adds "id=rom YouTube". I checked an old file File:Ashi Singh.gif and that seems to have the same problem. Not quite sure how to fix because if there is a time included in the link then we miss that if we only add the id. @C1K98V: that uploaded the file and tipped me. --MGA73 (talk) 18:18, 2 April 2022 (UTC)[reply]

I also made a post at Template_talk:YouTubeReview#How_to_indicate_id_and_time_of_screenshot_in_review. --MGA73 (talk) 18:21, 2 April 2022 (UTC)[reply]

Another problem is that script does not work when it does not say {{YouTubeReview}} but {{YouTube Review}} (with a blank). I tried to fix but had to restore (see Special:Diff/674000584) because my change made the review add "desc" where it should not per Special:Diff/673999968.

If there is no {{YouTubeReview}} the script ask to add a template but "YouTubeReview" is not on the drop down list. That would be nice too. --MGA73 (talk) 08:20, 13 July 2022 (UTC)[reply]

Edit button[edit]

Hello, I noticed that the 'Edit' button interface goes a bit long downwards. It's not a problem though doesn't look good IMO. Could someone please fix it? Kind regards, — Tulsi 24x7 06:13, 10 August 2022 (UTC)[reply]

Flickr no source[edit]

Add support for {{Flickr no source}}, see [2] [3]. It would just be adding it as an replacement alternative on line 238. [[c maybe? :) Platonides (talk) 21:09, 23 August 2022 (UTC)[reply]

@Platonides: It seems like a good idea. I imagine you are thinking of adding something like "|({{(F|f)lickr no source.*?}})"? --MGA73 (talk) 19:36, 24 August 2022 (UTC)[reply]
Yes, exactly MGA73. In fact, the parens around the different options are not needed, I don't know why they are included in existing ones, but harmless. Platonides (talk) 21:34, 24 August 2022 (UTC)[reply]
@Platonides: ✓ Done. I was wondering about the parens but since it was used for the other options I thought perhaps it is made by someone to indicate that it is a "set" that belongs together. I changed and tested with Special:Diff/684935762. It seems to work as it should. --MGA73 (talk) 05:40, 25 August 2022 (UTC)[reply]

Position of insertion[edit]

instead of appending, the "passed" template should be inserted somewhere before the first occurrence of [[Category . i think the logic can be like this:

  1. (maintain a list of copyright templates) match the last occurrence of a template in the list. insert template at a new line after it.
    1. if no template in the list can be matched, then match =={{int:license-header}}==. insert template at a new line after it.
      1. if license-header is not found, then match the first occurrence of [[Category . insert template at a new line before it.
        1. if no cat is found, then append.

RZuo (talk) 12:28, 21 March 2023 (UTC)[reply]

PD files for review[edit]

It is requested that an edit or modification be made to this protected page.
Administrators: Please apply <nowiki> or {{Tl}} to the tag after the request is fulfilled.

Tacsipacsi

Please add support for the procedure at Commons:PD files § Where to ask for PD review. When a file has Category:PD files for review, ensure that tracking category is removed and subst:{{PDr}} is added (with an optional task to add a note to the talk page of the file concerned.) Matr1x-101 {user - talk? - useless contributions} 19:57, 18 May 2023 (UTC)[reply]

Can't use the gadget[edit]

It is requested that an edit or modification be made to this protected page.
Administrators: Please apply <nowiki> or {{Tl}} to the tag after the request is fulfilled.

Tacsipacsi

The screen is stuck at "The editor will now load. If you still see this message after a few seconds, please reload the page." when clicking on "license +".

In console, it is throwing up this error:

Uncaught TypeError: Cannot read properties of undefined (reading 'wpTextbox1')

    at Object.gotEditHTML [as success] (ext.gadget.LicenseReview-script-0.js:760:23)

    at fire (jquery.js:3223:31)

    at Object.fireWith [as resolveWith] (jquery.js:3353:7)

    at done (jquery.js:9627:14)

    at XMLHttpRequest.<anonymous> (jquery.js:9888:9)

I am using Visual Editor. Please advise. Robertsky (talk) 11:37, 10 February 2024 (UTC)[reply]

An obvious workaround on your part is not to use VisualEditor. A probably easy workaround on the gadget’s part is replacing
			$.get(mw.util.wikiScript('index'), {
				action: 'edit', title: conf.wgPageName.replace(/ /g, '_')
			}, gotEditHTML);
with
			$.get(mw.util.wikiScript('index'), {
				action: 'submit', title: conf.wgPageName.replace(/ /g, '_')
			}, gotEditHTML);
– this forces the traditional wikitext editor to be used for that particular request even if the user otherwise prefers VisualEditor or the 2017 wikitext editor. Of course, the good solution is making it compatible with VisualEditor, but that’s probably magnitudes more complicated than this workaround. —Tacsipacsi (talk) 01:59, 11 February 2024 (UTC)[reply]