Commit graph

429 commits

Author SHA1 Message Date
addshore fc213c8880 Flip toggle button in 2 missing cases
- 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
2016-11-17 10:59:40 +00:00
WMDE-Fisch f17850d6e6 Clean up logging in code
Change-Id: Iad9f6846f9a80e7c6e82d930f643a92c8f42cab6
2016-11-16 15:42:04 +01:00
James D. Forrester 3269f791f5 build: Bump eslint-config-wikimedia to v0.3.0 and make pass
Change-Id: I774e05c4393eca8b4719f335a124efcb3d2a6dd5
2016-11-15 16:48:38 -08:00
WMDE-Fisch a8a129d627 Move lines into container
Bug: T149175
Change-Id: I4e231ff450661eaeaabae0fd2883914bb62101dc
2016-11-08 15:45:59 +01:00
WMDE-Fisch df9d94ca60 Draw lines between pointers and related columns
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
2016-11-08 13:46:14 +01:00
jenkins-bot bf9cde5d66 Merge "Remove negative margin" 2016-11-03 12:23:40 +00:00
WMDE-Fisch 6f8e23f7d9 Remove negative margin
The top pointer hovers a few pixel over the slider line. Thats
not intended.

Change-Id: I5424ea72ccf2828d638c1fc4e9e2e345ba7bf94e
2016-11-03 13:00:40 +01:00
Tobias Gritschacher 1bef050429 Add margin to pin button
This also fixes the "border-overlapping-issue" when hovering
the pin button in Chrome.

Bug: T145726
Bug: T145519
Change-Id: I6d3788ca5f54937f84c6a7f0fcc456ddf4b665d7
2016-11-02 14:16:02 +01:00
WMDE-Fisch 300c552334 Store settings for anonymous users
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
2016-10-24 16:46:42 +02:00
addshore 1e1c2f5943 Don't nest mw-content-text element when reloading diff
Bug: T144391
Change-Id: I5763c6c4288bfcfef03df0cd949715d21430c9af
2016-10-24 09:53:08 +01:00
Ed Sanders 62c5b4cff9 Prevent selecting the same revision twice
Bug: T141254
Change-Id: Ic51605dca1484ce66ce9764a2291c8a947f9d376
2016-10-14 10:25:10 -07:00
Ed Sanders 79c0305b09 Throttle the window resize event handler
Drag-resizing a window results in hundreds of events being fired,
so limit this to one event every 250ms.

Change-Id: Ie3ace9001cd840a5d790cd269c4ae3c77649079a
2016-10-14 08:25:35 +00:00
jenkins-bot 64f6724128 Merge "Avoid parseInt" 2016-10-14 08:25:30 +00:00
jenkins-bot ef111d2342 Merge "Compute and cache directionality once" 2016-10-14 08:25:29 +00:00
Ed Sanders a020b238e9 Avoid parseInt
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
2016-10-13 11:58:55 -07:00
WMDE-Fisch 8fef5ac005 Fix order when executing pointer update
This should always happen before updating the diff.

Change-Id: Icf6b52c3495e42e188bfa5d5307f91d0558cc7a4
2016-10-13 16:51:11 +02:00
Ed Sanders d728cda396 Compute and cache directionality once
Computed CSS ($.css) is relatively slow, and directionality
should never change, so just compute it once.

Change-Id: I6519fa7f54599c498e22a348dfaedd940c860955
2016-10-12 21:07:28 -07:00
Tobias Gritschacher da8f7fb064 Update pointer position attributes immediately
Update attributes right after setting position and
don't wait until revisions are refreshed.

Change-Id: Ic32a554d6939806ce95d4e7b441ee08965b81940
2016-10-12 15:31:38 +02:00
Tobias Gritschacher 70ea8fafda Always apply data-pos attribute to pointers as well
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
2016-10-10 14:52:45 +00:00
Tobias Gritschacher 4872d31669 Add fixed padding for scrollbar
This is not very nice but the simplest I was able to come up with.

Bug: T144267
Change-Id: I959c8e6e7aa053f372455b1ec4ed5768a02d8b5d
2016-09-28 14:27:51 +02:00
jenkins-bot 82a7af9be5 Merge "Fix pin button style" 2016-09-26 08:20:06 +00:00
addshore 5c9b9f7eb4 Fix pin button style
Bug: T145519
Change-Id: I1fdc0ec32b223732d59640a6462758c59b99ebac
2016-09-20 12:35:30 +02:00
Ed Sanders a97c4d1c0e Use word-break to avoid horizontal scrollbars inside popups
Bug: T144267
Change-Id: If946b2a71dfede4cf33a513b3fad974517d4359f
2016-09-19 17:36:10 -07:00
jenkins-bot a79bccf2ea Merge "Close HelpDialouge when clicking away from it" 2016-09-15 10:14:33 +00:00
addshore 22556fcf16 Close HelpDialouge when clicking away from it
Bug: T145525
Change-Id: Ia21d5163f561ede4f327eec3a4aaf7c34d103094
2016-09-15 12:01:08 +02:00
jenkins-bot dec6b85652 Merge "Fire wikipage.diff instead of revslider.diffreload" 2016-09-15 09:04:54 +00:00
jenkins-bot cce4ff706c Merge "Expand Revision Slider when user activates pin button" 2016-09-14 09:18:42 +00:00
jenkins-bot 9aabbb4ae4 Merge "Fix position from top of tuitorial" 2016-09-13 16:07:20 +00:00
addshore 42917b1821 Fix position from top of tuitorial
Bug: T145526
Change-Id: Id7d344c946dd0e66d1ed2fd639ebbb1edf06b913
2016-09-13 15:56:49 +00:00
Tobi Gritschacher a3244e1805 Expand Revision Slider when user activates pin button
Bug: T145068
Change-Id: I26bd6d3cbd2e0da6e3d537431a45ef8193906c40
2016-09-13 16:05:01 +02:00
addshore 5fbe86fc0f Fire wikipage.diff instead of revslider.diffreload
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
2016-09-13 10:37:51 +02:00
addshore c8cd4c5fb4 Only show pin button to logged in users
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
2016-09-12 12:45:35 +02:00
jenkins-bot f068f9b684 Merge "Revert "Do not nest mw-content-text element when reloading a diff"" 2016-09-07 07:58:45 +00:00
Addshore b6906e70f1 Revert "Do not nest mw-content-text element when reloading a diff"
This reverts commit a6c5c5a81c.

