Free javascript Hosting


UPNScriptwResources2.js

Uploaded on Jan 03 2010 15:20 by deadflyproductions

var Mood_Sets = new Array();
Mood_Sets[0] = ["Aluminum"]
Mood_Sets[1] = ["Cattle"]
Mood_Sets[2] = ["Coal"]
Mood_Sets[3] = ["Fish"]
Mood_Sets[4] = ["Furs"]
Mood_Sets[5] = ["Gems"]
Mood_Sets[6] = ["Gold"]
Mood_Sets[7] = ["Iron"]
Mood_Sets[8] = ["Lead"]
Mood_Sets[9] = ["Lumber"]
Mood_Sets[10] = ["Marble"]
Mood_Sets[11] = ["Oil"]
Mood_Sets[12] = ["Pigs"]
Mood_Sets[13] = ["Rubber"]
Mood_Sets[14] = ["Silver"]
Mood_Sets[15] = ["Spices"]
Mood_Sets[16] = ["Sugar"]
Mood_Sets[17] = ["Uranium"]
Mood_Sets[18] = ["Water"]
Mood_Sets[19] = ["Wheat"]
Mood_Sets[20] = ["Wine"]

if(location.href.match("act=UserCP&CODE")){
var divs = document.getElementsByTagName("div")
for(var k=divs.length-1;k>-1;k--){
if(divs[k].className == 'pformstrip' && divs[k].innerHTML.match("Subscriptions")){
var div = document.createElement("div")
div.setAttribute("class", "pformstrip")
div.innerHTML = "Nation Information"
divs[k].parentNode.insertBefore(div,divs[k])
k++
var p = document.createElement("p")
p.innerHTML = " . <a href='"+location.href.split("?")[0]+"?act=UserCP&CODE=AddProfile'>Manage Nation Information</a><br />"
divs[k].parentNode.insertBefore(p,divs[k])
}
}
}

if(location.href.match("act=UserCP&CODE=AddProfile")!=null){
a="<br /><br /><span id='check_profile'><div align='center'><br /><b>Loading, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div></span>";
document.getElementById("ucpcontent").innerHTML="<div class='maintitle'>Manage Nation Information</div>"+a;
document.write("<iframe name='Profile' id='Profile' frameborder='0' src='"+location.href.split("?")[0]+"?act=UserCP&CODE=22' height='0' width='0' onload='Check_Profile();'></iframe>");
}

