Commit graph

1625 commits

Author SHA1 Message Date
thiemowmde f0742e7ba3 Use existing data-pos attribute instead of pixel calculations
This click handler is assigned to many different elements. Not all
of them can be used as a source for a data-pos="…" attribute. But a
lot can.

Again, this patch alone will not actually fix T352169. But it will
improve the situation a lot, according to my local tests. Many of
the clicks will start to work fine on RTL wikis because the
problematic pixel-based getRevisionPositionFromLeftOffset
calculations are not used any more.

Steps to reproduce: Go to a RTL page with a very long history, e.g.
https://he.wikipedia.org/wiki/Special:Diff/38031767?uselang=he
Click on one of the gray bars in the right half of the slider. This
will not work, i.e. the slider will not move to this position but
to a totally different one. This is the bug described in T352169.

I noticed that a browser zoom other than 100% can cause many more
problems that are unrelated to this patch. Please test with 100%.

Bug: T352169
Change-Id: Ife49557c891736bc94df6087658f76326791f61b
2024-02-09 16:27:05 +00:00
jenkins-bot ffc40f6954 Merge "Remove $dummy element after determineRtlScrollType call" 2024-02-09 16:03:50 +00:00
thiemowmde e505805adb Remove $dummy element after determineRtlScrollType call
This updates the code a little bit to be closer to the current
version of https://github.com/othree/jquery.rtl-scroll-type
without actually changing anything (for now).

I tried copy-pasting the current version to see if that helps with
T352169, but it doesn't make a difference.

The only actual change is that the dummy element is removed when
it's not needed any more.

Change-Id: Ibdd064e228fa9464a8652ce9a8a9ac388662f29d
2024-02-09 12:26:15 +01:00
thiemowmde 1b49469c96 Fix rounding error in revisionsPerWindow calculation
I have seen this getting fed with fractional numbers like
38.9994375. This apparently happens when specific browser zooms
are used, e.g. 110% in Google Chrome. There is a lot of code that
expects this to be an integer number and stops working entirely
when it isn't.

I'm also updating two related comparisons to not be so extremely
specific any more. This probably doesn't make a difference any more
with the fix above, but can't hurt.

This patch doesn't solve T352169, but is one more puzzle piece on
the way to solve it.

Bug: T352169
Change-Id: Ied0b9748beec941e901ca4ecba428c16967ca510
2024-02-09 12:19:31 +01:00
thiemowmde 7e152e9f7c Drop obsolete special case for Google Chrome before version 60
The version numbers mentioned in the comment are from the V8 engine.
The last Google Chrome version to use a 5.x version of the V8 engine
was Google Chrome version 59. That was 8 years ago. See T168299.

Our official support matrix asks for 3 years.
https://www.mediawiki.org/wiki/Compatibility#Browser_support_matrix

Notice how there is no version number in the code despite the comment
explaining that it shouldn't be used in later versions.

According to my local tests this is not a full fix for T352169, but
notably improves the situation. I can still see the bad behavior
described in T352169, but only in a narrow region on the right side
of the slider. Removing the obsolete browser detection is necessary
to unblock further investigation.

Making the dummy text a bit longer also makes an actual difference.
To keep this patch as minimal as possible all I do is to add a single
character.

Bug: T352169
Change-Id: I56f3c1969ce4f164f4319e5038d0f97527e6b1c0
2024-02-07 17:29:19 +01:00
Translation updater bot 30cca9dac8 Localisation updates from https://translatewiki.net.
Change-Id: I51f3dd05b8691510b7e0cba1e3d617baa70157bc
2024-02-07 08:27:31 +01:00
WMDE-Fisch 95540a313c Merge tooltip browser tests
No need to build up two test here with refreshing the page.

Change-Id: I9bc5b44e2b92704b896edaaa03affac216b9dbce
2024-02-02 16:53:02 +01:00
WMDE-Fisch 502e207e7c Remove obsolete lint rule exception
Now triggers a warning, that the exception is not needed.

Change-Id: I3e7fd4dba7e17fc9f7e0969148db322fedd34c1c
2024-02-02 14:01:57 +01:00
jenkins-bot 4e3d7944d2 Merge "Merge large chunk of code duplication in SliderArrowView" 2024-02-02 11:03:49 +00:00
jenkins-bot 7f5b0d9cf4 Merge "Merge a small piece of code duplication in SliderView" 2024-02-02 09:13:50 +00:00
thiemowmde d006c26f65 Merge a small piece of code duplication in SliderView
The method is only called from two places, and both do very similar
things before the call. This duplication can be merged.

One notable difference is that .scrollLeft() was possibly called
twice before. The first call was pointless anyway. The argument for
.scrollLeft() is absolute, not relative.

This code cleanup is motivated by T352169, but doesn't solve it.

Bug: T352169
Change-Id: I75e9ffc77ef6331f14e074921c78c28233e60840
2024-02-01 23:40:58 +00:00
thiemowmde ed2c0a8b73 Merge large chunk of code duplication in SliderArrowView
This was almost the exact same code, with very few differences (e.g.
different CSS classes, and different icons).

