Despite its documentation the "constructor" of RevisionList tends
to expect array of revision data in a format returned by API instead
of array of Revision objects.
Due to different name of ID fields in Revision object and in API array,
if "real" Revision object is passed to RevisionList, its ID is lost.
This changes RevisionList so that it only accepts an array of Revision
objects. This provides better abstraction.
This is basically a revert of I147270f28381038d05f8bcfd2317e8c269b2e458
which aimed at the same problem but suggested solution doesn't seem right.
Change-Id: Ic45cdd3e7b707a8c6a19eecf0a84d4c11696cd1f
This adds 1 simple browser test to make sure that the placeholder
for the revision slider loads when the beta feature is enabled and
does not load when it is disabled
More tests will follow.
Bug: T133278
Change-Id: I5be9014b6c5ac03128c034fd866141e89fd7a0ed
- slide show dialog using OOJS UI
- setting a user option to only show it once
- translatable content
- images of the slides
Bug: T136830
Change-Id: Ia820aecb20aa6b239f1a64dd328683639baf399e
MediaWiki uses the momentJS module to display standard timestamps;
this means you can avoid calculating the user offset, but also, it
means that all timestamps are internationalized and translated, and
use the standard view that MW uses in its interfaces.
We can store the user's offset in a RevisionSlider variable so we can
refer to it in timestamp construction, as well as manipulate it in
tests without touching any global user options that may affect other
tests.
Bug: T136825
Change-Id: I67d9859b8f33ab8a217128822e246e7ab67f6511
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
If something goes wrong with the initial api rquest the
slider would either load in a broken state or say that
it is loading forever.
Now a message will be displayed to the user as well
as the error logged to the console.
Change-Id: Id763f31432feb7bd0e9ecbbeb2dd40f7ca6acaaf
This allows using browser back and forward buttons
once users have started heading between revisions.
This also updates the URL so that the page can be
reloaded at any time and the same state will be held.
(This also removes a commented out block of code that
I think was left for updating the URL)
Change-Id: I4cfe38f76eeb9e090f0a8a42e22e75cf84014d60
* 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
Slider width is now calculated according to number of revs.
Slider is now always shown in the center of the page.
The width of the ticks depends on the number of revisions per page.
Bug: T133281
Change-Id: I460b2bccff35c9dd6a4c2e5b7e847e2c59f882d3
This turns the prototype code of the Revision Slider into a MediaWiki
extension.
With this extension enabled the slider should appear on diff pages
already but it won't actually show diffs when adjusting the slider
pointers.
Things that changed so far in the prototype JS code:
- pulled out the rainbow function and made it use Math.floor instead of
the ~~ binary operator
- pulled out the API request that fetches the revisions into its own
module
- cleaned up and documented some parts of the code
The code is still very much WIP and JSCS still has a couple of
complaints.
Bug: T132576
Change-Id: I2e22365f3b93a76d5b8d3997242b5fed996c6d78