Commit graph

93 commits

Author SHA1 Message Date
WMDE-Fisch c6f24f2100 Merge container and pointer building and dependencies
Change-Id: I52ac8b42e39b3a37c0bac6b7fff5a676d7c2ecfe
2017-07-04 14:02:58 +02:00
WMDE-Fisch fc5c13f359 Merge draggableDragAction and dependencies
Also temporarily deactivate browser tests for bar clicking.

Change-Id: I347533ef445cb3c37e420beebcc79919e56a1223
2017-07-04 10:56:40 +00:00
WMDE-Fisch 6ffe96bc4c Fix errors leading to wrong slider scroll postions
The detection touched in this patch addresses slightly different
kinds of RTL handling in browsers. The detection how things are
handled seems to be broken in the mentioned Chrome V8 versions.

The workaround takes care of that issue. With Chrome V8 6.0 this
should be fixed and the workaround can be removed.

P.S.: Credits to Leszek for the idea what's actually going on.

Bug: T168299
Change-Id: I068c2fb6ba60189004c0ec6661fcd346af16126c
2017-06-21 15:21:08 +02:00
WMDE-Fisch 0525f0bdb2 Do not assume that revIds increase in time
This patch fixes issues with the RevisonSlider assuming that the higher
revision id belongs to the newer revision. Min/Max methods to decide what
the diff and what the oldid is are removed and the usage of methods is
adjusted accordingly.

Also the test for switchover pointers is removed since this will not work
with the patch.

Bug: T164455
Change-Id: If5d9cbb8ebd872aee376d249942e6881c8edb984
2017-06-01 18:29:22 +02:00
pppery 4ed9851610 Fix handling of escape key
Previously, pressing ESC aborted the dragging of the slider, but this
was broken by I64cca7a7547310bee64ad95f500b722c362bbb45, which refactored
uses of a variable that was previously a closure into two separate functions.

Bug: T140965
Change-Id: I6b7bc383128d8c7d99da469706bff881f1329cd9
2017-05-22 15:22:55 -04:00
WMDE-Fisch 31b9fe31ef Convert touch events to mouse events on pointers
This will make the pointers work on touch devices. The events responsible
for the touch drag and move are converted to mouse actions that will
trigger the draggable.

When using Chrome on touch devices and zooming the offset of elements
calculated by jQuery is wrong. There is a workaround that seems to work
and also seems to not break behavior with normal browsers and on other
devices. Since this only seems to be a problem in Chrome the fix will
only applied to Chrome browsers to avoid performance los on others.

Also introduced a script file for static utility methods.

Bug: T164249
Change-Id: I245f77eb836afded249f3b5ebb7129dab08d0017
2017-05-08 12:55:31 +02:00
Ed Sanders c6465dee07 build: Update eslint to 0.4.0 and make pass
Change-Id: I6e3e2f30615996c57650127cde9738d3a6dd9ae5
2017-05-04 21:06:08 +00:00
jenkins-bot 095c3ea863 Merge "Throw errors, not strings" 2017-05-03 09:33:09 +00:00
Ed Sanders 4e9689ce36 Throw errors, not strings
Change-Id: I65bad18f2526283ba426aed8ff7da9121f230770
2017-05-03 09:47:14 +01:00
WMDE-Fisch 9e6f44cb06 Tooltips when hovering slider lines in the SliderViewTwo
This change enables tooltips when hovering the slider lines. To avoid
interference of these events when dragging a variable is set to keep
track of the dragging state.

Bug: T162602
Change-Id: I45c1b73ca470d7b8fcf8b95e15187864e35e907f
2017-04-19 11:26:51 +00:00
WMDE-Fisch 177d6a1bd1 Factored out drag action from draggable
As preperation for tooltip and hover color changes while dragging in
the new SliderView.

Change-Id: I679fc1b6fb5f69d27f6dee0aafd168493dc33957
2017-04-06 13:47:59 +02:00
WMDE-Fisch c52c657516 Introduce alternate SliderView
Adding a new class for an alternative slider view with
one slider for each pointer. The new class will be used
when the extension is installed as a beta feature.

Each pointer has now its own pointer container visualized
with a thin line. Pointers can not change places anymore
and methods doing so where overwritten in the patch.

Selected revisions are not colored atm to better distinguish
between pointers and bars. Poiner lines are now shown above
the bars. ( as from feedback in the last PM session )

Some issues with the design might remain. But since we plan
the deployment anyway next week this could be merged if reviewed. 

