mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-24 15:44:09 +00:00
9477fd5fe6
If a user has hovercards disabled, when they right click a link this will trigger another hover event which will reset dwellStartTime. This means when a dwelledButAbandoned event fires shortly afterwards the totalInteractionTime will not be correct. To remedy this, the calculation of totalInteractionTime and perceivedWait is moved into ext.popups.schemaPopups Now that we can trigger events without logging to the server and checking the total interaction time duration in two places, let's always run the event and only check it once. A `hover` event triggers the setting of a dwell start time A `display` event triggers the setting of the perceivedWait value * Both are reset on a dwelledButAbandoned. Since dwellStartTime is controlled inside a single place, getMassageData no longer needs to clear it. The test "returns false if dwelledButAbandoned event without a dwellStartTime" is removed as this should no longer be possible. Bug: T147846 Change-Id: Ie5917ca86f0d0ab27f4cf507e6dfa2c271433c03
20 lines
534 B
JavaScript
20 lines
534 B
JavaScript
( function ( mw ) {
|
|
var previousLogData,
|
|
// Log the popup event as defined in the schema
|
|
// https://meta.wikimedia.org/wiki/Schema:Popups
|
|
schemaPopups = new mw.eventLog.Schema(
|
|
'Popups',
|
|
mw.popups.schemaPopups.getSamplingRate(),
|
|
mw.popups.schemaPopups.getDefaultValues()
|
|
);
|
|
|
|
mw.trackSubscribe( 'ext.popups.event', function ( topic, data ) {
|
|
data = mw.popups.schemaPopups.getMassagedData( data, previousLogData );
|
|
|
|
if ( data ) {
|
|
schemaPopups.log( data );
|
|
}
|
|
previousLogData = data;
|
|
} );
|
|
} )( mediaWiki );
|