r83952 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83951‎ | r83952 | r83953 >
Date:19:32, 14 March 2011
Author:catrope
Status:ok
Tags:
Comment:
1.17wmf1: MFT r83919
Modified paths:
  • /branches/wmf/1.17wmf1/extensions/ClickTracking/modules/ext.clickTracking.js (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/ClickTracking/modules/jquery.clickTracking.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/extensions/ClickTracking/modules/jquery.clickTracking.js
@@ -49,4 +49,19 @@
5050 }
5151 );
5252 };
 53+
 54+ /**
 55+ * Rewrites a URL to one that runs through the ClickTracking API module
 56+ * which registers the event and redirects to the real URL
 57+ * @param {string} url URL to redirect to
 58+ * @param {string} id Event identifier
 59+ */
 60+ $.trackActionURL = function( url, id ) {
 61+ return mediaWiki.config.get( 'wgScriptPath' ) + '/api.php?' + $.param( {
 62+ 'action': 'clicktracking',
 63+ 'eventid': id,
 64+ 'token': $.cookie( 'clicktracking-session' ),
 65+ 'redirectto': url
 66+ } );
 67+ }
5368 } )( jQuery );
Index: branches/wmf/1.17wmf1/extensions/ClickTracking/modules/ext.clickTracking.js
@@ -7,13 +7,10 @@
88 $( document ).ready( function() {
99 $( '#p-logo a, #p-navigation a, #p-interaction a, #p-tb a' ).each( function() {
1010 var href = $( this ).attr( 'href' );
11 - var token = $.cookie( 'clicktracking-session' );
1211 // Only modify local URLs
1312 if ( href.length > 0 && href[0] == '/' && ( href.length == 1 || href[1] != '/' ) ) {
1413 var id = 'leftnav-' + skin + '-' + ( $( this ).attr( 'id' ) || $( this ).parent().attr( 'id' ) );
15 - href = mediaWiki.config.get( 'wgScriptPath' ) + '/api.php?action=clicktracking' +
16 - '&eventid=' + id + '&token=' + token + '&redirectto=' + escape( href );
17 - $( this ).attr( 'href', href );
 14+ $( this ).attr( 'href', $.trackActionURL( href, id ) );
1815 }
1916 } );
2017 } );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r83919ClickTracking: Factor api.php?action=clicktracking&redirectto=... URL generat...catrope16:41, 14 March 2011

Status & tagging log