Extract core rendering functionality from the mw.popups.renderer and
mw.popups.renderer.article objects.
For now, render and show the preview when the user dwells on and
abandons a link respectively.
Supporting changes:
* Add mw.popups.wait, which is sugar around window.setTimeout.
* action.response -> action.result in the FETCH_END case of the preview
reducer.
Change-Id: I14b437e7c2f55b988837fcb2800dd61a23c29a01
Supporting changes:
* Remove the preview.previousActiveLink property from the state tree as
it's unnecessary.
Change-Id: I657decf9425a7a9e2b27a798ed60b162569661d8
OO.copy doesn't copy Element instances, whereas $.extend does. However,
OO.copy does copy properties whose values are undefined or null, whereas
$.extend doesn't.
Since the state tree contains an Element instance - the
preview.activeLink property - we need to use $.extend.
Add the nextState helper function which copies the current state tree
with $.extend and mixes in all updates manually.
Change-Id: Ie8edd9fa0cc3a62a792ed60b49288f85b3ca73e9
If the user has abandoned the link or dwelled on a different link, then
don't make the API request.
Changes:
* Fix a bug in the linkDwell reducer where the activeLink was always
being set to undefined.
* Add the private fetch action creator.
* Make the linkDwell action dispatch the result of the fetch action
creator after 500ms.
Supporting changes:
* Make the link* action creators take DOM elements rather than jQuery
instances so that:
1. Testing whether the state tree has changed is an identity
comparison.
2. jQuery instances are constructed only when required.
* Document the ext.popups.Gateway type.
* Document the Redux.Store type.
* Rename the "previews-page-title" data attribute to
"page-previews-title" to avoid confusion.
Change-Id: I0b1cf3337a6f8d6450ad2bd127cb292ebb73af4f
Changes:
* Add sessionToken and pageToken properties to the BOOT action and
update the preview reducer.
Supporting changes:
* Move the mw.popups.createActions to ext.popups/boot.js so that Redux
is used in one file and the actions can be tested in isolation more
easily.
Change-Id: Icd61bf1aeb466899e047432bf9798e2574652830
Reducers as a whole are a WIP, but this implements a baseline from which
to add more.
Changes:
* Create ext.popups.reducers to house all reducers
* Create reducers for preview and renderer state manipulation
* Create rootReducer by combining preview and renderer reducers
* Add QUnit tests for reducers
* Move action types into ext.popups.actionTypes
* Extract rootReducer from boot.js
Change-Id: I8a2296c6846cd4b0552a485e671af1d974944195