Another change in the same file is the removal of an extra
`!== undefined` check. This is impossible. I can't tell why this was
there. Maybe an artifact from when this was developed?

This code cleanup is motivated by T352169, but doesn't solve it.

Bug: T352169
Change-Id: I3bb7ce00f9b754f9ba58310100b855c8ee3fca4a
2024-02-01 23:40:51 +00:00
jenkins-bot 27aa61e0a3 Merge "Make use of the /i feature instead of .toLowerCase()" 2024-02-01 23:26:13 +00:00
thiemowmde 99c0064e34 Make use of the /i feature instead of .toLowerCase()
Depends-On: I8a101781bb47612deabb0f2a06a398ac13e860e6
Change-Id: Id738c409cca89c1783290578f42c92e2c8b0cac3
2024-01-31 19:34:59 +00:00
Translation updater bot defc20e88a Localisation updates from https://translatewiki.net.
Change-Id: I2efdebc90ac63b3b0402329d97a347f1ed543028
2024-01-28 16:07:57 +01:00
Translation updater bot e7aab0bd7c Localisation updates from https://translatewiki.net.
Change-Id: I2337d96d4e89c52146c1f971325626172994ed73
2024-01-18 09:27:08 +01:00
Volker E df7d5b95ac build: Update 'svgo' to latest v3.2.0 and re-minify SVGs
The latest update of 'svgo' dependency includes three optimizations on
converting path commands, which
- improves closing paths and how we determine if to use absolute or
  relative commands.
- round arc or convert to lines based on the geometric sagitta
- convert cubic Bézier curves to quadratic Bézier curves where possible
Also unifiying npm command to qua standard notation `minify:svg`.

Bug: T354875
Change-Id: I38ccbfa62ee7afcfb10eee7853b33648863f54ad
2024-01-16 00:17:03 +01:00
jenkins-bot 8f79cb6ad9 Merge "Various tiny clean-ups" 2024-01-12 09:48:13 +00:00
Translation updater bot 0befc9d8f9 Localisation updates from https://translatewiki.net.
Change-Id: Ie9eab77a2e0bfb792994daeb937a0fe3f74084b7
2024-01-12 09:01:00 +01:00
Translation updater bot ab5ef78bb5 Localisation updates from https://translatewiki.net.
Change-Id: Ia3d368b59ac07f8da1a4de4ece997870a6181ae4
2024-01-10 08:33:22 +01:00
Umherirrender 748c7d9b89 tests: Use namespaced classes
Change-Id: I5f578ee6a91720921512bb8321ee7a95dd3d3aa4
2024-01-05 21:23:18 +01:00
Translation updater bot 8ede0f2514 Localisation updates from https://translatewiki.net.
Change-Id: I9862f592155bfd675568428c9765bd3186fb2d8b
2024-01-02 10:17:17 +01:00
jenkins-bot b395d66270 Merge "Add fail-safe to SliderView.revisionsClickHandler" 2023-12-07 10:53:04 +00:00
jenkins-bot 7a5e15527e Merge "Inline trivial single-use method in the Revision class" 2023-12-07 10:52:32 +00:00
jenkins-bot f74da84e6c Merge "Drop another chunk of code duplication from SliderView" 2023-12-06 17:38:02 +00:00
Fomafix aadedc996f Use MediaWiki\ResourceLoader\ImageModule instead of ResourceLoaderImageModule
The class name ResourceLoaderImageModule is deprecated since 1.39.

Change-Id: I1ef11649f10f4114372685ca20177227f06b1237
2023-12-01 13:27:37 +00:00
jenkins-bot 442f905c5f Merge "Update StaticUserOptionsLookup's FQN" 2023-11-30 15:05:39 +00:00
gerritbot 419865a72b Update StaticUserOptionsLookup's FQN
User-options related classes are being moved to
the MediaWiki\User\Options namespace in MediaWiki Core;
reflect that change here.

Bug: T352284
Depends-On: I42653491c19dde5de99e0661770e2c81df5d7e84
Change-Id: I5b9f4c7ea90f492f75b9055b801ec0853da22687
2023-11-29 17:55:18 +00:00
gerritbot 639d3fa19c Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: I4daca7542a428455aa72cc372521e894716e3c40
2023-11-29 12:39:57 +00:00
thiemowmde 33b9ee0e14 Drop another chunk of code duplication from SliderView
Change-Id: I9c258454b2ed34208950efa113fed32ce4d0e0be
2023-11-29 13:15:08 +01:00
thiemowmde fdf34e4dfb Various tiny clean-ups
Notable:
* Arrays shouldn't be initialized like this. Instances will actually
  share the same array object. Luckily this was dead code anyway
  because it's re-done in the constructor.
* $timeOffset is already guaranteed to be an int.

Change-Id: Ib0a2b0f39ee368fcef4756281099d519d470eb44
2023-11-29 12:58:51 +01:00
thiemowmde eda9022d51 Inline trivial single-use method in the Revision class
This utility method doesn't really belong here. This does at least
reduce the surface area. Now it's only a single method instead of
two.