function Check_Profile(){
var Profile = window.frames['Profile'].document.getElementsByTagName("div");
for(z=0;z<Profile.length;z++){
if(Profile[z].className=="signature"){
if(Profile[z].innerHTML.match(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i)!=null){
a = "Your Current Nation Information:<br /><br />";
if(RegExp.$1 != ""){
a += "Your Tech Status: <b>"+RegExp.$1+"</b> <input type='button' value='Reset Gender Info' onclick='Reset_Gender();'><br /><br />";
}
if(RegExp.$1 == ""){
a += "<br />Edit your Tech Status: <form><select onchange='Set_Gender(this.options[this.selectedIndex].value)'><option value=''>Choose your Tech Status";
a += "<option value='Neither'>Neither<option value='Buying'>Buying<option value='Selling'>Selling";
a += "</select></form><br />";
}
if(RegExp.$2 != ""){
a += "Your Nation ID: <b>"+RegExp.$2+"</b> <input type='button' value='Reset Nation ID' onclick='Reset_NID();'><br />";
}
if(RegExp.$2 == ""){
a += "<br />Edit your Nation ID: <input type='text' value='' id='age' maxlength='6' size='8'> <input type='button' value='Edit Nation ID' onclick='Set_NID();'><br />";
}
if(RegExp.$3 != ""){
a += "<br />Your Nation Name: <b>"+RegExp.$3+"</b> <input type='button' value='Reset Nation Name' onclick='Reset_Name();'><br />";
}
if(RegExp.$3 == ""){
a += "<br />Edit your Nation Name: <input type='text' value='' id='nName' maxlength='16' size='18'> <input type='button' value='Edit Name' onclick='Set_Name();'><br />";
}
if(RegExp.$4 != ""){
a += "<br />Your first resource: <b>"+RegExp.$4+"</b> <input type='button' value='Reset Resource Info' onclick='Reset_Mood();'><br />";
}
if(RegExp.$4 == ""){
a += "<br />Edit your first resource: <form><select onchange='Set_Mood(this.options[this.selectedIndex].value)'><option value=''>Choose your Resource";
for(h in Mood_Sets){
a += "<option value='"+Mood_Sets[h][0]+"'>"+Mood_Sets[h][0];
}
a += "</select></form><br />";
}
if(RegExp.$5 == ""){
a += "<br />Edit your second resource: <form><select onchange='Set_2Mood(this.options[this.selectedIndex].value)'><option value=''>Choose your Resource";
for(h in Mood_Sets){
a += "<option value='"+Mood_Sets[h][0]+"'>"+Mood_Sets[h][0];
}
a += "</select></form><br />";
}
a += "<br /><br /><input type='button' value='Reset All Profile Info' onclick='Reset_Profile();'>";
}
else{
a = "You don\'t have any Nation Information.<br /><br />"
a += "Edit your Tech Status: <form><select onchange='Set_Gender(this.options[this.selectedIndex].value)'><option value=''>Choose your Tech Status";
a += "<option value='Neither'>Neither<option value='Buying'>Buying<option value='Selling'>Selling";
a += "</select></form><br />";
a += "<br />Edit your Nation ID: <input type='text' value='' id='age' maxlenght='6' size='36'> <input type='button' value='Edit Nation ID' onclick='Set_NID();'><br />";
a += "<br />Edit your Nation Name: <input type='text' value='' id='nName' maxlength='16' size='18'> <input type='button' value='Edit Name' onclick='Set_Name();'><br />";
a += "<br />Edit your First Resource: <form><select onchange='Set_Mood(this.options[this.selectedIndex].value)'><option value=''>Choose your Resource";
for(h in Mood_Sets){
a += "<option value='"+Mood_Sets[h][0]+"'>"+Mood_Sets[h][0];
}
a += "</select></form>";
a += "<br />Edit your Second Resource: <form><select onchange='Set_2Mood(this.options[this.selectedIndex].value)'><option value=''>Choose your Resource";
for(h in Mood_Sets){
a += "<option value='"+Mood_Sets[h][0]+"'>"+Mood_Sets[h][0];
}
a += "</select></form>";
}
document.getElementById("check_profile").innerHTML=a
}
}
}

function Reset_Profile(){
var frame = window.frames['Profile'].document.getElementsByTagName("input");
for(a=0;a<frame.length;a++){
if(frame[a].value == "Update my Signature"){
frame[a].click();
document.getElementById("check_profile").innerHTML="<div align='center'><br /><b>Reseting Profile, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div>";
setTimeout("Reload()",3000);
}
}
}

function Reload(){
window.location=location.href.split('?')[0]+"?act=UserCP&CODE=AddProfile";
}

function Set_NID(){
var get_age = document.getElementById("age").value;
if(!get_age.match(/^\d+$/i)){
alert("Input a number.");
}
if(get_age.match(/^\d+$/i)){
var Profile = window.frames['Profile'].document.getElementsByTagName("div");
for(z=0;z<Profile.length;z++){
if(Profile[z].className=="signature"){
if(Profile[z].innerHTML.match(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i)!=null){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ]"+RegExp.$1+","+get_age+","+RegExp.$3+","+RegExp.$4+","+RegExp.$5+"[/TCZ]";
}
else{
if(RegExp.$1 == "" && RegExp.$2 != "" || (RegExp.$3 == "" && RegExp.$2 != "") || (RegExp.$4 == "" && RegExp.$2 != "") || (RegExp.$5 == "" && RegExp.$2 != "")!=null){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ]"+RegExp.$1+","+get_age+","+RegExp.$3+","+RegExp.$4+","+RegExp.$5+"[/TCZ]";
}
}
}
}
var frame = window.frames['Profile'].document.getElementsByTagName("input");
for(a=0;a<frame.length;a++){
if(frame[a].value == "Update my Signature"){
frame[a].click();
document.getElementById("check_profile").innerHTML="<div align='center'><br /><b>Editing your Nation Information, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div>";
}
}
}
}

