jenkins-bot has submitted this change and it was merged.
Change subject: EventLogging support for MultimediaViewer
......................................................................
EventLogging support for MultimediaViewer
Capture clicky events for most buttons and things.
Change-Id: I7d7ed21512df5cda19a0e5b7b7e1a32fd1ccfd2b
---
M MultimediaViewer.php
M js/ext.multimediaViewer.js
2 files changed, 54 insertions(+), 1 deletion(-)
Approvals:
Gergő Tisza: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MultimediaViewer.php b/MultimediaViewer.php
index dcb7da9..1706165 100644
--- a/MultimediaViewer.php
+++ b/MultimediaViewer.php
@@ -75,6 +75,16 @@
),
), $moduleInfo );
+if ( isset( $wgResourceModules['ext.eventLogging'] ) ) {
+ $wgResourceModules['schema.MediaViewer'] = array(
+ 'class' => 'ResourceLoaderSchemaModule',
+ 'schema' => 'MediaViewer',
+ 'revision' => 6055641,
+ );
+
+ $wgResourceModules['ext.multimediaViewer']['dependencies'][] =
'ext.eventLogging';
+ $wgResourceModules['ext.multimediaViewer']['dependencies'][] =
'schema.MediaViewer';
+}
$wgAutoloadClasses['MultimediaViewerHooks'] = __DIR__ .
'/MultimediaViewerHooks.php';
$wgHooks['GetBetaFeaturePreferences'][] =
'MultimediaViewerHooks::getBetaPreferences';
diff --git a/js/ext.multimediaViewer.js b/js/ext.multimediaViewer.js
index 9a77fa9..b93f848 100644
--- a/js/ext.multimediaViewer.js
+++ b/js/ext.multimediaViewer.js
@@ -39,7 +39,15 @@
'mediatype',
'metadata',
'extmetadata'
- ];
+ ],
+
+ mmvLogActions = {
+ 'thumbnail-link-click': 'User clicked on thumbnail to
open lightbox.',
+ 'enlarge-link-click': 'User clicked on enlarge link to
open lightbox.',
+ 'fullscreen-link-click': 'User clicked on fullscreen
button in lightbox.',
+ 'defullscreen-link-click': 'User clicked on button to
return to normal lightbox view.',
+ 'close-link-click': 'User clicked on the lightbox close
button.'
+ };
function MultimediaViewer() {
var $thumbs = $( '.thumbimage' ),
@@ -70,6 +78,14 @@
urls[index].filePageLink = filePageLink;
$links.click( function ( e ) {
+ var $this = $( this );
+
+ if ( $this.is( 'a.image' ) ) {
+ viewer.log( 'thumbnail-link-click' );
+ } else if ( $this.is( '.magnify a' ) ) {
+ viewer.log( 'enlarge-link-click' );
+ }
+
e.preventDefault();
viewer.lightbox.currentIndex = index;
@@ -185,6 +201,8 @@
} );
lightboxHooks.register( 'modifyInterface', function () {
+ var ui = this;
+
this.$imageDesc = $( '<p>' )
.addClass( 'mw-mlb-image-desc' );
@@ -225,6 +243,18 @@
.append( this.$title );
this.$controlBar.append( this.$titleDiv );
+
+ this.$closeButton.click( function () {
+ viewer.log( 'close-link-click' );
+ } );
+
+ this.$fullscreenButton.click( function () {
+ if ( ui.isFullScreen ) {
+ viewer.log( 'fullscreen-link-click' );
+ } else {
+ viewer.log( 'defullscreen-link-click' );
+ }
+ } );
} );
}
@@ -344,6 +374,19 @@
}
};
+ MultimediaViewer.prototype.log = function ( action ) {
+ mw.log( mmvLogActions[action] || action );
+
+ if ( mw.eventLog ) {
+ mw.eventLog.logEvent( 'MediaViewer', {
+ version: '1.0',
+ action: action,
+ userId: mw.user.getId(),
+ editCount: mw.config.get( 'wgUserEditCount', 0 )
+ } );
+ }
+ };
+
$( function () {
MultiLightbox = window.MultiLightbox;
LightboxImage = window.LightboxImage;
--
To view, visit https://gerrit.wikimedia.org/r/90073
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7d7ed21512df5cda19a0e5b7b7e1a32fd1ccfd2b
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: DarTar <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits