|
|
| Topic: Warning! Idiot at large!~sdn please help! |
|
|
|
|
| Catchow |
People keep asking to have all instances of a person's user name colored including in posts. I have figured out that to do this, the user names must all be turned into links. I tried to do that before because several requested that when posting a user name it be linked to their profile. But I am too much of an idiot to figure out how to do this. I have tried to write a span class that would color the user names without the links as well but nothing has come close to working. Am I following an impossible dream or am I just an impossible idiot? |
|
|
| Anti Paul |
if user names need to be converted to links, then why not just usethe same type method you did before in your nifty copyright script? except this time the change would be repeated throughout each template (Index / Forum / Thread / etc)
it would be tedious to rewrite, and Memberlist still would not reflect this modification, but I suppose the payoff would be pretty good. |
|
|
| Catchow |
Sorry Paul but that is not what is being asked for. They want it to be so that everytime says a user name in a post it will look like this Catchow or Anti Paul or sdn or Sage or Seb_Thig so that each name is a different color but also contains the link to the named person's profile. What you seem to be suggesting would make it impossible to use a "one size fits all" kind of script. |
|
|
| sdn |
<script language="javascript">
<!--
// replace common text with images script
// written by sdn, just now <forums.33bit.com> or <stufoo.com> if you want
// goes at the bottom of the forum template
function replace(username, class) {
var search = document.body.createTextRange();
search.collapse();
while (search.findText(text)) {
search.pasteHTML('<span class="' + class + '">' + username + '</span>');
}
search.collapse(true);
}
replace('USERNAME', 'CLASSNAME');
//-->
</script>
You'll have to make a CSS class with a font color for every color you want to use. |
|
|
| Catchow |
Dang it sdn. I tried something similar to that but it didn't work. And that doesn't look like it will contain the link to a user profile either or am I just dense?
*wanders off to experiment* |
|
|
| sdn |
No, it won't have a link to the profile. Are you trying to get every instance of the username to be replaced with a link? |
|
|
| Catchow |
yes. That is what people keep asking for. Personally I see no real reason for the name to be linked to the profile and I can't really see how if it does become a link, that you could still make different colors show on the user name. Wouldn't the text color take on the same color as the link color?
(Edited by Catchow) |
|
|
| RevolutionGarage |
Quote: sdn wrote:
<script language="javascript">
<!--
// replace common text with images script
// written by sdn, just now <forums.33bit.com> or <stufoo.com> if you want
// goes at the bottom of the forum template
function replace(username, class) {
var search = document.body.createTextRange();
search.collapse();
while (search.findText(text)) {
search.pasteHTML('<span class="' + class + '">' + username + '</span>');
}
search.collapse(true);
}
replace('USERNAME', 'CLASSNAME');
//-->
</script>
You'll have to make a CSS class with a font color for every color you want to use.
|
What does this do? The reason I want the user name to be a link, is because when I put the colored user names script in, it only applys when the user name is a link. Is there away to edit the script so that it doesnt ONLY apply towards links, but yet, not apply when ever it is written? Sounds very complex, but im guessing thats why there are people who specialize in this kind of stuff. |
|
|
| sdn |
Sorry, I don't understand what you want. Give me some examples of text you want to be colored and text you don't. |
|
|
| RevolutionGarage |

What I don't want to happen.
 |
|
|
| RevolutionGarage |
Problem solved. |
|
|
| sdn |
<script language="javascript">
<!--
// color username to link script
// written by sdn <forums.33bit.com> or <stufoo.com>
// goes at the bottom of the forum template
var colorusers = new Array();
// add colorusers lines between this
// and this
function replace(username, color) {
var search = document.body.createTextRange();
search.collapse();
while (search.findText(text)) {
search.pasteHTML('<span style="color: ' + color + '"><a href="/user.php?action=start&userid=' + colorusers[username] + '&boardid=BOARDID">' + username + '</a></span>');
}
search.collapse(true);
}
replace('username', 'color');
//-->
</script>
For every username you want to be a link, add this where the script says to:
colorusers['username'] = 'the user's user ID';
And add a replace() line where the example line is.
(Edited by sdn) |
|
|
| Koyana Nuva |
Y'know, this should be added to the Wishlist. When you register, or edit your profile, you can select what color you want your username to be. |
|
|