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'); | ||
TimerBin.Obj1.Timer = $.timer(updateTimer, incrementTime, true); | |||
}; | }; | ||
this.extPause = function(){ | this.extPause = function(){ | ||
Line 36: | Line 37: | ||
$(init); | $(init); | ||
}); | }); | ||
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){ | ||
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'); | ||
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; | ||
TimerBin.Obj1.extPlay(); | |||
if(!this.isActive){ | if(!this.isActive){ | ||
TimerBin.Obj2.extPlay(); | |||
} | } | ||
}; | }; |