Post Reply 
Status Bar Clock
Jul. 25, 2011, 11:11 PM (This post was last modified: Jul. 26, 2011 12:17 AM by Proxology.)
Post: #1
Cool Status Bar Clock
I've always wanted to have a small clock on my web browser because I have my Task Bar set to auto-hide. So I decided to look into a way to display a clock using The Proxomitron, with a tiny bit of JavaScript. By-the-way, my JavaScript abilities are VERY limited (still learning).

The first attempt was a very short amount of .js that wrote the time at the top of the screen. I used the Title tag as a way to insert the script, but some pages can cause problems.

A few days ago, I came across a way to display a clock on the status bar at the bottom of the browser. So far, it seems to work o.k., but I expect to quickly find websites that will not work.

If anyone knows how to make the script leaner, cleaner, and meaner, then I would appreciate it.

Thanks

p.s. I thought about christening it the "Proxomitron Clock," but I don't think it's anywhere near that just yet

p.p.s. This filter was tested out using Mozilla Firefox.

[Patterns]
Name = "Status Bar Clock"
Active = TRUE
Bounds = "<body*>"
Limit = 128
Match = "<body (ONLOAD="*"|)(*)\0>"
Replace = "<!-- START Staus Bar Clock | 2011-07-25 -->"
" "
"<body onLoad="timefunct()"\0>"
"<script language="JavaScript">"
"function timefunct() "
"{"
"daynow = new Date();"
"hours = daynow.getHours();"
"minutes = daynow.getMinutes();"
"seconds = daynow.getSeconds();"
"var secfinal;"
"var minfinal;"
"var hourfinal;"
"if (seconds <= 9) "
"{"
"secfinal = "0" + seconds;"
"} else "
"{"
"secfinal = seconds;"
"}"
"if (minutes <= 9) "
"{"
"minfinal = "0" + minutes;"
"} else "
"{"
"minfinal = minutes;"
"}"
"if (hours >= 13) "
"{"
"hourfinal = hours-12;"
"} else {"
"hourfinal = hours;"
"}"
"var time = hourfinal + ":" + minfinal + ":" + secfinal;"
"setTimeout('timefunct()', 1000);"
"self.status = time;"
"}"
"</script>"
""
"<!-- END Staus Bar Clock -->"
Add Thank You Quote this message in a reply
Jul. 26, 2011, 01:18 AM
Post: #2
RE: Status Bar Clock
impressive idea - mind if we see a screen-cap of 'er in action?
Add Thank You Quote this message in a reply
Jul. 26, 2011, 05:02 AM
Post: #3
RE: Status Bar Clock
The idea is to keep it visible in the lower left-hand corner of the status bar until the mouse hovers over a link.

I only got started with JavaScript a couple of months ago, so most of the script is based off of what the maestros are willing to share online.

What has me concerned is the use of the ONLOAD. I am guessing that some pages that call for ONLOAD to perform other actions will get screwed up since my matching only erases any existing ONLOAD in the BODY tag, copies any other info, and then calls timefunct().

I wouldn't mind also changing the color of the display to Prox-Green also.


Attached File(s)
.gif  Status_Bar_Clock.gif (Size: 19.16 KB / Downloads: 667)
Add Thank You Quote this message in a reply
Jul. 28, 2011, 08:57 PM
Post: #4
Smile RE: Status Bar Clock
This seems to work better. It does away with the <body="ONLOAD"> tag and just calls the function from inside the script.

[Patterns]
Name = "The Proxomitron Clock (Proxology_2011-07-28)"
Active = TRUE
Bounds = "</html>"
Limit = 128
Match = "</html>"
Replace = "<!-- BEGIN Proxomitron Clock -->"
"<script language="JavaScript">"
"function timefunct() {"
"daynow = new Date();"
"hours = daynow.getHours();"
"minutes = daynow.getMinutes();"
"seconds = daynow.getSeconds();"
"var secfinal;"
"var minfinal;"
"var hourfinal;"
"if (seconds <= 9) {"
"secfinal = "0" + seconds;"
"} else {"
"secfinal = seconds;"
"}"
"if (minutes <= 9) {"
"minfinal = "0" + minutes;"
"} else {"
"minfinal = minutes;"
"}"
"if (hours >= 13) {"
"hourfinal = hours-12;"
"} else {"
"hourfinal = hours;"
"}"
"var time = hourfinal + ":" + minfinal + ":" + secfinal;"
"setTimeout('timefunct()', 1000);"
"self.status = time;"
"}"
"timefunct()"
"</script>"
"<!-- END Proxomitron Clock -->"
"</html>"

Thanks....
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: