Test edit

In order to prepare a test-run of the new created gallery-tool, please copy the content of User:Rillke/JSONListUploads.js to the front. Thank you. -- RE rillke questions? 18:12, 12 September 2011 (UTC)Reply

  Done. If the site blows up, well I'll know who to turn to. :) – Adrignola talk 20:34, 13 September 2011 (UTC)Reply
Too late whahaha. All admin's credentials stolen and you will not be able to login again. Thank you, again. :) -- RE rillke questions? 21:14, 13 September 2011 (UTC)Reply

{{Editprotected}} In order to handle the provided a link for other users' uploads, please copy the content of User:Rillke/JSONListUploads.js to the front. Thank you. -- RE rillke questions? 14:27, 14 September 2011 (UTC)Reply

  Done Jean-Fred (talk) 16:22, 16 September 2011 (UTC)Reply

Review / clean up edit

Hi,

Since people want this huge script to be live for all visitors, I'm working on reviewing it first for security and stability (since it would be ran for anonymous users that haven't opted in to this as well) In no particular order some of the things I fixed:

  • Wrapping the entire code in a closure to avoid local variable leakage to the global scope
  • Using protocol-relative urls for domains that support it (currently: upload.wikimedia.org and bits.wikimedia.org). That way people using the httpS:// connection gate-way will not get insecure requests, since the browser automatically resolves // to the current protocol. Aside from getting insecure content, some requests are not allowed cross-domain from https://commons.wikimedia.org http://commons.wikimedia.org for example.
  • Removing trailing whitespace
  • Most indention is with tabs, convert spaces to tabs where not
  • Declaring var statements at the top of a function in a few places. Remember that there is no such thing as block scope in javascript, only function scope. in getPagesCount() using
    "var gpc; if( .. ) gpc = ..; if ( .. ) gpc = ..;"
    instead of: "if( .. ) var gpc = ..; if( .. ) var gpc = ..; "
  • Apply good practices and resolve syntax warnings
    • Missing semicolon
    • Use strict comparison where possible for speed and accuracy
    • Don't declare the same variable name with var multiple times in the same scope. either drop the 'var' or pick a different variable name to avoid collisions. Seeing these var statements at the top may seem weird at first but that's exactly what JavaScript is doing for you if not already on run-time. When not already in your code they are magically hosted to the top of the current function scope. By declaring them there you avoid unexpected 'undeclared' errors or redefinition warnings about the same variable names.
    • Trailing comma in an array [1, 2, 3, 4, ]. Causes failure in IE. (in mdTagRecognization)
    • Trailing comma in object { foo: 1, bar: 2, }. Causes failure in IE.
    • Validating mostly JSHint.com now
  • Fix syntax error in several setTimeout's. There was: "setTimeout( function(){ foo(), 1000 } );" with the 1000 inside the function. This works because of the looseness in javascript. Avoid this by being more strict and inserting more semicolons, line breaks and indentation where it makes sense.
  • ReferenceError in nextTask(): isArray undeclared (fixed with $.isArray)
  • Performance:
    • Using .text() instead of .append() (which behaves like .html()) in createNfNodeSp(). .text() is also faster for performance.
    • Using the 'html' property in the object passed as second argument to $() instead of $( "", { .. } ).append( .. ) – when setting html. So like $( "", { html: .., .. } );
    • Passing a function by reference.
      • instead of wrapping like "bar( function(){ foo(); } )"
      • using simply "bar( foo )" where possible.
  • Readability:
    • Declare object literals with one key-value pair per line. Spaces is cheap and gets minified. Readability is priceless.
    • Renamed a few functions and variables to be more readable and less cryptic/obfuscated

These are the things I did, below are some things that should still be done:

  • Deobfuscate more variable names such as var ct, cls, ifs, nffs. No idea what some of those are supported to be.
  • Use canonical MediaWiki variables in comparisons (ie. wgCanonicalSpecialPageName === 'Listfiles' instead of regex-matching wgPageName). That makes it easier to programm (since those values won't change, whereas the display title ("ListFiles") could change in the future, the canonical id "Listfiles" will not). It also makes the code re-usable on other-language wikis (ie. as gallery on German Wikipedia, or a third party Commons-like wiki that isn't English)

Krinkletalk 03:35, 19 September 2011 (UTC)Reply

Thanks for the hints.

  • Concerning upload.wikimedia.org: Whether the image-content is digitally signed by the server or not ...
  • only function scope - thanks. I really did not know (coming from c++);
  • syntax error in several setTimeout's: Whoops. Silly mistake.
  • Using the 'html' property - something seems to be broken. No select.

I am going to apply the missing things to my copy at User:Rillke/JSONListUploads.js. Please use this copy if you like to make changes. Otherwise I have a pile of work again. Thanks -- RE rillke questions? 13:46, 19 September 2011 (UTC)Reply

