Sep 27, 2008

MSN Plus : simple countdown script

Simplest countdown script for MSN Plus. Seriously.
//Countdown date
TehDatum = "October 13, 2008 22:40:00";
//Refresh timer in seconds
TehDelay = 1;
//the 'until' text
TehWha = "do 20 let !";
//What do display if the counter ended
TehAfter = "20 let !";
//Smallest unit: dan, ura, minuta, sekunda
TehMode = "sekunda";


//end config -----------------------------

function OnEvent_Initialize(MessengerStart){
 MsgPlus.AddTimer("RFR",1000);
}

function OnEvent_Signin(Email) { 
 MsgPlus.AddTimer("RFR",1000);
}

function OnEvent_Timer(sTimerId){
    if(sTimerId == "RFR"){
    
 var dns = new Date();
     var pb = new Date(TehDatum);
     var d = pb.getTime() - dns.getTime();
     
     d=d/1000;
     dni=Math.floor(d/3600/24);
     ur=Math.floor((d-(dni*3600*24))/3600);
     min=Math.floor((d-(dni*3600*24)-(ur*3600))/60);
     sec=Math.floor(d-(dni*3600*24)-(ur*3600)-(min*60));
     
time = "Še "+dni+" dni, "+ur+" ur, "+min+" minut in "+sec+" sekund "+TehWha;

if(TehMode == "dan") { 
time = "Še "+dni+" dni "+TehWha;
}   

if(TehMode == "ura") { 
time = "Še "+dni+" dni in "+ur+" ur "+TehWha;
}  

if(TehMode == "minuta") { 
time = "Še "+dni+" dni, "+ur+" ur in "+min+" minut "+TehWha;
}

   
    
         if(pb.getTime() < dns.getTime()) {
          time = TehAfter;
         }      

   Messenger.MyPersonalMessage = time;
         MsgPlus.AddTimer("RFR",TehDelay*1000);
    }
}

1 comment:

Anonymous said...

thanks, work great.