- The first case is when the slider is collapsed and the auto
expand is switched on, the slider expands and now the toggle
switches.
- The second case is when the slider is loaded expanded, the toggle
now loads in the correct direction
Bug: T150846
Change-Id: I75610308c9f169fb926953a12dc5108e0fba23bf
Introducing a new class that draws lines between the pointers
and the related diff columns. Lines are redrawn when pointers
were moved. A colored border is added to the diff columns and
readded when the diff changes.
Bug: T149175
Change-Id: Iadf779368c58da7779c769bda8e9bd3fc5afcffa
This also fixes the "border-overlapping-issue" when hovering
the pin button in Chrome.
Bug: T145726
Bug: T145519
Change-Id: I6d3788ca5f54937f84c6a7f0fcc456ddf4b665d7
Introducing the Settings class handling settings for all users.
Use hidden user prefs for logged-in users and localStorage or
cookies for anonymous users.
Bug: T145494
Change-Id: I8676873c87d5656c55365706f1ccefa604caae4d
Drag-resizing a window results in hundreds of events being fired,
so limit this to one event every 250ms.
Change-Id: Ie3ace9001cd840a5d790cd269c4ae3c77649079a
Where we know the number contains only numerals, just cast
straight to a number using '+' operator. When getting computed
css from jQuery, use more suitable position methods instead.
Change-Id: Ia58b41a4522a1ef5a1516852821573c47e8dc9c9
Computed CSS ($.css) is relatively slow, and directionality
should never change, so just compute it once.
Change-Id: I6519fa7f54599c498e22a348dfaedd940c860955
Adding position data-attribute to the pointer elements and always
apply the same value as for the revision bars they are pointing to.
This will allow us to reduce the complexity of browsertests.
Bug: T146276
Change-Id: I6e6db55204b0c45fe94a5173e297a67a7ed38d00
Also add a note to the console about WikEdDiff
& RevisionSlider interaction and the required code
change.
As the code change uses the wikipage.diff hook the code
change will actually have no effect until this patch
is deployed, which includes the removal of the hack
for WikEdDiff.
Bug: T142636
Change-Id: Ie88021abb2325cc6259cf2fb041fbdca4ae9ca89
Depends-On: Ie488021f5d0e314a8ad6c8d1f1f3d936c427d719
When the extension is used without the BetaFeatures
extension it is possible to use while not logged in.
Anon users can not have a user preference set.
Thus anon users should not be shown the pin icon.
It may be an idea to add a cookie for anon users
later down the line.
Change-Id: Iafeacf6ae9e24b3134f1c180d390cfad4245719a
In order to properly fix problems reported in T142636, core hook
triggered on diff change (on diff page) will be added in
I5aad7cc10a0db869d7c25d41f7db056885dad69b.
When that change is merged, Thanks extension will be listening
to this hook and not to RevisionSlider-specific revslider.diffreload.
This adds temporary code fixing RevisionSlider's and Thanks' interaction
before hook introduced in I5aad7cc10a0db869d7c25d41f7db056885dad69b is
available. After it gets merged, the code added here should be replaced
by firing the new core hook.
Change-Id: I5dd6c592165ed30244ac8bff37bb6e4949c8bc4a
First I jumped on replacing both jscs and jshint with eslint but
it might be premature decision. Although linting with eslint
is possible (like in there is wikimedia config for eslint)
it is still not clear should it
But in case the change happens we will be ready.
Apart from config stuff this changes few bits spotted by eslint:
improves some indentation, removes weird spaces, completes some
doc blocks, changes IIFE forms in tests. These changes do not
seem controversial.
Change-Id: I9f8bf0f5745da8e662685f4cd879ea4baa609c01
Added the revisions to the exception to avoid tooltips beeing
closed and opened again when clicking on a revision-bar to
load it.
Bug: T143090
Change-Id: Ib8011a52c469ad715e97c1c42e7489c5b31aa4a8
When rendering several RevisionListView items e.g. by loading and adding
more revisions each one had its own 'currentTooltip' so the elements
where not exclusive. This patch fixes that by looking for the class
objects when closing tooltips or changing wrapper highlighting.
Tooltip timeouts are still per-list but that should not affect the
behavior with multiple lists.
Bug: T143090
Change-Id: I23c61547e1a925da1c0b7e7a475ad61e6ed1b1b6
Reordering of stuff and splitting conditions seems to fix some of wiredness.
Mouseenter and Mouseleave are the better events in these cases.
Change-Id: I66d71b1d4f394199949475dc42ca085169e0584f
Print version of the page contains a "Retrieved from" link
referring to a particular revision. URL should be adjusted when
revisions are switched in the slider
Change-Id: Icca3c452ae6926a997b22d3bf9632591fbc0b58d
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
After resizing a window there might be more space at the beginning
of the slider "axis" than there are revisions loaded so far. In such
case the slider should be expanded, so more revisions are loaded
to fill the whole available space.
Change-Id: Ied8abe294967328112afb1fe4d14b2e29ed2c092
* The jQuery for appending the 'darkness' mask was broken (not nesting)
* Use a more semantic name
* Simplify styling to just set opacity to 50%.
* Remove browser compatibility hacks as all MediaWiki's JS
supported browsers also support CSS opacity.
Change-Id: Id893a75bb90a4e6e2e8a26ebc3863de565d8a4ee
Localized format of date containing month name, day, year and time
is used instead of format enforcing the order of time and date,
and use of short month name.
Bug: T141167
Change-Id: I39b2844e777beb986cefb3097d52d481bb038a63
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
User langauge setting could be overriden by adding uselang parameter
to the URL. Extension should use its value if present when fetching
the localized diff page.
Bug: T141760
Change-Id: I2539bc7bf523870f55f67bc94000c28644528172
This fixes two bugs:
- when more older revisions are loaded and inserted at the "beginning"
of revision list, the slider position in the top history state
should be adjusted. Otherwise when going back in browser history
wrong "window" of the slider is displayed.
This bug has been introduced in Ib3f4a6ac57ff17008f9d8784c4716bd294443096
- when clicking revision bars the history state should contain
the position of the changed after the clicking instead of the
position prior to the event. Otherwise when going back and forward,
the latter does not change the pointer positions (two top history
states before going back store the same pointer positions).
Change-Id: I2305a731a5e43ea15ad8468eb3dc4a5eea12b182
Extension should not enforce English order with number being followed
by unit "bytes" in messages related to byte size.
This also splits a message into two messages: one for page size value,
and other for change size. The latter size is signed and value to be
shown is colour-coded HTML element so it is a bit more complicated
case than the page size.
Bug: T141507
Change-Id: I96992eafd4cd8a5aed3fcd5944129bcd83139a16
This changes the previous behaviour of fetching always up to
500 most recent revisions.
Now the extensions fetches N revisions including the newer
revision selected to diff as the most recent revision.
N is number of revisions that would fit in the current
window when rendered as bars.
When user is close to either "end" of the slider, extensions
fetches another batch of up to N older or newer revisions,
as long as user does not reach the oldest or the newest
revision of the page.
Among others, this removes the limitations of the previous
approach: showing only 500 revisions, and failing to show
anything when any of selected revisions was older than
500 recent revisions.
This change also simplifies usage of Api class.
Bug: T135005
Change-Id: Ib3f4a6ac57ff17008f9d8784c4716bd294443096
This moves all HTML formatting out of messages and makes all
formatting happen in code. This should make work of translator
easier and the UI of the extension no longer rely on HTML tags
being included or not in i18n messages.
In particular "tooltip" rows are now generated in code, with
only their labels being translatable.
Change-Id: I2af9b9f0e231a7b2827a202d9ac7161b8c95855a
After fetching a batch of revision data, user names are extracted
and another API query is made to get gender preferences for users.
This change also moves a code responsible for MediaWiki API calls
to its own class.
Bug: T136367
Change-Id: Id11fe14e9ca37829141ae92b13b51f10f992eb96
Quotes and double quotes are allowed as part of a user name/page title.
Other things escaped by previously used mw.html.escape, ie. <, >, &
are not allowed in a user name any way. But just in case, to stick with
current preventive behaviour, this strips those three characters
if they somehow happen to appear in the user name returned by API.
Bug: T141171
Change-Id: I08dd09dcc94823461d7e9a8b116c088c4e8ee8d5
This adjusts the position of the tooltip depending on what is the
position of the related revision bar in the plot, and on the
size of the contents of the tooltip.
This change makes the tooltip be always displayed below
the revision plot, so it is visible to the user no matter if there is
enough (visible) space above the plot.
Also now it is checked if there is enough space on the left and right
side of the browser window to display the tooltip centered horizontally.
If not, this adjusts the horizontal position of the tooltip so that
it does not get shown outside of the window.
The latter in particular improves displaying of longer edit
summaries in RTL mode. Apparently LTR-centered browsers took care
of not showing the tooltip outside the right edge of the window
but in the case of left edge the tooltip could run outside of the window
leaving a part of summary not visible to the user without scrolling.
Bug: T141071
Bug: T141093
Change-Id: I8d519c5fd42d8403b527fa97d72a5c46991fc27b
In particular, link to a Meta page on the related community wish
should open in the new window/tab.
Bug: T140875
Change-Id: Ib0d7bf679c9ac8a3ee2fdf2289fc53cfdfdaa671
In RTL UI the positive and negative numbers will
appear on the wrong side unless the direction is
defined explicitly.
Change-Id: I39ef512993878daf10008e967ffd0492f7e1e80a
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
Testing the visibility / presence of things around
the dialog appears to be hard and the DOM for the dialog
remains unchanged when shown / hidden as far as I can see.
These tests test that the dialog is only shown once per
user.
And that the sequence of the dialog works in regards to the correct
buttons being present at the correct times.
Bug: T133278
Change-Id: Ia86cb69573da3e888c2897b8b50f1d2e5c61d8d4
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
This makes Mediawiki render the link. Unfortunately, it is
not rendering redlinks for not exisiting pages.
Also updates qqq.json i18n file which was missing in
Ifb2f33febbdf0f7c9584941b71596abb47fb8088
Bug: T138944
Change-Id: If336984362358193a6c43144ace2f818dbe0633d
After changing this several times to address concerns related to
GENDER, decided to use the mediawiki standard here also used
in the core code. For translators a hint was added that GENDER
is not supported here so an appropriate translation should be
chosen by them.
Bug: T136367
Change-Id: Icc2a8e6fc08761367c4ab6bb2a446262f8aa86e6
Also introduced language specific number formating. Therefore removed the
'bytes' message. Plural form will be computed in the size messages directly.
Comment label and value were split so the parsed comment can be used
plain without parsing the html again.
Bug: T137183
Change-Id: I12f30cb518e3cc5210528d5b22737dde868a0325
- 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
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
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
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
For example when user name is not visible due to RevisionDelete the script
crashed. This makes it check if there is a user name defined and not try
to show it if there is none.
Bug: T135198
Change-Id: I43ce0e49e13ad6262cc60fd938c486ea3e328e64
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
Divs can not be directly inside <table>
elements, and apparently IE11 and Edge will thus
put these elements somewhere else / throw them away
/ do different things to other browsers.
Thus add the div to a row!
Bug: T134983
Change-Id: I1ad38298fc0d4ec7e6f45cb77ac0100900df9bd1
This introduces styles for "not available" arrow, and styles for hovered arrow
and "active" (under left mouse button click arrow).
Bug: T135970
Change-Id: If5f7df475eef36dcb6d038297ad97717b8c96f77
This fixes a bug that would show a slider window where neither of
the pointers is visible after selecting the last revision of the current
window with the old revision pointer and then refreshing.
Change-Id: I15402d8ca7b8c783990a32e2d8426871763e20e1
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
This adds labels for user, comment and article size to the revision
tooltip as well as the respective messages needed for the labels.
Bug: T135740
Change-Id: Ia65fb0bbbe3eb2405665d784bad157ea059e2d6e
This fixes a bug which caused the old revision pointer to appear yellow
when being moved on click after the pointers switched places.
Change-Id: Ibfa104e059e847c68667605b60efe5cbb003327f
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
This fixes a bug that caused the slider to always show the first "page"
after a refresh even if a different page was selected before the
refresh.
Change-Id: Ic5defd28f699617be6cf2ae5827e90f294d616b5
Also removes black borders and replaces them with white ones.
This part was a bit tricky because we want to keep bottom/top borders
to have a continuous line in the middle.
Bug: T134996
Change-Id: I7ac95604eceb732b31d39120adb57cbc8e44b230
This also allows pointer to be dragged past the other. In such case
pointer colour changes while dragging, but pointer orientation/position
is only updated after dragging is finished (along with reloading diff etc).
Bug: T134994
Bug: T134996
Change-Id: Ia333306b5b0a488a4f8e92ac4b1b843dc4863d47
Pointer shadow is left out here on purpose. It will be
added after changing "new" pointer's position.
Bug: T134994
Change-Id: Id80ed63cda9f015228a22bb1d8b9b742438fe27d
Zero has been passed to Math.log which returned -Infinity resulting
in incorrect size of a "negative" bar.
Bug: T135219
Change-Id: I5facc94f8cb555a95d730cc507df21399124913d
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
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
The first revision was previously not included because revision size was
calculated by subtracting the size in bytes of a revision from the size
of the previous revision which lead to a problem with the first
revision. The first revision's relative size is now equal to its actual
size.
Bug: T135003
Change-Id: I71441ed33673b06407be0fc566c96c3955dddbf9
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