Change-Id: Iba8e287e200ece043fe6e0ebed960b5d9e522236
2016-09-07 07:15:28 +00:00
jenkins-bot 90455594e6 Merge "Temporarily trigger revslider.diffreload to re-add Thanks JS code" 2016-09-06 16:42:32 +00:00
jenkins-bot d1148c49c5 Merge "Fix position of pointers in RTL mode" 2016-09-06 16:42:31 +00:00
jenkins-bot 86f62f85c5 Merge "Do not nest mw-content-text element when reloading a diff" 2016-09-06 16:42:31 +00:00
Leszek Manicki 08afa590de Fix position of pointers in RTL mode
Apparently after some recent changes, pointers in RTL UI were a bit off

Change-Id: Idae3b043d1d596c36b59b784b0a24fd0b9da76d3
2016-09-06 18:03:11 +02:00
Leszek Manicki a6c5c5a81c Do not nest mw-content-text element when reloading a diff
Bug: T144391
Change-Id: I1ac8c5f31a5e0c34913ba37676f5b3a89aa4db35
2016-09-06 18:01:12 +02:00
Leszek Manicki 9581a55ba2 Temporarily trigger revslider.diffreload to re-add Thanks JS code
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
2016-09-06 18:00:02 +02:00
Leszek Manicki effe850b57 Add temporary code to re-add WikEdDiff gadget after reloading a diff
Bug: T143199
Change-Id: If839acfc86bc3640b91d37211b56bd62df2f210d
2016-09-06 17:52:58 +02:00
Leszek Manicki 8e7fe2434d Add eslint, to be used instead of jscs and/or jshint
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
2016-09-05 09:47:11 +02:00
jenkins-bot ea9c83aa80 Merge "Close tooltips when clicking somewhere outside of them" 2016-09-01 12:42:16 +00:00
jenkins-bot 50313505fd Merge "Avoid having multiple revision tooltips at once" 2016-09-01 12:38:50 +00:00
WMDE-Fisch 9be2aa5a56 Close tooltips when clicking somewhere outside of them
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
2016-09-01 13:25:24 +02:00
WMDE-Fisch 2277651f44 Avoid having multiple revision tooltips at once
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
2016-09-01 13:18:12 +02:00
jenkins-bot 3dcfec7f5e Merge "Update URL in print footer when reloading a diff" 2016-09-01 09:57:38 +00:00
WMDE-Fisch a0cb76f747 Improve tooltip handling
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
2016-09-01 07:40:49 +00:00
Leszek Manicki f10e137897 Update URL in print footer when reloading a diff
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
2016-08-31 15:54:09 +02:00
jenkins-bot ddf94dd141 Merge "Do not include Revision Slider in the printable version of the page" 2016-08-31 12:17:16 +00:00
jenkins-bot 3f6815858c Merge "Add button to have revision slider expanded automatically" 2016-08-31 08:27:02 +00:00
Leszek Manicki 6502728184 Add button to have revision slider expanded automatically
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
2016-08-30 13:57:12 +02:00
Leszek Manicki 6c8c275690 Do not include Revision Slider in the printable version of the page
Change-Id: I477e80b82a74ac02e48759fc912200350cfc1824
2016-08-29 08:23:00 +00:00
Leszek Manicki a64dc43963 Reload category links when reloading the diff after revisions change
Bug: T143843
Bug: T143204
Change-Id: I6871ef106729e598329647d2726bef4755c45299
2016-08-25 14:01:42 +02:00
jenkins-bot 805b92dd1a Merge "Use moment.js's localized date and time format" 2016-08-23 10:19:07 +00:00
jenkins-bot 3c1c284de5 Merge "Highlight revision bar when hovering revision wrapper." 2016-08-21 11:04:45 +00:00
jenkins-bot 923d9608e2 Merge "Expand draggable/clickable pointer area." 2016-08-21 11:01:23 +00:00
jenkins-bot 01cf07fc12 Merge "Remove transition on revision wrapper hover." 2016-08-21 10:58:14 +00:00
Jakob Warkotsch 188c5d58c8 Remove transition on revision wrapper hover.
Bug: T143116
Change-Id: I85dbb9e9c46a022d701dc956051304090daa44fc
2016-08-19 16:18:17 +02:00
Jakob Warkotsch c5687cde9a Highlight revision bar when hovering revision wrapper.
Bug: T143115
Change-Id: I4e4d749e4d1b9644db66a476731a052c450caa3c
2016-08-19 14:57:11 +02:00
Jakob Warkotsch 19d98c55df Remove 1px height from pointer container.
Bug: T143113
Change-Id: Id9eee9451cc2437adbf3c3e109b26bec028134ca
2016-08-19 14:44:05 +02:00
Jakob Warkotsch 2625c6f1aa Expand draggable/clickable pointer area.
Bug: T143091
Change-Id: I43d8635542e489d816aea0b8ab3366207f27546c
2016-08-19 14:15:06 +02:00
Jakob Warkotsch a88c05c1f6 Reload side panel when loading a new diff.
Bug: T143204
Change-Id: I1034c756f094c9a3b12cfdd65c94f036fc0e4eee
2016-08-18 15:00:55 +02:00
Leszek Manicki d2a4c63107 Expand slider if there are space for more revision at the beginning
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
2016-08-17 14:35:01 +02:00
jenkins-bot d353e0db32 Merge "Reload the page menu when loading a new revision." 2016-08-17 11:36:05 +00:00
Jakob Warkotsch 567ebde9fa Reload the page menu when loading a new revision.
This avoids opening the edit page for the wrong revision when clicking
"Edit".