function Reset_NID(){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ]"+RegExp.$1+",,"+RegExp.$3+","+RegExp.$4+","+RegExp.$5+"[/TCZ]";
var frame = window.frames['Profile'].document.getElementsByTagName("input");
for(a=0;a<frame.length;a++){
if(frame[a].value == "Update my Signature"){
frame[a].click();
document.getElementById("check_profile").innerHTML="<div align='center'><br /><b>Reseting Age, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div>";
setTimeout("Reload()",3000);
}
}
}

function Set_Gender(type){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ]"+type+","+RegExp.$2+","+RegExp.$3+","+RegExp.$4+","+RegExp.$5+"[/TCZ]";
var frame = window.frames['Profile'].document.getElementsByTagName("input");
for(a=0;a<frame.length;a++){
if(frame[a].value == "Update my Signature"){
frame[a].click();
document.getElementById("check_profile").innerHTML="<div align='center'><br /><b>Editing your Nation Information, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div>";
}
}
}

function Reset_Gender(){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ],"+RegExp.$2+","+RegExp.$3+","+RegExp.$4+","+RegExp.$5+"[/TCZ]";
var frame = window.frames['Profile'].document.getElementsByTagName("input");
for(a=0;a<frame.length;a++){
if(frame[a].value == "Update my Signature"){
frame[a].click();
document.getElementById("check_profile").innerHTML="<div align='center'><br /><b>Reseting Tech Status, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div>";
setTimeout("Reload()",3000);
}
}
}

function Set_Name(){
var get_Nationn = document.getElementById("nName").value;
var Profile = window.frames['Profile'].document.getElementsByTagName("div");
for(m=0;m<Profile.length;m++){
if(Profile[m].className=="signature"){
if(Profile[m].innerHTML.match(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i)!=null){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ]"+RegExp.$1+","+RegExp.$2+","+get_Nationn+","+RegExp.$4+","+RegExp.$5+"[/TCZ]";
}
else{
if(RegExp.$1 == "" && RegExp.$2 != "" || (RegExp.$3 == "" && RegExp.$2 != "") || (RegExp.$4 == "" && RegExp.$2 != "") || (RegExp.$5 == "" && RegExp.$2 != "")!=null){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ]"+RegExp.$1+","+RegExp.$2+","+get_Nationn+","+RegExp.$4+","+RegExp.$4+"[/TCZ]";
}
}
}
}
var frame = window.frames['Profile'].document.getElementsByTagName("input");
for(a=0;a<frame.length;a++){
if(frame[a].value == "Update my Signature"){
frame[a].click();
document.getElementById("check_profile").innerHTML="<div align='center'><br /><b>Editing your Nation Information, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div>";
}
}
}

function Reset_Name(){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ]"+RegExp.$1+","+RegExp.$2+",,"+RegExp.$4+","+RegExp.$5+"[/TCZ]";
var frame = window.frames['Profile'].document.getElementsByTagName("input");
for(a=0;a<frame.length;a++){
if(frame[a].value == "Update my Signature"){
frame[a].click();
document.getElementById("check_profile").innerHTML="<div align='center'><br /><b>Reseting Nation Name, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div>";
setTimeout("Reload()",3000);
}
}
}

function Set_Mood(mood){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ]"+RegExp.$1+","+RegExp.$2+","+RegExp.$3+","+mood+","+RegExp.$5+"[/TCZ]";
var frame = window.frames['Profile'].document.getElementsByTagName("input");
for(a=0;a<frame.length;a++){
if(frame[a].value == "Update my Signature"){
frame[a].click();
document.getElementById("check_profile").innerHTML="<div align='center'><br /><b>Editing your Nation Information, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div>";
}
}
}

