Commit graph

49 commits

Author SHA1 Message Date
WMDE-Fisch 1fa153aeab Fix issues to prepare for lint update
The new mw eslint config comes with node 12 and the change will be
quite big due to the lock file. I wanted to keep the diff of actual
code changes seperate.

- Applied all code style recommendations
- Removed one test that's not giving any value
- Changed regex .match to .test for performance and convinience

Change-Id: I578be8c6460c7a4d1220354c028a9bfd9bb86d13
2022-01-13 13:59:53 +01:00
Thiemo Kreuz 9aca3a2593 Merge ….RevisionList ResourceLoader module away
It's never used in another context but together with the
….Slider module.

Motivated by the confusion about the two types of require()
introduced in Idf1cc79.

Bug: T233279
Change-Id: I922d7ab56fd3ce80bc901f1a5d7174df6fe6756d
2021-12-20 12:13:09 +01:00
jenkins-bot d8c013e323 Merge "Merge ….HelpDialog ResourceLoader module away" 2021-12-17 13:48:22 +00:00
jenkins-bot fd8b96b791 Merge "Merge ….Pointer ResourceLoader module away" 2021-12-17 13:48:20 +00:00
Thiemo Kreuz 1407e0a90d Merge ….HelpDialog ResourceLoader module away
It's never used in another context but together with the
….Slider module as well as the ….init module. The ….init
module continues to require the ….Slider module, so all
dependencies are still met.

Motivated by the confusion about the two types of require()
introduced in Idf1cc79.

Bug: T233279
Change-Id: I4b4ef69f3074d57f884763c092a515ce976daaef
2021-12-16 16:45:41 +01:00
Thiemo Kreuz 319061c92a Merge ….Pointer ResourceLoader module away
It's never used in another context but together with the
….Slider module.

Motivated by the confusion about the two types of require()
introduced in Idf1cc79.

Bug: T233279
Change-Id: I7c98a41051e6d83ab3524cb14a709002feec2d78
2021-12-16 16:39:07 +01:00
Ed Sanders 64effa6e42 Move var declarations inline
Change-Id: If1256b01f6ac8237c79b5ba62f20ad65f1dc7691
2021-10-07 14:55:44 +01:00
Adam Wight 8132e43a20 Migrate Slider module to packageFiles
Change-Id: Idf1cc799ab37ec8f49b3a28d161b6cd53090f707
2020-11-19 09:13:45 +00:00
Adam Wight ebd9985afc Migrate RevisionList to packageFiles
Change-Id: I3299d3a4bc66a3b85d0d0f7d8a49edbf8f6329c3
2020-11-19 08:54:10 +00:00
Thiemo Kreuz 4ac1ff57f1 Remove closure wrappers from all JavaScript code
These are not needed any more, because the code runs in a
seperate scope anyway.

Change-Id: I939a06102f194a0c98021accb2f62be73dd0562f
2020-11-18 11:16:04 +01:00
Thiemo Kreuz c57fe0f2b6 Get rid of all var … = function () {} declarations
… and replace them with more trivial `function …() {}`. I
believe this does not make any difference. But I feel this
makes the code a little more straightforward.

The motivation for this patch is because a few other patches
change some of these function declarations, leaving a (in my
opinion) confusing mixture of styles behind.

Change-Id: Ib8928c4176a963afcf1fee1c785dd7bdc86c9706
2020-11-12 19:23:40 +00:00
Adam Wight ddcd65f4de Migrate Pointer to packageFiles
Change-Id: I8e06c9eeb47688741a95bca8f996b2148b03028c
2020-09-21 18:14:07 +00:00
jenkins-bot 1e13c311e8 Merge "Migrate HelpDialog to packageFiles" 2020-09-21 07:21:33 +00:00
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
Adam Wight c9958c5edd Migrate HelpDialog to packageFiles
FIXME: Reusing HelpDialog as a module entrypoint creates a circular
reference.  It's harmless because the dependencies are added at
different times, but also easy to refactor away.

Change-Id: I3608a78baddf2376cc9eb4524625f4911c130c06
2020-04-05 01:50:48 +02:00
Adam Wight 17ab004262 Fix test module copypasta
A few modules had wrong (duplicated) names.

Change-Id: Ib2ff195ee458a23d01e25a6cb1ff1b573dd9999a
2020-03-29 23:23:48 +02:00
Amir Sarabadani 111d108150 Merge some resource loader modules
Each RL module comes with the cost of its name + hash being sent over every
request and in the startup module increasing the time to load the page.

