mediawiki.page.gallery: Various clean up and minor optimisations
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 13 Jul 2018 05:22:31 +0000 (22:22 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Fri, 13 Jul 2018 05:24:29 +0000 (22:24 -0700)
commit5eca3ca414e7cb1b440d6c723518e5d8ee25b163
tree8e668368d531b8f02167822b81d55b5fbb8c2537
parente81c2423de097008787e78410b9536befdeebcf0
mediawiki.page.gallery: Various clean up and minor optimisations

* Moved some variables to a lower scope more appropiate,
  to make it easier to understand what they are used for,
  and to reduce chances of mistakes in the future.

* Use push() instead of .length assignment.

* Use the same property for checks as for access ([0] vs length),
  also potentially faster, but nothing worth mentioning.

* Avoid duplicate $this.outerWidth(), expensive computation.

Bug: T88654
Change-Id: Ib03d05a5c6422afdec11c56360bd568bdb2633fb
resources/src/mediawiki.page.gallery.js