Bug: T143151
Change-Id: Iac2954449689c290c5f81a1a3a8505197d93dc14
2016-08-17 12:31:26 +02:00
Jakob Warkotsch 4d6233f842 Resize revision slider when resizing the browser window.
Bug: T139101
Change-Id: I57c7d9e553f02c2e8eaa76ee729f85ec4ae2ec3b
2016-08-16 16:08:44 +02:00
Ed Sanders 6c9e3e36a6 Fix loading state of diff page
* 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
2016-08-15 11:20:34 -07:00
Ed Sanders 6997f135db Abort pending requests
Ensure all requests are abortable promises, and abort if
a new, conflicting request is made.

Change-Id: Ie05142f6da8cba6dde4f73c1b22960b726af4764
2016-08-15 11:19:15 -07:00
Leszek Manicki 90d652adef Use moment.js's localized date and time format
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
2016-08-11 11:40:30 +00:00
Ed Sanders f6a44f43fe Convert the few instances of IDs to classes
Makes for more modular code.

Change-Id: Ic71d7421aea548e5b4a9c4841cd4af49a3d385a5
2016-08-10 15:32:12 -07:00
Leszek Manicki e243ca2746 Do not load RevisionSlider initially, add a button to show/hide it
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
2016-08-10 16:26:54 +02:00
WMDE-Fisch c5690ba763 Revert "Do not load RevisionSlider initially, add button to load it"
This reverts commit b0f229d75f.

Change-Id: I26427faaa00b38c2aa1377a66224c9062dcca302
2016-08-09 16:34:53 +00:00
Leszek Manicki b0f229d75f Do not load RevisionSlider initially, add button to load it
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
2016-08-09 14:54:59 +02:00
Leszek Manicki 796a971118 Make backward/forward arrows OO.ui.ButtonWidgets
Bug: T142206
Change-Id: I25c98e32c74235a2b70ac1d02c221f1898ba9958
2016-08-08 16:17:35 +00:00
Leszek Manicki 77095bfa65 Use OOjs Popup Widgets instead of tipsy
Bug: T141983
Change-Id: I4b4ea427f82b15625537d859623461eceb1eb52b
2016-08-08 18:11:23 +02:00
Leszek Manicki 0af4fe35d5 Make the "show help" button a OOjs ButtonWidget
This also adjusts position of the help icon so it better fits
the available space.