Change-Id: I21fbb4e4922f2cc3bc3e23c457b5ceeb216f3ab4
2023-11-29 12:55:18 +01:00
thiemowmde c634608057 Add fail-safe to SliderView.revisionsClickHandler
Turns out we can run into this failure situation even if everything
goes according to plan. It is possible to click just one pixel outside
of the valid range, e.g. on the very right corner right next to the
last bar. This is supposed to not do anything anyway, and correctly
doesn't do anything from the user's perspective. But it shows up as a
failure in the JavaScript console.

Bug: T352169
Change-Id: I12c9cce90970be36667ba1b721afd38a13a063c9
2023-11-29 12:50:34 +01:00
WMDE-Fisch 6482107b14 build: Update linter libs
* "eslint-config-wikimedia": "0.26.0"
* "grunt-eslint": "24.3.0"
* "grunt-stylelint": "0.19.0"
* "stylelint-config-wikimedia": "0.16.1"

Including auto fixes.

Change-Id: I24374dad734fca734f9c5e25cfa5b5380ad24c46
2023-11-24 10:14:15 +01:00
Translation updater bot f06840c303 Localisation updates from https://translatewiki.net.
Change-Id: I433cfe32a46c3da2ad0d090b6c8f0da07d069a41
2023-11-23 11:57:22 +01:00
Translation updater bot 857ca7ce40 Localisation updates from https://translatewiki.net.
Change-Id: I759bc66d9f493e596f887a715edcecf10b180f91
2023-11-22 08:20:38 +01:00
jenkins-bot b0e365ae0a Merge "Revert "partly drop dependency from RevisionListView"" 2023-11-15 15:23:40 +00:00
thiemowmde ac0096b23b Revert "partly drop dependency from RevisionListView"
This is a manual revert of I06b8af8. Turns out the list of revisions
(and with that the maximum size calculated from the list of revisions)
changes during the lifetime of the view. It must be recalculated.
Maybe not as often. But this is an optimization for a later patch.

Change-Id: Id1dce5566a9041396bcf72df7e4936be0e53188a
2023-11-14 17:40:52 +01:00
jenkins-bot c853426760 Merge "Move tooltip events to the tooltip creation" 2023-11-09 09:17:16 +00:00
WMDE-Fisch f77502f526 Move tooltip events to the tooltip creation
Change-Id: I0de2aa4fabde1d4a063373de26336ccf6c8bda5e
2023-11-09 09:10:37 +01:00
thiemowmde d20cead930 Split large hook handler function into named methods
Change-Id: Ided2c233829166bd691f01cb8b619f03c1ca4ff2
2023-11-08 09:16:38 +01:00
WMDE-Fisch fc4cef8c8d Add RevisionClickHandler only to new elements
When expanding the slider to newer or older revisions the handler
for revision clicks should only be added to the new revisions.

Change-Id: If590996d27dc75cbdfc931e9649418f875c3869d
2023-11-07 13:08:46 +01:00
jenkins-bot a4f6201e3b Merge "Remove redundant checks for .offset() !== undefined" 2023-11-07 11:32:53 +00:00
jenkins-bot 0debea3f8b Merge "Consolidate highlights and tooltip creation" 2023-11-07 10:00:04 +00:00
thiemowmde d2b03abe43 Remove redundant checks for .offset() !== undefined
We added this more as an experiment because we couldn't reliably
figure out what makes later .offset() calls fail. After looking into
the actual jQuery source code I realized the only way .offset() can
return undefined is when .length is zero. Which means the two checks
are redundant and one can be removed.

In case an element is not attached to the document an object with
{ top: 0, left: 0 } is returned.

Bug: T342556
Change-Id: I6265fd27b3102a9cfe853a9c0e11063b76cf0b7b
2023-11-06 22:14:58 +01:00
WMDE-Fisch 56b886a76b Don't try to draw lines when the slider is not fully loaded
Bug: T342556
Change-Id: Ibacc149214c23310f70b8efec19d6693a4d79c06
2023-11-03 11:11:30 +01:00
WMDE-Fisch 08fe283ba7 Give this context to removeColoredColumnBorders
Otherwise the `this` to call addColoredColumnBorders() inside of
that function is unkown when triggering the callback.

Can be verified working when collapsing the slider on master vs
this patch.

Regression introduced in Icffe9551d633470ccec1b63ea570e138db48dee8

Change-Id: I653db133688d7678d0cb3b80936c7e9a7ebebd1f
2023-11-03 10:34:42 +01:00
WMDE-Fisch 5550fc74da Consolidate highlights and tooltip creation
This is a first step in restructuring and consolidating the
highlight and tooltip creation. I use revision focus to communicate
the state when a revision is highlighted and shows a tooltip.

There's still stuff to untangle but I want to keep the diffs small.

Change-Id: I0b169042837a2c3bb825c23368e7e8a485694eb5
2023-10-26 20:37:54 +02:00
jenkins-bot 68a6403052 Merge "Mark private methods with @private tags" 2023-10-26 12:22:38 +00:00
jenkins-bot ff56357289 Merge "Partly drop dependency from RevisionListView to RevisionList" 2023-10-26 12:21:38 +00:00