Widget:TimerTest2: Difference between revisions

Jump to navigation Jump to search
Matt Pijoan (talk | contribs)
No edit summary
Matt Pijoan (talk | contribs)
No edit summary
Line 4: Line 4:
mw.loader.using('mediawiki.user',function(){
mw.loader.using('mediawiki.user',function(){
if($.inArray("CMEUser", mw.config.get( 'wgUserGroups' )) != "-1"){
if($.inArray("CMEUser", mw.config.get( 'wgUserGroups' )) != "-1"){
var Obj1 = new (function(){
var window.TimerBin = {};
TimerBin.Obj1 = new (function(){
     var $timer1,
     var $timer1,
     incrementTime = 100,
     incrementTime = 100,
Line 22: Line 23:
     init = function(){
     init = function(){
         $timer1 = $('#output1');
         $timer1 = $('#output1');
         var window.Obj1.Timer = $.timer(updateTimer, incrementTime, true);
         TimerBin.Obj1.Timer = $.timer(updateTimer, incrementTime, true);
     };
     };
     this.extPause = function(){
     this.extPause = function(){
Line 36: Line 37:
$(init);
$(init);
});
});
window.Obj2 = new (function(){
TimerBin.Obj2 = new (function(){
     var $timer2,
     var $timer2,
     incrementTime = 100,
     incrementTime = 100,
Line 44: Line 45:
         currentTime -= incrementTime;
         currentTime -= incrementTime;
         if(currentTime === 100){
         if(currentTime === 100){
             window.Obj1.extPause();
             TimerBin.Obj1.extPause();
             this.resetTimer();
             this.resetTimer();
             alert("Click OK to continue accruing CME Time");
             alert("Click OK to continue accruing CME Time");
Line 51: Line 52:
     init = function(){
     init = function(){
         $timer2 = $('#output2');
         $timer2 = $('#output2');
        window.Obj1.Timer = $.timer(updateTimer, incrementTime, true);
        TimerBin.Obj2.Timer = $.timer(updateTimer, incrementTime, true);
     };
     };
     this.extPlay = function(){
     this.extPlay = function(){
Line 60: Line 61:
     this.resetTimer = function(){
     this.resetTimer = function(){
         currentTime = 30000;
         currentTime = 30000;
         window.Obj1.extPlay();
         TimerBin.Obj1.extPlay();
         if(!this.isActive){
         if(!this.isActive){
         window.Obj2.extPlay();
         TimerBin.Obj2.extPlay();
         }
         }
     };
     };

Revision as of 19:25, 22 April 2014