mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-23 04:22:46 +00:00
7dfad14da1
Given we currently have modules defined in extension.json and in hooks it can be really confusing understanding how the code fits together. This change hopefully makes this a little clearer by using folder names that are named after the resource loader modules - this is also consistent with how we do things in our other extensions. A images folder is added to the route so that it is clearer that the images are not used in ResourceLoader module definitions and are only used to illustrate the beta feature. Change-Id: Ia650ec03e3a6d3069165441ddfa069d390be4d10
31 lines
887 B
JavaScript
31 lines
887 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.schemaPopups', function ( topic, data ) {
|
|
var shouldLog = true;
|
|
|
|
data = mw.popups.schemaPopups.getMassagedData( data );
|
|
|
|
// Only one action is recorded per link interaction token...
|
|
if ( data.linkInteractionToken &&
|
|
data.linkInteractionToken === previousLogData.linkInteractionToken ) {
|
|
// however, the 'disabled' action takes two clicks by nature, so allow it
|
|
if ( data.action !== 'disabled' ) {
|
|
shouldLog = false;
|
|
}
|
|
}
|
|
|
|
if ( shouldLog ) {
|
|
schemaPopups.log( data );
|
|
}
|
|
previousLogData = data;
|
|
} );
|
|
} )( jQuery, mediaWiki );
|