Bug: T139150
Change-Id: Iec7ec31a83a1a847cd68a994ecac12acf960d699
2016-08-08 13:14:31 +00:00
jenkins-bot 7010b98d7f Merge "Include a number in messages showing a number with a unit" 2016-08-03 10:03:39 +00:00
WMDE-Fisch fefe746b07 Reduce help text font-size
Bug: T139100
Change-Id: Ie4401b1a49026606109d90160001d327472f1bff
2016-08-02 14:12:57 +00:00
jenkins-bot 7ce0442fa0 Merge "Track the load times of RevisionSlider" 2016-08-02 12:08:31 +00:00
addshore fd61e41db8 Track the load times of RevisionSlider
Change-Id: Ibeaac111802af80d2910c1892d233b7835069148
2016-08-02 13:02:57 +01:00
jenkins-bot dd8ee7bad4 Merge "Consider custom user language setting, and include all parameters in generated URLs" 2016-08-02 09:42:53 +00:00
Leszek Manicki 042a3bb213 Consider custom user language setting, and include all parameters in generated URLs
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
2016-08-01 17:10:21 +02:00
jenkins-bot ff550611b2 Merge "Clean up the usage of <bdi> tags" 2016-08-01 13:53:57 +00:00
Leszek Manicki de8ec35f2f Fix restoring the position of pointers when moving in browser history
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
2016-08-01 12:35:35 +02:00
addshore 093bb1466b Use history.replaceState on initial load
Bug: T141732
Change-Id: I283b9f45f9ecf6bed5d5031ea21b374f12758309
2016-07-31 20:13:00 +01:00
addshore f7289bf65c Use SliderView refreshRevisions method in SliderView
Change-Id: Ibaeb9776ee18061c99ddf1a6e794b5a3a6faa16a
2016-07-31 19:50:33 +01:00
Leszek Manicki 3cc218391c Include a number in messages showing a number with a unit
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
2016-07-28 15:04:25 +02:00
jenkins-bot 6aea17b627 Merge "Fetch more revisions as the user moves back and forward" 2016-07-28 11:38:53 +00:00
Leszek Manicki dc838bc87d Fetch more revisions as the user moves back and forward
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
2016-07-28 12:58:35 +02:00
jenkins-bot c6be0d7660 Merge "Smarter setting of the "gravity" of tooltips" 2016-07-27 14:27:50 +00:00
Leszek Manicki 0534bf2ba8 Clean up the usage of <bdi> tags
Bug: T141215
Change-Id: I981eb29a40fbca76ae5e7bc6aa3d723ecfb42f23
2016-07-27 11:50:15 +02:00
Leszek Manicki 633e7421e1 Remove HTML tags from i18n messages
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
2016-07-27 10:28:37 +02:00
Leszek Manicki c7190cf97d Add support for GENDER to the username label in the tooltip
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
2016-07-26 11:50:59 +02:00
Leszek Manicki 8ec7004cc3 Do not escape quotes and double quotes in user names
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
2016-07-26 10:24:44 +02:00
Leszek Manicki d737153e29 Smarter setting of the "gravity" of tooltips
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
2016-07-25 12:14:42 +02:00
Leszek Manicki 8d91433b61 Open links in the "tutorial" in the new window
In particular, link to a Meta page on the related community wish
should open in the new window/tab.

Bug: T140875
Change-Id: Ib0d7bf679c9ac8a3ee2fdf2289fc53cfdfdaa671
2016-07-20 12:28:20 +02:00
Amire80 bee97e111f Make sure that positive/negative sign in displayed correctly
In RTL UI the positive and negative numbers will
appear on the wrong side unless the direction is
defined explicitly.

Change-Id: I39ef512993878daf10008e967ffd0492f7e1e80a
2016-07-18 11:24:08 +00:00
addshore f0cb111671 Account for suppressed comments and users
Bug: T140397
Change-Id: Ie3a4d81da38f6b721c80738d725fc59cc4fec345
2016-07-15 09:27:59 +01:00
jenkins-bot e901b847a5 Merge "Fix parameter type in docblock" 2016-07-06 08:28:08 +00:00
addshore 1e65ec602f Tooltip browser tests
Bug: T133278
Change-Id: I7ee7143ab3fcd9c2fe41604c370d9c4e2e7a9d20
2016-07-05 11:57:36 +01:00
Leszek Manicki 8e2365502b Make RevisionList expect list of Revision object
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
2016-07-05 00:01:46 +02:00
Leszek Manicki a5c441ecd3 Fix parameter type in docblock
Change-Id: I62e9f2035d869aec5bee02f628623962fab17be9
2016-07-04 23:58:22 +02:00
addshore 6101897460 Add browser tests for tutorial / help dialog
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
2016-07-04 13:39:19 +00:00
Ed Sanders a5f36af0f3 Prefix all classes and IDs with mw-revslider
Bug: T139105
Change-Id: Ia92396ec4f8acea39398173c81842d66257dc519
2016-07-01 11:27:23 +01:00
Ed Sanders 7b463c52eb Replace csslint with stylelint and make a pass
Change-Id: I7f3d1cd867399fa23b087daa89970ebe305c46d9
2016-06-30 21:21:28 +01:00
Jakob f2f24b1b11 Merge "Add more QUnit tests for public methods" 2016-06-30 15:08:15 +00:00
WMDE-Fisch f7ae734b99 Add more QUnit tests for public methods
Added tests for DiffPage, HelpDialog and RevisionListView.
Slightly refactored RevisionListView to improve testability.