function Reset_Mood(){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ]"+RegExp.$1+","+RegExp.$2+","+RegExp.$3+",,"+RegExp.$5"[/TCZ]";
var frame = window.frames['Profile'].document.getElementsByTagName("input");
for(a=0;a<frame.length;a++){
if(frame[a].value == "Update my Signature"){
frame[a].click();
document.getElementById("check_profile").innerHTML="<div align='center'><br /><b>Reseting First Resource, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div>";
setTimeout("Reload()",3000);
}
}
}
function Set_2Mood(mo2od){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ]"+RegExp.$1+","+RegExp.$2+","+RegExp.$3+","+RegExp.$4+","+mo2od+"[/TCZ]";
var frame = window.frames['Profile'].document.getElementsByTagName("input");
for(a=0;a<frame.length;a++){
if(frame[a].value == "Update my Signature"){
frame[a].click();
document.getElementById("check_profile").innerHTML="<div align='center'><br /><b>Editing your Nation Information, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div>";
}
}
}

function Reset_2Mood(){
window.frames['Profile'].document.forms['REPLIER'].Post.value+="[TCZ]"+RegExp.$1+","+RegExp.$2+","+RegExp.$3+","+RegExp.$4",[/TCZ]";
var frame = window.frames['Profile'].document.getElementsByTagName("input");
for(a=0;a<frame.length;a++){
if(frame[a].value == "Update my Signature"){
frame[a].click();
document.getElementById("check_profile").innerHTML="<div align='center'><br /><b>Reseting First Resource, please wait...<br /><br /><img src='http://209.85.48.12/11661/52/upload/p2153323.gif'><br /><br /><br /></div>";
setTimeout("Reload()",3000);
}
}
}
//Thanks Godkillah! Visit phantom-designs.net now! =D
if(location.href==top.location.href && location.href.match(/act=UserCP/i) && location.href.match(/CODE=22/i)){
backup=""
if(document.forms.REPLIER.Post.value.match(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i)){
backup="[TCZ]"+RegExp.$1+","+RegExp.$2+","+RegExp.$3+","+RegExp.$4+"[/TCZ]"
document.forms.REPLIER.Post.value=document.forms.REPLIER.Post.value.split("[TCZ]"+RegExp.$1+","+RegExp.$2+","+RegExp.$3+","+RegExp.$4+","+RegExp.$5+"[/TCZ]").join("")
}
document.forms.REPLIER.onsubmit=function(){
if(document.forms.REPLIER.Post.value.match(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i)){
document.forms.REPLIER.Post.value=document.forms.REPLIER.Post.value.split("[TCZ]"+RegExp.$1+","+RegExp.$2+","+RegExp.$3+","+RegExp.$4+","+RegExp.$5+"[/TCZ]").join("")
}
document.forms.REPLIER.Post.value=backup+document.forms.REPLIER.Post.value
}
a=document.getElementsByTagName("div")
for(i=0;i<a.length;i++){
if(a[i].innerHTML.match(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i) && a[i].className=='signature'){
a[i].innerHTML=a[i].innerHTML.split("[TCZ]"+RegExp.$1+","+RegExp.$2+","+RegExp.$3+","+RegExp.$4+","+RegExp.$5+"[/TCZ]").join("")
}
}
}

if(location.href.match(/act=UserCP&CODE=22/i)){
text = document.getElementsByTagName("textarea");
for(i=0;i<text.length;i++){
if(text[i].className=="textinput"){
if(text[i].innerHTML.match(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i)!=null){
text[i].innerHTML=text[i].innerHTML.replace(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i,"");
}
}
}
}

//Thanks Godkillah! :)
if(location.href.match(/showtopic=/i)){
a=document.getElementsByTagName("span")
for(i=0;i<a.length;i++){
if(a[i].className=="postdetails" && a[i].innerHTML.match(/Joined:/i)){
b=a[i].parentNode.parentNode.getElementsByTagName("td")[1]
if(b.getElementsByTagName("div")[b.getElementsByTagName("div").length-1].className=="signature"){
if(b.getElementsByTagName("div")[b.getElementsByTagName("div").length-1].innerHTML.match(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i)!=null){
if(RegExp.$2 != "" && RegExp.$3 != ""){
a[i].innerHTML += "<br /><br /><b>Nation: </b><i><a href='http://www.cybernations.net/nation_drill_display.asp?Nation_ID="+RegExp.$2+"'>"+RegExp.$3+"</a></i>";
}
}
if(RegExp.$1 != ""){
a[i].innerHTML += "<br /><b>Tech Status: </b><i>"+RegExp.$1+"</i><br />";
}
if(RegExp.$4 != "" && RegExp.$5 != ""){
a[i].innerHTML += "<b>Resources: </b><i>"+RegExp.$4+"</i> & <i>"+RegExp.$5+"</i>";
}
}
}
if(b.getElementsByTagName("div")[b.getElementsByTagName("div").length-1].innerHTML.split(" ").join("")==""){
b.getElementsByTagName("div")[b.getElementsByTagName("div").length-1].parentNode.innerHTML=b.getElementsByTagName("div")[b.getElementsByTagName("div").length-1].parentNode.innerHTML.split("--------------------").join("")
}
}
}
var topic = document.getElementsByTagName("div");
for(hide=0;hide<topic.length;hide++){
if(topic[hide].className=="signature"){
if(topic[hide].innerHTML.match(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i)!=null){
topic[hide].innerHTML=topic[hide].innerHTML.replace(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i,"");
}
}
}
}

