|
Viewing Single Post From: Advanced Weather v1
|
|
Justin186
|
Dec 18 2008, 11:23 PM
|
- Posts:
- 302
- Group:
- Members
- Member
- #59,790
- Joined:
- July 3, 2005
- I'm Browsing With
- Firefox 3
|
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>
|
|
|