Bug:T137964
Change-Id: I07dc8059d5a90bdd6623fd7748d36ba212763e15
2016-06-30 17:01:10 +02:00
WMDE-leszek 200f3e1ddd Merge "Start browser tests (Initial test for beta feature switch)" 2016-06-30 14:01:29 +00:00
addshore d7caa6c1f3 Start browser tests (Initial test for beta feature switch)
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
2016-06-30 14:46:37 +01:00
WMDE-leszek 2964b673d5 Merge "Show a tooltip for the questionmark that opens the help text." 2016-06-30 13:11:46 +00:00
Jakob Warkotsch 80aafa27d9 Show a tooltip for the questionmark that opens the help text.
Bug: T138945
Change-Id: I6c3235bdf228d051c7039f188ff62d1137377bca
2016-06-30 15:07:18 +02:00
Leszek Manicki 946c7656f3 Make username in the toolip a link, another approach
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
2016-06-30 14:27:16 +02:00
Leszek Manicki 22dc00571f Make username in the tooltip a link
Bug: T138944
Change-Id: Ifb2f33febbdf0f7c9584941b71596abb47fb8088
2016-06-30 13:17:07 +02:00
Leszek Manicki 8e5189422a Highlight revision "wrapper" when mouse inside a tooltip
Bug: T138946
Change-Id: I93da2bc2fad36dc2927fe4123f91cab470cb3553
2016-06-30 11:52:57 +02:00
WMDE-Fisch 64c84fd573 Add own message for minor edit
Change-Id: I644d200c05e9d3cad6ef14aa48757e8d58e919f0
2016-06-28 13:48:25 +02:00
WMDE-Fisch a2d4b2cbc8 Use username for username label
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
2016-06-25 16:12:44 +02:00
WMDE-leszek 33cf55a6f4 Merge "Bold tooltip labels and color-coded change size" 2016-06-25 14:07:55 +00:00
jenkins-bot 8bfed7caf1 Merge "Make a symbol on the "Show help" button translatable" 2016-06-25 11:40:18 +00:00
WMDE-Fisch 1d436fcfea Bold tooltip labels and color-coded change size
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
2016-06-24 17:51:36 +02:00
Leszek Manicki cd12add2cb Make a symbol on the "Show help" button translatable
Change-Id: I60ae368f59203f63fb352ec861db5d75d488f8fa
2016-06-24 15:55:03 +02:00
Jakob Warkotsch ec9caea004 Make revision tooltips hoverable.
Bug: T138392
Change-Id: Ic43345839cf8d04486141d24074a4d735c9c5c1f
2016-06-24 15:13:20 +02:00
Leszek Manicki 94405e7f6d Add a simple JSDuck config file
Running jsduck command generates API documentation to docs directory.

Change-Id: I1f9acbaf7868ebf48a56d20d6906cbcf23ef9748
2016-06-22 14:40:27 +02:00
jenkins-bot da0ee1560c Merge "Enhance code documentation." 2016-06-21 11:30:37 +00:00
Jakob Warkotsch 11ceffab2f Enhance code documentation.
Bug: T137965
Change-Id: Ice393838545f1545ee085ecdcddfa35f60b32ecd
2016-06-21 13:25:50 +02:00
jenkins-bot d4ea6b838f Merge "Add button to reopen the help dialog." 2016-06-17 11:23:56 +00:00
Jakob Warkotsch 079f5607c9 Add button to reopen the help dialog.
Bug: T137086
Change-Id: Ifef5c8451a53bf43b10418ace8e6651801480bb2
2016-06-17 13:11:38 +02:00
Leszek Manicki 202e76e78b Add a link to Meta page describing a community wish
Link is added to the first "slide" of the help dialogue.

Change-Id: I6abf375951b11331fe1d67993e7d06a2bb0c8f51
2016-06-17 10:59:48 +02:00
Leszek Manicki 3b9c3e73ad Escape HTML message in the "help slideshow"
Change-Id: I6854da2d8c6d7176956394f4f4733d0c2529d295
2016-06-17 10:55:42 +02:00
Jakob Warkotsch 5f6b3c8556 Show a help dialog.
- 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
2016-06-16 18:05:10 +02:00
Moriel Schottlender abfcd2c01b RTLize RevisionSlider's behavior
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
2016-06-08 13:26:43 +00:00
Jakob Warkotsch 183abd6286 Merge "Use a gender-neutral label for user." 2016-06-07 08:54:13 +00:00
Jakob Warkotsch 78a691ca06 Use a gender-neutral label for user.
Gender-specific labels here would be to expensive.

Bug: T136367
Change-Id: Id66790cd5c921ae536cbc5bede71f61d0e55a043
2016-06-06 15:51:29 +02:00
Moriel Schottlender 7b75c1ebf2 Use momentjs to display internationalized timestamps
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
2016-06-03 13:20:35 +00:00
WMDE-Fisch 05ea211e8b Fire event for wikipage.content hook
Bug: T136827
Change-Id: If3e92716c4db71b9aeae3fb624c17174cf909b7d
2016-06-03 11:52:49 +02:00
Jakob 9ec481052a Merge "Add resize cursor to pointers" 2016-06-03 09:14:47 +00:00
WMDE-Fisch 1a7fe36941 Add resize cursor to pointers
Also prevent cursor flickering when dragging.

Bug: T136099
Bug: T136833
Change-Id: Ie04c5ad9669c1e839b34bc8f649cc9264f70b666
2016-06-03 11:12:49 +02:00
WMDE-Fisch 1a8a4312de Move dependencies to extension.json
Also removed unused dependency.

Bug: T135198
Change-Id: I1ee53ec9d7e123bdca84701b9557aeeeade815ff
2016-06-02 18:16:23 +02:00
jenkins-bot 04df38c25f Merge "Use parsed comment instead of custom parsing" 2016-06-02 15:46:02 +00:00
Brian Wolff 39d8d9229a Make files not executable
I know it doesn't matter, but it was kind of bothering me.

Change-Id: Iae9f8b17a3fb5ced362dc2da95e67e20db8af5a5
2016-06-02 13:48:09 +00:00
WMDE-Fisch f8446590cb Use parsed comment instead of custom parsing
Bug: T135740
Change-Id: I49757b5bcf2c47f459538bd4383325882a15336f
2016-06-02 13:47:41 +00:00
Jakob 19c50267e7 Merge "Dont push state to history in cases where not possible" 2016-06-02 12:10:27 +00:00
Jakob 3482b4a968 Merge "Add change size to tooltip" 2016-06-02 12:01:12 +00:00
WMDE-leszek 0956cf51e9 Merge "Do not center tooltip text" 2016-06-02 10:16:29 +00:00
WMDE-Fisch f6854e0bd4 Do not center tooltip text
Bug: T135740
Change-Id: I6c3b825b27736f693260bc3a6447b6328449e0d6
2016-06-02 12:14:01 +02:00
addshore 7d996ec788 Dont push state to history in cases where not possible
This fixes some issues with older versions of IE

