Commit graph

55 commits

Author SHA1 Message Date
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 ab874bdd57 Improve doc, naming and pointer updates
Several improvments including documentation, naming and refactoring:
- bundeling of methods setting, redrawing and loading new diffs
- renamed and improved documentation around some methods in that area
- fixed some leftovers from past refactoring not using new methods

Change-Id: Idf1afcd6ce9210951d28655128a47150f6b7a2aa
2017-07-14 10:19:33 +00:00
WMDE-Fisch ada6498b81 Move data pos attr to PointerView
Change-Id: I46c3dceaddae84b279625caec3349aa10d931048
2017-07-14 12:18:51 +02:00
WMDE-Fisch c6f24f2100 Merge container and pointer building and dependencies
Change-Id: I52ac8b42e39b3a37c0bac6b7fff5a676d7c2ecfe
2017-07-04 14:02:58 +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
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 66ca836e1c Fix JS trigger for the thanks links
Bug: T142636
Change-Id: Idd550f83c02ab50f7c9c10e4224d394ddb39cdb3
2017-04-12 11:57:56 +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
Ed Sanders b00f11ebd2 Update wgRevisionId when changed by slider
Bug: T161257
Change-Id: I1ede31dc9ce67fdc596f117f48ce4bfdde54c2cc
2017-03-23 21:48:11 +00:00
WMDE-Fisch 89345e9e8c Drop IE8 hint
Since IE8 support is dropped, remove hint for incompatibility.
Hint for IE9 is kept to keep track of possible issues.

Bug: T123218
Change-Id: I0fd066dbc22f603da733dcfa339e5af3ffbde41f
2017-02-22 14:00:13 +01: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
addshore 4225951117 Remove WikEdDiff logging code
Change-Id: I898234d72f496d0ce7299f18c121faf2fe174645
2017-02-02 16:26:09 +00:00
Ed Sanders e9eabd00ef Don't replace all tabs on update
Tabs are hooked up to JS events which will break
if they are replaced, just switch out the oldid
in the edit link as that is all that changes.

Change-Id: Iea073f8d435a511ba91cdc0c7bdb9e8f1ec1d4ac
2016-11-23 13:25:32 +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
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
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
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
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 86f62f85c5 Merge "Do not nest mw-content-text element when reloading a diff" 2016-09-06 16:42:31 +00: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
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
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
Jakob Warkotsch a88c05c1f6 Reload side panel when loading a new diff.
Bug: T143204
Change-Id: I1034c756f094c9a3b12cfdd65c94f036fc0e4eee
2016-08-18 15:00:55 +02: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
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
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 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
addshore 093bb1466b Use history.replaceState on initial load
Bug: T141732
Change-Id: I283b9f45f9ecf6bed5d5031ea21b374f12758309
2016-07-31 20:13:00 +01: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
Jakob Warkotsch 11ceffab2f Enhance code documentation.
Bug: T137965
Change-Id: Ice393838545f1545ee085ecdcddfa35f60b32ecd
2016-06-21 13:25:50 +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
WMDE-Fisch 05ea211e8b Fire event for wikipage.content hook
Bug: T136827
Change-Id: If3e92716c4db71b9aeae3fb624c17174cf909b7d
2016-06-03 11:52:49 +02:00
Jakob 19c50267e7 Merge "Dont push state to history in cases where not possible" 2016-06-02 12:10:27 +00: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
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 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
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
Leszek Manicki f2f29832e5 Mark selected and intermediate revisions with colours
Change-Id: If8e2268540a9e5f8110256e779cbee92c6a413ca
2016-05-19 18:39:58 +02: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 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
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