Commit graph

86 commits

Author SHA1 Message Date
Ed Sanders eaa7966710 build: Update eslint-config-wikimedia to 0.16.1
Mostly documentation style fixes

Change-Id: I75262aead377f7f41931de44c5208b7b7d06930d
2020-06-16 15:13:36 +01:00
Thiemo Kreuz 7f38c9c579 Improve discoverability of JS code with @class tags
In my PHPStorm IDE, this makes it possible to follow all methods and
properties in these classes, even these that are later defined.
Otherwise only the empty stub of each class is found.

This might be different in other IDEs.

Basically: PHPStorm does not understand the meaning of the $.extend()
syntax from jQuery without these hints.

Change-Id: I4aa76db183122f6669dc72561441f46f0056d793
2020-01-24 17:21:23 +01:00
WMDE-Fisch 7c47e6e981 Apply user highlighting for all revisions in DOM
This only solves part of the issue. Highlighting is applied for more
elements since they are retrieved from the DOM. The problem still exists
since highlighting depends on the RevisionList chunk on which is it applied.

To fix the issue completely highlighing should be managed somehow globally
on the global list.

Bug: T207781
Change-Id: Idda930f3d0dd64e767c68dade2ca8759bc636898
2019-05-19 11:27:59 +02:00
WMDE-Fisch 9e73c7d2c1 Fix re-highlighting of revisions
This was broken for obvious reasons. Also adding a test.

Change-Id: Ib6e8988884ff84472928758d4112574e17fa48be
2019-04-25 11:15:14 +02:00
WMDE-Fisch 98c33c4731 Extract reapplication of saved filter state
Change-Id: If770e0cb52034a5f52bc8bb3639c9dccdf64b683
2019-04-12 19:15:18 +00:00
WMDE-Fisch d4a3ec243e Use switch statement for filter events
Change-Id: I0f564e33744d3806682534267c4b922edd5e9b3c
2019-04-12 19:15:12 +00:00
WMDE-Fisch bd38ccaf98 Early exit filter events
Change-Id: I72fd4a1496f6c0247a9166ba54ce3de2918bc310
2019-04-12 19:15:05 +00:00
WMDE-Fisch 32cf219c4e Extract code that resets/removes highlighting
The next iterration on avoiding code duplication. I
still stuggle a bit merging these methods in a sane
way.

Change-Id: I8d95acc06da7f83a6133e55becabdf03b26a97af
2019-04-12 19:13:20 +00:00
WMDE-Fisch a49cb0c466 General code reduction in the highlight event handlers
- make use of toggelCSS()
- use more general jQuery selectors ro reset the line and bubble highlight
- get rid of ~= when selecting revision ids

Change-Id: I123e263bb379107a561fe8a2ffed476da9032b88
2019-04-12 19:12:44 +00:00
WMDE-Fisch f4c64b744e Put event setup for user line highlighting in own method
This is mainly a copy of what's done for the tag lines to set the events.
In the next steps I'll try to avoid code duplication here be extracting
common code.

Change-Id: I29df109de30c538cc206d445abff8464baf45378
2019-04-12 19:09:50 +00:00
WMDE-Fisch a2ca2c031e Add node selenium tests for revision highlight feature
The patch adds a first package of node selenium tests including
test for the user and tag filters.

The classes for user- and tag-rows were re-added to have better
access via selectors.

Change-Id: I8c53d9c923820e177d83ee900cee08e93cd3f65b
2019-04-11 17:58:53 +02:00
WMDE-Fisch a96b079e8f Unify highlighting CSS classes
Change-Id: Iceb094075d1fb1bd4aca53c120dbc3c6ccd39eb6
2019-03-25 17:30:47 +01:00
WMDE-Fisch 55c558169b Retrieve revision list in highlighting method
This moves the retrieval of the revisions into the method setting the
highlighting. The check for undefined did not to much since the rev
var would still remain undefined.

Change-Id: I1acf540f135af4c16fb80d633b3690473ada7833
2019-03-25 17:21:03 +01:00
srish 6ee7f910b7 Add filters for tags
* Uses the existing implementation of highlighting revisions from the same user
* Shows bubble next to tags in Tooltip
* When you hover on a bubble, tag row is circled, and revisions with a specific tag gets highlighted. When hovering ends, highlighting ends. But, if there is an active filter available, all previous states are restored accordingly.
* When you click on a bubble, in addition to highlighting revisions and tag row, any previous tag or user filter is removed.

Bug: T203581
Change-Id: I824a027a7f542eb7227545870553e58ec23542bb
2019-03-25 16:57:57 +01:00
Ed Sanders 57f9876e27 build: Update eslint-config-wikimedia to 0.10.1
Change-Id: I8aeddc384d25318e8618bb617884205f1c0c1f00
2019-02-10 16:54:28 +00:00
Thiemo Kreuz 2a2d01ffc9 Remove redundant checks for .length on jQuery objects
jQuery objects behave fine when they don't contain anything. No need
to check the .length before. This is one of the essential feature of
jQuery.

I'm also simplifying some setTimeout the same way. clearTimeout will
never fail. It will ignore numbers that never represented a timeout,
or have been cleared before. Note how the property was never set back
to -1. So this code was kind of incomplete anyway. I suggest to fix it
this way around, instead of trying to set -1.

