r84213 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84212‎ | r84213 | r84214 >
Date:22:47, 17 March 2011
Author:catrope
Status:ok
Tags:
Comment:
1.17wmf1: MFT r84212
Modified paths:
  • /branches/wmf/1.17wmf1/extensions/Vector/modules/ext.vector.sectionEditLinks.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/extensions/Vector/modules/ext.vector.sectionEditLinks.js
@@ -3,16 +3,19 @@
44 */
55 ( function( $, mw ) {
66
 7+var eventBase = 'ext.vector.sectionEditLinks-bucket:';
 8+var cookieBase = 'ext.vector.sectionEditLinks-';
 9+
710 if ( mw.config.get( 'wgVectorSectionEditLinksBucketTest', false ) ) {
811 // If the version in the client's cookie doesn't match wgVectorSectionEditLinksExperiment, then
912 // we need to disregard the bucket they may already be in to ensure accurate redistribution
10 - var currentExperiment = $.cookie( 'ext.vector.sectionEditLinks-experiment' );
 13+ var currentExperiment = $.cookie( cookieBase + 'experiment' );
1114 var experiment = Number( mw.config.get( 'wgVectorSectionEditLinksExperiment', 0 ) );
1215 var bucket = null;
1316 if ( currentExperiment === null || Number( currentExperiment ) != experiment ) {
14 - $.cookie( 'ext.vector.sectionEditLinks-experiment', experiment );
 17+ $.cookie( cookieBase + 'experiment', experiment );
1518 } else {
16 - bucket = $.cookie( 'ext.vector.sectionEditLinks-bucket' );
 19+ bucket = $.cookie( cookieBase + 'bucket' );
1720 }
1821 if ( bucket === null ) {
1922 // Percentage chance of being tracked
@@ -21,30 +24,28 @@
2225 ) );
2326 // 0 = not tracked, 1 = tracked with old version, 2 = tracked with new version
2427 bucket = ( Math.random() * 100 ) < odds ? Number( Math.random() < 0.5 ) + 1 : 0;
25 - $.cookie( 'ext.vector.sectionEditLinks-bucket', bucket, { 'path': '/', 'expires': 30 } );
 28+ $.cookie( cookieBase + 'bucket', bucket, { 'path': '/', 'expires': 30 } );
2629 // If we are going to track this person from now on, let's also track which bucket we put
2730 // them into and when
2831 if ( bucket > 0 && 'trackAction' in $ ) {
29 - $.trackAction( 'ext.vector.sectionEditLinks-bucket:' + bucket + '@' + experiment );
 32+ $.trackAction( eventBase + bucket + '@' + experiment );
3033 }
3134 }
3235 }
3336 if ( bucket > 0 ) {
3437 // Transform the targets of section edit links to route through the click tracking API
35 - $( 'span.editsection a' ).each( function() {
36 - var session = $.cookie( 'clicktracking-session' );
37 - var editUrl = $( this ).attr( 'href' );
38 - editUrl += ( editUrl.indexOf( '?' ) >= 0 ? '&' : '?' ) + $.param( {
 38+ var session = $.cookie( 'clicktracking-session' );
 39+ $( 'span.editsection a, #ca-edit a' ).each( function() {
 40+ var event = eventBase + bucket + '@' + experiment;
 41+ if ( $(this).is( '#ca-edit a' ) ) {
 42+ event += '-tab';
 43+ }
 44+ var href = $( this ).attr( 'href' );
 45+ var editUrl = href + ( href.indexOf( '?' ) >= 0 ? '&' : '?' ) + $.param( {
3946 'clicktrackingsession': session,
40 - 'clicktrackingevent':
41 - 'ext.vector.sectionEditLinks-bucket:' + bucket + '@' + experiment + '-save'
 47+ 'clicktrackingevent': event + '-save'
4248 } );
43 - $(this).attr( 'href', mediaWiki.config.get( 'wgScriptPath' ) + '/api.php?' + $.param( {
44 - 'action': 'clicktracking',
45 - 'eventid': 'ext.vector.sectionEditLinks-bucket:' + bucket + '@' + experiment + '-click',
46 - 'token': session,
47 - 'redirectto': editUrl
48 - } ) );
 49+ $(this).attr( 'href', $.trackActionURL( editUrl, event + '-click' ) );
4950 } );
5051 if ( bucket == 2 ) {
5152 // Move the link over to be next to the heading text and style it with an icon
Property changes on: branches/wmf/1.17wmf1/extensions/Vector/modules/ext.vector.sectionEditLinks.js
___________________________________________________________________
Modified: svn:mergeinfo
5253 Merged /trunk/extensions/Vector/modules/ext.vector.sectionEditLinks.js:r84212

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84212* Added click tracking to edit tab...tparscal22:40, 17 March 2011

Status & tagging log