Bug: T229791
Change-Id: I3ae230a84112a70ab369ffbff70e173b8f07ec1a
2019-08-14 23:10:25 +02:00
Ed Sanders e62f46dd80 Remove obsolete aliases from closures
Bug: T208951
Change-Id: Icf10ea6bbc09542e69c0cd583a4ee4f2f76a3f43
2018-11-16 16:33:52 +00:00
Ed Sanders 351bdcfae7 build: Update linters
Change-Id: If21c9dbeba945d54c6bcf9b6e4edd586c5b411ca
2018-09-13 21:58:39 +01:00
Thiemo Kreuz 48396b78c7 Rework and cleanup ext.RevisionSlider.DiffPage code
This is a direct follow up to the change done in I885f8e7. I found the
code very hard to read after the change, and tried to rearrange it a
little bit. This is what I came up with. What the code does is entirely
untouched.

This also rearranges the replaceWith calls so the replacements are done
from top to bottom.

This patch also avoids calling mw.config.set multiple times.

Change-Id: I1cbce8e8aa030d6ba5cd7d19ab26fa363e13474b
2018-09-04 10:52:16 +02: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
Ed Sanders b1f2613d79 Use core wgDiffOldId/wgDiffNewId JS config values
Newly introduced in a469795efc5bc1c585c9f84ee289ee099833661d.
This will require MediaWiki 1.30.

Change-Id: I9897a77b24e258bf037f8ec6cafa1d0684bf867d
2017-07-18 16:16:05 +00:00
WMDE-Fisch 4a9ee131d3 Refactor pointer class names
Pointers can always be identified as the pointer for the "older" and
"newer" revisions. Class nameing was cleaned up and changed accordingly.

Change-Id: Id17878e780b5a405b196fdc5ec7429eeaef5bd4c
2017-07-11 10:17:24 +02:00
jenkins-bot ac5e6de6f4 Merge "Add jQuery reference to modules using it" 2017-07-06 14:31:29 +00:00
WMDE-Fisch edfd885543 Remove last SliderViewTwo parts
Bug: T165747
Change-Id: I9ac410613361e567bd825f096eb12bbb3edc5cde
2017-07-05 10:22:33 +02:00
WMDE-Fisch 64bf845aef Add jQuery reference to modules using it
Change-Id: Icf5ff3459978b7c7a5fa8e24b42981e789bcc492
2017-06-29 10:14:27 +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
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 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 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
Tobias Gritschacher 233b69ccbf Check if QUnit tests are language-setting-proof
Change-Id: I6ed0cc013db676a587f734c1f35f117525405db7
2016-12-20 14:44:56 +01:00
Tobias Gritschacher f81d65bf6d Revert "Reset custom separator transform tables in number formatting tests"
This reverts commit b46c105202.

Checking if this was fixed by changes to core.

Change-Id: Ia8dcae5227163edd5911cd1ea3c1b0213f7e654d
2016-12-20 13:23:33 +00:00
Leszek Manicki b46c105202 Reset custom separator transform tables in number formatting tests
Looks like custom settings used in a test for number separator
transformation added in Icc9bc09675151645055c7e7f706472a15cc81b0f
influenced RevisonSlider's tests resulting in test failure if
that core test was run before RS test.
Relevant RevisionSlider tests now are ignoring any custom value.
Any value before the test is restored after the test run, though,
in case other tests relied on this (which does not seem to be a case).

Bug: T153121
Change-Id: Ida81b93e4d081b6948e760995a92d182ad79fe0f
2016-12-14 11:23:28 +01:00
Ed Sanders 1c3ef546ad eslint: Remove old jshint/jscs refs, fix exceptions
Change-Id: I56b9f037405d0f93f82dc81dad1cc1b111be338e
2016-11-19 13:37:20 +00: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
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 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
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 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
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 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
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
jenkins-bot 488f8ec8a8 Merge "Make QUnit tests language-setting-proof" 2016-07-04 13:29:13 +00:00
WMDE-Fisch 471ee2eb47 Remove empty test file
Change-Id: Ica247e802cb9f2abfb1de97b87a6100af4376aef
2016-07-04 14:02:01 +02:00
WMDE-Fisch a27925152a Make QUnit tests language-setting-proof
There seems to be no good way to enforce language on the QUnit tests. It works
for the number formatting by setting the user language on the fly but for everything
else it fails. I simplified some tests and skip some tests or asserts when the language
is not 'en'.

I also added a helper to have conditions for skipping tests. This should be part of
QUnit IMO.

Still I dont know if this is something we should care about at all or just assume, that
devs will know what they do when they try to run tests.

Change-Id: I624ccf3984434e06200abffe7ccdd25b396251af
2016-07-04 11:59:49 +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 cdd4a6bd83 Fix linting path for test files and make a pass
Change-Id: Iee023c901d6e87c6d23ce78a57c16c73d90e3efb
2016-07-01 11:26:18 +01: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
addshore d5809a08c2 Move qunit tests to a directory
Change-Id: I5aa8d951e8fb77321748af341a1a17277aad9820
2016-06-27 12:24:47 +01:00