if(location.href.match(/showuser=/i)){
var name = document.getElementById("profilename").innerHTML;
user = document.getElementsByTagName("td");
for(hide=0;hide<user.length;hide++){
if(user[hide].className=="maintitle" && user[hide].innerHTML=="Posting Details"){
if(user[hide].parentNode.parentNode.parentNode.rows[4].cells[1].innerHTML.match(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i)){
a=document.getElementsByTagName("TABLE");
for (i=0;i<a.length;i++){
if(a[i].align == "center" && a[i].cellPadding == 0 && a[i].cellSpacing == 2 && a[i].width == "100%"){
b = '<table cellspacing="1" cellpadding="6" width="100%"><tr>';
b += '<td align="center" colspan="2" class="maintitle">'+name+'\'s Nation Information</td></tr>';
if(RegExp.$2 != "" && RegExp.$3 != ""){
b += "<tr><td class='row3' width='30%' valign='top'><b>Nation</b></td><td align='left' width='70%' class='row1'><a href='http://www.cybernations.net/nation_drill_display.asp?Nation_ID="+RegExp.$2+"'><i>"+RegExp.$3+'</i></a></td></tr>';
}
if(RegExp.$1 != ""){
b += '<tr><td class="row3" width="30%" valign="top"><b>Tech Status</b></td><td align="left" width="70%" class="row1"><i>'+RegExp.$1+'</i></td></tr>';
}
if(RegExp.$4 != "" && RegExp.$5 != ""){
b += '<tr><td class="row3" width="30%" valign="top"><b>Resources</b></td><td align="left" width="70%" class="row1"><i>'+RegExp.$4+'</i> & <i>'+RegExp.$5+'</i></td></tr>';
}
b += '</table>';
a[i].insertRow(-1);
a[i].rows[2].insertCell(-1);
a[i].rows[2].cells[0].innerHTML = b;
a[i].rows[2].cells[0].vAlign= "top";
a[i].rows[2].cells[0].className= "plainborder";
}
}
user[hide].parentNode.parentNode.parentNode.rows[4].cells[1].innerHTML=user[hide].parentNode.parentNode.parentNode.rows[4].cells[1].innerHTML.replace(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i,"");
}
else if(!user[hide].parentNode.parentNode.parentNode.rows[4].cells[1].innerHTML.match(/\[TCZ\](.*),(.*),(.*),(.*),(.*)\[\/TCZ\]/i)){
a=document.getElementsByTagName("TABLE");
for (i=0;i<a.length;i++){
if(a[i].align == "center" && a[i].cellPadding == 0 && a[i].cellSpacing == 2 && a[i].width == "100%"){
b = '<table cellspacing="1" cellpadding="6" width="100%">'
b += '<tr><td align="center" colspan="2" class="maintitle">'+name+'\'s Nation Information</td></tr><tr><td align="center" width="100%" class="row1"><i>None</i></td></tr></table>'
a[i].insertRow(-1);
a[i].rows[2].insertCell(-1);
a[i].rows[2].cells[0].innerHTML = b;
a[i].rows[2].cells[0].vAlign= "top";
a[i].rows[2].cells[0].className= "plainborder";
}
}
}
}
}
}

Back to list