Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Resources
  • Code Requests
  • Completed Requests
  • [Completed] [ZB] Code to override another
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
  • Pages:
  • 1
  • 2
[Completed] [ZB] Code to override another
Tweet Topic Started: Oct 30 2009, 04:33 AM (487 Views)
Lout Oct 30 2009, 04:33 AM Post #1
Member Avatar


Posts:
402
Group:
Dedicated
Member
#2,400
Joined:
Feb 19, 2009
Been a while since I requested a code but here's a challenge for you guys.

I'm currently using Reid's Default Post Options code, but one of the staff uses a theme that nobody else does.

The problem is that some colours of text don't show up very well on this one particular theme, so what I would like is a code that will work by either username or user ID, which will override the Default Post Options code and make all text a specified colour for whichever member is specified.

Let me know if you need any more info :)
Posted Image
Offline Profile Goto Top
 
RedBldSandman Oct 30 2009, 10:14 AM Post #2
Member Avatar
ZIPPY!

Posts:
482
Group:
Coding Staff
Member
#2,122
Joined:
Jan 25, 2009
All text? So even text inside the color BBCodes or just the normal text? And do you want the user themselves to be able to set the colour or the administrator?
Edited by RedBldSandman, Oct 30 2009, 10:19 AM.
Posted Image
"To iterate is human, to recurse divine."

Offline Profile Goto Top
 
Lout Oct 30 2009, 10:56 AM Post #3
Member Avatar


Posts:
402
Group:
Dedicated
Member
#2,400
Joined:
Feb 19, 2009
All text in the text area I guess, and it's only one user that needs it so just as a user ID in the code itself will be fine.

As long as I can specify which user, and also choose the hex colour then that will be fine, but I'm guessing that it will have to run after the code I'm already using?
Posted Image
Offline Profile Goto Top
 
RedBldSandman Oct 30 2009, 01:20 PM Post #4
Member Avatar
ZIPPY!

Posts:
482
Group:
Coding Staff
Member
#2,122
Joined:
Jan 25, 2009
Try this:
Code:
 
var cancel_default_user = "Username"
var cancel_default_color = "Color"

$(function() {
if ($("#top_info strong a").text()==cancel_default_user) {
function children(x) {
$(x).children("span").css("color",cancel_default_color);
if ($(x).children().html()) {
$(x).children().each(function() {
children(this);
});
}
}

$(".c_post").each(function() {
$(this).css("color",cancel_default_color);
children(this);
});
}});
Just place it underneath Reid's Default Post Option code and change cancel_default_user to the username and cancel_default_color to the color (in whichever form you wish). It should change all text, even text affected by the [color] BBcode to the chosen colour :D
Posted Image
"To iterate is human, to recurse divine."

Offline Profile Goto Top
 
Lout Oct 30 2009, 02:45 PM Post #5
Member Avatar


Posts:
402
Group:
Dedicated
Member
#2,400
Joined:
Feb 19, 2009
I'll let you know how it works as soon as the guy comes online.

EDIT: just tested it using my username instead but it didn't change anything.
Edited by Lout, Oct 30 2009, 02:53 PM.
Posted Image
Offline Profile Goto Top
 
Gorgor Oct 30 2009, 02:53 PM Post #6
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
LagerLout
Oct 30 2009, 02:45 PM
I'll let you know how it works as soon as the guy comes online.
Can't you try it yourself by specifying your name in the code and viewing the theme that he uses? :P
Offline Profile Goto Top
 
Lout Oct 30 2009, 03:11 PM Post #7
Member Avatar


Posts:
402
Group:
Dedicated
Member
#2,400
Joined:
Feb 19, 2009
Gorgor
Oct 30 2009, 02:53 PM
LagerLout
Oct 30 2009, 02:45 PM
I'll let you know how it works as soon as the guy comes online.
Can't you try it yourself by specifying your name in the code and viewing the theme that he uses? :P
I did, check the edit :P
Posted Image
Offline Profile Goto Top
 
Gorgor Oct 30 2009, 04:18 PM Post #8
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
Add this below the default post color script.
Code:
 
<script type='text/javascript'>
user = "USERNAME"
color = "COLOR"

a = $("#top_info strong a").html()
if(a == user){
$(".c_post").css('color',color)
$(".c_post").find("span").css('color',color)
}
</script>
Offline Profile Goto Top
 
RedBldSandman Oct 30 2009, 05:09 PM Post #9
Member Avatar
ZIPPY!

Posts:
482
Group:
Coding Staff
Member
#2,122
Joined:
Jan 25, 2009
You're going about it in a much better way than I did Gorgor xD It won't actually work unless you put the $(function() { around it since that's how the Default Post Option code is called. So use this:
Code:
 
<script type="text/javascript">
user = "USERNAME";
color = "COLOR";

$(function() {
a = $("#top_info strong a").html();
if(a == user){
$(".c_post").css("color",color);
$(".c_post").find("span").css("color",color);
}});
</script>
Collaborative Effot :P
Posted Image
"To iterate is human, to recurse divine."

Offline Profile Goto Top
 
Gorgor Oct 30 2009, 05:38 PM Post #10
Hello

Posts:
1,187
Group:
Former Staff
Member
#2,728
Joined:
Apr 2, 2009
Coding language
PHP
I still need to get used to using
Code:
 
$(function(){
Thanks :P
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Completed Requests · Next Topic »
Locked Topic
  • Pages:
  • 1
  • 2

Track Topic · E-mail Topic Time: 2:27 PM Jul 11
Hosted for free by ZetaBoards · Privacy Policy