MediaWiki talk:Gadget-LicenseReview.js
This script, LicenseReview, is a JavaScript gadget which can be enabled or disabled in your Preferences. The documentation page is located at Help:Gadget-LicenseReview. |
Gadget descriptions: LicenseReview: Helps license reviewers and administrators with reviewing files. [talk] |
i18n | Gadget translations:
no internationalisation required: |
Ipernity
Lemill Web Albums
OpenPhoto
iNaturalist
Scanned books, documents and ephemra
- Scans from the Internet Archive/unverified (1,584,567)
- Scans from Google Books/unverified (612)
Other reviews
- Unreviewed files from Bollywood Hungama (11)
- Filmitadka review needed (0)
- CC without license information (0)
- PD files for review (115)
- Tasnimnews review needed (12,654)
- Mehrnews review needed (1,810)
- Farsnews review needed (1,528)
- Nasimnews review needed (0)
- Khamenei.ir review needed (365)
- Mojnews review needed (0)
- Finna review needed (33,748)
- Unreviewed files from Pixabay (25)
- Unreviewed photos of GODL-India (15,547)
- Unreviewed photos of GWOIA (44)
- License review needed (76,048)
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)
- Done Awesome! Thank you! 4nn1l2 (talk) 13:48, 4 May 2020 (UTC)
- Thx! It's working special:diff/417126765.--Roy17 (talk) 17:51, 4 May 2020 (UTC)
- Thanks to both of you for improving the Workflow. // Eatcha (talk) 16:49, 5 May 2020 (UTC)
- Thx! It's working special:diff/417126765.--Roy17 (talk) 17:51, 4 May 2020 (UTC)
- this code has a flaw and causes this: special:diff/432441725. to prevent this, change the
Review.*\}
toReview[^}]*\}
, so the \}\} would match the first }} only.--RZuo (talk) 08:55, 4 August 2020 (UTC)- @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)- Why not use the non-greedy
\{\{ArrangedLicenseReview.*?\}\}
. // Eatcha (talk) 14:28, 4 August 2020 (UTC)- @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)
- 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)
- Done, @Roy17, RZuo, Eatcha, MGA73, and AntiCompositeNumber: please test! --Lucas Werkmeister (talk) 20:42, 6 August 2020 (UTC)
- Why not use the non-greedy
- @RZuo: Is it not the
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)
- 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)
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)
- This edit should give an idea of what to remove if it can't be fixed. --MGA73 (talk) 19:08, 4 August 2020 (UTC)
- 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)
- @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)
- 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)
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)
- 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)
- Done With this edit thanks to User:Acagastya. --MGA73 (talk) 17:15, 17 September 2020 (UTC)
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)
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)
- Don't we have a bot that should review those? --MGA73 (talk) 21:39, 22 June 2020 (UTC)
- @AntiCompositeNumber: How are User:iNaturalistReviewBot doing? --MGA73 (talk) 21:41, 22 June 2020 (UTC)
- I've made the changes that are required in User:AntiCompositeNumber/LicenseReview.js. --AntiCompositeNumber (talk) 19:06, 9 September 2020 (UTC)
Done @AntiCompositeNumber: Added! --MGA73 (talk) 19:25, 9 September 2020 (UTC)
PDM
[edit]Per this:
The script needs to be updated. New template is {{PDMark-owner}}. --MGA73 (talk) 17:26, 27 August 2020 (UTC)
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)
- 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)
- Done I added code for PDMark-owner and Cc-zero. See this edit. --MGA73 (talk) 18:41, 8 September 2020 (UTC)
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)
- 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)
- Done I made it non-greedy. See this edit. --MGA73 (talk) 18:41, 8 September 2020 (UTC)
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)
- 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)
- Thank you for the feedback, helping me fix the required elements, MGA73!
Acagastya (talk) 20:40, 10 September 2020 (UTC)
- Thank you for the feedback, helping me fix the required elements, MGA73!
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)
- 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)
- @Acagastya: Done please test to see if it works as it should. --MGA73 (talk) 17:01, 21 September 2020 (UTC)
- Seems like it is. Thanks, @MGA73:
Acagastya (talk) 08:46, 25 September 2020 (UTC)
- Seems like it is. Thanks, @MGA73:
- @Acagastya: Done please test to see if it works as it should. --MGA73 (talk) 17:01, 21 September 2020 (UTC)
iNaturalist
[edit]Seems can not match {{INaturalistreview}}, See [1]. (`・ω・´) (talk) 14:46, 9 March 2021 (UTC)
- Hi (`・ω・´)! It seems that the problem was that there were no license? --MGA73 (talk) 18:13, 2 April 2022 (UTC)
Add support to GWOIA template
[edit]{{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)
- Hi! As far as I can tell then adding a review to {{GWOIA}} have no effect. So we can't see if the file have been reviewed or not. I think that we either need to change the template to do something when reviewed or we need a new template like {{Flickrreview}}. So I think we should have a discussion first how a review should be made. I will start a discussion at Template talk:GWOIA#GWOIA review. --MGA73 (talk) 10:28, 27 October 2024 (UTC)
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)
- 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)
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)
- Done I changed the script so now it will also work on {{YouTube Review}} (with a space in the name) and I also added it to the dropdown menu so it is no longer required to add the template manually before review. --MGA73 (talk) 10:07, 27 October 2024 (UTC)
- I also made a change to script to case-insensitive when looking for {{From YouTube}} to avoid Special:Diff/949835870. --MGA73 (talk) 12:37, 27 October 2024 (UTC)
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)
- @Tulsi: I do not understand the problem you talk about. Perhaps you can tell us more or add a screenshot? --MGA73 (talk) 10:50, 27 October 2024 (UTC)
- Checked and seems the issue is already been fixed. Kind regards, Tulsi 24x7 04:19, 14 December 2024 (UTC)
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)
- @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)- 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)
- @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)
- 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)
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:
- (maintain a list of copyright templates) match the last occurrence of a template in the list. insert template at a new line after it.
- if no template in the list can be matched, then match =={{int:license-header}}==. insert template at a new line after it.
- if license-header is not found, then match the first occurrence of [[Category . insert template at a new line before it.
- if no cat is found, then append.
- if license-header is not found, then match the first occurrence of [[Category . insert template at a new line before it.
- if no template in the list can be matched, then match =={{int:license-header}}==. insert template at a new line after it.
RZuo (talk) 12:28, 21 March 2023 (UTC)
- I agree it could be done better. For YouTubeReview I made the script add it below the {{YouTube CC-BY}}. For all the other it may require more work because there can be many combinations as you point out. --MGA73 (talk) 13:45, 27 October 2024 (UTC)
PD files for review
[edit]{{Edit request}} Please add support for the procedure at Commons:PD files § Where to ask for license 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)
- @Matrix: Per {{PDr}} the template is now depreciated and instead we have to use {{Lrw}}. So it seems this request is no longer relevant (because lrw is supported). --MGA73 (talk) 11:00, 27 October 2024 (UTC)
- Agreed, thanks for responding —Matrix(!) ping onewhen replying {user - talk? -
uselesscontributions} 13:56, 28 October 2024 (UTC)
- Agreed, thanks for responding —Matrix(!) ping onewhen replying {user - talk? -
Can't use the gadget
[edit]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)
- An obvious workaround on your part is not to use VisualEditor. A probably easy workaround on the gadget’s part is replacing with
$.get(mw.util.wikiScript('index'), { action: 'edit', 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)$.get(mw.util.wikiScript('index'), { action: 'submit', title: conf.wgPageName.replace(/ /g, '_') }, gotEditHTML);
- @Tacsipacsi: if you think this will fix problems perhaps you can add it? --MGA73 (talk) 11:03, 27 October 2024 (UTC)
- @MGA73: No, I can’t – I’m not an interface admin on Commons. —Tacsipacsi (talk) 22:52, 27 October 2024 (UTC)
- Sorry, I read the templates on you userpage wrong. --MGA73 (talk) 05:22, 28 October 2024 (UTC)
- @Tacsipacsi: I have been looking more into this and as I understand it the script will in most cases edit and save automatically and user may not even notice that edit was done differently. And after the page is saved then everything will be as usual for the user. And if user want to edit something else they can just do that as they normally edit. Is that how you see it too? --MGA73 (talk) 17:06, 28 October 2024 (UTC)
- Sorry, I read the templates on you userpage wrong. --MGA73 (talk) 05:22, 28 October 2024 (UTC)
- @MGA73: No, I can’t – I’m not an interface admin on Commons. —Tacsipacsi (talk) 22:52, 27 October 2024 (UTC)
- @Tacsipacsi: if you think this will fix problems perhaps you can add it? --MGA73 (talk) 11:03, 27 October 2024 (UTC)
Encounter a problem with the gadget
[edit]Hello, I've just encounter a problem while using the gadget. Please See Special:diff/914359187. I've just clicked on license+
to mark a file as reviewd, but it faild with the wrong edit. Thanks. –TANBIRUZZAMAN (💬) 01:09, 22 August 2024 (UTC)
- Fixed @Tanbiruzzaman: I just tested after I updated per MediaWiki_talk:Gadget-LicenseReview.js#Problem_with_youtube_review and the result is that the script now add a review template per Special:Diff/949818687. It also changes the {{!}} but per https://commons.wikimedia.org/wiki/MediaWiki:Gadget-LicenseReview.js#L-140 the script is supposed to do that. So the problem should be fixed now. (Off topic: I could not locate the snip in the video). --MGA73 (talk) 11:17, 27 October 2024 (UTC)
http vs https
[edit]Hello! I just noticed that the script says http in a number of places instead of https. Can anyone think of a reason not to change to https? MGA73 (talk) 17:11, 28 October 2024 (UTC)
- Support changing to https. RoyZuo (talk) 09:43, 29 October 2024 (UTC)
Done Thank you for your reply. --MGA73 (talk) 12:41, 3 November 2024 (UTC)
Thank you text window is outside screen
[edit]The thank you text is sometimes located so low that it is not visible and I have to scroll down to see it. At least for me. Does anyone else have the same problem?
If yes perhaps we could add something like this to make the window visible:
$('#mw-licensereview-add').dialog({
position: { my: 'center', at: 'center', of: window },
buttons: { Ok: function () {
if (gotResult) document.editform.submit();
Or perhaps someone have a better idea? MGA73 (talk) 17:52, 1 November 2024 (UTC)
- I added the code but because of the "scrollTop" code in another part of the code it still does not always work. So I think we may need a tiny delay. So I will also add a setTimeout(function() delay. --MGA73 (talk) 12:45, 3 November 2024 (UTC)