Post by CrAzY_J on Jan 27, 2006 6:42:00 GMT -8
Code Description: Adds more options in the gender drop down menu on the "modify profile" page.
Code creator: CrAzY_J
Global Footers:
<script type='text/javascript'>
/* Add more gender options
created by CrAzY_J
do not redistribute this code without the creator's permission*/
var More = [
['Both','Image Url'],
['Unkown','Image Url'],
['Yet to Find out','Image Url']
];
var Patt = /%\\(\d+)\\%/;
if( document.modifyForm )
{
var Sex = document.modifyForm.gender;
var originalSex = Sex.selectedIndex;
function Put(event)
{
if( !Patt.test( document.modifyForm.personaltext.value) )
document.modifyForm.personaltext.value += '%\\'+Sex.selectedIndex+'\\%';
else
document.modifyForm.personaltext.value = document.modifyForm.personaltext.value.replace( Patt, '%\\'+Sex.selectedIndex+'\\%');
if(Sex.selectedIndex > 1)
Sex.selectedIndex = originalSex;
}
for( var z = 0 ; z < More.length ; z ++ )
Sex.options[Sex.options.length] = new Option( More[z][0], z);
if( document.modifyForm.personaltext.value.match( Patt ) )
Sex.selectedIndex = RegExp.$1;
if( document.addEventListener )
document.modifyForm.profileaction[0].addEventListener('click',Put,false);
else
document.modifyForm.profileaction[0].attachEvent('onclick',Put);
}
if( this.location.href.match(/(view|cgi$|display)/i) )
{
var GenderTest = /Gender:\s/;
var TD = document.body.getElementsByTagName('td');
for( var t = 0 ; t < TD.length ; t ++ )
{
if( TD[t].width == '20%' && TD[t].className != 'catbg' && TD[t].innerHTML.match(Patt) )
{
var gender = parseInt(RegExp.$1)
TD[t].innerHTML = TD[t].innerHTML.replace(Patt, '');
if( !GenderTest.test( TD[t].innerHTML ) && gender > 1 )
TD[t].innerHTML = TD[t].innerHTML.replace(/Posts:/,'Gender: '+More[gender-2][0]+' <img src="'+More[gender-2][1]+'" border="0" /><br />Posts:');
else if(gender > 1)
TD[t].innerHTML = TD[t].innerHTML.replace(/Gender:\s.+?<br/i,'Gender: '+More[gender-2][0]+' <img src="'+More[gender-2][1]+'" border="0" /><br');
}
}
}
</script>
Code instructions:
Edit the red/blue lines in the code. The red line is for the extra option and the blue line is for the image url to the image which will appear in the mini profile when the user chooses that "gender".
You can add more options by adding this:
['Gender Option','Image Url'],
To the code.
February 12, 2009: Changed modifyForm.sex to modifyForm.gender ~ Triad
February 19, 2009: Update ~ Triad
Code creator: CrAzY_J
Global Footers:
<script type='text/javascript'>
/* Add more gender options
created by CrAzY_J
do not redistribute this code without the creator's permission*/
var More = [
['Both','Image Url'],
['Unkown','Image Url'],
['Yet to Find out','Image Url']
];
var Patt = /%\\(\d+)\\%/;
if( document.modifyForm )
{
var Sex = document.modifyForm.gender;
var originalSex = Sex.selectedIndex;
function Put(event)
{
if( !Patt.test( document.modifyForm.personaltext.value) )
document.modifyForm.personaltext.value += '%\\'+Sex.selectedIndex+'\\%';
else
document.modifyForm.personaltext.value = document.modifyForm.personaltext.value.replace( Patt, '%\\'+Sex.selectedIndex+'\\%');
if(Sex.selectedIndex > 1)
Sex.selectedIndex = originalSex;
}
for( var z = 0 ; z < More.length ; z ++ )
Sex.options[Sex.options.length] = new Option( More[z][0], z);
if( document.modifyForm.personaltext.value.match( Patt ) )
Sex.selectedIndex = RegExp.$1;
if( document.addEventListener )
document.modifyForm.profileaction[0].addEventListener('click',Put,false);
else
document.modifyForm.profileaction[0].attachEvent('onclick',Put);
}
if( this.location.href.match(/(view|cgi$|display)/i) )
{
var GenderTest = /Gender:\s/;
var TD = document.body.getElementsByTagName('td');
for( var t = 0 ; t < TD.length ; t ++ )
{
if( TD[t].width == '20%' && TD[t].className != 'catbg' && TD[t].innerHTML.match(Patt) )
{
var gender = parseInt(RegExp.$1)
TD[t].innerHTML = TD[t].innerHTML.replace(Patt, '');
if( !GenderTest.test( TD[t].innerHTML ) && gender > 1 )
TD[t].innerHTML = TD[t].innerHTML.replace(/Posts:/,'Gender: '+More[gender-2][0]+' <img src="'+More[gender-2][1]+'" border="0" /><br />Posts:');
else if(gender > 1)
TD[t].innerHTML = TD[t].innerHTML.replace(/Gender:\s.+?<br/i,'Gender: '+More[gender-2][0]+' <img src="'+More[gender-2][1]+'" border="0" /><br');
}
}
}
</script>
Code instructions:
Edit the red/blue lines in the code. The red line is for the extra option and the blue line is for the image url to the image which will appear in the mini profile when the user chooses that "gender".
You can add more options by adding this:
['Gender Option','Image Url'],
To the code.
February 12, 2009: Changed modifyForm.sex to modifyForm.gender ~ Triad
February 19, 2009: Update ~ Triad