Post by Shin™ on Mar 22, 2005 19:35:23 GMT
Browser Compatibility: Cross-Browser
Preview: Profile page, Boards
This code was asked for on the Code Support board, but I figured other people might like this code also
This code adds a custom title to the mini-profiles in the boards underneath the member group and the star images.
The custom title can be edited in the member's profiles, by anyone (typically an admin) who has the power to edit other people's profiles. It isn't coded very neatly because it was a rush job, but oh well.
Main Page Footer:
Board Footers:
Edit: Previews added
Edit again: My break tags were actually causing breaks in the post... Who's idea was that?
Preview: Profile page, Boards
This code was asked for on the Code Support board, but I figured other people might like this code also
This code adds a custom title to the mini-profiles in the boards underneath the member group and the star images.
The custom title can be edited in the member's profiles, by anyone (typically an admin) who has the power to edit other people's profiles. It isn't coded very neatly because it was a rush job, but oh well.
Main Page Footer:
<script type="text/javascript">
/*
Custom Title code by Shin. You may use this code freely, but do not edit or repost this code without my prior, express consent. This header must remain intact at all times.
This part of the code goes in your Main Page Footer only.
*/
if(location.href.match(/action=profile/i)&&document.creator){
var websiteURL=document.creator.websiteurl;
if(websiteURL.value.match(/\?title=(.+?)\?\?\?/i)){
var cTitle=RegExp.$1;
websiteURL.value=websiteURL.value.split("?title")[0];
} else {
var cTitle="None";
}
function TitleSave1(){
var customTitle=document.creator.titleInput.value;
if(websiteURL.value=="" || !websiteURL.value.match(/^http/i)){
websiteURL.value=location.href.split("?")[0];
document.creator.websitetitle.value=document.title.split("-")[0];
}
websiteURL.value+="?title="+customTitle+"???";
}
function TitleSave2(){
if(websiteURL.value=="" || !websiteURL.value.match(/^http/i)){
websiteURL.value=location.href.split("?")[0];
document.creator.websitetitle.value=document.title.split("-")[0];
}
websiteURL.value+="?title="+cTitle+"???";
}
var UTParent3=document.creator.usertext.parentNode.parentNode.parentNode;
var cTitleIR=UTParent3.parentNode.parentNode.insertRow(UTParent3.rowIndex);
var cTitleIC1=cTitleIR.insertCell(0);
var cTitleIC2=cTitleIR.insertCell(1);
cTitleIC1.innerHTML="<font size='2'><b>Custom Title:</b></font>";
if(document.creator.settings6){
cTitleIC2.innerHTML="<input type=text name='titleInput' value='"+cTitle+"'>";
document.creator.onsubmit=TitleSave1;
} else {
cTitleIC2.innerHTML="<font size='2'>"+cTitle+"</font>";
document.creator.onsubmit=TitleSave2;
}
}
if(location.href.match(/action=(profile2|viewprofile)/i)){
var TD=document.getElementsByTagName("td");
for(var e=0;e<TD.length;e++){
if(TD[e].width=='30%' && TD[e].vAlign=='middle' && TD[e].className=='windowbg'){
var TDLinks=TD[e].getElementsByTagName("a");
for (var c=0;c<TDLinks.length;c++){
if(TDLinks[c].href.match(/\?title/i)){
TDLinks[c].href=TDLinks[c].href.split("?title")[0];
}
}
}
}
}
if(location.href.match(/action=ml(all|letter|top|staff)/i)){
var TR=document.getElementsByTagName("tr");
for(var h=0;h<TR.length;h++){
if(TR[h].cells.length>2 && TR[h].cells[2].className=='windowbg' && TR[h].cells[2].firstChild.nodeName=='FONT' && TR[h].cells[2].getElementsByTagName('a').length>0){
var AHR=TR[h].cells[2].getElementsByTagName('a')[0];
AHR.href=AHR.href.split("?title")[0];
}
}
}
</script>
Board Footers:
<script type="text/javascript">
/*
Custom Title code by Shin. You may use this code freely, but do not edit or repost this code without my prior, express consent. This header must remain intact at all times.
This part of the code goes in your Board Footers only.
*/
if(location.href.match(/action=display/i)){
var TD=document.getElementsByTagName("TD");
for(var h=0;h<TD.length;h++){
if(TD[h].width=="20%" && TD[h].className.match(/windowbg/i) && TD[h].rowSpan=="2" && TD[h].getElementsByTagName("A").length>0){
var TDLinks=TD[h].getElementsByTagName("A");
for(var e=0;e<TDLinks.length;e++){
if(TDLinks[e].href.match(/\?title=(.+?)\?\?\?/i)){
var customTitle=RegExp.$1;
TDLinks[e].href=TDLinks[e].href.split('?class')[0];
break;
} else {
var customTitle="None";
}
}
if(customTitle!="None"){
var TDBreak=TD[h].innerHTML.split("<b"+"r>");
if(navigator.appName.match(/Microsoft/i)){
var TDBreak=TD[h].innerHTML.split("<B"+"R>");
}
TD[h].innerHTML=TDBreak[0]+"<br/>"+TDBreak[1]+"<br/>"+TDBreak[2]+"<br/><br/><font size='1'><b>"+customTitle+"</b></font><br/><br/>"+TDBreak[3]+"<br/><br/>"+TDBreak[4]+"<br/><br/>"+TDBreak[5]+"<br/><br/>"+TDBreak[6]+"<br/><br/>"+TDBreak[7]+"<br/><br/>"+TDBreak[8]+"<br/><br/>";
}
}
}
}
</script>
Edit: Previews added
Edit again: My break tags were actually causing breaks in the post... Who's idea was that?