I hope I added all your improvements to my copy at User:Rillke/JSONListUploads.js except Passing a function by reference., which I was unable to find. BTW, I don't like if (someVar == someConstantOrFunction). I started programming with VB and then I tried c++; Fortunately most compiles throw warnings when assigning values in if ()- clauses. But one time it crashed my computer while experimenting with windows hooks because I forgot one "=".
Additionally I fixed the broken "select>", and an error in mdExtractTags. You may wonder about the "md"-prefix. This will removed soon. They come from AjaxMassDelete, which merges itself in AjaxQuickDelete-Object. -- RE rillke questions? 15:07, 19 September 2011 (UTC)Reply
Please place a // INUSE in User:Rillke/JSONListUploads.js before attempting to edit in order to prevent edit-conflicts. Thank you. -- RE rillke questions? 16:31, 19 September 2011 (UTC)Reply

Ready? edit

Sorry, guys, but what are we waiting for to put this live? Rd232 (talk) 05:12, 4 October 2011 (UTC)Reply

If Krinkle has too many objections or just no time, feel free to remove the link to this tool from your js, and let's include this later. I am sure a lot of people are waiting at least for the MyUploads-Link to Special:ListFiles. -- RE rillke questions? 10:35, 4 October 2011 (UTC)Reply

i18n ? edit

Hello, how about some i18n for this script ? Unless I am mistaken, the "User uploads" link in the toolbox is displayed for every user and is defined in this script. Cheers, Jean-Fred (talk) 13:13, 27 November 2011 (UTC)Reply

The link-text is there. This script will not support i18n until it is "ready" and we can use MediaWiki messages to translate it. When we get the new MW-version a lot of work is to be done in i18n-area (not actually translating but rewriting scripts). -- RE rillke questions? 21:46, 27 November 2011 (UTC)Reply
oops, my mistake. I did look at MediaWiki:Gadget-MyUploads.js but somehow missed it. Then sure, let’s wait for it to be ready :-) Jean-Fred (talk) 09:18, 28 November 2011 (UTC)Reply

Script uses a non-existing special page as "host" which is served via HTTP 404 edit

