http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65379
Revision: 65379
Author: tparscal
Date: 2010-04-21 13:30:47 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Changed from using click handlers on the links to modifying the href attributes
of the links. This fixes the issue seen in bug #23267.
Modified Paths:
--------------
trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.js
Modified: trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.js
===================================================================
--- trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.js
2010-04-21 13:18:10 UTC (rev 65378)
+++ trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.js
2010-04-21 13:30:47 UTC (rev 65379)
@@ -1,26 +1,23 @@
-(function($) {
- if( !wgClickTrackingIsThrottled ) {
- // creates 'track action' function to call the clicktracking
API and send the ID
- $.trackAction = function ( id ) {
- $j.post( wgScriptPath + '/api.php', { 'action':
'clicktracking', 'eventid': id, 'token': wgTrackingToken } );
+( function( $ ) {
+ if ( !wgClickTrackingIsThrottled ) {
+ // Create 'track action' function to call the clicktracking API
and send the ID
+ $.trackAction = function( id ) {
+ $j.post(
+ wgScriptPath + '/api.php', { 'action':
'clicktracking', 'eventid': id, 'token': wgTrackingToken }
+ );
};
-
- // Clicktrack the left sidebar links
+ // Add click tracking hooks to the sidebar
$j(document).ready( function() {
- $( '#p-logo a, #p-navigation a, #p-tb a' ).click(
function() {
- var id = 'leftnav-' + skin + '-' +
- ( $(this).attr( 'id' ) ||
$(this).parent().attr( 'id' ) );
+ $( '#p-logo a, #p-navigation a, #p-interaction a, #p-tb
a' ).each( function() {
var href = $(this).attr( 'href' );
- // Don't attach to javascript: URLs and the
like,
- // only to local URLs (start with a /), http://
,
- // https:// and same-protocol URLs (start with
//)
- if ( href[0] == '/' || href.match(
/^https?:\/\// ) )
- window.location = wgScriptPath +
-
'/api.php?action=clicktracking&eventid=' +
- id + '&token=' +
wgTrackingToken +
- '&redirectto=' + escape( href );
- });
- });
+ // Only modify local and same-schema URLs
+ if ( href[0] == '/' || href.match(
/^https?:\/\// ) ) {
+ var id = 'leftnav-' + skin + '-' + (
$(this).attr( 'id' ) || $(this).parent().attr( 'id' ) );
+ href = wgScriptPath +
'/api.php?action=clicktracking' +
+ '&eventid=' + id + '&token=' +
wgTrackingToken + '&redirectto=' + escape( href );
+ $(this).attr( 'href', href );
+ }
+ } );
+ } );
}
-
-})(jQuery);
+} )( jQuery );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs