Forum:Clock extension question (how to add an if user-logged in)

Hi, I'm back with another problem. This time it goes about an clock that I replaced inside the navbar above. But there's an problem. I want that the clock only show up when your logged in but the code doesn't seem to work. I probaly did something totaly wrong. Does someone knowns an fix? Here's the page of the problem:.

The bug is probably with the if inside an if code:

--Jens Ingels (talk) 12:49, July 30, 2012 (UTC)

To make it only show for logged-in users, replace the line that says $( liveClock ); with if (wgUserName) { $( liveClock ); }

Also, I recommend moving the "showTime" function to the top of the script. The reason is because it's called by "liveClock", but it's not defined until after it's called. This is potentially a problem in JavaScript because the function could be called before it's defined, in which case that would generate an error.

It works, thx a lot for the info. Btw your sign, do you known what css or js is required to round those borders off?--Jens Ingels (talk) 18:09, July 31, 2012 (UTC)


 * Use the border-radius property for rounded corners. You should also consider using -moz-border-radius and -webkit-border-radius for outdated browsers. My signature code is at User:Mathmagician/sig, it uses


 * Try using an anonymous function, like this:

Sam Wang 19:05, July 31, 2012 (UTC)