Weather-Watch.com
February 09, 2010, 12:15:23 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Members: 9,224  Posts: 342,204  Topics: 37,971
Please welcome clubber1966, our newest member.

Latest versions: WD - 10.37P  WDL - 6.05  MML - 1.03
 News:
Check out the new FAQs (Frequently Asked Questions) board for a growing list of hints, tips and diagnostic suggestions.
  Advanced Search
   Home   Bug Tracker Photo Gallery Wiki Chat Calendar Search Login Register Help  
Pages: [1] 2 3 ... 8
  Print  |  « previous  |  next »  |  Go Down  
Author Topic: Javascript advisory scroll  (Read 26441 times)
0 Members and 1 Guest are viewing this topic.
carterlake
Tom Chaplin
Junior Weather Controller
****
Offline Offline

Location: Carter Lake, Iowa USA
Posts: 2,274
Local Time: Tuesday 07:15



WWW
« on: January 31, 2005, 11:44:21 PM »

NorCal Dan was asking about this code and I thought I'd make it it's own thread.

The code is actually very very simple. This simply inserts HTML code anywhere on a custom page if the NOAAEvent custom tag is anything but "NO CURRENT ADVISORIES". The idea behind this is that there is no need to post an advisory that says "no advisory".

The code I use is below. It uses the MARQUEE tag to scroll the warning so the webpage does not pause to load Java.

Insert it wherever you want the code to appear on your page or pages. It really gives a professional feel to the advisories. I credit www.weather.com with the idea. They do the exact same thing.

Also, for those wanting to use this in WD, here is the setup guide for the NOAA Warnings...

NOAA Warning Setup
« Last Edit: November 05, 2005, 02:41:53 PM by carterlake » Logged


WD; Davis VP2 6153; Quickcam for Notebooks Pro; Boltek w/ Nexstorm; GRLevel3; Live NOAA radio
carterlake
Tom Chaplin
Junior Weather Controller
****
Offline Offline

Location: Carter Lake, Iowa USA
Posts: 2,274
Local Time: Tuesday 07:15



WWW
« Reply #1 on: January 31, 2005, 11:48:23 PM »

No advisory...


* noadvisory.jpg (48.59 KB, 580x346 - viewed 975 times.)
Logged


WD; Davis VP2 6153; Quickcam for Notebooks Pro; Boltek w/ Nexstorm; GRLevel3; Live NOAA radio
carterlake
Tom Chaplin
Junior Weather Controller
****
Offline Offline

Location: Carter Lake, Iowa USA
Posts: 2,274
Local Time: Tuesday 07:15



WWW
« Reply #2 on: January 31, 2005, 11:48:48 PM »

Advisory...


* advisory.jpg (43.68 KB, 592x324 - viewed 936 times.)
Logged


WD; Davis VP2 6153; Quickcam for Notebooks Pro; Boltek w/ Nexstorm; GRLevel3; Live NOAA radio
lknweather
Forecaster
*****
Offline Offline

Location: Lake Norman, NC, US
Station Type: LaCrosse WS-2315
Posts: 183
Local Time: Tuesday 07:15



WWW
« Reply #3 on: February 01, 2005, 04:07:35 AM »

Carterlake...Thanks for the code, I have managed to add it to my website. I do have a question though...

I was looking at your Hazard page (wx4) and saw that you have the Hazard Outlook text at the bottom. I was able to figure out how to get that onto a page that I have made and had WD process into html.  I assume that you are using the HTTP Download to download the text file from NWS. I found the correct file and set the HTTP Download screen up to get it, but it downloaded the first file and now each additional file is being saved with a .TXT2 then .TXT3, then .TXT4, etc.

I can not find an option to just overwrite the file with the latest downloaded. What am I missing?

Thanks again,

Chad
Logged
carterlake
Tom Chaplin
Junior Weather Controller
****
Offline Offline

Location: Carter Lake, Iowa USA
Posts: 2,274
Local Time: Tuesday 07:15



WWW
« Reply #4 on: February 01, 2005, 12:06:26 PM »

Carterlake...Thanks for the code, I have managed to add it to my website. I do have a question though...

