Gender Option

vash shadows 0 Tallied Votes 144 Views Share

Add to....Board Wrappers: Footer

No need to really change anything in the code, if you want to select a different default URL just change the variable in the top of the script. It's there so that at least some URL is added to the website url field.

You can't add extra ones to the drop down, this is specifically Male and Gender options only.

<script type="text/javascript">
<!--
/*
Copyright © 2003 - 2004 SolidSnakeDesigns.com
All Rights Reserved

This code may not be redistributed without express permission from the creator.
This header must stay intact at all times.
*/ 

var URLDefault = "http://invisionfree.com/"

var GetTag = document.getElementsByTagName
var GetID = document.getElementById
var WS = GetID("WebSite")
var genders = ["Male","Female"]

function getGend(which){
 if(which == 1 || which == 2){
  if(WS.value.match(/^http:\/\/$/) || WS.value.length == 0){
   WS.value = URLDefault + "---" + which
  } else if(WS.value.length > 7){
   WS.value += "---" + which
  }
 }
}

function remIt(){
 if(WS.value.match(/(---)/)){
  WS.value = WS.value.replace("---" + RegExp.rightContext,"")
  GetID("gender").selectedIndex = RegExp.rightContext
 }
}

function makeSel(){
 var sel = document.createElement("select")
 sel.id = "gender"
 sel.className = "forminput"
 sel.options[0] = new Option("--")
 for(g=0;g<genders.length;g++){
     sel.options[g+1] = new Option(genders[g],genders[g])
 }
 return sel
}

function addOp(){
 var re = /(Date of Birth|member title)/i
 var oTable = GetTag("table")
 for(o=0;o<oTable.length;o++){
  with(oTable[o]){
   if(width=="100%" && rows[0].cells[0].innerHTML.match(re)){
    var addR = oTable[o].insertRow(2)
    var addC = addR.insertCell(0)
    addC.innerHTML = "<b>Your Gender</b>"
    addC.className = "pformleft"
    addC = addR.insertCell(1)
    addC.className = "pformright"
    addC.appendChild(makeSel())
   }
  }
 }
}

function popRC(){
 var re = /Information/i
 var pTable = GetTag("table")
 for(p=0;p<pTable.length;p++){
  with(pTable[p]){
   if(cellSpacing=="1" && cellPadding=="6" && firstChild.firstChild.innerHTML.match(re)){
    var addR = pTable[p].insertRow(4)
    var addC = addR.insertCell(0)
    addC.className = "row3"
    addC.innerHTML = "<b>Gender</b>"
    addC = addR.insertCell(1)
    addC.className = "row1"
    if(unescape(innerHTML.match(/---(\d)/)) && RegExp.$1.match(/(1|2)/)){
     addC.innerHTML = genders[Math.floor(RegExp.$1 - 1)]
     var RCInn = rows[1].cells[1].getElementsByTagName("a")
     RCInn[0].href = RCInn[0].href.replace("---" + RegExp.$1,"")
    } else {
     addC.innerHTML = "<i>No Information</i>"
    }
   }
  }
 }
}

if(location.href.indexOf("act=UserCP&CODE=01")!=-1){
 addOp();
 document.theForm.onsubmit = function(){ getGend(GetID("gender").selectedIndex) }
 window.onload = remIt
}

if(location.href.indexOf("showuser")!=-1){
 popRC();
}

function minPro(){
 var theGender = ""
 var pTD = GetTag("td")
 for(c=0;c<pTD.length;c++){
  if(pTD[c].className.match(/post(2|1)/i) && pTD[c].innerHTML.match(/Posts:/i)){
   var thisTd="";
   var gotTD="0"
   for(i=c;i<pTD.length;i++){
    if(pTD[i].innerHTML.match(/<div/i) && pTD[i].className=="darkrow3" && gotTD=="0"){
     thisTD = i;
     gotTD = 1;
    }
   }
   var A = pTD[thisTD].getElementsByTagName("A")
   for(a=0;a<A.length;a++){
    if(A[a].href.match(/---(\d)/)){
     theGender = RegExp.$1
     A[a].href = A[a].href.replace("---" + RegExp.$1,"")
    }
   }
   if(theGender.match(/(1|2)/)){
    var meNum = /\W\w+\WMember No/i
    var shoGen = "<br />Gender: " + genders[Math.floor(theGender - 1)]
    shoGen += "<br />Member No"
    pTD[c].innerHTML = pTD[c].innerHTML.split(meNum).join(shoGen)
   }
  }
 }
}

 minPro()

//-->
</script>