MarkTraceur has uploaded a new change for review.
https://gerrit.wikimedia.org/r/90073
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, 55 insertions(+), 2 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer
refs/changes/73/90073/1
diff --git a/MultimediaViewer.php b/MultimediaViewer.php
index ff6a686..1b77e0d 100644
--- a/MultimediaViewer.php
+++ b/MultimediaViewer.php
@@ -74,6 +74,16 @@
),
), $moduleInfo );
+if ( isset( $wgResourceModules['ext.eventLogging'] ) ) {
+ $wgResourceModules['schema.MediaViewer'] = array(
+ 'class' => 'ResourceLoaderSchemaModule',
+ 'schema' => 'MediaViewer',
+ 'revision' => 6054199,
+ );
+
+ $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 197920b..57e2643 100644
--- a/js/ext.multimediaViewer.js
+++ b/js/ext.multimediaViewer.js
@@ -28,7 +28,15 @@
'mime',
'mediatype',
'metadata'
- ];
+ ],
+
+ 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' ),
@@ -54,6 +62,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;
@@ -96,7 +112,9 @@
this.$imageDiv.append( this.$imageLink );
} );
- lightboxHooks.register( 'modifyInterface', function () {
+ lightboxHooks.register( 'modifyinterface', function () {
+ var iface = this;
+
this.$imageDesc = $( '<p>' ).addClass(
'mw-mlb-image-desc' );
this.$imageDescDiv = $( '<div>' )
.addClass( 'mw-mlb-image-desc-div' )
@@ -113,6 +131,18 @@
.append( this.$imageLinkDiv );
this.$wrapper.append( this.$imageMetadata );
+
+ this.$closeButton.click( function () {
+ viewer.log( 'close-link-click' );
+ } );
+
+ this.$fullscreenButton.click( function () {
+ if ( iface.isFullScreen ) {
+ viewer.log( 'fullscreen-link-click' );
+ } else {
+ viewer.log( 'defullscreen-link-click' );
+ }
+ } );
} );
}
@@ -241,6 +271,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: newchange
Gerrit-Change-Id: I7d7ed21512df5cda19a0e5b7b7e1a32fd1ccfd2b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits