This adds a button which allows a user to make revision slider
automatically expand on each diff page (disabled by default).
User's choice is stored as a hidden user preference.
This is a bit hacky as it squeezes a button on top
of another button (100% wide expand/collapse button).
This also adjusts styles of ToggleButtonWidget so
the button looks more like a frameless button, although
it is created as a framed one (to have inverted behaviour
when button is in its "on" state).
The button only gets visible when Resource Loader finishes
loading JS and CSS to avoid button jumping around the top
of slider window before "right" styles are applied.
Bug: T142196
Change-Id: Id561485344cba9b136666fe31b086151467de19e
This will give us a better idea of how many times the
slider is being sent out in by the php code as oposed
to how many times the JS code is running.
This number is important as client side the code will
listed to things like DoNotTrack and not send data!
The difference between the initphp and init numbers
should give us an idea of how often this is heppening!
Change-Id: I01db4318b08851de4c6b8c96cbf2740324160140
Instead of loading RevisionSlider only add a little button
to expand RevisionSlider on top of the diff page.
This makes RevisionSlider only steal a bit of space over the
diff, and only inserts quite a big slider to users that want
to have it visible for the particular diff.
API calls are only made once RevisionSlider has been expanded.
This is re-submit of b0f229d75f
that was reverted in I26427faaa00b38c2aa1377a66224c9062dcca302.
Bug: T141871
Change-Id: I879de5774b2cce7b908e73cbbe869fd48d6afa23
Instead of loading RevisionSlider only add a little button
to expand RevisionSlider on top of the diff page.
This makes RevisionSlider only steal a bit of space over the
diff, and only inserts quite a big slider to users that want
to have it visible for the particular diff.
API calls are only made once RevisionSlider has been expanded.
Bug: T141871
Change-Id: Ib312f6225b85b9ebdf4ac5d16e254a57d5cf6411
DifferenceEngine extends ContextSource, so we can
get the user from there instead of using a global.
Change-Id: I46e7a244729f2d8259319bed2c905e2971b37bf0
There seems to be no good way to enforce language on the QUnit tests. It works
for the number formatting by setting the user language on the fly but for everything
else it fails. I simplified some tests and skip some tests or asserts when the language
is not 'en'.
I also added a helper to have conditions for skipping tests. This should be part of
QUnit IMO.
Still I dont know if this is something we should care about at all or just assume, that
devs will know what they do when they try to run tests.
Change-Id: I624ccf3984434e06200abffe7ccdd25b396251af
As suggested in a comment in T135198, do not show anything above the
diff when JavaScript disabled instead of always putting a message
there.
Change-Id: I1c66fa4a9fa6e90f8318de3a4f656d629000d9ca
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 the user has a time offset that will be used.
If the user uses the default then the offset is
still retrieved from mw.user.options.values.timecorrection
If the user is anon then mw.config.values.extRevisionSliderTimeOffset
is used which is added as a JS var by the Hook
Bug: T135109
Change-Id: Iab56bbeb6a1dd2ea08b73983341485623ff63ef1
* 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
As far as I can tell diff is the only thing that is needed
to show a diff page (which is where we want to show the Slider)
For example:
- http://localhost/w/index.php?title=Foo&diff=5
Change-Id: I0c4e5ae04412a6da4034cf8c804742537aaeafdd
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