Bug: T160410
Change-Id: If00c31e30f8a01f3525b191c70605b9c9381671d
2017-04-06 07:29:19 +00:00
WMDE-Fisch 040dd9c945 Factor out setting of cursor pointers
Change-Id: Idb66dcd1daeff48dcce3a39be32eae7c8e17acc8
2017-04-06 07:29:12 +00:00
WMDE-Fisch f978f8690c Fade out pointer lines while dragging / pointer animations
Bug: T162259
Change-Id: I54d6a9bc33b93c0785b2a808b4d1482789d91317
2017-04-06 07:29:02 +00:00
WMDE-Fisch a72b31b280 Renamed container offset variable
Change-Id: I6fc2d51f5a591dcf4898abb1ae010a433131a0d9
2017-04-03 11:05:51 +02:00
jenkins-bot 16d9e74760 Merge "Move arrow button logic to own class" 2017-03-27 22:45:37 +00:00
jenkins-bot 7abac9b03e Merge "Move helper button logic to own class" 2017-03-27 22:44:09 +00:00
WMDE-Fisch b0227f24b4 Renamed firstVisibleRevision to oldestVisibleRevison
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
2017-03-27 21:04:31 +02:00
WMDE-Fisch 97c85abdf2 Move arrow button logic to own class
Change-Id: I56e52d8b11f8557d759dc495512d9754e8f441f6
2017-03-27 18:56:59 +00:00
WMDE-Fisch 7e277fbd9d Move helper button logic to own class
Change-Id: I8fdfeb3344974b3cee7ce07bcf2ceea9308fffe6
2017-03-27 18:56:34 +00:00
WMDE-Fisch 277d714ec3 Factor out relative pointer index
Change-Id: If0843bea19089c1a91228a0c01f8ac65e44f7f3f
2017-03-23 17:54:12 +01:00
WMDE-Fisch c2510ab082 Factor out draggable options
Change-Id: I64cca7a7547310bee64ad95f500b722c362bbb45
2017-03-23 17:42:49 +01:00
WMDE-Fisch c01d07bc1f Add documentation for new methods
Also some minor refactoring in the pointer method.

Change-Id: I986036277d2b6e65cbed9f39c81f9f03ad0e9e3c
2017-03-23 12:46:24 +01:00
WMDE-Fisch 981e9d4a7e Bundle slider construction
Change-Id: I7202755ee49d1cb42d68f997750170defdc3304c
2017-03-22 18:56:11 +01:00
WMDE-Fisch 394f812d9b Extract pointer rendering
Change-Id: I9e0200faf477c2c9476574059c46d1f8b003537b
2017-03-22 13:32:17 +00:00
WMDE-Fisch 06bb204fac Extract pointer and revisions container rendering
Change-Id: I2f65a173c2020a5a0ed276d064f0a45104982497
2017-03-22 13:32:10 +00:00
WMDE-Fisch 9c80fda6f8 Extract rendering of arrows
Change-Id: Ie639cca4bfcd3fe3f8b81556d900dbcdc3232f83
2017-03-22 13:32:02 +00:00
WMDE-Fisch e611e40833 Extract rendering of help button
Change-Id: I1db2a87c70ffce126478533836ea0ab4e21e3a08
2017-03-22 13:27:48 +00:00
WMDE-Fisch fbac5c69a4 Refactor usage of OOjs UI tooltips
This patch changes the way OOjs UI tooltips are constructed.
Until now we did not use the full potential of the widget.

Some strange behaviour remains and it seems we can not use
'horizontalPosition' here. Therefore the direction is passed
down to the RevisionsListView to center the tooltip manually
and margins are set for the help and arrow tooltips.

Bug: T159428
Change-Id: I0a67340da4d94f2f6b29e507f94fc695b44b71f9
2017-03-03 14:31:07 +00:00
addshore ce4bc18569 Attach to Newer / Older edit links
This now attaches the revisionslider to the
older and new links that are by default in the
diff.

This means when clicking them the revision slider
will use an ajax call to reload the diff (while moving
its own pointes) rather than reloading the whole page

Change-Id: I11fa92828140f980ca8edee27403a4e2a5f5a6a7
2017-02-03 15:06:20 +00:00
pppery b169f6237a Introduce ESC key detection during dragging RevisionSlider
When the ESC key is pressed, aborts the drag and returns the sliders to
their original positions

Bug: T140965
Depends-On: Ib0f386c6a2447740f44591be70c34cf4a83b88c4
Change-Id: I2dfc2fa03d2c7705fa2947dffa07fbce8ed3b185
2017-01-23 09:51:52 +00:00
addshore 17caad54ca Use mw.Map#get instead of mw.Map#values
Change-Id: Ifbc7f3e40190f678d6d9dad41fc161334b9b12c2
2016-11-23 00:31:53 +00:00
Ed Sanders 1c3ef546ad eslint: Remove old jshint/jscs refs, fix exceptions
Change-Id: I56b9f037405d0f93f82dc81dad1cc1b111be338e
2016-11-19 13:37:20 +00: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
Ed Sanders 62c5b4cff9 Prevent selecting the same revision twice
Bug: T141254
Change-Id: Ic51605dca1484ce66ce9764a2291c8a947f9d376
2016-10-14 10:25:10 -07: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
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
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
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 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
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