mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-15 11:46:55 +00:00
9611d3b2db
Supporting changes: * Add mw.popups.processLinks. * Extract the existing unit tests for mw.popups.selectPopupElements and mw.popups.getTitle. * Fix Grunt QUnit timeout. Change-Id: I325bcb15abc6e0b745d78b7308a346a034ab2988
57 lines
1.2 KiB
JavaScript
57 lines
1.2 KiB
JavaScript
( function ( mw, Redux ) {
|
|
|
|
var actions = {};
|
|
|
|
/**
|
|
* @param {Function} isUserInCondition See `mw.popups.createExperiment`
|
|
*/
|
|
actions.boot = function ( isUserInCondition ) {
|
|
return {
|
|
type: 'BOOT',
|
|
isUserInCondition: isUserInCondition()
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Represents the user dwelling on a link, either by hovering over it with
|
|
* their mouse or by focussing it using their keyboard or an assistive device.
|
|
*
|
|
* @param {jQuery} $el
|
|
* @return {Object}
|
|
*/
|
|
actions.linkDwell = function ( $el ) {
|
|
return {
|
|
type: 'LINK_DWELL',
|
|
el: $el
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Represents the user abandoning a link, either by moving their mouse away
|
|
* from it or by shifting focus to another UI element using their keyboard or
|
|
* an assistive device.
|
|
*
|
|
* @param {jQuery} $el
|
|
* @return {Object}
|
|
*/
|
|
actions.linkAbandon = function ( $el ) {
|
|
return {
|
|
type: 'LINK_ABANDON',
|
|
el: $el
|
|
};
|
|
};
|
|
|
|
/**
|
|
* Creates an object whose methods encapsulate all actions that can be
|
|
* dispatched to the given
|
|
* [store](http://redux.js.org/docs/api/Store.html#store).
|
|
*
|
|
* @param {Store} store
|
|
* @return {Object}
|
|
*/
|
|
mw.popups.createActions = function ( store ) {
|
|
return Redux.bindActionCreators( actions, store.dispatch );
|
|
};
|
|
|
|
}( mediaWiki, Redux ) );
|