Bug: T136714
Change-Id: I20d35e16ff4b31c2f719cc72c80ca7c57d5b528e
2016-06-02 12:02:39 +02:00
WMDE-Fisch da43204662 Add change size to tooltip
Bug: T135740

Change-Id: I50833c5b65c821eb885b261a15de2088cd15da6d
2016-06-01 17:05:09 +02:00
Leszek Manicki c14fa78bc0 Remove unused parameters when creating Pointer objects
Change-Id: I2bc5337d2a48fb5dd6b81d6c95584f79974d7e9f
2016-06-01 16:49:26 +02:00
Leszek Manicki b86194eacb Fix updating revision bar styles when going back/forward in history
This left unchanged in I164538bbaf44d46a4c66659f56e07ec7225d7fa9

Change-Id: Ied950472458a61efbfae5850d070f7047a222879
2016-06-01 16:45:15 +02:00
Leszek Manicki f9d9a4a4b7 When JavaScript disabled do not show RevisionSlider
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
2016-05-31 19:49:08 +00:00
Leszek Manicki 225f48ac52 Do not fail when name of the user performing the revision is not available
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
2016-05-31 19:48:53 +00:00
Leszek Manicki a2774984c4 Make JavaScript code and CSS follow the style guide.
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
2016-05-31 14:57:14 +02:00
jenkins-bot 72e059034a Merge "Fix opacity on load in IE & Edge" 2016-05-31 10:38:56 +00:00
addshore e0aa879b99 Fix opacity on load in IE & Edge
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
2016-05-30 12:24:42 +01:00
jenkins-bot 768df0fa7e Merge "Adjust arrow styles" 2016-05-30 10:51:27 +00:00
Leszek Manicki f642fb44dc Adjust arrow styles
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
2016-05-30 11:54:24 +02:00
Jakob Warkotsch 49dea1cf68 Show correct slider window after refresh when the last revision is selected.
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
2016-05-27 16:10:59 +02:00
Leszek Manicki b0466a9615 Fix pointer pointer dragging to edge revisions
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
2016-05-27 15:37:05 +02:00
WMDE-leszek dc3e840f72 Merge "Set correct pointer color on click." 2016-05-26 15:25:18 +00:00
WMDE-leszek 1aaad847f1 Merge "Show a pointer cursor on revision wrappers." 2016-05-26 15:19:32 +00:00
Jakob Warkotsch d4dd4c3576 Add labels to revision tooltips.
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
2016-05-26 17:10:29 +02:00
WMDE-leszek 7f46eb45fc Merge "Make pointer offset depend on whether pointer is the upper pointer." 2016-05-26 15:00:49 +00:00
Jakob Warkotsch eb21b1a623 Set correct pointer color on click.
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
2016-05-26 16:54:56 +02:00
Jakob Warkotsch 910039cd6e Show a pointer cursor on revision wrappers.
Bug: T134993
Change-Id: I3412e03aba726fde6194b3cac88765655e69b8aa
2016-05-26 16:12:35 +02:00
Leszek Manicki 321659c70f Remove "legend" annotations and move scrolling button hint to a tooltip
This also removes a "diff size" axis legend.

Bug: T136098
Change-Id: I9705d6ab37c8d24b9bdb1fddaa895b2863e98043
2016-05-26 15:19:18 +02:00
Jakob Warkotsch f5d9347d93 Make pointer offset depend on whether pointer is the upper pointer.
Bug: T135837
Change-Id: I0ccc34751765f1f98dd29426d4efb3f3419f3932
2016-05-26 12:30:12 +02:00
WMDE-leszek 9b008b502d Merge "Fix bug that caused the most recent revision to never be visible." 2016-05-26 09:05:16 +00:00
Jakob Warkotsch 90ef5dbb23 Fix bug that caused the most recent revision to never be visible.
Bug: T135739
Change-Id: I00e30a585b3a38da7e405f200356163b20358df9
2016-05-26 10:56:25 +02:00
Jakob Warkotsch e3c9502686 Enable moving of the pointers by clicking on the revisions.
Bug: T134993
Change-Id: I6b467d8b89bdccc2d6e01fbd94ac5890a07d20b4
2016-05-24 13:45:30 +02:00
jenkins-bot 6de7022a8d Merge "Add annotation labels to the slider" 2016-05-22 11:30:34 +00:00
jenkins-bot 154649d2d9 Merge "Mark selected and intermediate revisions with colours" 2016-05-22 11:27:07 +00:00
WMDE-Fisch e126efa953 Add annotation labels to the slider
Bug: T133270
Change-Id: Ibfc16196d35305a56c63d6c23a174712442f31a8
2016-05-22 12:26:41 +01:00
jenkins-bot 91194c3c88 Merge "Fix pointer alignment." 2016-05-22 11:25:45 +00:00
jenkins-bot 6096164380 Merge "Internationalize the tooltip pieces" 2016-05-22 11:25:37 +00:00
Moriel Schottlender 2440c52bc0 Internationalize the tooltip pieces
Make sure that username and comment fields are bidi-isolated and
add an i18n message to "bytes".

