http://www.mediawiki.org/wiki/Special:Code/MediaWiki/86349
Revision: 86349 Author: nimishg Date: 2011-04-18 21:57:46 +0000 (Mon, 18 Apr 2011) Log Message: ----------- checks for userbuckets added Modified Paths: -------------- trunk/extensions/ClickTracking/modules/ext.UserBuckets.js Modified: trunk/extensions/ClickTracking/modules/ext.UserBuckets.js =================================================================== --- trunk/extensions/ClickTracking/modules/ext.UserBuckets.js 2011-04-18 21:44:04 UTC (rev 86348) +++ trunk/extensions/ClickTracking/modules/ext.UserBuckets.js 2011-04-18 21:57:46 UTC (rev 86349) @@ -7,17 +7,17 @@ ( function( $ ) { //lazy-load $.getBuckets = function (force){ - if (typeof(this.userBuckets) == 'undefined' || force ){ - this.userBuckets = $.parseJSON( $.cookie('userbuckets') ); + if (typeof($.userBuckets) == 'undefined' || force ){ + $.userBuckets = $.parseJSON( $.cookie('userbuckets') ); } - return this.userBuckets; + return $.userBuckets; }; $.setBucket = function ( bucketName, bucketValue, bucketVersion ){ var bucketCookies = $.getBuckets(); if(!bucketCookies) { bucketCookies ={};} bucketCookies[ bucketName ] = [ bucketValue, bucketVersion ]; - $.cookie('userbuckets', JSON.stringify( bucketCookies ) , { expires: 365 }); //expires in 1 year + $j.cookie('userbuckets', JSON.stringify( bucketCookies ) , { expires: 365 }); //expires in 1 year bucketCookies = $.getBuckets(true); //force it to rerun and update }; @@ -25,7 +25,6 @@ var buckets = $.getBuckets(); for(iter in MW.activeCampaigns){ var campaign = MW.activeCampaigns[iter]; - // if bucket has been set, or bucket version is out of date, // set up a user bucket if(!buckets || !buckets[campaign.name] || buckets[campaign.name][1] < campaign.version){ @@ -53,7 +52,7 @@ } // do the actual code in the campaign based on the bucket - if($.getBuckets()[campaign.name][0] != "none"){ + if($.getBuckets()[campaign.name] && $.getBuckets()[campaign.name][0] != "none"){ campaign[$.getBuckets()[campaign.name][0]](); //function to execute if(campaign.allActive){ campaign.allActive(); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs