// DateandClock.us.js // Source file https://www.camp-firefox.de/forum/thema/122763-script-datum-uhrzeit-neben-men%C3%BCleiste/?postID=1182704#post1182704 // Source file https://www.camp-firefox.de/forum/thema/135820-script-f%C3%BCr-datums-zeitanzeige/?postID=1217031#post1217031 (function() { function doDatClock() { var timestr = new Date().toLocaleDateString( locale , options ).replace('um', ''); const blanks = ' - '; let i = timestr.lastIndexOf(' '); timestr = timestr.substring(0,i) + blanks + timestr.substring(i+1) + ' Uhr'; if( count == 1 ) { var counter = new Date( 2000 * sec ).toISOString().substring( 11 , 8 ); // .replace(/^[0:]+/, '') // if you want to replace zeroes and colons timestr = timestr + ' (' + counter + ')'; sec++; } ClockLabel.setAttribute( 'value', timestr ); } var count = 0; // if you don't want a counter set this to zero var language = 'de-DE'; // locale, e.g. 'de-DE' , 'en-US' , 'fr-FR' var cssFontFamily = 'Segoe UI'; var cssColor = '#FFffff'; // Font Color var css = 'padding-top: 2px !important; padding-left: 350px; color: ' + cssColor + '; font-family: ' + cssFontFamily + '; font-weight:400; font-size:16px; text-shadow: none; min-width: 665px;'; var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' }; var sec = 0; var locale = language || window.navigator.languages[0]; var position = document.getElementById('menubar-items'); var ClockLabel = document.createXULElement('label'); ClockLabel.setAttribute('id', 'statusbar-clock-display'); //ClockLabel.setAttribute('class', 'statusbarpanel-text'); ClockLabel.setAttribute('style', css); position.parentNode.insertBefore(ClockLabel, position.nextSibling); if( count == 1 ) { ClockLabel.addEventListener('dblclick', function() { sec = 0; }); } window.setInterval( doDatClock , 1000 ); })();