Index: trunk/extensions/ClickTracking/modules/jquery.clickTracking.js |
— | — | @@ -26,9 +26,9 @@ |
27 | 27 | */ |
28 | 28 | $.trackAction = function( id ) { |
29 | 29 | $.post( |
30 | | - mediaWiki.config.get( 'wgScriptPath' ) + '/api.php', { |
| 30 | + mw.config.get( 'wgScriptPath' ) + '/api.php', { |
31 | 31 | 'action': 'clicktracking', |
32 | | - 'namespacenumber': mediaWiki.config.get( 'wgNamespaceNumber' ), |
| 32 | + 'namespacenumber': mw.config.get( 'wgNamespaceNumber' ), |
33 | 33 | 'eventid': id, |
34 | 34 | 'token': $.cookie( 'clicktracking-session' ) |
35 | 35 | } |
— | — | @@ -42,10 +42,10 @@ |
43 | 43 | */ |
44 | 44 | $.trackActionWithInfo = function( id, info ) { |
45 | 45 | $.post( |
46 | | - mediaWiki.config.get( 'wgScriptPath' ) + '/api.php', { |
| 46 | + mw.config.get( 'wgScriptPath' ) + '/api.php', { |
47 | 47 | 'action': 'clicktracking', |
48 | 48 | 'eventid': id, |
49 | | - 'namespacenumber': mediaWiki.config.get( 'wgNamespaceNumber' ), |
| 49 | + 'namespacenumber': mw.config.get( 'wgNamespaceNumber' ), |
50 | 50 | 'token': $.cookie( 'clicktracking-session' ), |
51 | 51 | 'additional': info |
52 | 52 | } |
— | — | @@ -59,12 +59,13 @@ |
60 | 60 | * @param {string} id Event identifier |
61 | 61 | */ |
62 | 62 | $.trackActionURL = function( url, id ) { |
63 | | - return mediaWiki.config.get( 'wgScriptPath' ) + '/api.php?' + $.param( { |
| 63 | + return mw.config.get( 'wgScriptPath' ) + '/api.php?' + $.param( { |
64 | 64 | 'action': 'clicktracking', |
65 | 65 | 'eventid': id, |
66 | | - 'namespacenumber': mediaWiki.config.get( 'wgNamespaceNumber' ), |
| 66 | + 'namespacenumber': mw.config.get( 'wgNamespaceNumber' ), |
67 | 67 | 'token': $.cookie( 'clicktracking-session' ), |
68 | 68 | 'redirectto': url |
69 | 69 | } ); |
70 | 70 | } |
| 71 | + |
71 | 72 | } )( jQuery ); |
Index: trunk/extensions/ClickTracking/modules/ext.UserBuckets.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | - |
| 2 | +// FIXME: Use jquery.json.js instead |
3 | 3 | var JSON; |
4 | 4 | if (!JSON) { |
5 | 5 | JSON = {}; |
— | — | @@ -48,8 +48,8 @@ |
49 | 49 | |
50 | 50 | $.setupActiveBuckets = function(){ |
51 | 51 | var buckets = $.getBuckets(); |
52 | | - for(iter in MW.activeCampaigns){ |
53 | | - var campaign = MW.activeCampaigns[iter]; |
| 52 | + for(iter in mw.activeCampaigns){ |
| 53 | + var campaign = mw.activeCampaigns[iter]; |
54 | 54 | // if bucket has been set, or bucket version is out of date, |
55 | 55 | // set up a user bucket |
56 | 56 | if(campaign.all){ |
Index: trunk/extensions/ClickTracking/modules/sampleCampaign.js |
— | — | @@ -1,53 +1,54 @@ |
| 2 | +/** |
| 3 | + * Sample campaign for ClickTracking |
| 4 | + */ |
2 | 5 | |
3 | | -//checks |
4 | | -if(typeof(MW) == "undefined"){ MW={};} |
5 | | -if(!MW.activeCampaigns){ MW.activeCampaigns ={}; } |
| 6 | +// Check |
| 7 | +if ( !mw.activeCampaigns ) { |
| 8 | + mw.activeCampaigns = {}; |
| 9 | +} |
6 | 10 | |
7 | | -//define new active campaign |
8 | | -MW.activeCampaigns.ArticleSave = |
| 11 | +// Define new active campaign |
| 12 | +mw.activeCampaigns.ArticleSave = { |
| 13 | + // Treatment name |
| 14 | + name: "ArticleSave", |
9 | 15 | |
10 | | -{ |
11 | | - //Treatment name |
12 | | - "name": "ArticleSave", |
13 | | - |
14 | | - //Treatment version. Increment this when altering rates |
15 | | - "version": 2, |
16 | | - |
17 | | - // Rates are calculated out of the total sum, so |
18 | | - // rates of x:10000, y:3, and z:1 mean users have a |
19 | | - // chance of being in bucket x at 10000/10004, |
20 | | - // y at 3/10004 and z at 1/10004 |
21 | | - // The algorithm is faster if these are ordered in descending order, |
22 | | - // particularly if there are orders of magnitude differences in the |
23 | | - // bucket sizes |
24 | | - // "none" is reserved for control |
25 | | - "rates": {"none": 10000, "Bold": 3, "Italics": 1 }, |
26 | | - |
27 | | - // individual changes, function names corresponding |
28 | | - // to what is in "rates" object |
29 | | - // (note: "none" function not needed or used) |
30 | | - |
31 | | - "Bold": function(){ |
32 | | - //change edit button to bold |
33 | | - $j("#wpSave").css("font-weight", "bolder"); |
34 | | - |
35 | | - }, |
36 | | - "Italics": function(){ |
37 | | - //change edit button to italics |
38 | | - $j("#wpSave").css("font-weight", "normal") |
39 | | - .css("font-style", "italic"); |
40 | | - |
41 | | - }, |
42 | | - |
43 | | - // "allActive" is reserved. |
44 | | - // If this function exists, it will be apply to every user not in the "none" bucket |
45 | | - "allActive": function(){ |
46 | | - //add click tracking to save |
47 | | - $j("#wpSave").click(function(){ $j.trackAction('save'); }); |
48 | | - //add click tracking to preview |
49 | | - $j("#wpPreview").click(function(){ $j.trackAction('preview'); }); |
50 | | - $j("#editpage-copywarn").click(function(){ $j.trackAction('copywarn'); }); |
51 | | - |
52 | | - } |
53 | | - |
54 | | -}; |
\ No newline at end of file |
| 16 | + // Treatment version. Increment this when altering rates |
| 17 | + version: 2, |
| 18 | + |
| 19 | + // Rates are calculated out of the total sum, so |
| 20 | + // rates of x:10000, y:3, and z:1 mean users have a |
| 21 | + // chance of being in bucket x at 10000/10004, |
| 22 | + // y at 3/10004 and z at 1/10004 |
| 23 | + // The algorithm is faster if these are ordered in descending order, |
| 24 | + // particularly if there are orders of magnitude differences in the |
| 25 | + // bucket sizes |
| 26 | + // "none" is reserved for control |
| 27 | + rates: { |
| 28 | + none: 10000, |
| 29 | + Bold: 3, |
| 30 | + Italics: 1 |
| 31 | + }, |
| 32 | + |
| 33 | + // Individual changes, function names corresponding |
| 34 | + // to what is in "rates" object |
| 35 | + // (note: "none" function not needed or used) |
| 36 | + Bold: function(){ |
| 37 | + // Change edit button to bold |
| 38 | + jQuery( '#wpSave' ).css( 'font-weight', 'bolder' ); |
| 39 | + }, |
| 40 | + Italics: function(){ |
| 41 | + // Change edit button to italics |
| 42 | + jQuery( '#wpSave' ).css( { 'font-weight': 'normal', 'font-style': 'italic' }); |
| 43 | + }, |
| 44 | + |
| 45 | + // "allActive" is reserved. |
| 46 | + // If this function exists, it will be apply to every user not in the "none" bucket |
| 47 | + allActive: function(){ |
| 48 | + // Add click tracking to save |
| 49 | + jQuery( '#wpSave' ).click(function(){ jQuery.trackAction( 'save' ); }); |
| 50 | + // Add click tracking to preview |
| 51 | + jQuery( '#wpPreview' ).click(function(){ jQuery.trackAction( 'preview' ); }); |
| 52 | + jQuery( '#editpage-copywarn' ).click(function(){ jQuery.trackAction( 'copywarn' ); }); |
| 53 | + } |
| 54 | + |
| 55 | +}; |