Change-Id: Ic15812ead9d93f8eb07831aeb75577df2abdff07
2019-01-14 09:40:55 +01:00
Ed Sanders e62f46dd80 Remove obsolete aliases from closures
Bug: T208951
Change-Id: Icf10ea6bbc09542e69c0cd583a4ee4f2f76a3f43
2018-11-16 16:33:52 +00:00
jenkins-bot 7b1688a2af Merge "Highlight revisions from the same user" 2018-10-10 09:27:21 +00:00
gopavasanth 154180ba52 Highlight revisions from the same user
Completed subtasks

* Added bubble in the Tootltip
* Added border on clicking or hovering the bubble
* Highlites Bubble on hover
* When Clicked or hover on the Bubble: Highlights
  revisions from the same user
* Added filter revisions.

Bug: T136105
Change-Id: I64cfef395ce1812d501980067edffe210fc99227
2018-10-05 19:12:44 +05:30
srish 6934b90d87 Show tags data on the tooltip in Revision Slider
Approach followed:
- Include tags as an additional parameter in rvprop field to fetch revision tags
- Use API Tags to fetch available change tags for a wiki along with their display names
- At the time of fetching revision data rebuild the revision list with tags containing display names
- Display tags one in each line on the tooltip

Bug: T180429
Change-Id: Ieba8b79ed408ff50b3f7d4bcfd7b2fa8cca83278
2018-08-28 23:22:12 -07:00
Addshore b86be90b06 Reintroduce improved hover and bar clicking
This patch mainly reintroduces the option to click on bars and move
the pointers with it. To do this, 'ghost' pointers are introduced
to show what would happen when bars are clicked. The pointers moved
differ depending on where the user clicks on a bar. Pointers are
still not allowed to change positions, so in some cases booth pointers
move with one click. See the task description.

The patch also includes some renaming and also refactoring of the
click handling in general. Furthermore bar hover mechanics are handled
by the RevisionListView class now.

Moving both pointers is not possible when it would push one of them of
limits.

Bug: T172092, T173566
Change-Id: I32a8256f7667e03081324d54accdf03a17454faf
2017-08-29 09:19:13 +00:00
WMDE-Fisch dcfb074916 Fix typo and set optional values
Change-Id: I43174f7c28e0f665decf88f92f9175bb4c69a3cb
2017-08-23 17:01:03 +02:00
WMDE-Fisch 1d2811f3d9 Revert "Reintroduce hover and bar clicking"
We want to make an announcement first.

This reverts commit 0da5702f82.

Change-Id: Icbf5fb99c3fbb87a47106e25d9d80685e86cba32
2017-08-17 13:52:53 +00:00
WMDE-Fisch 0da5702f82 Reintroduce hover and bar clicking
Bug: T172092
Change-Id: I496143f2425eccd0028cc1980fc7189a457c70a2
2017-08-11 17:54:48 +02:00
mdew192837 8f9b30b3ac Reduce confusion for mw.util.getUrl()
Currently, `this` is passed as the parameter for pageName, making it
seem like getUrl() can take in an object as the first parameter, when
it should be a string. This works right now because of a tertiary
operator that fetches what we need. To reduce confusion, we should
pass null instead.

Change-Id: Ieea30a4933f3e3fdeb8331c5c544bf1eb034e6b7
2017-08-10 13:49:38 -05:00
Pmlineditor ea187d6944 Convert date in Revision Slider tooltip to link
Bug: T171067
Change-Id: Iedcefdebe99138dc58bec50aaa7e9560d9101c96
2017-08-10 11:46:53 -04:00
WMDE-Fisch cf5d602a53 Update eslint and fix issues
Change-Id: I0e3ad763398430608c30bb22741a57c81b2b7062
2017-07-14 12:28:45 +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
WMDE-Fisch 72d19630ad Let revision bars leave space for the pointer line end border
The end border for the pointer lines can not be displayed because the
bars on the biggest revisions used all the height. This patch reduces
the max height of the bars slightly and refactores the calculating method.

Bug: T163436
Change-Id: Idfa6bdb9f85221063e13f3ec16b22fcfbe6cbd9c
2017-04-25 15:29:18 +02:00
WMDE-Fisch 3c4c9fed0d Fix OOjs UI tooltip position
The latest OOjs UI update seem to fix tooltip center positioning.
Margins added manually are removed now.

Change-Id: I883a5026002fae6fbda230b407303a4f2b82914d
2017-04-19 13:08:24 +00:00
WMDE-Fisch 624b4786ec Introduce RevisionsListView element
This will avoid several jQuery calls.

Change-Id: I1934bcfde97415ca0c01465037f34d2555b6daa4
2017-04-19 11:26:44 +00:00
WMDE-Fisch aa7daf4758 Rename $rev to $revisionContainer in ListView
Meanings are more clear now.

Change-Id: I3ff9fd0df4748c68ab363a47bda84ec8d1464fc4
2017-03-06 10:14:03 +01: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
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 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
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
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 77095bfa65 Use OOjs Popup Widgets instead of tipsy
Bug: T141983
Change-Id: I4b4ea427f82b15625537d859623461eceb1eb52b
2016-08-08 18:11:23 +02:00
jenkins-bot 7010b98d7f Merge "Include a number in messages showing a number with a unit" 2016-08-03 10:03:39 +00:00
jenkins-bot ff550611b2 Merge "Clean up the usage of <bdi> tags" 2016-08-01 13:53:57 +00: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