Add a configuration variable for disabling tracking clicks on the toolbar buttons

This commit is contained in:
Roan Kattouw 2012-02-23 22:29:37 +00:00
parent 462c74edd9
commit f26acc15c7
Notes: Roan Kattouw 2012-02-23 22:29:37 +00:00
3 changed files with 10 additions and 3 deletions

View file

@ -29,6 +29,9 @@ class WikiEditorHooks {
'modules' => array( 'modules' => array(
'ext.wikiEditor.toolbar', 'ext.wikiEditor.toolbar',
), ),
'configurations' => array(
'wgWikiEditorToolbarClickTracking',
),
), ),
'dialogs' => array( 'dialogs' => array(
'preferences' => array( 'preferences' => array(

View file

@ -46,6 +46,10 @@ $wgWikiEditorFeatures = array(
); );
// If set to true and the ClickTracking extension is installed, track clicks
// on the toolbar buttons
$wgWikiEditorToolbarClickTracking = false;
/* Setup */ /* Setup */
$wgExtensionCredits['other'][] = array( $wgExtensionCredits['other'][] = array(

View file

@ -238,7 +238,7 @@ fn: {
doAction : function( context, action, source ) { doAction : function( context, action, source ) {
// Verify that this has been called from a source that's within the toolbar // Verify that this has been called from a source that's within the toolbar
// 'trackAction' defined in click tracking // 'trackAction' defined in click tracking
if ( $.trackAction !== undefined && source.closest( '.wikiEditor-ui-toolbar' ).size() ) { if ( mw.config.get( 'wgWikiEditorToolbarClickTracking' ) && $.trackAction !== undefined && source.closest( '.wikiEditor-ui-toolbar' ).size() ) {
// Build a unique id for this action by tracking the parent rel attributes up to the toolbar level // Build a unique id for this action by tracking the parent rel attributes up to the toolbar level
var rels = []; var rels = [];
var step = source; var step = source;
@ -461,7 +461,7 @@ fn: {
{ expires: 30, path: '/' } { expires: 30, path: '/' }
); );
// Click tracking // Click tracking
if ( $.trackAction !== undefined){ if ( mw.config.get( 'wgWikiEditorToolbarClickTracking' ) && $.trackAction !== undefined ) {
$.trackAction(section + '.' + $(this).attr('rel')); $.trackAction(section + '.' + $(this).attr('rel'));
} }
context.fn.restoreCursorAndScrollTop(); context.fn.restoreCursorAndScrollTop();
@ -640,7 +640,7 @@ fn: {
} ); } );
} }
// Click tracking // Click tracking
if ( $.trackAction !== undefined ) { if ( mw.config.get( 'wgWikiEditorToolbarClickTracking' ) && $.trackAction !== undefined ) {
$.trackAction( $section.attr('rel') + '.' + ( show ? 'show': 'hide' ) ); $.trackAction( $section.attr('rel') + '.' + ( show ? 'show': 'hide' ) );
} }
// Save the currently visible section // Save the currently visible section