Roleplay game:Mobius World War/Map/Script.js

//Clear the page
$(document).ready(function(){document.body.innerHTML = null;
//Add map image
$('body').append("<img src='http://images.wikia.com/sonicfanon/images/2/29/SFWRiskMap.png'/>");
//Create Variables and Arrays
mobiusWorldWarX = new Array;
mobiusWorldWarY = new Array;
mobiusWorldWarTerritories = new Array;
mobiusWorldWarAlliances = new Array;
mobiusWorldWarNations = new Array;
mobiusWorldWarUnits = new Array;
mobiusWorldWarInfo = document.createElement('div');
 mobiusWorldWarInfo.id = "mobiusWorldWarInfo";
 mobiusWorldWarInfo.style.display = "none";
//Position Data
mobiusWorldWarX[1]=330;mobiusWorldWarY[1]=206;mobiusWorldWarX[2]=471;mobiusWorldWarY[2]=195;mobiusWorldWarX[3]=98;mobiusWorldWarY[3]=225;mobiusWorldWarX[4]=196;mobiusWorldWarY[4]=228;mobiusWorldWarX[5]=307;mobiusWorldWarY[5]=270;mobiusWorldWarX[6]=419;mobiusWorldWarY[6]=296;mobiusWorldWarX[7]=522;mobiusWorldWarY[7]=333;mobiusWorldWarX[8]=617;mobiusWorldWarY[8]=360;mobiusWorldWarX[9]=31;mobiusWorldWarY[9]=332;mobiusWorldWarX[10]=160;mobiusWorldWarY[10]=310;mobiusWorldWarX[11]=297;mobiusWorldWarY[11]=346;mobiusWorldWarX[12]=404;mobiusWorldWarY[12]=391;mobiusWorldWarX[13]=498;mobiusWorldWarY[13]=436;mobiusWorldWarX[14]=654;mobiusWorldWarY[14]=473;mobiusWorldWarX[15]=353;mobiusWorldWarY[15]=490;mobiusWorldWarX[16]=475;mobiusWorldWarY[16]=519;mobiusWorldWarX[17]=377;mobiusWorldWarY[17]=574;mobiusWorldWarX[18]=500;mobiusWorldWarY[18]=597;mobiusWorldWarX[19]=494;mobiusWorldWarY[19]=693;mobiusWorldWarX[20]=380;mobiusWorldWarY[20]=738;mobiusWorldWarX[21]=471;mobiusWorldWarY[21]=781;mobiusWorldWarX[22]=557;mobiusWorldWarY[22]=770;mobiusWorldWarX[23]=418;mobiusWorldWarY[23]=848;mobiusWorldWarX[24]=553;mobiusWorldWarY[24]=866;mobiusWorldWarX[25]=482;mobiusWorldWarY[25]=942;mobiusWorldWarX[26]=1147;mobiusWorldWarY[26]=253;mobiusWorldWarX[27]=1286;mobiusWorldWarY[27]=230;mobiusWorldWarX[28]=875;mobiusWorldWarY[28]=261;mobiusWorldWarX[29]=960;mobiusWorldWarY[29]=280;mobiusWorldWarX[30]=1047;mobiusWorldWarY[30]=312;mobiusWorldWarX[31]=1123;mobiusWorldWarY[31]=324;mobiusWorldWarX[32]=1232;mobiusWorldWarY[32]=308;mobiusWorldWarX[33]=1302;mobiusWorldWarY[33]=316;mobiusWorldWarX[34]=1032;mobiusWorldWarY[34]=424;mobiusWorldWarX[35]=1172;mobiusWorldWarY[35]=411;mobiusWorldWarX[36]=1273;mobiusWorldWarY[36]=398;mobiusWorldWarX[37]=1206;mobiusWorldWarY[37]=499;mobiusWorldWarX[38]=1380;mobiusWorldWarY[38]=322;mobiusWorldWarX[39]=1475;mobiusWorldWarY[39]=353;mobiusWorldWarX[40]=1558;mobiusWorldWarY[40]=382;mobiusWorldWarX[41]=1325;mobiusWorldWarY[41]=435;mobiusWorldWarX[42]=1403;mobiusWorldWarY[42]=431;mobiusWorldWarX[43]=1511;mobiusWorldWarY[43]=443;mobiusWorldWarX[44]=1618;mobiusWorldWarY[44]=470;mobiusWorldWarX[45]=1355;mobiusWorldWarY[45]=536;mobiusWorldWarX[46]=1461;mobiusWorldWarY[46]=514;mobiusWorldWarX[47]=1553;mobiusWorldWarY[47]=521;mobiusWorldWarX[48]=1285;mobiusWorldWarY[48]=592;mobiusWorldWarX[49]=1400;mobiusWorldWarY[49]=631;mobiusWorldWarX[50]=1466;mobiusWorldWarY[50]=608;mobiusWorldWarX[51]=1393;mobiusWorldWarY[51]=719;mobiusWorldWarX[52]=1449;mobiusWorldWarY[52]=902;mobiusWorldWarX[53]=852;mobiusWorldWarY[53]=625;mobiusWorldWarX[54]=980;mobiusWorldWarY[54]=612;mobiusWorldWarX[55]=863;mobiusWorldWarY[55]=699;mobiusWorldWarX[56]=980;mobiusWorldWarY[56]=693;mobiusWorldWarX[57]=1092;mobiusWorldWarY[57]=659;mobiusWorldWarX[58]=982;mobiusWorldWarY[58]=793;mobiusWorldWarX[59]=1050;mobiusWorldWarY[59]=770;mobiusWorldWarX[60]=1042;mobiusWorldWarY[60]=859;mobiusWorldWarX[61]=1109;mobiusWorldWarY[61]=873;mobiusWorldWarX[62]=917;mobiusWorldWarY[62]=936;mobiusWorldWarX[63]=1605;mobiusWorldWarY[63]=53;mobiusWorldWarX[64]=1514;mobiusWorldWarY[64]=111;mobiusWorldWarX[65]=1611;mobiusWorldWarY[65]=163;mobiusWorldWarX[66]=8;mobiusWorldWarY[66]=103;mobiusWorldWarX[67]=58;mobiusWorldWarY[67]=525;mobiusWorldWarX[68]=832;mobiusWorldWarY[68]=821;
//Add Territory Icons
for (i=1;i<mobiusWorldWarX.length;i++)
 {
 mobiusWorldWarTerritories[i] = document.createElement('div');
 mobiusWorldWarTerritories[i].id = 'Territory_'+i;
 mobiusWorldWarTerritories[i].className = "Territory Unoccupied";
 mobiusWorldWarTerritories[i].style.left = mobiusWorldWarX[i]+'px';
 mobiusWorldWarTerritories[i].style.top = mobiusWorldWarY[i]+'px';
 mobiusWorldWarTerritories[i].onclick = function(){window.open('http://sonicfanon.wikia.com/wiki/Roleplay_game:Mobius_World_War/Territories#'+this.id,'Territories');};
 mobiusWorldWarTerritories[i].oncontextmenu = function(){window.open('http://sonicfanon.wikia.com/wiki/Roleplay_game:Mobius_World_War/Territories?action=edit§ion='+this.id.replace('Territory_',),'Territories');};
 mobiusWorldWarTerritories[i].innerHTML+=""+i+"";
 mobiusWorldWarTerritories[i].innerHTML+="";
 $('#territories').append(mobiusWorldWarTerritories[i]);
 }
$(mobiusWorldWarInfo).load('http://sonicfanon.wikia.com/wiki/Roleplay_game:Mobius_World_War/Territories?action=render', null, function() {
 $('body').append(mobiusWorldWarInfo);
 mobiusWorldWarAlliances = $('.alliance');
 mobiusWorldWarUnits = $('.units');
 mobiusWorldWarUnitsLoad = $('.TerritoryUnits');
 mobiusWorldWarNations = $('.nation');
 for (i=0;i<mobiusWorldWarTerritories.length-1;i++) 
 {
 if (mobiusWorldWarAlliances[i].innerHTML.indexOf("Defenders")!=-1) {
 mobiusWorldWarTerritories[i+1].className = "Territory Defenders";
 }
 if (mobiusWorldWarAlliances[i].innerHTML.indexOf("Conquerors")!=-1) {
 mobiusWorldWarTerritories[i+1].className = "Territory Conquerors";
 }
 if (mobiusWorldWarAlliances[i].innerHTML.indexOf("Terrorists")!=-1) {
 mobiusWorldWarTerritories[i+1].className = "Territory Terrorists";
 }
 };
 for (i=0;i<mobiusWorldWarTerritories.length-1;i++) 
 {
 mobiusWorldWarUnitsLoad[i].innerHTML = mobiusWorldWarUnits[i].innerHTML;
 };
 }
);
});
$('#key').load('http://sonicfanon.wikia.com/wiki/Roleplay_game:Mobius_World_War/Map/Key?action=render')
Category:Sub-pages