Change-Id: I6a27cd7fdebf775dd86ccfc6084505aad4e931d2
2016-05-20 16:40:26 +02:00
Jakob Warkotsch 9ae092c4fe Fix pointer alignment.
The pointer weren't pointing exactly at the middle of a revision. It
appears to be off by 4px.

Bug: T135837
Change-Id: I750debb4ed82025dfb5b4ef9f988ff9bbeb36acb
2016-05-20 15:44:28 +02:00
jenkins-bot 2f93a591d2 Merge "Do not restrict width of the tooltip" 2016-05-20 10:43:51 +00:00
jenkins-bot a206b47670 Merge "Add navigation arrow bars" 2016-05-20 10:02:43 +00:00
WMDE-Fisch 43b3c36336 Add navigation arrow bars
Also adjusted margins and slider to side calculation to prevent
sliders from moving into the arrow bars.

Change-Id: I90078ff86ba8346baa6c9ab01474da871c046033
2016-05-20 09:44:36 +02:00
Leszek Manicki f2f29832e5 Mark selected and intermediate revisions with colours
Change-Id: If8e2268540a9e5f8110256e779cbee92c6a413ca
2016-05-19 18:39:58 +02:00
Leszek Manicki b0963da338 Do not restrict width of the tooltip
Longer edit summaries were squashed into 200-pixel-wide box.

Bug: T135742
Change-Id: Ic73c44df7d73b18d14f7eb10ee761f465276e72e
2016-05-19 17:16:10 +02:00
jenkins-bot b2c1de07b8 Merge "Adjust pointer size and make them drop shadow" 2016-05-19 13:22:29 +00:00
Jakob Warkotsch cf12a390f6 Resume slider scroll position after refresh.
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
2016-05-19 15:03:38 +02:00
Leszek Manicki 6df5692dd4 Adjust pointer size and make them drop shadow
Bug: T134994
Change-Id: I8d65ed9abba412a4b960ee858c51dcf3cf95b879
2016-05-19 14:15:17 +02:00
WMDE-Fisch 6a95afb4f5 Add wrapper with hover effect for revisions
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
2016-05-19 12:46:14 +02:00
Leszek Manicki 4d8949533f Change the position of the "newid" pointer
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
2016-05-19 11:02:42 +02:00
jenkins-bot ecfcc0f4e8 Merge "Use SVG icons for pointers instead of CSS magic" 2016-05-18 17:34:41 +00:00
Leszek Manicki b77cf18cbc Use SVG icons for pointers instead of CSS magic
Pointer shadow is left out here on purpose. It will be
added after changing "new" pointer's position.

Bug: T134994

Change-Id: Id80ed63cda9f015228a22bb1d8b9b742438fe27d
2016-05-18 12:54:40 +00:00
Leszek Manicki 10da0333b7 Stop using ancient <center> tag in tooltips
Change-Id: I26aef8df98a7950c93a5de2c0d426cb5db4afde4
2016-05-18 12:45:06 +02:00
Leszek Manicki 4569540481 Fix height of bars for revisions that haven't changed the page size
Zero has been passed to Math.log which returned -Infinity resulting
in incorrect size of a "negative" bar.

Bug: T135219
Change-Id: I5facc94f8cb555a95d730cc507df21399124913d
2016-05-14 09:46:14 +00:00
addshore b86ceb02bf Also refresh the article preview
Change-Id: I8a96515db9a0dbe329000a51840ad2f365b5aba0
2016-05-13 11:23:20 +00:00
addshore ec80c4fa6f Get rid of left and right pointers.
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
2016-05-13 11:23:11 +00:00
addshore f894286873 Map pointer colors to diff colours
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
2016-05-13 11:23:05 +00:00
addshore fc74a35709 Use correct time offset based on server and user settings
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
2016-05-13 11:02:20 +00:00
addshore 39663c4539 Use JS config vars instead of DOM injection
Change-Id: I0d670de6e6c6c2a86e1f1227487b16b85a10b4f4
2016-05-13 11:01:44 +00:00
addshore 8ba5d9acea Add size & minor flag to tooltip
Bug: T135118
Change-Id: I2bc90a2f8a03693df092a4785cfe2fdfcc85730a
2016-05-13 11:57:31 +01:00
addshore 7d5de12c11 Remove section legend and colors
Bug: T135115
Change-Id: I01948c58812c37731f076629fe917f03d2b29a13
2016-05-12 16:46:02 +01:00
addshore b14f4cac33 Remove bytes changes from tooltip
New things will be added in a followup

