Commit graph

7 commits

Author SHA1 Message Date
Timo Tijhof 1f26153a5d collapsibleTabs: Clean up and simplify code
* Rename 'rtl' to 'isRTL' and use DOM to compute its value.
* Document code with JSDuck similar to other extensions.
* Remove unused 'prevElement' property. Not used in Vector
  nor anywhere else in Wikimedia Git.
* Make 'boundEvent' property private. Not used anywhere in
  Wikimedia Git outside this file.

* Simplify 'instances' tracking.
  The jQuery object stored in this property wasn't used beyond
  calling each(). Convert to a plain array.
  Preserve and re-use the jQuery object first created
  by collapsibleTabs().

* Simplify calculateTabDistance() by using getElementById() and
  getBoundingClientRect(). Its support includes IE 5.
  The "new" version (since Firefox 3.5 and IE 9) also includes
  'height' and 'width' properties and is supported in all
  browsers supported by the MediaWiki 1.28 startup feature test.

  This helps avoid code in offset() and width(), which is fairly
  expensive in jQuery 1.x.

* moveToCollapsed()
  - Remove redundant jQuery object creation (only caller passes a
    jQuery object already).
  - Remove redundant re-receiving of expContainerSettings inside
    the animate() callback. Already in the main scope.
    Relates to a bunch of patches that work around a problem
    caused by use of remove() instead of detach() in an earlier
    version of the code. Which was only a problem because the
    other settings object was also not used from the main scope.
    (See pre-Gerrit commits 1f93310e and e7900807.)

Change-Id: I48d542580d767df2d17ce4c6668e9e233a0f7902
2016-11-29 02:25:00 +00:00
Timo Tijhof f354aafebc collapsibleTabs: Defer DOM changes via requestAnimiationFrame
Widely supported, unprefixed (over 85%)
http://caniuse.com/#feat=requestanimationframe

Change-Id: I13a73e3ba4f68af86ca77ca8242107ee449b255e
2015-11-19 23:54:42 +00:00
Timo Tijhof 020956d070 collapsibleTabs: Debounce resize event at 100ms instead of 500ms
A delay of 500ms is quite long and is a bad user experience.
Resize should be more responsive than that.

Matches other plugins that do the same thing, such as:
http://www.paulirish.com/2009/throttled-smartresize-jquery-event-handler/

And also more in accordance with RAIL.
https://developers.google.com/web/tools/chrome-devtools/profile/evaluate-performance/rail

Change-Id: I076785f82a7786f16ca4fb1564a4972dd23cc56b
2015-11-19 23:53:17 +00:00
paladox 95ef8f2cc6 Update jscs to 2.1.0
Change-Id: Ibba453510c8e15c3e915d28f7ecf7c296bca7894
2015-10-22 00:38:01 +01:00
Bartosz Dziewoński e4ab0757d9 collapsibleTabs: Don't mix Arrays and jQuery objects for one property
We treat this as a jQuery object throughout the code, but it was
initialized to an array.

Bug: T109259
Change-Id: I44c10683ded05656eb7ca1b4be43ddc4f9281076
2015-08-17 21:42:35 +02:00
James D. Forrester 46c2ae820a test: Make code pass jscs 1.5.0 with Wikimedia code style preset
Change-Id: I385f7d9ca9f641b3ad936605af1f9894a57192e5
2015-02-14 12:45:20 -08:00
Bartosz Dziewoński d28f09df31 Move Vector skin from core
This is the final step of the process described at
<https://www.mediawiki.org/wiki/Separating_skins_from_core_MediaWiki>.

Corresponding core change: Idfc38503.

Change-Id: I84fcf7ce6385b8323544cafe6912a00f1886d20d
2014-08-07 13:38:34 +02:00