I was looking at your Hazard page (wx4) and saw that you have the Hazard Outlook text at the bottom. I was able to figure out how to get that onto a page that I have made and had WD process into html.  I assume that you are using the HTTP Download to download the text file from NWS. I found the correct file and set the HTTP Download screen up to get it, but it downloaded the first file and now each additional file is being saved with a .TXT2 then .TXT3, then .TXT4, etc.

I can not find an option to just overwrite the file with the latest downloaded. What am I missing?

Thanks again,

Chad

Mine makes a couple of those as well...  Shocked I just ignore them.  Very Happy
Logged


WD; Davis VP2 6153; Quickcam for Notebooks Pro; Boltek w/ Nexstorm; GRLevel3; Live NOAA radio
carterlake
Tom Chaplin
Junior Weather Controller
****
Offline Offline

Location: Carter Lake, Iowa USA
Posts: 2,274
Local Time: Tuesday 07:15



WWW
« Reply #5 on: February 10, 2005, 01:26:34 AM »

Here's a somewhat more advanced version of the same scroll script. It has more customizable options in the variables and changes the background and font colors based on the type of advisory being displayed.

<script type="text/javascript">
<!--
var warning = "%NOAAEvent%".toUpperCase();
var width = "550";
var mylocation = "CARTER LAKE, IOWA";
var link = "wx4.html";
var watchcolor = "#FFCC66"; <!-- Background color for watches //-->
var watchfont = "#0000FF"; <!-- Font color for watches //-->
var warningcolor = "#FF3333"; <!-- Background color for warnings //-->
var warningfont = "#FFFFFF"; <!-- Font color for warnings //-->
var defaultcolor = "#F0E68C"; <!-- Default background color //-->
var defaultfont = "#0000FF"; <!-- Default font color //-->
if (warning != "NO CURRENT ADVISORIES") {
       if (warning.indexOf("WATCH") > 0) {
       document.write("<table border='1' cellpadding='2' cellspacing='0' width=" + width + " bgcolor='" + watchcolor + "'><tr><td><marquee scrolldelay='125' width='" + width + "'><a href='" + link + "'><font face='verdana,arial' size='1' color='" + watchfont + "'>" + mylocation + " - <b><span style='text-transform: uppercase'>%NOAAEvent%</span></b> ... [Click here for more]</marquee></font></a></td></tr></table><br>");
   }
   else if (warning.indexOf("WARNING") > 0) {
       document.write("<table border='1' cellpadding='2' cellspacing='0' width=" + width + " bgcolor='" + warningcolor + "'><tr><td><marquee scrolldelay='125' width='" + width + "'><a href='" + link + "'><font face='verdana,arial' size='1' color='" + warningfont + "'>" + mylocation + " - <b><span style='text-transform: uppercase'>%NOAAEvent%</span></b> ... [Click here for more]</marquee></font></a></td></tr></table><br>");
   }
   else {
       document.write("<table border='1' cellpadding='2' cellspacing='0' width=" + width + " bgcolor='" + defaultcolor + "'><tr><td><marquee scrolldelay='125' width='" + width + "'><a href='" + link + "'><font face='verdana,arial' size='1' color='" + defaultfont + "'>" + mylocation + " - <b><span style='text-transform: uppercase'>%NOAAEvent%</span></b> ... [Click here for more]</marquee></font></a></td></tr></table><br>");
   }
}
//-->
</script>


(Minor bug fixes listed in red since code was originally posted.)
« Last Edit: March 06, 2005, 02:38:03 PM by carterlake » Logged


WD; Davis VP2 6153; Quickcam for Notebooks Pro; Boltek w/ Nexstorm; GRLevel3; Live NOAA radio
JaxWeather
Bob
Senior Weather Controller
*
Offline Offline

Location: Jacksonville, Fl. USA
Station Type: Vantage Pro 2 w/ FARS + 1-wire Lightning - Logitech Pro 5000
Posts: 10,082
Local Time: Tuesday 08:15


MML Station: WD00007


WWW
« Reply #6 on: March 01, 2005, 12:25:18 PM »

carterlake,

I just wanted to point out that the "Enhanced - Bigger and Better" scroll script breaks in Firefox, works Ok in IE, It was choking on:

" + location + " -

Kept trying to add the entry for Location, JACKSONVILLE,%20FL, to the end of the URL...

