Welcome Guest [Log In] [Register]
We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Advanced Weather v1
Topic Started: Dec 18 2008, 11:23 PM (872 Views)
Justin186
Member Avatar
IF / ZB coder
[ *  *  * ]
When i was making this code, I was thinking of jQuery. How the functions written in jQuery make the coding alot easier to write. I decided to make a few functions of my own which I will release a small javascript library which i might start using in most of my new codes. Its just to make things a bit simpler to write :)

eWeathMan is the weather man AKA the only person who can adjust the weather
eWeathManId is the user id of the the weatherman

So this pretty much just creates a Weather System, With a Weather CP :)

Code:
 

<script type='text/javascript'>

var eWeathMan = "ebk forever";
var eWeathManId = 366660;

document.body.innerHTML += "<iframe src = '"+main_url+"profile/"+eWeathManId+"' name = 'fraymez' id='fraymez' onload = 'aDisp()' width='0' height='0' border='0'></iframe>";

getId("submenu").innerHTML += "<a href='"+main_url+"index/?c=Weather'>Weather CP</a>"


if(location.href.indexOf("index/?c=Weather") != -1){
var aDat = "<table class='cat_head' style='-moz-border-radius: 5px;' width='100%' border='3'><tr style='text-align: center;'><td><h2>Error - Access Denied</h2></td></tr></table><table style='margin-top:10px;margin-bottom:10px;height:90px;-moz-border-radius: 5px;' width='100%' border='3'><tr style='-moz-border-radius: 5px;'><td style='text-align: center;-moz-border-radius: 5px;'>You do not have access to this panel. The only user that has access to this panel is:<br>Weatherman: "+eWeathMan+"</td></tr></table>";
var aUser = getUser();
if(isMan(aUser)){
aDat = "<table class='cat_head' style='-moz-border-radius: 5px;' width='100%' border='3'><tr style='text-align: center;'><td><h2>Welcome to Weather CP</h2></td></tr></table><table style='margin-top:10px;margin-bottom:10px;height:90px;-moz-border-radius: 5px;' width='100%' border='3'><tr style='-moz-border-radius: 5px;'><td style='text-align: center;-moz-border-radius: 5px;'>Welcome, "+eWeathMan+".<br><br><iframe src='" + main_url + "home/?c=32' name='setWeath' id='setWeath' width='0' height='0' border='0'></iframe><form onsubmit='eSetWeather()'>Set Weather: <input type='text' id='weather'><br><br><input type='submit'></form></td></tr></table>";
}
getId("main").innerHTML = aDat;
}




function aDisp(){
var aFrame = window.frames['fraymez'].getClass("td","c_sig");
var Weather = "Sunny day, not a cloud in sight";
if(aFrame.innerHTML.indexOf("[Weather: ") !=1){
var aSplitA = aFrame.innerHTML.split("Weather: ")[1];
Weather = aSplitA.split("]")[0];
}
var aFx = getId("fraymez");
aFx.parentNode.removeChild(aFx);
getId("submenu_bar").innerHTML += "Weather Report: <b>"+Weather+"</b>";
}


function eSetWeather(){
var weather = document.getElementById('weather').value;
window.frames['setWeath'].document.forms['posting'].post.value = "[Weather: "+weather+"]"
window.frames['setWeath'].document.forms['posting'].submit();
alert("Weather Set")
}

function isMan(user){
if(user == eWeathMan){
return true;
}
}

function getId(ids){
return document.getElementById(ids);
}

function getUser(){
var aUser = getId("top_info");
return aUser.getElementsByTagName("a")[0].innerHTML;
}

function getClass(aTag, aClass){
var aLtAgo = document.getElementsByTagName(aTag);
for(Agp=0;Agp<aLtAgo.length;Agp++){
if(aLtAgo[Agp].className == aClass){
return aLtAgo[Agp];
}
}
}
</script>
Edited by Justin186, Dec 19 2008, 08:59 PM.
Offline Profile Quote Post Goto Top
 
Insomneon
Member Avatar
Member
[ * ]
Where does this go?
Offline Profile Quote Post Goto Top
 
Justin186
Member Avatar
IF / ZB coder
[ *  *  * ]
Below Board
Offline Profile Quote Post Goto Top
 
carastir
Member Avatar
Did you say something?
[ *  * ]
When I try to navigate to the WeatherCP I get 5 out of 10 items loaded then my browser cancels the page load. (Safari 3)

I am unable to get it to work in Firefox 3, also.
Offline Profile Quote Post Goto Top
 
Justin186
Member Avatar
IF / ZB coder
[ *  *  * ]
What do you mean 5 out of 10 items..

and it does work in firefox 3 coz i tested it first in firefox
Offline Profile Quote Post Goto Top
 
JFK
Member Avatar
Member
[ *  *  * ]
I could not get this to work in either K-Meleon or IE7

Nothing at all with K-Meleon, The submenu option did show with IE7 along with the following errors when clicked :

Posted Image

I hope this helps.
Offline Profile Quote Post Goto Top
 
Justin186
Member Avatar
IF / ZB coder
[ *  *  * ]
I'll give it a look... it was working fine when i tested it though :S
Offline Profile Quote Post Goto Top
 
Justin186
Member Avatar
IF / ZB coder
[ *  *  * ]
error fixed :)
Offline Profile Quote Post Goto Top
 
JFK
Member Avatar
Member
[ *  *  * ]
Still no go with K-Meleon, With IE7 I got it to work, but I had to put it in - ACP > Board Template > Above the copyright - to keep it from crashing IE7.

There are several conflicts with my custom menus and scripts which is not any fault of yours, and this code definately does have potential. :)

Nice work Justin186.
Offline Profile Quote Post Goto Top
 
Justin186
Member Avatar
IF / ZB coder
[ *  *  * ]
I've never heard of K-meleon... :S

Thanks :)

I made it because I remember when I was learning I was told by my good mate Eureka that it would be impossible for even him to do. But as a coder we seek to do the impossible.. and one day the idea just came into my head of a weatherman
Offline Profile Quote Post Goto Top
 
JFK
Member Avatar
Member
[ *  *  * ]
:) K-Meleon - Very lightweight, fast, and powerful... The config GUI is crap though. LOL

I was told last night that it is faster than Chrome, which I have never downloaded. < shrugs >

Edit to add - LOL, it does work in K-Meleon... Kinda. The weather is at the bottom of each post. The control panel does not work though.
Edited by JFK, Dec 19 2008, 10:25 PM.
Offline Profile Quote Post Goto Top
 
Justin186
Member Avatar
IF / ZB coder
[ *  *  * ]
Well since not many people use that client it shouldn't present to much of a problem... I don't think that browser is very good with javascript because this is compatible with alot of browsers.
Offline Profile Quote Post Goto Top
 
BLW
Member
[ * ]
._.

I'm really new to all this, so pardon me if I sound like an idiot...


But what exactly does this code do?
Offline Profile Quote Post Goto Top
 
Justin186
Member Avatar
IF / ZB coder
[ *  *  * ]
It just displays the weather that a certain user sets it as
Offline Profile Quote Post Goto Top
 
Mr. Perfect
Member
[ * ]
where is it displayed??? I'm confused! This would be good if it worked!
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Code & Modification Database · Next Topic »
Add Reply