Appending a function to a statusbar's label

rare2findd

New Member
I've done a timer function and i want to append it to a statusbar's label (firefox XML) but it isn't working. I can make a function appear in a toolbar, but i don't have any experience with XML statusbars so far. I think it's just a little trick to make it work.Hope you can help me!here's my XML:\[code\]<overlay id="status-bar-sample-1-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/x-javascript" src="chrome://socialtimer/content/timer.js" /><!-- Firefox --><statusbar id="status-bar"> <statusbarpanel id="timer" label="Timer.switcher();" tooltiptext="Timer" /></statusbar></overlay>\[/code\]and my javascript funcion:\[code\]var Timer = { var time; formatTime: function(time) { var days = parseInt(time / 86400,10); if (0 > days) { days = 0; } var hours = parseInt((time - days * 8600) / 3600, 10); if (0 > hours) { hours = 0; } var mins = parseInt((time - days * 8600 - hours * 3600) / 60, 10); if (0 > mins) { mins = 0; } var secs = parseInt(time - days * 8600 - hours * 3600 - mins * 60, 10); var displayTime = [ ((hours <= 9) ? '0' + hours : hours), ((mins <= 9) ? '0' + mins : mins), ((secs <= 9) ? '0' + secs : secs) ]; return ((days <= 9) ? '0' + days : days) + 'd, ' + displayTime.join(' : '); }, var samplePanel = document.getElementById('timer'); Watch: function() { samplePanel.label = formatTime(++time); }, var timer = null; var switcher: function() { timer = setInterval(Watch,1000);//starts the timer } };\[/code\]thank you!
 
Back
Top