Here is a test page with the broken script running.

http://www.JaxWeather.net/WeatherImages/WD/wx9.html

I simply removed the three instances of " + location + " and hard coded Jacksonville, Fl to fix...

The running instance can be seen here:
http://www.jaxquest.com/WeatherImages/WD/wx7.html

By the way thanks for these scripts Smile

-Bob
Logged

TomTc
Senior Forecaster
*
Offline Offline

Location: Granada Hills, CA, USA
Station Type: Davis 6161 VP Plus FARS
Posts: 375
Local Time: Tuesday 04:15



WWW
« Reply #7 on: March 01, 2005, 02:03:35 PM »

Perhaps Brian can add this to WD in place of the Weather Alert default web page code he is presently using...  He needs to make the No Advisory variable customizable though since NOAA here uses a different string for no advisories in my location than "No Advisory" and thus it does not work properly for me...

Tom
« Last Edit: March 09, 2005, 01:37:32 PM by Tom T » Logged

windy
Brian
Climate Controller
***
Offline Offline

Location: West Coast Road, Awhitu Peninsular, New Zealand
Station Type: Davis VP, Mac
Posts: 55,962
Local Time: Wednesday 01:15



WWW
« Reply #8 on: March 01, 2005, 04:59:43 PM »

i could have as option to have on web page.,.,
so what is the coding needed?
what is here on this thread, less the +location+
?
Logged

JaxWeather
Bob
Senior Weather Controller
*
Offline Offline

Location: Jacksonville, Fl. USA
Station Type: Vantage Pro 2 w/ FARS + 1-wire Lightning - Logitech Pro 5000
Posts: 10,082
Local Time: Tuesday 08:15


MML Station: WD00007


WWW
« Reply #9 on: March 01, 2005, 05:54:48 PM »

The code that carterlake posted here:
http://www.weather-watch.com/smf/index.php/topic,7508.msg52321.html#msg52321

Unless he (or someone who knows more than I do) can post a correction for the "location" entry then removing...

var location = "CARTER LAKE, IOWA";
and
three instances of: " + location + " -

would allow the script to work in IE and FF...

