r86349 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86348‎ | r86349 | r86350 >
Date:21:57, 18 April 2011
Author:nimishg
Status:ok
Tags:
Comment:
checks for userbuckets added
Modified paths:
  • /trunk/extensions/ClickTracking/modules/ext.UserBuckets.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ClickTracking/modules/ext.UserBuckets.js
@@ -7,17 +7,17 @@
88 ( function( $ ) {
99 //lazy-load
1010 $.getBuckets = function (force){
11 - if (typeof(this.userBuckets) == 'undefined' || force ){
12 - this.userBuckets = $.parseJSON( $.cookie('userbuckets') );
 11+ if (typeof($.userBuckets) == 'undefined' || force ){
 12+ $.userBuckets = $.parseJSON( $.cookie('userbuckets') );
1313 }
14 - return this.userBuckets;
 14+ return $.userBuckets;
1515 };
1616
1717 $.setBucket = function ( bucketName, bucketValue, bucketVersion ){
1818 var bucketCookies = $.getBuckets();
1919 if(!bucketCookies) { bucketCookies ={};}
2020 bucketCookies[ bucketName ] = [ bucketValue, bucketVersion ];
21 - $.cookie('userbuckets', JSON.stringify( bucketCookies ) , { expires: 365 }); //expires in 1 year
 21+ $j.cookie('userbuckets', JSON.stringify( bucketCookies ) , { expires: 365 }); //expires in 1 year
2222 bucketCookies = $.getBuckets(true); //force it to rerun and update
2323 };
2424
@@ -25,7 +25,6 @@
2626 var buckets = $.getBuckets();
2727 for(iter in MW.activeCampaigns){
2828 var campaign = MW.activeCampaigns[iter];
29 -
3029 // if bucket has been set, or bucket version is out of date,
3130 // set up a user bucket
3231 if(!buckets || !buckets[campaign.name] || buckets[campaign.name][1] < campaign.version){
@@ -53,7 +52,7 @@
5453 }
5554
5655 // do the actual code in the campaign based on the bucket
57 - if($.getBuckets()[campaign.name][0] != "none"){
 56+ if($.getBuckets()[campaign.name] && $.getBuckets()[campaign.name][0] != "none"){
5857 campaign[$.getBuckets()[campaign.name][0]](); //function to execute
5958 if(campaign.allActive){
6059 campaign.allActive();

Status & tagging log