Post by Lugubrious on Jun 26, 2010 20:17:51 GMT -8
This is Crossbrowser. It goes in the header or footer, wherever you want the table to go.
To Edit:
Part One - The Weather Types
Under var weather=[, you see the following:
['Wicked','http://i49.tinypic.com/243jcl4.jpg','Wow, this is some wicked weather! Hold on to your hats!'], //0
['Java','http://i50.tinypic.com/fax9qw.jpg','Moo, I\'m a pig!'], //1
['Party','http://i45.tinypic.com/260poio.jpg','LAWLZ ITS PARTY TIMEEE!'] //2, etc
The order is ['Weather Name','url of image of weather','weather notice or description'],
You may enter as many as you want. The last line has no comma. Note how it says //0, //1, etc. This is to keep track of what I call, weather ID's. You need that for the cities. Also, keep in mind that if you want to have different notes for the same weather icon, you may simply repeat the same picture and the same weather name but change the note.
Part Two - The Cities
Under var cities=[, you see the following:
['Boston',60,91,0,25,2,6],
['Austin',200,500,2,30],
['Los Angeles',0,4,1,20,2,3]
This means: ['City Name','lowest temp in f','highest temp in f + 1','id of first weather type','frequency of that id','id','frequency'],
So the first one, Boston, says that the city name is Boston, the degree range in F is 60 to 90. It has 25/31 chance of having the weather be ID 0, which is 'wicked'. It has a 6/31 chance of having the ID be 2, which is 'party'.
NOTE: You cannot have spaces between the commas.
NOTE2: Just as in the weather section, leave the comma off of the last line.
Part Three - Everything Else
Just read through the provided directions. If you want anything edited, just PM me here or see my site where I have a guest-friendly code support section, Epoque.
BIG IMPORTANT NOTE: If you want an apostophe in your weather name, weather notice, or city name, you must put a back slash before it. (ie: 'Elephant\'s Forest' )
<script type="text/javascript">
/* Multiple City Weather Generator
Feel free to edit, but keep this header intact.
By Lugubrious @ http://epoque.proboards.com */
var d=new Date();
var class1='titlebg'; //the class for the top row of cells
var class2='catbg';//the class for the city name cells
var class3='windowbg'; // the class for the other cells
var ans ='week'; //write week for weekly, day for daily
//note: it is case sensitive
if(ans=='day'){
var week = Math.round(d.getTime()/(1000*60*60*24));
}
else{
var week = Math.round(d.getTime()/(1000*60*60*24*7));
}
var weather=[
['Wicked','http://i49.tinypic.com/243jcl4.jpg','Wow, this is some wicked weather! Hold on to your hats!'], //0
['Java','http://i50.tinypic.com/fax9qw.jpg','Moo, I\'m a pig!'], //1
['Party','http://i45.tinypic.com/260poio.jpg','LAWLZ ITS PARTY TIMEEE!'] //2, etc
];
var cities=[
['Boston',60,91,0,25,2,6],
['Austin',200,500,2,30],
['Los Angeles',0,4,1,20,2,3]
];
var f=new Array();
function PickTemperature(x){
for(m=0;m<(cities[x][2]-cities[x][1]);m++){
if((week*week)%(cities[x][2]-cities[x][1])==m){
document.write(cities[x][1]+m + '°F or ');
document.write(Math.round((cities[x][1]+m-32)*(5/9)) + '°C');
}}}
///////////
for(i=0;i<cities.length;i++){
for(p=0;p<=cities[i].length;p++){
if(p==0){
f[i]=0;
}
else if(p!=0 & p!=2 & p%2==0){
f[i]+=cities[i][p];
}}}
function PickWeather(x){
document.write('</td><td ="'+class3+'" align="center"> <img src="');
for(m=0;m<f[x];m++){
if((week*week)%f[x]==m){
var z=2,L=0;
while(L<m){
z+=2;
L+=cities[x][z];
}
document.write(weather[cities[x][z-1]][1] + '" />');
document.write(' </td><td class="windowbg" align="center"> ' + weather[cities[x][z-1]][2] + ' </td></tr>');
}}}
document.write('<table width="790"><tr><td class="'+class1+'" align="center"><h2>Territory Region</h2></td><td class="'+class1+'" align="center"><h2>Temperature</h2></td><td class="'+class1+'" align="center"><h2>Weather</h2></td><td class="'+class1+'" align="center"><h2>Weather Statistics</h2></td></tr>');
for(i=0;i<cities.length;i++){
document.write('<tr><td ="'+class2+'" height="30px" align="center">');
document.write(cities[i][0]);
document.write('</td><td class="'+class3+'" height="30px" align="center"> ');
PickTemperature(i);
PickWeather(i);
}
document.write('</table>');
</script>
To Edit:
Part One - The Weather Types
Under var weather=[, you see the following:
['Wicked','http://i49.tinypic.com/243jcl4.jpg','Wow, this is some wicked weather! Hold on to your hats!'], //0
['Java','http://i50.tinypic.com/fax9qw.jpg','Moo, I\'m a pig!'], //1
['Party','http://i45.tinypic.com/260poio.jpg','LAWLZ ITS PARTY TIMEEE!'] //2, etc
The order is ['Weather Name','url of image of weather','weather notice or description'],
You may enter as many as you want. The last line has no comma. Note how it says //0, //1, etc. This is to keep track of what I call, weather ID's. You need that for the cities. Also, keep in mind that if you want to have different notes for the same weather icon, you may simply repeat the same picture and the same weather name but change the note.
Part Two - The Cities
Under var cities=[, you see the following:
['Boston',60,91,0,25,2,6],
['Austin',200,500,2,30],
['Los Angeles',0,4,1,20,2,3]
This means: ['City Name','lowest temp in f','highest temp in f + 1','id of first weather type','frequency of that id','id','frequency'],
So the first one, Boston, says that the city name is Boston, the degree range in F is 60 to 90. It has 25/31 chance of having the weather be ID 0, which is 'wicked'. It has a 6/31 chance of having the ID be 2, which is 'party'.
NOTE: You cannot have spaces between the commas.
NOTE2: Just as in the weather section, leave the comma off of the last line.
Part Three - Everything Else
Just read through the provided directions. If you want anything edited, just PM me here or see my site where I have a guest-friendly code support section, Epoque.
BIG IMPORTANT NOTE: If you want an apostophe in your weather name, weather notice, or city name, you must put a back slash before it. (ie: 'Elephant\'s Forest' )