However the addition of a WD tag that pulled the Station Name (if there isn't already one) into the areas where the " + location + " - was removed would be a nice touch...

Code:
<font face='verdana,arial' size='1' color='" + warningfont + "'>%stationnametag% - <b>

And then if nothing is edited by hand it would at least have some identification.  And for those that want they could probably hard code something else if they wanted?

-Bob
Logged

windy
Brian
Climate Controller
***
Offline Offline

Location: West Coast Road, Awhitu Peninsular, New Zealand
Station Type: Davis VP, Mac
Posts: 55,962
Local Time: Wednesday 01:15



WWW
« Reply #10 on: March 01, 2005, 07:36:52 PM »

uploading a new 10.23 zip now with this in it
Logged

carterlake
Tom Chaplin
Junior Weather Controller
****
Offline Offline

Location: Carter Lake, Iowa USA
Posts: 2,274
Local Time: Tuesday 07:15



WWW
« Reply #11 on: March 01, 2005, 10:22:48 PM »

carterlake,

I just wanted to point out that the "Enhanced - Bigger and Better" scroll script breaks in Firefox, works Ok in IE, It was choking on:

" + location + " -

Kept trying to add the entry for Location, JACKSONVILLE,%20FL, to the end of the URL...

Here is a test page with the broken script running.

http://www.JaxWeather.net/WeatherImages/WD/wx9.html

I simply removed the three instances of " + location + " and hard coded Jacksonville, Fl to fix...

The running instance can be seen here:
http://www.jaxquest.com/WeatherImages/WD/wx7.html

By the way thanks for these scripts Smile

-Bob

Hum.... I think there is something wrong with your HTML. I get this kind of broken page when I do things like <br. instead of <br>
« Last Edit: March 01, 2005, 10:26:20 PM by carterlake » Logged


WD; Davis VP2 6153; Quickcam for Notebooks Pro; Boltek w/ Nexstorm; GRLevel3; Live NOAA radio
JaxWeather
Bob
Senior Weather Controller
*
Offline Offline

Location: Jacksonville, Fl. USA
Station Type: Vantage Pro 2 w/ FARS + 1-wire Lightning - Logitech Pro 5000
Posts: 10,082
Local Time: Tuesday 08:15


MML Station: WD00007


WWW
« Reply #12 on: March 01, 2005, 10:39:26 PM »

The only change in the two files is one has the 'var location =' and ' " + location + " ' removed...

This is the code actually contained in wx9.html...
Code:
<script type="text/javascript">
<!--
var warning = "FLOOD WARNING";
var width = "550";
var location = "JACKSONVILLE, FL";
var link = "http://JaxWeather.net/JaxWeatherWarning.php";
var watchcolor = "#008080"; <!-- Background color for watches //-->
var watchfont = "#1CE6E6"; <!-- Font color for watches //-->
var warningcolor = "#FF3333"; <!-- Background color for warnings //-->
var warningfont = "#FFFFFF"; <!-- Font color for warnings //-->
var defaultcolor = "#FFFFFF"; <!-- Default background color //-->
var defaultfont = "#0000FF"; <!-- Default font color //-->
if (warning != "NO CURRENT ADVISORIES") {
       if (warning.indexOf("WATCH") > 0) {
       document.write("<table border='1' cellpadding='2' cellspacing='0' width=" + width + " bgcolor='" + watchcolor + "'><tr><td><marquee scrolldelay='125' width='" + width + "'><a href='" + link + "'><font face='verdana,arial' size='2' color='" + watchfont + "'>Jacksonville, FL - <b><span style='text-transform: uppercase'>FLOOD WARNING</span></b> ... [Click here for more]</marquee></font></a></td></tr></table><br>");
   }
   else if (warning.indexOf("WARNING") > 0) {
       document.write("<table border='1' cellpadding='2' cellspacing='0' width=" + width + " bgcolor='" + warningcolor + "'><tr><td><marquee scrolldelay='125' width='" + width + "'><a href='" + link + "'><font face='verdana,arial' size='22' color='" + warningfont + "'>Jacksonville, FL - <b><span style='text-transform: uppercase'>FLOOD WARNING</span></b> ... [Click here for more]</marquee></font></a></td></tr></table><br>");
   }
   else {
       document.write("<table border='1' cellpadding='2' cellspacing='0' width=" + width + " bgcolor='" + defaultcolor + "'><tr><td><marquee scrolldelay='125' width='" + width + "'><a href='" + link + "'><font face='verdana,arial' size='2' color='" + defaultfont + "'>Jacksonville, FL - <b><span style='text-transform: uppercase'>FLOOD WARNING</span></b> ... [Click here for more]</marquee></font></a></td></tr></table><br>");
   }
}
//-->
</script>

Removing just that block allows the page to work...  Placing it back breaks it again in FF? 
If I mucked something above up please let me know  LOL

-Bob
Logged

carterlake
Tom Chaplin
Junior Weather Controller
****
Offline Offline

Location: Carter Lake, Iowa USA
Posts: 2,274
Local Time: Tuesday 07:15



WWW
« Reply #13 on: March 01, 2005, 10:44:26 PM »

Well, what do you know.... Firefox doesn't like the variable "location"

Fixed. See above for latest code.
« Last Edit: March 06, 2005, 02:34:33 PM by carterlake » Logged


WD; Davis VP2 6153; Quickcam for Notebooks Pro; Boltek w/ Nexstorm; GRLevel3; Live NOAA radio
JaxWeather
Bob
Senior Weather Controller
*
Offline Offline

Location: Jacksonville, Fl. USA
Station Type: Vantage Pro 2 w/ FARS + 1-wire Lightning - Logitech Pro 5000
Posts: 10,082
Local Time: Tuesday 08:15


MML Station: WD00007


WWW
« Reply #14 on: March 01, 2005, 10:56:28 PM »

Updated and confirmed...
http://JaxWeather.net/WeatherImages/WD/wx9.html

I changed the color in the warning fields just as a sanity test for myself Smile

Thanks carterlake and now if we can figure out how to get the "Right" warnings and alerts called by %NOAAEvent% the world will be good for a few moments Smile

Thanks again,
Bob
Logged

Pages: [1] 2 3 ... 8
  Print  |  « previous  |  next »  |  Go Up  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!