Index: trunk/extensions/ClickTracking/ClickTracking.hooks.php |
— | — | @@ -71,9 +71,12 @@ |
72 | 72 | public static function beforePageDisplay( $out, $skin ) { |
73 | 73 | global $wgClickTrackSidebar, $wgClickTrackThrottle; |
74 | 74 | $out->addModules( 'ext.UserBuckets' ); |
75 | | - |
76 | | - if ( $wgClickTrackSidebar && $wgClickTrackThrottle >= 0 && rand() % $wgClickTrackThrottle == 0 ) { |
77 | | - $out->addModules( 'ext.clickTracking' ); |
| 75 | + // Throttle ClickTracking if neccessary |
| 76 | + // 1 out of every $wgClickTrackThrottle users will have ClickTracking enabled |
| 77 | + if ( $wgClickTrackThrottle > 0 && rand() % $wgClickTrackThrottle == 0 ) { |
| 78 | + if ( $wgClickTrackSidebar ) { |
| 79 | + $out->addModules( 'ext.clickTrackingSidebar' ); |
| 80 | + } |
78 | 81 | } |
79 | 82 | return true; |
80 | 83 | } |
Index: trunk/extensions/ClickTracking/modules/ext.clickTracking.js |
— | — | @@ -1,15 +0,0 @@ |
2 | | -/* |
3 | | - * JavaScript for ClickTracking extension |
4 | | - */ |
5 | | - |
6 | | -jQuery( function( $ ) { |
7 | | - // Add click tracking hooks to the sidebar |
8 | | - $( '#p-logo a, #p-navigation a, #p-interaction a, #p-tb a' ).each( function() { |
9 | | - var $el = $(this), href = $el.attr( 'href' ); |
10 | | - // Only modify local URLs |
11 | | - if ( href.length > 0 && href[0] == '/' && ( href.length == 1 || href[1] != '/' ) ) { |
12 | | - var id = 'leftnav-' + skin + '-' + ( $el.attr( 'id' ) || $el.parent().attr( 'id' ) ); |
13 | | - $el.attr( 'href', $.trackActionURL( href, id ) ); |
14 | | - } |
15 | | - } ); |
16 | | -} ); |
Index: trunk/extensions/ClickTracking/modules/ext.clickTrackingSidebar.js |
— | — | @@ -0,0 +1,15 @@ |
| 2 | +/* |
| 3 | + * JavaScript for sidebar ClickTracking campaign |
| 4 | + */ |
| 5 | + |
| 6 | +jQuery( function( $ ) { |
| 7 | + // Add click tracking hooks to the sidebar |
| 8 | + $( '#p-logo a, #p-navigation a, #p-interaction a, #p-tb a' ).each( function() { |
| 9 | + var $el = $(this), href = $el.attr( 'href' ); |
| 10 | + // Only modify local URLs |
| 11 | + if ( href.length > 0 && href[0] == '/' && ( href.length == 1 || href[1] != '/' ) ) { |
| 12 | + var id = 'leftnav-' + skin + '-' + ( $el.attr( 'id' ) || $el.parent().attr( 'id' ) ); |
| 13 | + $el.attr( 'href', $.trackActionURL( href, id ) ); |
| 14 | + } |
| 15 | + } ); |
| 16 | +} ); |
Property changes on: trunk/extensions/ClickTracking/modules/ext.clickTrackingSidebar.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 17 | + native |
Index: trunk/extensions/ClickTracking/ClickTracking.php |
— | — | @@ -75,8 +75,8 @@ |
76 | 76 | 'scripts' => 'jquery.clickTracking.js', |
77 | 77 | 'dependencies' => 'jquery.cookie', |
78 | 78 | ) + $ctResourceTemplate; |
79 | | -$wgResourceModules['ext.clickTracking'] = array( |
80 | | - 'scripts' => 'ext.clickTracking.js', |
| 79 | +$wgResourceModules['ext.clickTrackingSidebar'] = array( |
| 80 | + 'scripts' => 'ext.clickTrackingSidebar.js', |
81 | 81 | 'dependencies' => 'jquery.clickTracking', |
82 | 82 | ) + $ctResourceTemplate; |
83 | 83 | $wgResourceModules['ext.UserBuckets'] = array( |