All pastes #78587 Raw Edit

zelnen

public javascript v1 · immutable
·published 2006-07-04 08:37 UTC
rendered paste body
<script>// An RPG Component for iFusion// In the coding battle against Chris// Copyright Zelnen, 2006function race(){  if(location.href.match("act=clans")){      i = document.getElementById("ra")        race = i.value        forms = window.frames['zel'].document.forms["REPLIER"]        var raceReg = new RegExp("\\[R\\](.*?)\\[R\\]" , "i")        if (forms.Post.value.match(raceReg)){          forms.Post.value = forms.Post.value.replace(raceReg, "")          }        forms.Post.value += '[R]' + race + '[R]'        window.frames['zel'].document.REPLIER.submit()      }} function class(){  if(location.href.match("act=clans")){      i = document.getElementById("cl")        class = i.value            forms = window.frames['zel'].document.forms["REPLIER"]        var clasReg = new RegExp("\\[C\\](.*?)\\[C\\]" , "i")        if (forms.Post.value.match(clasReg)){          forms.Post.value = forms.Post.value.replace(clasReg, "")          }        forms.Post.value += '[C]' + class + '[C]'        window.frames['zel'].document.REPLIER.submit()       }}            function get(){  if(location.href.match("act=clans")){    i = document.getElementById("c")        clan = i.value        forms = window.frames['zel'].document.forms["REPLIER"]        var clanReg = new RegExp("\\[A\\](.*?)\\[B\\]" , "i")        if (forms.Post.value.match(clanReg)){          forms.Post.value = forms.Post.value.replace(clanReg, "")          }        forms.Post.value += '[A]' + clan + '[B]'        window.frames['zel'].document.REPLIER.submit()                }} function moo(){    forms = window.frames['zel'].document.forms["REPLIER"]    var myReg = new RegExp("\\[A\\](.*?)\\[B\\]" , "i");  var classReg = new RegExp("\\[C\\](.*?)\\[C\\]" , "i");  var raceReg = new RegExp("\\[R\\](.*?)\\[R\\]" , "i");    if(forms.Post.value.match(myReg)){      var clan = RegExp.$1      }    else{      var clan = "None"    }    if(forms.Post.value.match(classReg)){      var classs = RegExp.$1    }    else{      var classs = "None"      }      if(forms.Post.value.match(raceReg)){      var race = RegExp.$1      }     else{      var race = "None"      }       var content = "<div style='text-align:center'><table width='65%' align='center' border='0'><tr><td><div class='tableborder'><div class='maintitle' align='left' style='text-align:left'><img src='http://67.18.37.15/style_images/1/nav_m.gif' border='0' alt='>' width='8' height='8' />RPG Profile</div><table width='100%' border='0' cellspacing='1' cellpadding='4'><tr><td class='row1'>Welcome to your RPG profile. From here you can select your class and race. Please note the class and race you pick will effect the way you battle etc. The class and race will also show in your mini profile (under your avatar where you post).<br><br><SELECT id='ra' NAME='race'><OPTION VALUE='Choose a race'>Choose a race<OPTION VALUE='" + a[0] + "'>" + a[0] + "<OPTION VALUE='" + a[1] + "'>" + a[1] + "<OPTION VALUE='" + a[2] + "'>" + a[2] + "</SELECT>&nbsp; <input type='button' id='race' value='Submit' onclick='race()'>&nbsp; &nbsp; Your current race is: " + race + "<br><br><SELECT id='cl' NAME='class'><OPTION VALUE='Choose a class'>Choose a class<OPTION VALUE='" + b[0] + "'>" + b[0] + "<OPTION VALUE='" + b[1] + "'>" + b[1] + "<OPTION VALUE='" + b[2] + "'>" + b[2] + "</SELECT>&nbsp; <input type='button' id='class' value='Submit' onclick='class()'>&nbsp; &nbsp; Your current class is: " + classs + "<br><BR></td></tr></table></div></td></tr></table></div><br /><div style='text-align:center'><table width='65%' align='center' border='0'><tr><td><div class='tableborder'><div class='maintitle' align='left' style='text-align:left'><img src='http://67.18.37.15/style_images/1/nav_m.gif' border='0' alt='>' width='8' height='8' />Clanning</div><table width='100%' border='0' cellspacing='1' cellpadding='4'><tr><td class='row1'>Welcome to the clan section. Here you can join clans, leave clans or find out the latest news on the clan your in. To join a clan simpley select the clan you would like to join from the drop down and hit submit. To leave a clan you should see the Leave Clan link just simpley click it and you will be out of the clan. Once your in a clan the clan name will show up in your profile and your postdetails. <br> Happy clanning!<br><br><b>Join A Clan</b><br><br><SELECT id='c' NAME='clans'><OPTION VALUE='Choose a clan to join'>Choose a clan to join<OPTION VALUE='" + c[0] + "'>" + c[0] + "<OPTION VALUE='" + c[1] + "'>" + c[1] + "<OPTION VALUE='" + c[2] + "'>" + c[2] + "</SELECT><input type='button' id='join' value='Join' onclick='get()'>&nbsp; &nbsp; Your current clan is: " + clan + "<br><br>Select the clan you would like to join from the drop down the hit the 'Join' button.</td></tr></table></div></td></tr></table></div><br />"  document.getElementById('clans').innerHTML=content  }function leave(){  forms = window.frames['zel'].document.forms["REPLIER"]    forms.Post.value = forms.Post.value.replace(/\[A\](.*)\[B\]/," ")    window.frames['zel'].document.REPLIER.submit();    } function yourposts(p){  tds = window.frames['zelnen'].document.getElementsByTagName('TD')    for (t=0; t<tds.length; t++){      if(tds[t].innerHTML.match('of total forum posts') && tds[t].className == 'row1'){      var posts = parseInt(tds[t].getElementsByTagName("b")[0].innerHTML)      var mylink = document.getElementById('userlinks').getElementsByTagName('A')[0]      mylink.innerHTML += "(<span id='myposts'>" + posts + "</span>)"    }   }}      if(location.href.match("act=UserCP&CODE=22")){  tds = document.getElementsByTagName("td")    for(x=0; x < tds.length; x++){      if(tds[x].innerHTML.match("Open Tags:") && tds[x].className == 'pformright'){            tds[x].innerHTML = tds[x].innerHTML.replace("Open Tags:","If you see the [A] [B] tags inside your signature please DO NOT remove them.<br> Open Tags:")          }  }} if(location.href.match("showtopic=")){    spans = document.getElementsByTagName("span")    for(x=0; x < spans.length; x++){      if(spans[x].className == 'postdetails' && spans[x].innerHTML.match("Group:")){          spans[x].innerHTML += "<br><b>RPG Profile</b><br>"          }   }       divs = document.getElementsByTagName("div");   var myReg = new RegExp("\\[A\\](.*?)\\[B\\]" , "i");  var classReg = new RegExp("\\[C\\](.*?)\\[C\\]" , "i");  var raceReg = new RegExp("\\[R\\](.*?)\\[R\\]" , "i");   for(x=0; x < divs.length; x++){     if(divs[x].className == 'signature'){      if(divs[x].innerHTML.match(myReg)){           var clan = RegExp.$1               var r = divs[x].parentNode.parentNode               spans = r.getElementsByTagName("span")               spans[0].innerHTML += "<br>Clan: " + clan      }             else {              var r = divs[x].parentNode.parentNode               spans = r.getElementsByTagName("span")                 spans[0].innerHTML += "<br>Clan: None"      }            if (divs[x].innerHTML.match(classReg)){        var classname = RegExp.$1               var r = divs[x].parentNode.parentNode               spans = r.getElementsByTagName("span")             spans[0].innerHTML += "<br>Class: " + classname            }      else {        var r = divs[x].parentNode.parentNode               spans = r.getElementsByTagName("span")                 spans[0].innerHTML += "<br>Class: None"      }            if (divs[x].innerHTML.match(raceReg)) {        var race = RegExp.$1               var r = divs[x].parentNode.parentNode               spans = r.getElementsByTagName("span")             spans[0].innerHTML += "<br>Race: " + race            } else {              var r = divs[x].parentNode.parentNode               spans = r.getElementsByTagName("span")                 spans[0].innerHTML += "<br>Race: None"      }    }  }  }if(location.href.match("showuser=")){  tds = document.getElementsByTagName("td")    var myReg = new RegExp("\\[A\\](.*?)\\[B\\]" , "i")    for(x=0; x < tds.length; x++){         if(tds[x].className == 'row3' && tds[x].innerHTML.match("Signature") && tds[x+1].innerHTML.match(myReg)){          var clan = RegExp.$1            tables = document.getElementsByTagName("table")            for(y=0; y < tables.length; y++){              if(tables[y].innerHTML.match("Information") && tables[y].innerHTML.match("Home Page")){                    tables[y].innerHTML = tables[y].innerHTML.replace("<!--{CUSTOM.FIELDS}-->","<tr><td class='row3' valign='top'><b>Clan</b></td><td align='left' class='row1'><i>" + clan + "</i></td></tr>")                  }      }    }  }}if(location.href.match("showtopic=")){  divs = document.getElementsByTagName("div")    for(x=0; x < divs.length; x++){      if(divs[x].className == 'signature' && divs[x].innerHTML.match("[A]")){        divs[x].innerHTML = divs[x].innerHTML.replace(/\[A\](.*)\[B\]/," ")      divs[x].innerHTML = divs[x].innerHTML.replace(/\[R\](.*)\[R\]/," ")      divs[x].innerHTML = divs[x].innerHTML.replace(/\[C\](.*)\[C\]/," ")           }  }}       if(location.href.match("showuser=")){  tds = document.getElementsByTagName("td")      for(x=0; x < tds.length; x++){          if(tds[x].className == 'row1' && tds[x].innerHTML.match("[A]")){              tds[x].innerHTML = tds[x].innerHTML.replace(/\[A\](.*)\[B\]/," ")        tds[x].innerHTML = tds[x].innerHTML.replace(/\[C\](.*)\[C\]/," ")        tds[x].innerHTML = tds[x].innerHTML.replace(/\[R\](.*)\[R\]/," ")      }   }}if(location.href.match("act=UserCP&CODE=22")){  divs = document.getElementsByTagName("div")      for(x=0; x < divs.length; x++){          if(divs[x].className == 'signature' && divs[x].innerHTML.match("[A]")){              divs[x].innerHTML = divs[x].innerHTML.replace(/\[A\](.*)\[B\]/," ")        divs[x].innerHTML = divs[x].innerHTML.replace(/\[R\](.*)\[R\]/," ")        divs[x].innerHTML = divs[x].innerHTML.replace(/\[C\](.*)\[C\]/," ")              }    }}var leveldiv = 2var attackdiv = 3var strengthdiv = 4var defencediv = 2if(location.href.match("showtopic=")){ var userlink = document.getElementById('userlinks').getElementsByTagName('A')[0].href; var posts = 0 var framelink = "<iframe name='zelnen' src='" + userlink + "' height='0' width='0' border='0' onload='yourposts()'></iframe>" document.write(framelink)  spans = document.getElementsByTagName("span") for (s=0; s<spans.length; s++){   if (spans[s].className == "postdetails" && spans[s].innerHTML.match("Posts:")){     var posts = parseInt(spans[s].innerHTML.split("Posts: ")[1])     var level = parseInt(posts / leveldiv)     spans[s].innerHTML = spans[s].innerHTML + "<br>" + "Level:" + level     var attack = parseInt(posts / attackdiv)     spans[s].innerHTML = spans[s].innerHTML + "<br>" + "Attack:" + attack     var strength = parseInt(posts / strengthdiv)     spans[s].innerHTML = spans[s].innerHTML + "<br>" + "Strength:" + strength     var defense = parseInt(posts / defencediv)     spans[s].innerHTML = spans[s].innerHTML + "<br>" + "Defense:" + defense + "<br><br>"     var name = spans[s-2].innerHTML        }   }}  var level = 0  var attack = 0  var strength = 0  var defence = 0  if(location.href.match("showuser=")){    tds = document.getElementsByTagName("td")    for (t=0; t<tds.length; t++){      if(tds[t].innerHTML.match('of total forum posts') && tds[t].className == 'row1'){        var posts = parseInt(tds[t].getElementsByTagName("b")[0].innerHTML)        level = parseInt(posts / leveldiv)        attack = parseInt(posts / attackdiv)        strength = parseInt(posts / strengthdiv)        defence = parseInt(posts / defencediv)      }    }  tables = document.getElementsByTagName("table")  for (t=0; t<tables.length; t++){    if(tables[t].innerHTML.match("Information") && tables[t].innerHTML.match("Home Page")){       tables[t].innerHTML = tables[t].innerHTML.replace("<!-- Profile -->","<tr><td width='50%' valign='top' class='plainborder'><table cellspacing='1' cellpadding='6' width='100%'><tr><td align='center' colspan='2' class='maintitle'>Levels</td></tr><tr><td class='row3' width='30%' valign='top'><b>Level</b></td><td align='left' width='70%' class='row1'><i>" + level + "</i></td></tr><tr><td class='row3' valign='top'><b>Attack</b></td><td align='left' class='row1'><i>" + attack + "</i></td></tr><tr><td class='row3' valign='top'><b>Strength</b></td><td align='left' class='row1'><i>" + strength + "</i></td></tr><tr><td class='row3' valign='top'><b>Defence</b></td><td align='left' class='row1'><i>" + defence + "</i></td></tr></table></td>")    }  }} if(location.href.match("act=UserCP&CODE=")){  tds = document.getElementsByTagName("td")    for (t=0; t<tds.length; t++){      if(tds[t].innerHTML.match("<!-- Options -->") && tds[t].id == 'ucpmenu'){          tds[t].innerHTML = tds[t].innerHTML.replace("<!-- Options -->","<div class='pformstrip'>RPG Profile</div><p>&middot; <a href='" + boardurl + "act=clans'>Modify RPG Profile</a><br /></p>")          }  }}                            if(location.href.match("act=clans")){document.write("<iframe name='zel' src='" + boardurl + "act=UserCP&CODE=22' height='100%' width='100%' border='0' onload='moo()'></iframe>")}</script>