... e.g. Special:MyGallery/Saibo. HTTP 404 is sent as response by the server since the special page is not available. That is factually wrong since it is the right page - if the tool is enabled. The problem is: some nasty browsers hijack 404 pages (prominently t-online's "Browser 6.0") and display their own error page which cause the script to non work at all. Can't we use e.g. MediaWiki:MyGallery as "host" which displays something like "Wait for the script to be loaded ... If you do not see a image gallery after waiting at maximum about one minute please click here: Special:ListFiles/Saibo to see a simple gallery". Cheers --Saibo (Δ) 03:07, 18 February 2012 (UTC)Reply

Commons:MyGallery is recognized by the script an should be now in all user's cache. Changing the link. -- RE rillke questions? 12:32, 18 February 2012 (UTC)Reply
Is there a way to display the same message on all subpages? -- RE rillke questions? 12:50, 18 February 2012 (UTC)Reply
Thanks, okay, but, the link on top of Special:ListFiles/Saibo links to Commons:MyGallery/Saibo which is a 404. Is there a reason for calling subpages at all?
No, I don't think there is a need for it to be a subpage. But there needs to be a way to change/pass the username for permalinks. Perhaps use a query string instead of modifying the pagename itself ? e.g. ?target=Krinkle. Also, to avoid the 404 issue one could use Special:BlankPage as base instead of a custom wiki page. That way it'll also work on other wikis without having to create this page everywhere (e.g. //commons.wikimedia.org/w/index.php?title=Special:BlankPage/UploadGallery&target=Krinkle and redirect from Special:BlankPage/MyUploadGallery). –Krinkletalk 09:10, 19 February 2012 (UTC)Reply
Do you mean as edit notice? Yes, afaik... somehow. --Saibo (Δ) 01:39, 19 February 2012 (UTC)Reply

All I know is if I middle click on https://commons.wikimedia.org/w/index.php?title=Special:MyGallery&withJS=MediaWiki:JSONListUploads.js&gUser=Jidanni the browser tab says No Such Special Page, until we click the browser tab to have a look. Jidanni (talk) 07:02, 5 February 2023 (UTC)Reply

Script issues edit

{{Edit request}} First a remark: I do not have installed this script in my common.js, and I do not have the intention to do this.

  • This script is one of the affected scripts containing or depending on jquery.badge which is going to be removed from MediaWiki code in near future.
  • When I go on Commons:MyGallery the title is displayed once as expected. But after loading the script with the button it suddenly appears twice.
  • Inside of the script there are still several references to User:Rillke/JSONListUploads.js and the related User:Rillke/Gallery tool (plus subpages). Wouldn't it be a good idea to move all the content of the latter to Commons:Gallery tool or similar and update all regarding references? BTW there is still User talk:Rillke/JSONListUploads.js.

— Speravir – 22:57, 16 November 2017 (UTC)Reply

  Done Hey Speravir, thank you much for pointing this out. I've done and fixed all points. -- User: Perhelion 13:19, 18 December 2017 (UTC)Reply

i18n (2) edit

{{Edit request}} Where I am may be found a template with translatable messages? Set of strings in the "i18n" section is completed?--Kaganer (talk) 00:06, 3 March 2019 (UTC)Reply

Hey Kaganer, the template looks like this:
i18n: {
		optUser: 'The user whose contributions are to be shown',
		optStartAt: 'Start listing from a specific date',
		optStartAtHowTo: 'Format:  YYYY-MM-DD<br> or, optionally<br>YYYY-MM-DD&nbsp;hh:mm:ss<br>or use the picker',
		optIntit: 'Files the user created new on Commons',
		optOverwrite: 'Files where the user overwrote an earlier version of the file',
		optRevert: 'Files the user reverted to an earlier version',
		optDeleted: 'Files which have been deleted',
		optTop: 'Filter by state of a file-revision. Old implies that the file has been overwritten',
		optHideRevs: 'Unselect to show all revisions the user uploaded',
		optCat: 'Filter by category',
		optCatHowTo: 'Fill in the category and hit enter.\nRemove your input when you do not want to filter by category',
		inCatPlaceholder: 'In category',
		gPagesPanel: 'Pages control panel. By design, it is undeterminable for the script how many uploads a user has before loading a complete list of them; however you can step through all uploads by clicking >>',
		statResultHelp: 'These are pure log-statistics of the user. Files may be deleted inbetween, or the revision history - shown on a file-description-page - has been manipulated by an administrator',
		filterHelp: 'To improve the performance, not all files are loaded. If you filter, you will probably get fewer results than you expect. To get all results, click on >> until a statistics-box shows up, then click on apply',
		filterHelp2: 'All files are loaded now so the filter-results are right'
}
-- User: Perhelion 19:42, 29 July 2019 (UTC)Reply

i18n: Russian (ru) edit

@Perhelion:   Done. See:

i18n: {
		optUser: 'Участник, чей вклад будут отображаться',
		optStartAt: 'Начать показ списка файлов с определённой даты',
		optStartAtHowTo: 'Формат:  ГГГГ-ММ-ДД<br> или, необязательно<br>ГГГГ-ММ-ДД&nbsp;чч:мм:сс<br>или используйте всплывающий календарик',
		optIntit: 'Файлы, первую версию которых загрузил на Викисклад участник',
		optOverwrite: 'Файлы, для которых участник перезаписал более раннюю версию файла',
		optRevert: 'Файлы, которые участник вернул к более ранней версии',
		optDeleted: 'Файлы, которые были удалены',
		optTop: 'Фильтр по состоянию версии файла. Значение «старые» подразумевает, что файл был перезаписан',
		optHideRevs: 'Снимите флажок, чтобы показать все загруженные участиником версии',
		optCat: 'Фильтр по категории',
		optCatHowTo: 'Заполните категорию и нажмите клавишу «enter».\nУдалите введённое значение, если не хотите фильтровать по категории',
		inCatPlaceholder: 'В категории',
		gPagesPanel: 'Панель управления страницами. Скрипт написан так, что заранее неизвестно, насколько велик объём загрузок участника, и где окончится список; однако вы можете пройти через все загрузки, нажав >>',
		statResultHelp: 'Это чистая лог-статистика участника. Некоторые файлы (промежуточные версии) могли быть удалены, или же история изменений, показанная на странице описания файла, могла быть обработана администратором',
		filterHelp: 'Для повышения производительности загружаются не все файлы. Если вы используете фильтры, то вы, вероятно, получите меньше результатов, чем ожидаете. Чтобы получить все результаты, нажмите на >>, пока не появится окно статистики, а затем нажмите кнопку «применить»',
		filterHelp2: 'Сейчас загружены все файлы, так что результаты соответствуют заданным фильтрам'
}

In my opinion, this list is not completed. Next labels and filter values also should be translated:

Filelist.
Version:
General help via Commons:Help Desk.
FAQ and known issues of this tool.
Export to gallery: Export the list of files currently matching the filter and loaded.
Change user, start date, sorting, view
Start at 
Invalid. Use YYYY-MM-DD
Sorting
Newest
Oldest
submit
Visible details
Details on hover
Filtering options?
Created
Overwrote
Reverted   
apply
Show Deleted
Show only the user's latest upload per file
select state - Top/Old
top - upload is current version of file
old - not current version of file
Page:  1 /?

--Kaganer (talk) 20:31, 31 July 2019 (UTC)Reply

  Done ./ru.js I've also made your proposals translatable, so you can now extend your translation. I'll create also a German translation later. -- User: Perhelion 19:31, 7 September 2019 (UTC)Reply
@Perhelion: I'm sorry, but i am don't see translatable page for extension... Currently all translations is a hardcoded. ---Kaganer (talk) 22:16, 8 September 2019 (UTC)Reply

Enhance images per page? edit

Hi, I do not know where else to write this - it would be extremely helpful if there would be an option like a dropdown menu to increase the numbers of images shown on one (most importantly: the first) page. I am a heavy uploader, and often I have to browse to the third page to find an image I uploaded some days ago. On the standard page of Commons, it is possible to increase to up to 500 images (in a vertical row in that case). Just an idea which many users might find extremely useful. Apart from that, thanks a lot for the great script. Regards, Pittigrilli (talk) 20:21, 26 October 2021 (UTC)Reply

Return to "JSONListUploads.js" page.