Commit graph

35 commits

Author SHA1 Message Date
addshore 1ab20bf772 Also track the hook run count
This will give us a better idea of how many times the
slider is being sent out in by the php code as oposed
to how many times the JS code is running.

This number is important as client side the code will
listed to things like DoNotTrack and not send data!

The difference between the initphp and init numbers
should give us an idea of how often this is heppening!

Change-Id: I01db4318b08851de4c6b8c96cbf2740324160140
2016-08-12 10:31:18 +01: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
Leszek Manicki 77095bfa65 Use OOjs Popup Widgets instead of tipsy
Bug: T141983
Change-Id: I4b4ea427f82b15625537d859623461eceb1eb52b
2016-08-08 18:11:23 +02:00
addshore e5c8a04e62 Use Title::inNamespace() in Hooks
Change-Id: I5fc56e612fb48635acb1a8ed6e034968df39afa4
2016-07-26 12:09:45 +01:00
addshore f61443cb9d Don't load on Special pages
Bug: T141296
Change-Id: I3b2e37d45793d8f3ac50f06e92d767368eadee29
2016-07-25 21:15:15 +01:00
aude 7ec0c426b3 Get user from context instead of global
DifferenceEngine extends ContextSource, so we can
get the user from there instead of using a global.

Change-Id: I46e7a244729f2d8259319bed2c905e2971b37bf0
2016-07-14 15:43:42 -04: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 237c181c69 Add remoteExtPath to tests module
Change-Id: If923759dfdb9979f91d707c685f91b24ef2aeb33
2016-07-01 11:24:59 +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
WMDE-Fisch ace6ec3ed3 Add BetaFeatures images
Bug: T137969
Change-Id: Ifee3deb60d5ce2aad42c4f18efa25c2fcfe3007f
2016-06-16 17:28:29 +02:00
WMDE-Fisch f79ce331b4 Use ->text() to get message content
Bug: T136826
Change-Id: I8490f730bce5eb432ad76f5efaf3a9c2ec48c354
2016-06-02 18:01:57 +02:00
Brian Wolff 39d8d9229a Make files not executable
I know it doesn't matter, but it was kind of bothering me.

Change-Id: Iae9f8b17a3fb5ced362dc2da95e67e20db8af5a5
2016-06-02 13:48:09 +00:00
Leszek Manicki f9d9a4a4b7 When JavaScript disabled do not show RevisionSlider
As suggested in a comment in T135198, do not show anything above the
diff when JavaScript disabled instead of always putting a message
there.

Change-Id: I1c66fa4a9fa6e90f8318de3a4f656d629000d9ca
2016-05-31 19:49:08 +00: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 fc74a35709 Use correct time offset based on server and user settings
If the user has a time offset that will be used.

If the user uses the default then the offset is
still retrieved from mw.user.options.values.timecorrection

If the user is anon then mw.config.values.extRevisionSliderTimeOffset
is used which is added as a JS var by the Hook

Bug: T135109
Change-Id: Iab56bbeb6a1dd2ea08b73983341485623ff63ef1
2016-05-13 11:02:20 +00:00
addshore 39663c4539 Use JS config vars instead of DOM injection
Change-Id: I0d670de6e6c6c2a86e1f1227487b16b85a10b4f4
2016-05-13 11:01:44 +00:00
addshore cfac82978c Fix commented out tests
Change-Id: I283228cc03dcc64107720f9092a2f41483f74853
2016-05-10 18:14:10 +01:00
Jakob Warkotsch 980f2ca917 Create Slider module.
* threw out most of the things from init.js
* turned Slider + View into respective modules
* pointers should remember position (except on page load) and correctly
  slide back to their position/to the side

Some things still need testing and refactoring.

Addshore: - CS fixes and comment out current failing tests

Bug: T134395
Change-Id: I78a7095e1d9902314163b1443448f47ef0484d4e
2016-05-10 17:38:46 +01:00
addshore ee80c0450e composer.json mediawiki/mediawiki-codesniffer to 0.7.1
Change-Id: I23c9b72ba0e1d9991910356fb61e6fa65a43805a
2016-05-09 09:20:53 +01:00
addshore 9bd8eb07a8 Add BetaFeatures support
Bug: T133379
Change-Id: I793665cf41ec5624034910d7aedde689ba0854b2
2016-05-09 09:17:47 +01:00
addshore a8b4bef516 Put the new and old rev ids in the dom for easy grabbing
Change-Id: Ice5ebc524cd8c028d26467860be498cfae79dec6
2016-05-06 14:44:21 +01:00
Jakob Warkotsch 54720944a0 Create Pointer module.
This creates a module for the draggable pointers for the RevisionSlider
mainly to encapsulate both the pointers' state and their HTML code.

Some animation methods such as slideToSide and slideToPosition
that are still flying around in init.js weren't added to the
module since I thought they should be part of the not yet existing
Slider module.

Change-Id: I1292bfb0bbd68f8d2de04b3b5e5f3133ec6363b8
2016-05-06 12:37:01 +00:00
addshore ed72e77693 Use Html class to make Html in onDiffViewHeader
Change-Id: I2e4f06d1700dd9c686bb8eda53408370784ef365
2016-05-06 11:37:30 +01:00
addshore ae1c298550 Add noscript sentence to the placeholder
Change-Id: I4a8c9cb5dc49ca3d023ea91932f0317540c455a5
2016-05-03 13:47:35 +00:00
addshore 7cc46839d1 Also add module in onDiffViewHeader hook
Change-Id: I33f85d0e24092b1e5bf9577069a3c34b9ac3e7a4
2016-05-03 15:45:14 +02:00
addshore ba4015ed6b Add localizable placeholder message while loading
Change-Id: I762b03c5af8765b90afee81af750880096db6638
2016-05-03 15:35:39 +02:00
addshore 8490d0f040 Reserve space for RevSlider to load into
Bug: T133275
Change-Id: I97283cfe0798a3bacc42fcb8bc067e74ab085ff1
2016-05-03 15:27:27 +02:00
addshore bc9373dc0f Fix Hooks isRevisionPage
As far as I can tell diff is the only thing that is needed
to show a diff page (which is where we want to show the Slider)

For example:
 - http://localhost/w/index.php?title=Foo&diff=5

Change-Id: I0c4e5ae04412a6da4034cf8c804742537aaeafdd
2016-05-03 10:35:12 +01:00
Jakob Warkotsch 8c6676f939 Create module for Revision type.
This pulls out some of the code around revisions into a decoupled and
tested module.

Change-Id: Ib2a4f96f0e0b9a96ec85d300d97cd52dcaffe89e
2016-04-28 12:38:24 +02:00
Jakob Warkotsch 23b5b2f112 Initial commit.
This turns the prototype code of the Revision Slider into a MediaWiki
extension.
With this extension enabled the slider should appear on diff pages
already but it won't actually show diffs when adjusting the slider
pointers.

Things that changed so far in the prototype JS code:
- pulled out the rainbow function and made it use Math.floor instead of
 the ~~ binary operator
- pulled out the API request that fetches the revisions into its own
 module
- cleaned up and documented some parts of the code

The code is still very much WIP and JSCS still has a couple of
complaints.

Bug: T132576
Change-Id: I2e22365f3b93a76d5b8d3997242b5fed996c6d78
2016-04-19 16:35:37 +02:00