Bug: T135118
Change-Id: I5f337f2ded0ac6ffe08c734b4e0c1a743d2aef12
2016-05-12 15:44:59 +00:00
addshore 91759f25bd Show useful error if either rev is not in our range
Bug: T135119
Change-Id: I48f3316f2285b987d1a7e4c4a622eb1291de6357
2016-05-12 16:44:34 +01:00
jenkins-bot 6565cffcfe Merge "Clean up awkward slider.slider dependency." 2016-05-12 15:38:55 +00:00
Jakob Warkotsch 139368093e Adds the missing first revision to the slider.
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
2016-05-12 15:25:37 +00:00
Jakob Warkotsch 0e227c8be3 Clean up awkward slider.slider dependency.
Change-Id: Idd673c19de30954aac46bd0e050d7b8cdf677abe
2016-05-12 17:19:14 +02:00
addshore a47a8fec0c Retry diff reload once if it fails
Change-Id: Icbdd230c05821dd582fcd1b8124fb6735dc95df4
2016-05-12 09:48:48 +01:00
addshore f9471bcfbc If the slider fails to load then fail nicely!
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
2016-05-12 09:46:39 +01:00
addshore b1f6a1df56 add events to history
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
2016-05-12 08:36:28 +00:00
addshore 4835195da9 Add basic usage tracking
Change-Id: I4bde95492ef6483cfd4e4f3c29b1ab7eaeccbc10
2016-05-12 08:36:23 +00:00
addshore 6017c396e9 Don't show arrow when slider is at either end
Change-Id: I7fdced0e959ff9692375bb0fcb879f821308189a
2016-05-11 12:25:01 +01:00
addshore 8d41f70a5b Don't allow pointer clicks while timeline is sliding
Bug: T133279
Change-Id: I46add92298ac41b06437eef59f33a0ee64c4ccf0
2016-05-10 21:04:21 +01:00
addshore bc9ae355dc Always show oldest version on left
Change-Id: Ic03e25acb751f6cb9f9e832dae71bef01622afc4
2016-05-10 20:45:09 +01:00
addshore 1dc1235a0f Always load showing at least the right pointer
Change-Id: If9544c2da6a456556b4011a6ee01c62449a0bb30
2016-05-10 20:42:11 +01:00
addshore 9975e83b9d Don't allow interaction while page loading
Change-Id: I614fe3c90c57511ba392493d683a5b6e8dc169d9
2016-05-10 20:15:11 +01:00
addshore ddc1980f7b Update diff view on pointer move.
Bug: T134384
Change-Id: I26461f8afdfc3322f125a7f3c30d7f8f1b231398
2016-05-10 19:53:31 +01:00
addshore be036e757c Re add section legend as a module
Change-Id: I6ad89e2b15435ef35cc1ebddde0f92584ffd9ecf
2016-05-10 19:11:59 +01:00
addshore 9044f120b7 Escape edit comments in tooltips
Change-Id: I436924fc2d4455c6aecff884a0eb746621fff210
2016-05-10 17:38:11 +00:00
addshore 78bf501d58 Load pointers on correct revisions
Bug: T133273
Change-Id: I2223defbb80bc44ec7508c71ac9270a1230e45bc
2016-05-10 18:34:05 +01:00
addshore cfac82978c Fix commented out tests
Change-Id: I283228cc03dcc64107720f9092a2f41483f74853
2016-05-10 18:14:10 +01:00
Jakob Warkotsch 980f2ca917 Create Slider module.
* 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
2016-05-10 17:38:46 +01:00
addshore 3eb7e87879 Add data-revid to all slider elements
Change-Id: I1ae5a98d40342cd581dca5a19caaae283472e2da
2016-05-06 14:59:59 +01:00
Jakob Warkotsch 54720944a0 Create Pointer module.
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
2016-05-06 12:37:01 +00:00
jenkins-bot 8140114a53 Merge "Add localizable placeholder message while loading" 2016-05-04 10:14:01 +00:00
jenkins-bot 08e608b81a Merge "Reserve space for RevSlider to load into" 2016-05-04 10:13:58 +00:00
addshore ba4015ed6b Add localizable placeholder message while loading
Change-Id: I762b03c5af8765b90afee81af750880096db6638
2016-05-03 15:35:39 +02:00
addshore 8490d0f040 Reserve space for RevSlider to load into
Bug: T133275
Change-Id: I97283cfe0798a3bacc42fcb8bc067e74ab085ff1
2016-05-03 15:27:27 +02:00
WMDE-Fisch a0f22fd88b Refactored getSection into Revision class and added tests
Change-Id: I6c6fa5194482c25aa3f2285aebfee11cd713285d
2016-05-02 15:21:40 +02:00
WMDE-Fisch a25d94bc53 Changed tick width and container calculation
Addresses bugs with pointer movements and revision ticks shown.
Changes width calulations to fixed tick width.

Bug: T133280
Change-Id: I3585df472906d482d26155966f2e62c4e7bd3458
2016-04-29 11:02:56 +00:00
Jakob Warkotsch 8c6676f939 Create module for Revision type.
This pulls out some of the code around revisions into a decoupled and
tested module.

Change-Id: Ib2a4f96f0e0b9a96ec85d300d97cd52dcaffe89e
2016-04-28 12:38:24 +02:00
WMDE-Fisch 3884f98479 implement centered and calculated slider width
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
2016-04-26 17:04:13 +02:00
Jakob Warkotsch 4b35b4d294 Fix all complaints jscs had.
Running `node_modules/grunt-cli/bin/grunt test` does now not throw
errors anymore.

Change-Id: I13a37f4b46c2dc35e35a4f8ec31b300e9d414a49
2016-04-22 17:06:21 +02:00
Jakob Warkotsch 23b5b2f112 Initial commit.
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
2016-04-19 16:35:37 +02:00