2016-05-12 22:37:19 +00:00
|
|
|
( function ( $, mw ) {
|
2016-05-16 20:32:11 +00:00
|
|
|
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()
|
|
|
|
);
|
2016-05-12 22:37:19 +00:00
|
|
|
|
|
|
|
mw.trackSubscribe( 'ext.popups.schemaPopups', function ( topic, data ) {
|
2016-05-16 20:32:11 +00:00
|
|
|
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;
|
2016-05-12 22:37:19 +00:00
|
|
|
} );
|
|
|
|
} )( jQuery, mediaWiki );
|