It seems the magic done with the 4px margin and its calculations
are not really needed. Getting rid of this does not only clean
the code but is also very helpfull for the new slider logic.
Change-Id: Iae86b8024d3b56517bdc4db5e8baec69bd61afbf
The meaning of first in this context was totally unclear and not
very usefull. It turns out, that the "first" revision is always
the oldest and the last is always the newest revision.
Change-Id: I009438777908a5f4a8833f8f5cb7d3041057741c
Allow RevisionSlider to work properly in both LTR and RTL contexts
by making sure that when the interface language is RTL, the entire
interface flips. "Backwards" and "Forwards" are reversed in RTL
context, and the code and behavior should respond to that.
Changes made:
* Make sure the container has a direction set
* Change the placement of the revision divs from absolute
positioning (that requires re-calculations when the page
is flipped to RTL) to divs that are display: inline-block
and have no right/left setting. This means that the DOM
will automatically flip its own visual order when the
container is set to RTL.
* Flip the calculation of positioning and the calculation
of which element the pointer is on when it is dragged
if the document is RTL.
* Mirror all scroll animations when the page is in RTL.
* Rename the scroll buttons to 'backwards' and 'forwards'
for clarity, as they are flipped when the interface is
RTL.
* Rename pointers to 'older' and 'newer' instead of
trusting their order in the DOM.
Bug: T136277
Change-Id: I7c903c2e9d8ee2a0ef2eeb7b99f2251f230a794e
Changes include:
- not passing in HTML attributes when creating tag elements,
- creating HTML elements instead of appending hand-crafted HTML,
- single append() calls instead of multiple consecutie appends,
- not using raw HTML messages when not needed,
- prefixing all CSS classes and IDs with "mw-" to avoid potential
name conflicts.
Change-Id: I164538bbaf44d46a4c66659f56e07ec7225d7fa9
This fixes a problem with not being able to drag a pointer to the newest revision,
and an extension allowing to drag pointers to revision further than there
are revisions visible in the plot.
This stops snapping a pointer to the "stopper" element, and introduces a grid
for a pointers to be moved in. Size of the grid reflects a size of the current
revision plot which prevents moving a pointer out of the plot.
Custom "containment" is added for the "newer" edge as jquery ui's "containment"
does not work for this particular case.
Bug: T135837
Change-Id: Ifc6ae29c6d64d2baf44ef2b8ff96a45ae86b4f5f
The pointer weren't pointing exactly at the middle of a revision. It
appears to be off by 4px.
Bug: T135837
Change-Id: I750debb4ed82025dfb5b4ef9f988ff9bbeb36acb
Also adjusted margins and slider to side calculation to prevent
sliders from moving into the arrow bars.
Change-Id: I90078ff86ba8346baa6c9ab01474da871c046033
As the pointers can switch side the idea
of having a left and right one will just lead
to confusion, so lets kill that idea now! :D
Change-Id: I9d56314ea4cf46402df56e0a038bfb9655218960
The need for left-pointer and right-pointer should be cleaned up at
some stage.
Infact It may be wise to loose the distinction between left and right
pointer and simply have 2 pointers.
Bug: T134994
Change-Id: I68a2159bde6fff969ca54a79587cfe03ed783454
* threw out most of the things from init.js
* turned Slider + View into respective modules
* pointers should remember position (except on page load) and correctly
slide back to their position/to the side
Some things still need testing and refactoring.
Addshore: - CS fixes and comment out current failing tests
Bug: T134395
Change-Id: I78a7095e1d9902314163b1443448f47ef0484d4e
This creates a module for the draggable pointers for the RevisionSlider
mainly to encapsulate both the pointers' state and their HTML code.
Some animation methods such as slideToSide and slideToPosition
that are still flying around in init.js weren't added to the
module since I thought they should be part of the not yet existing
Slider module.
Change-Id: I1292bfb0bbd68f8d2de04b3b5e5f3133ec6363b8