Jump to content

MediaWiki talk:Gadget-contribsrange.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Lowercase sigmabot III (talk | contribs) at 04:35, 14 September 2020 (Archiving 1 discussion(s) to MediaWiki talk:Gadget-contribsrange.js/Archive 1) (bot). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Still necessary

Is this entire gadget still necessary now that CIDR ranges are supported natively? I note that wildcards are permitted by this gadget. It might be a good idea to remove the functionality in this gadget which is presently unnecessary. --Izno (talk) 19:52, 22 November 2017 (UTC)[reply]

@Izno: This gadget groups edits by IP, while the native implementation doesn’t. For me the grouped version is more usable. This is, of course, subjective, but I think it’s enough to justify keeping this feature in the gadget. —Tacsipacsi (talk) 12:15, 12 April 2020 (UTC)[reply]

Interface-protected edit request on 25 December 2019

In the comment on line 21, please replace "These parameter soverride" with "These parameters override" (i.e. move the "s" to the other side of the space). Thanks, --DannyS712 (talk) 01:36, 25 December 2019 (UTC)[reply]

 Done Galobtter (pingó mió) 08:30, 25 December 2019 (UTC)[reply]

Spinner

Jon (WMF) changed the code so that it only tries to use the jQuery spinner if that’s already loaded. While this fix avoids null dereference, I don’t think it’s a good solution: if we want to show a spinner, we want to show it always, not just when it happens to have been loaded. Therefore I suggest changing

  if (mw.loader.getState('jquery.spinner') === 'ready' ) {
    $(spin).injectSpinner('prefixcontribs-spin');
  }

to

  mw.loader.using('jquery.spinner').then(function () {
    $(spin).injectSpinner('prefixcontribs-spin');
  });

which makes sure that the spinner always appears sooner or later. Thanks in advance, —Tacsipacsi (talk) 11:04, 13 September 2020 (UTC)[reply]

If
mw.loader.getState('jquery.spinner') === 'ready'
is not truthy than the next line will always throw a JS error (and was according to our production logs - a lot of errors! :)). Adding a dependency to
mw.loader.using('jquery.spinner')
is definitely the right solution, however you probably want to load it earlier in the script. If you are trying to display a spinner, it doesn't make sense to asynchronously show it - as that seems to defeat the purpose to me :) The spinner may display after the action the spinner is supposed to be displayed for as shown! Wrapping the whole code is one option, but ideally you'd wrap whatever begins the script e.g. the click of the UI button. Also consider not using jquery spinner for something so simple.
$('<img>').attr('src', urlOfCommonsSpinner ).appendTo(spin)
should work just as well without the overhead.Jon (WMF) (talk) 18:19, 13 September 2020 (UTC)[reply]
@Jon (WMF): jQuery.spinner is all about showing spinners, isn’t it? What could it do more complicated than showing a spinner? Yes, preloading the module would be even better, but I don’t know this script well enough to propose a good place for this preload. By the way, the image solution is asynchronous as well—the image needs to be loaded to show up. My favorite example is my local public transport company BKK’s timetable page: if you click on a destination, it shows a spinner GIF until the list of stops is loaded, but loading the spinner is a significant fraction of this time, so I often see the “toltes-loading” alt text (“töltés” meaning “loading” in Hungarian) for longer time than the actual spinner. —Tacsipacsi (talk) 23:01, 13 September 2020 (UTC)[reply]