|
[ C ] Colour Names Across the Board
|
|
Topic Started: Sep 2 2012, 11:19 AM (477 Views)
|
|
RenaH-ZNR
|
Sep 2 2012, 11:19 AM
Post #1
|
- Posts:
- 163
- Group:
- Members
- Member
- #57,667
- Joined:
- March 3, 2005
- I'm Browsing With
- Firefox
|
Board Address: http://dbzf.co.uk Board Software: ZetaBoards Description: Currently using this code here: http://resources.zetaboards.com/topic/5066857/1/
What I would like is a similar code but without the bugs, when people are joining with a similar name to a member of staff, they end up with a coloured name as well, which they shouldn't do, the same as what's pointed out on that topic as a bug that topic titles get coloured.
I don't know if someone could make something similar without those problems, but I'd appreciate it, maybe looking for the userID in the URL, rather than picking up the name in the URL could work?
Thanks.
|
|
|
| |
|
Pete B-ZNR
|
Sep 3 2012, 03:12 PM
Post #2
|
- Posts:
- 312
- Group:
- Members
- Member
- #144,152
- Joined:
- February 3, 2006
|
Only coded it so far to work on links. Not sure where a username might appear that isn't a link, but tell me if there is.
- Code:
-
<script type="text/javascript">
$(function(){ function gcolors(uid, color) { $("a[href*='/profile/']").each(function(){ url = $(this).attr('href'); uname = $(this).text(); uid_get = url.split('/profile/')[1].split('/')[0]; if(uid_get == uid){ $(this).html("<a href='"+url+"'><font color='"+color+"'>"+uname+"</font>"); } }); }
//Specify users by ID here. Specify color afterwards. gcolors(63280, "#000"); gcolors(1105853, "#FF0000");
});
</script>
|
|
|
| |
|
RenaH-ZNR
|
Sep 3 2012, 06:28 PM
Post #3
|
- Posts:
- 163
- Group:
- Members
- Member
- #57,667
- Joined:
- March 3, 2005
- I'm Browsing With
- Firefox
|
Works well so far, the only other place I would like to see it is on the user profile page, such as here: http://dbzf.co.uk/profile/6932/
If you can add it so it colours the header name on there and in the navigation, I'd like that too, if that's not possible or would be too much work, then it's good as it is
|
|
|
| |
|
Pete B-ZNR
|
Sep 4 2012, 04:58 AM
Post #4
|
- Posts:
- 312
- Group:
- Members
- Member
- #144,152
- Joined:
- February 3, 2006
|
No problem.
- Code:
-
<script type="text/javascript"> $(function () { function gcolors(uid, color) { //Styles profile links $("a[href*='/profile/']").each(function () { url = $(this).attr('href'); uname = $(this).text(); uid_get = url.split('/profile/')[1].split('/')[0]; if (uid_get == uid) { $(this).html("<a href='" + url + "'><font color='" + color + "'>" + uname + "</font>"); } }); //Styles profile page text if (window.location.href.indexOf("profile") > -1) { path = window.location.pathname; uid_cap = path.split('/profile/')[1].split('/')[0]; if (uid_cap == uid) { username = $(".profile:first th:last").text(); $(".profile:first th:last").html("<font color='" + color + "'>" + username + "</font>"); $("#nav li:last").html("<span><font color='" + color + "'>" + username + "</font></span>"); } } }
//Specify users by ID here. Specify color afterwards. gcolors(63280, "#FF0000"); gcolors(1105853, "#FF0000");
}); </script>
|
|
|
| |
|
RenaH-ZNR
|
Sep 4 2012, 09:14 AM
Post #5
|
- Posts:
- 163
- Group:
- Members
- Member
- #57,667
- Joined:
- March 3, 2005
- I'm Browsing With
- Firefox
|
That's great, thanks
|
|
|
| |
|
Pk Magic Hat
|
Sep 4 2012, 12:03 PM
Post #6
|
- Posts:
- 131
- Group:
- Members
- Member
- #391,946
- Joined:
- February 26, 2012
- Latest Design
- http://resources.zetaboards.com/topic/5155556/1/
|
And a prefix/suffix image, is that possible to add through this code?
|
|
|
| |
|
Pete B-ZNR
|
Sep 4 2012, 01:08 PM
Post #7
|
- Posts:
- 312
- Group:
- Members
- Member
- #144,152
- Joined:
- February 3, 2006
|
Mhmm
Prefix Image:
Spoiler: click to toggle - Code:
-
<script type="text/javascript"> $(function () { function gcolors(uid, color,ps_img) { //Styles profile links $("a[href*='/profile/']").each(function () { url = $(this).attr('href'); uname = $(this).text(); uid_get = url.split('/profile/')[1].split('/')[0]; if (uid_get == uid) { $(this).html("<a href='" + url + "'><img src='"+ps_img+"' alt='psimg' /><font color='" + color + "'>" + uname + "</font>"); } }); //Styles profile page text if (window.location.href.indexOf("profile") > -1) { path = window.location.pathname; uid_cap = path.split('/profile/')[1].split('/')[0]; if (uid_cap == uid) { username = $(".profile:first th:last").text(); $(".profile:first th:last").html("<img src='"+ps_img+"' alt='psimg' /><font color='" + color + "'>" + username + "</font>"); $("#nav li:last").html("<span><img src='"+ps_img+"' alt='psimg' /><font color='" + color + "'>" + username + "</font></span>"); } } }
//Specify users by ID here. Specify color afterwards. Then specify image. gcolors(63280, "#FF0000", "IMG URL"); gcolors(1105853, "#FF0000", "IMG URL");
}); </script>
Suffix Image:
Spoiler: click to toggle - Code:
-
<script type="text/javascript"> $(function () { function gcolors(uid, color) { //Styles profile links $("a[href*='/profile/']").each(function () { url = $(this).attr('href'); uname = $(this).text(); uid_get = url.split('/profile/')[1].split('/')[0]; if (uid_get == uid) { $(this).html("<a href='" + url + "'><font color='" + color + "'>" + uname + "</font><img src='"+ps_img+"' alt='psimg' />"); } }); //Styles profile page text if (window.location.href.indexOf("profile") > -1) { path = window.location.pathname; uid_cap = path.split('/profile/')[1].split('/')[0]; if (uid_cap == uid) { username = $(".profile:first th:last").text(); $(".profile:first th:last").html("<font color='" + color + "'>" + username + "</font><img src='"+ps_img+"' alt='psimg' />"); $("#nav li:last").html("<span><font color='" + color + "'>" + username + "</font><img src='"+ps_img+"' alt='psimg' /></span>"); } } }
//Specify users by ID here. Specify color afterwards. Then specify image. gcolors(63280, "#FF0000", "IMG URL"); gcolors(1105853, "#FF0000", "IMG URL");
}); </script>
|
|
|
| |
|
Pk Magic Hat
|
Sep 4 2012, 01:25 PM
Post #8
|
- Posts:
- 131
- Group:
- Members
- Member
- #391,946
- Joined:
- February 26, 2012
- Latest Design
- http://resources.zetaboards.com/topic/5155556/1/
|
Looks very nice Thank you.
Edit: Woops! It removes the bold from the usernames! How can I fix that? http://prntscr.com/ez6mz
|
|
|
| |
|
Pete B-ZNR
|
Sep 4 2012, 02:17 PM
Post #9
|
- Posts:
- 312
- Group:
- Members
- Member
- #144,152
- Joined:
- February 3, 2006
|
Hmm.
Will carry over styles set in the ACP, but overwrite colours as defined.
No Image - Code:
-
<script type="text/javascript"> $(function () { function gcolors(uid, g_color) { //Styles profile links $("a[href*='/profile/']").each(function () { url = $(this).attr('href'); uid_get = url.split('/profile/')[1].split('/')[0]; if (uid_get == uid) { $(this).css({color : g_color }); } }); //Styles profile page text if (window.location.href.indexOf("profile") > -1) { path = window.location.pathname; uid_cap = path.split('/profile/')[1].split('/')[0]; if (uid_cap == uid) { $(".profile:first th:last").css({color : g_color }); $("#nav li:last span").css({color : g_color }); } } }
//Specify ID, Hex gcolors(63280, "#FF0000"); gcolors(1105853, "#FF0000");
}); </script>
Prepended Image - Code:
-
<script type="text/javascript"> $(function () { function gcolors(uid, g_color,ps_img) { //Styles profile links $("a[href*='/profile/']").each(function () { url = $(this).attr('href'); uid_get = url.split('/profile/')[1].split('/')[0]; if (uid_get == uid) { $(this).css({color : g_color }); $(this).not('.member').prepend("<img src='"+ps_img+"' alt='psimg' />"); } }); //Styles profile page text if (window.location.href.indexOf("profile") > -1) { path = window.location.pathname; uid_cap = path.split('/profile/')[1].split('/')[0]; if (uid_cap == uid) { $(".profile:first th:last").css({color : g_color }); $(".profile:first th:last").prepend("<img src='"+ps_img+"' alt='psimg' />"); $("#nav li:last span").css({color : g_color }); $("#nav li:last span").prepend("<img src='"+ps_img+"' alt='psimg' />"); } } }
//Specify ID, Hex gcolors(63280, "#FF0000","http://z1.ifrm.com/static/1/nav.png"); gcolors(1105853, "#FF0000","http://z1.ifrm.com/static/1/nav.png");
}); </script>
Appended Image - Code:
-
<script type="text/javascript"> $(function () { function gcolors(uid, g_color,ps_img) { //Styles profile links $("a[href*='/profile/']").each(function () { url = $(this).attr('href'); uid_get = url.split('/profile/')[1].split('/')[0]; if (uid_get == uid) { $(this).css({color : g_color }); $(this).not('.member').append("<img src='"+ps_img+"' alt='psimg' />"); } }); //Styles profile page text if (window.location.href.indexOf("profile") > -1) { path = window.location.pathname; uid_cap = path.split('/profile/')[1].split('/')[0]; if (uid_cap == uid) { $(".profile:first th:last").css({color : g_color }); $(".profile:first th:last").append("<img src='"+ps_img+"' alt='psimg' />"); $("#nav li:last span").css({color : g_color }); $("#nav li:last span").append("<img src='"+ps_img+"' alt='psimg' />"); } } }
//Specify ID, Hex gcolors(63280, "#FF0000","http://z1.ifrm.com/static/1/nav.png"); gcolors(1105853, "#FF0000","http://z1.ifrm.com/static/1/nav.png");
}); </script>
|
|
|
| |
|
Pk Magic Hat
|
Sep 4 2012, 02:25 PM
Post #10
|
- Posts:
- 131
- Group:
- Members
- Member
- #391,946
- Joined:
- February 26, 2012
- Latest Design
- http://resources.zetaboards.com/topic/5155556/1/
|
Thank you very much
|
|
|
| |
|
Steve
|
Sep 5 2012, 09:10 AM
Post #11
|
- Posts:
- 36,967
- Group:
- Members
- Member
- #4,261
- Joined:
- December 21, 2003
- Latest Design
- E pluribus unum
|
Completed!
Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
|
|
|
| |
| 1 user reading this topic (1 Guest and 0 Anonymous)
|