Post by MSC™ on Mar 10, 2007 15:05:55 GMT -8
QUICK DESCRIPTION: Allows staff members to set a custom star, picked from a group, to appear under a user's name instead of the standard ones.
DETAILED EXPLANATION: This code will add a selection box to the admin area of the "Modify Profile" page. Any staff member with the ability to edit profiles can give users a custom star this way. When the custom star is given, it will replace all the user's standard stars in their Mini-Profile. The stars can be or removed at any time.
COMPATIBILITY: Will NOT work if the rank of the member in question used The Extra Star Group code by Ross. Should be compatible with MOST but not ALL profile hacks. Also, this must come AFTER any money codes and BEFORE any mini-profile mods.
LOCATION: Goes anywhere in the Global Footers.
Note for When Removing this Code: This code stores information in the "Custom Title" field of the users profile. If at some point you decide to remove this code or for whatever reason the code stops working then that information will remain visible in the custom title until you or the user removes it. This information would look something like: {S=2}
<script type="text/javascript">
<!--
// Custom user stars, by MegaShadowChao. May not be duplicated, altered, or reposted except by the author. //
var sregexp=/\{S=(\d+)\}/;
var star=0;
var tdlist=document.getElementsByTagName('td');
function DoStarSave(){
var ustar="{S="+mform.customstar.selectedIndex+"}";
mform.customtitle.maxLength+=ustar.length;
mform.customtitle.value=ustar+mform.customtitle.value;
}
if(document.modifyForm){
if(document.modifyForm.customtitle){
var mform=document.modifyForm;
mform.onsubmit=function(){disable(this); DoStarSave();}
star=0;
if(mform.customtitle.value.match(sregexp)){
star=RegExp.$1
}
mform.customtitle.value=mform.customtitle.value.replace(sregexp,"");
for(count=0; count<tdlist.length; count++){
if(tdlist[count].getElementsByTagName('td').length==0){
if(tdlist[count].innerHTML.match("Custom Title:")){
if(tdlist[count].width=="160"){
var stable=tdlist[count].parentNode.parentNode;
for(count2=0;count2<stable.rows.length;count2++){
if(stable.rows[count2]==tdlist[count].parentNode){break;}
}
var srow=stable.insertRow(count2+1);
var scol=srow.insertCell(0);
scol.width="160";
scol.vAlign="top";
scol.innerHTML='<font size="2">Custom Star:</font>';
scol=srow.insertCell(1);
scol.width="245";
scol.vAlign="top";
scol.innerHTML='<font size="2"><select name="customstar"><option>(none)</option></select></font>';
for(count2=0;count2<CStarNames.length;count2++){
var newop=document.createElement("option");
newop.innerHTML=CStarNames[count2];
mform.customstar.appendChild(newop);
}
mform.customstar.options[star].selected="1";
scol=srow.insertCell(2);
scol.width="245";
scol.vAlign="top";
scol.innerHTML="<font size=\"1\">To have custom stars replace the standard ones under this user's name, choose the star group here.</font>";
break;
}
}
}
}
}
} else {
for(count=0; count<tdlist.length; count++){
if(tdlist[count].width=="20%"){
if(tdlist[count].className.match("windowbg")){
if(tdlist[count].innerHTML.match(sregexp)){
star=RegExp.$1;
} else {
star=0
}
tdlist[count].innerHTML=tdlist[count].innerHTML.replace(sregexp,"");
tdlist[count].innerHTML = tdlist[count].innerHTML.replace(/<br\/?>(<br\/?>member is)/i, "$1");
if(star!=0){
for(count2=0;count2<tdlist[count].getElementsByTagName('img').length;count2++){
if(tdlist[count].getElementsByTagName('img')[count2].alt=="*"&&(!tdlist[count].getElementsByTagName('img')[count2].src.match(/warn/i))){
tdlist[count].getElementsByTagName('img')[count2].src=CStars[star-1];
} else {
break;
}
}
}
}
}
}
}
//-->
</script>
That's the part that you don't edit. But obviously, we need some editable stars. XD So, before pasting that in, you must first add this:
<script type="text/javascript">
<!--
// Custom stars go here. //
var CStarNames = ["STAR NAME 1","STAR NAME 2"];
var CStars = ["IMAGE URL 1","IMAGE URL 2"];
//-->
</script>
Right above where you paste the main code. STAR NAME # represents what the name of the star will be as seen by the staff while editing profiles. IMAGE URL # represents the URL to the image of the new star as seen in the mini-profile. You can have as many or as few as you want; all must be enclosed in quotes and separated by commas. Also, the name of the star must have the same index as the URL to that star, obviously. Feel free to PM me if you have any questions regarding the code.
EDIT [4/5/07]: Found and fixed an error that would happen when the user in question had a warning level; also added an info to the compatibility section.
Edit: 23rd July '07 by Ross: Added a line to remove the extra line break when the user doesn't have a custom title.
DETAILED EXPLANATION: This code will add a selection box to the admin area of the "Modify Profile" page. Any staff member with the ability to edit profiles can give users a custom star this way. When the custom star is given, it will replace all the user's standard stars in their Mini-Profile. The stars can be or removed at any time.
COMPATIBILITY: Will NOT work if the rank of the member in question used The Extra Star Group code by Ross. Should be compatible with MOST but not ALL profile hacks. Also, this must come AFTER any money codes and BEFORE any mini-profile mods.
LOCATION: Goes anywhere in the Global Footers.
Note for When Removing this Code: This code stores information in the "Custom Title" field of the users profile. If at some point you decide to remove this code or for whatever reason the code stops working then that information will remain visible in the custom title until you or the user removes it. This information would look something like: {S=2}
<script type="text/javascript">
<!--
// Custom user stars, by MegaShadowChao. May not be duplicated, altered, or reposted except by the author. //
var sregexp=/\{S=(\d+)\}/;
var star=0;
var tdlist=document.getElementsByTagName('td');
function DoStarSave(){
var ustar="{S="+mform.customstar.selectedIndex+"}";
mform.customtitle.maxLength+=ustar.length;
mform.customtitle.value=ustar+mform.customtitle.value;
}
if(document.modifyForm){
if(document.modifyForm.customtitle){
var mform=document.modifyForm;
mform.onsubmit=function(){disable(this); DoStarSave();}
star=0;
if(mform.customtitle.value.match(sregexp)){
star=RegExp.$1
}
mform.customtitle.value=mform.customtitle.value.replace(sregexp,"");
for(count=0; count<tdlist.length; count++){
if(tdlist[count].getElementsByTagName('td').length==0){
if(tdlist[count].innerHTML.match("Custom Title:")){
if(tdlist[count].width=="160"){
var stable=tdlist[count].parentNode.parentNode;
for(count2=0;count2<stable.rows.length;count2++){
if(stable.rows[count2]==tdlist[count].parentNode){break;}
}
var srow=stable.insertRow(count2+1);
var scol=srow.insertCell(0);
scol.width="160";
scol.vAlign="top";
scol.innerHTML='<font size="2">Custom Star:</font>';
scol=srow.insertCell(1);
scol.width="245";
scol.vAlign="top";
scol.innerHTML='<font size="2"><select name="customstar"><option>(none)</option></select></font>';
for(count2=0;count2<CStarNames.length;count2++){
var newop=document.createElement("option");
newop.innerHTML=CStarNames[count2];
mform.customstar.appendChild(newop);
}
mform.customstar.options[star].selected="1";
scol=srow.insertCell(2);
scol.width="245";
scol.vAlign="top";
scol.innerHTML="<font size=\"1\">To have custom stars replace the standard ones under this user's name, choose the star group here.</font>";
break;
}
}
}
}
}
} else {
for(count=0; count<tdlist.length; count++){
if(tdlist[count].width=="20%"){
if(tdlist[count].className.match("windowbg")){
if(tdlist[count].innerHTML.match(sregexp)){
star=RegExp.$1;
} else {
star=0
}
tdlist[count].innerHTML=tdlist[count].innerHTML.replace(sregexp,"");
tdlist[count].innerHTML = tdlist[count].innerHTML.replace(/<br\/?>(<br\/?>member is)/i, "$1");
if(star!=0){
for(count2=0;count2<tdlist[count].getElementsByTagName('img').length;count2++){
if(tdlist[count].getElementsByTagName('img')[count2].alt=="*"&&(!tdlist[count].getElementsByTagName('img')[count2].src.match(/warn/i))){
tdlist[count].getElementsByTagName('img')[count2].src=CStars[star-1];
} else {
break;
}
}
}
}
}
}
}
//-->
</script>
That's the part that you don't edit. But obviously, we need some editable stars. XD So, before pasting that in, you must first add this:
<script type="text/javascript">
<!--
// Custom stars go here. //
var CStarNames = ["STAR NAME 1","STAR NAME 2"];
var CStars = ["IMAGE URL 1","IMAGE URL 2"];
//-->
</script>
Right above where you paste the main code. STAR NAME # represents what the name of the star will be as seen by the staff while editing profiles. IMAGE URL # represents the URL to the image of the new star as seen in the mini-profile. You can have as many or as few as you want; all must be enclosed in quotes and separated by commas. Also, the name of the star must have the same index as the URL to that star, obviously. Feel free to PM me if you have any questions regarding the code.
EDIT [4/5/07]: Found and fixed an error that would happen when the user in question had a warning level; also added an info to the compatibility section.
Edit: 23rd July '07 by Ross: Added a line to remove the extra line break when the user doesn't have a custom title.