Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Zelnen

Zelnen Avatar
Javascriptin'

**
Official Member

91


June 2006
Ok i spent a while on this one. I'd like to thank forte/Eric for helping me with some of the RegExp.

Features
  • Join and Leave clans
  • Add your own clans
  • Easy Installation
  • For FF users Clan shows in profile
  • Clan shows in postdetails
  • Easy to join clans and data is saved
  • Cross-Browser (mostly)
Ok this code is crossbrowser mainly apart from in IE the clan doesn't show in profile but it does in postdetails.

PREVIEW

Username: test
Pas: test

Then in the nav bar click clanning and find your way around from there.

Then replace the <% BOARD %> tag with


<div id="clans">
<% BOARD %>
</div>


Then dump this into your footers:


<script>
// Advanced Clan System
// Copyright Zelnen, 2006

//Adding NaviBar Links
//By Webworldx


var aLink=new Array()
aLink[0]='<a href="http://zx.invisionfree.com/zelcoding/index.php?act=clans">Clanning</a>'

var uCell = document.getElementsByTagName('TD')
for (i=0;i<uCell.length;i++){
if (uCell.align=="right" && uCell.innerHTML.match("act=calendar") && uCell.innerHTML.match("act=Help")){
var addLink=""
for (j=0;j<aLink.length;j++){
addLink+=aLink[j]+"    "
}

uCell.innerHTML=addLink+uCell.innerHTML
}}


function get(){

if(location.href.match("act=clans")){

i = document.getElementById("c")

clan = i.value


forms = window.frames['zelnen'].document.forms["REPLIER"]

forms.Post.value += '' + clan + ''

window.frames['zelnen'].document.REPLIER.submit()


}
}

function moo(){

forms = window.frames['zelnen'].document.forms["REPLIER"]

if(forms.Post.value.match("
")){

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' />Clanning</div><table width='100%' border='0' cellspacing='1' cellpadding='4'><tr><td class='row1'>Welcome to the clan system. You are currently in a clan. To leave the clan you are in simpley click the Leave button. Happy clanning!<br><br><input type='button' id='leave' value='Leave Clan' onclick='leave()'><br><br></td></tr></table></div></td></tr></table></div><br />"
document.getElementById('clans').innerHTML=content
}

else{

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' />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='Fire Clan'>Fire Clan<OPTION VALUE='Water Clan'>Water Clan<OPTION VALUE='Earth Clan' >Earth Clan</SELECT><input type='submit' id='join' value='Join' onclick='get()'><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['zelnen'].document.forms["REPLIER"]

forms.Post.value = forms.Post.value.replace(/\[A\](.*)\[B\]/," ")

window.frames['zelnen'].document.REPLIER.submit();

}


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
tags inside your signature please DO NOT remove them.<br> Open Tags:")

}
}
}

if(location.href.match("showtopic=")){

divs = document.getElementsByTagName("div");

var myReg = new RegExp("\\[A\\](.*?)\\[B\\]" , "i");

for(x=0; x < divs.length; x++){

if(divs[x].className == 'signature' && divs[x].innerHTML.match(myReg)){

var clan = RegExp.$1

var r = divs[x].parentNode.parentNode

spans = r.getElementsByTagName("span")

for(y=0; y < spans.length; y++){

spans[y].innerHTML = spans[y].innerHTML.replace("Joined:","Clan: " + clan + "<br>Joined:")

}
}

}

}


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("
")){

divs[x].innerHTML = divs[x].innerHTML.replace(/\[A\](.*)\[B\]/," ")

}
}
}

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("
")){

tds[x].innerHTML = tds[x].innerHTML.replace(/\[A\](.*)\[B\]/," ")

}
}
}

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("
")){

divs[x].innerHTML = divs[x].innerHTML.replace(/\[A\](.*)\[B\]/," ")

}
}
}


if(location.href.match("act=clans")){
document.write("<iframe name='zelnen' src='http://zx.invisionfree.com/zelcoding/index.php?act=UserCP&CODE=22' height='0%' width='0%' border='0' onload='moo()'></iframe>")
}
</script>

Edit the 1st red to your board URL and the second lot of reds to the 3 clan names you want. If you want more than 3 clans please post in this topic saying you would like more than 3 and tell me what you would like them to be called and i'll do it for you. Change the last red to your board URL again and your done.

Enjoy :P

newBookmarkLockedFalling