Post by Todge on Nov 6, 2010 14:26:17 GMT -8
This will give you the option to have a list of friends on your profile page.
You will have an extra field below the signature on the Modify Profile page, where you can list your friends. Instructions are included on the page. I have used half of the signature as a place to save your friends list, so, after installing this code, your members will now have 200 characters for their signatures, instead of 400, and 199 characters for their friends list.
Put it in your GLOBAL FOOTER..
You will have an extra field below the signature on the Modify Profile page, where you can list your friends. Instructions are included on the page. I have used half of the signature as a place to save your friends list, so, after installing this code, your members will now have 200 characters for their signatures, instead of 400, and 199 characters for their friends list.
Put it in your GLOBAL FOOTER..
<script type="text/javascript">
<!--
/*
Friends List in Profile
by Todge
Copyright © 2010
Please keep this header intact
*/
// Alter profile form to include friends list..
if(document.modifyForm)
{
// Split signature into 2..
var sigcell = document.modifyForm.signature.parentNode.parentNode;
var sig = document.modifyForm.signature;
sigcell.nextSibling.firstChild.innerHTML = sigcell.nextSibling.firstChild.innerHTML.replace('400','200');
document.modifyForm.sigLength.value = document.modifyForm.sigLength.value - 200;
document.modifyForm.signature.onkeyup = function(event){
if (this.value.length > 200) { this.value = this.value.substring(0, 200); } document.modifyForm.sigLength.value = 200 - this.value.length; }
document.modifyForm.signature.onchange = function(event){
if (this.value.length > 200) { this.value = this.value.substring(0, 200); } document.modifyForm.sigLength.value = 200 - this.value.length; }
// Create and add Friends option into profile..
var friends = document.modifyForm.signature.cloneNode(true);
friends.name = 'friends';
friends.rows = 10;
friends.onkeyup = function(event){
if (this.value.length > 200) { this.value = this.value.substring(0, 200); } document.modifyForm.friendsLength.value = 200 - this.value.length; }
friends.onchange = function(event){
if (this.value.length > 200) { this.value = this.value.substring(0, 200); } document.modifyForm.friendsLength.value = 200 - this.value.length; }
var tr=document.createElement('tr');
var td1=document.createElement('td');
with(td1){vAlign="top"; innerHTML="<font size='2'>Friends:</font>";}
var td2=document.createElement('td');
td2.appendChild(friends);
var td3=document.createElement('td');
var td3code = '<font size="-2">You can add a list of your friends here. Put each friend on a new line in this format.. <b>USERNAME=DISPLAY NAME</b><br>';
td3code += 'If the display rname is the same as the username, use an asterisk (*) to save space. You can use a maximum of 199 characters for your list of friends.<br>';
td3code += 'Characters left: <input name="friendsLength" size="3" value="199" disabled="1" type="text"></font>';
with(td3){vAlign="top"; innerHTML=td3code;}
tr.appendChild(td1);
tr.appendChild(td2);
tr.appendChild(td3);
sigcell.parentNode.parentNode.insertBefore(tr,sigcell.parentNode.nextSibling);
sig.value = sig.value.split('ƒ')[0];
if(friends.value.match(/ƒ/))
{
friends.value = friends.value.split(/ƒ/)[1];
}
else
{
friends.value = '';
}
// Add friends list to signature when submitting form..
function addFriends()
{
sig.onchange = function(){}
sig.value += 'ƒ'+friends.value;
return;
}
if(window.addEventListener)
{
document.modifyForm.addEventListener('submit', addFriends, false);
}
else if(window.attachEvent)
{
document.modifyForm.attachEvent('onsubmit', addFriends);
}
else
{
document.modifyForm.onsubmit = addFriends();
}}
// Add friends to profile...
if(pb_action == 'viewprofile')
{
var sig = document.getElementsByTagName('div');
for(s=0; s<sig.length; s++)
{
if(sig[s].className == 'user_signature' && sig[s].innerHTML.match(/ƒ/))
{
var friends = sig[s].firstChild.innerHTML.split('ƒ')[1];
sig[s].firstChild.innerHTML = sig[s].firstChild.innerHTML.split('ƒ')[0];
var tr = document.createElement('tr');
var td = document.createElement('td');
with(td){colSpan="2"; innerHTML='<font size="2"><b>Friends</b><hr size="1"></font>';}
tr.appendChild(td);
sig[s].parentNode.parentNode.parentNode.appendChild(tr);
var tr = document.createElement('tr');
var td1 = document.createElement('td');
var td2 = document.createElement('td');
friends = friends.replace(/=/g,'">');
friends = friends.replace(/<br>/ig,'</a><br><a href="/index.cgi?action=viewprofile&user=');
friends = '<a href="/index.cgi?action=viewprofile&user='+friends+'</a>';
td2.innerHTML = '<font size="2">'+friends+'</font>';
tr.appendChild(td1);
tr.appendChild(td2);
sig[s].parentNode.parentNode.parentNode.appendChild(tr);
break;
}}}
// Remove friends from posted signatures..
if(location.href.match(/tion=display/))
{
var sig=document.getElementsByTagName('div');
for(s=0; s<sig.length; s++)
{
if(sig[s].className == 'user_signature')
{
sig[s].innerHTML = sig[s].innerHTML.split('ƒ')[0];
}}}
// -->
</script>