Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Support
  • InvisionFree and Zetaboards Support
  • [SOLVED][ZB] Renaming Shoutbox
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
[SOLVED][ZB] Renaming Shoutbox
Tweet Topic Started: May 5 2010, 03:20 AM (560 Views)
Poui May 5 2010, 03:20 AM Post #1
Member Avatar


Posts:
66
Group:
Member
Member
#2,982
Joined:
May 12, 2009
Coding language
HTML/CSS
Wishing to rename the shoutbox, the most obvious solution presents itself thus:

Code:
 
$("table.cat_head h2:contains('Shoutbox')").text("Chatbox");


But unfortunately, in doing this one also clears out the span.collapse.

So I'm wondering, is there a way I can rename the shoutbox while keeping the collapse button intact?
Offline Profile Goto Top
 
RedBldSandman May 6 2010, 05:03 PM Post #2
Member Avatar
ZIPPY!

Posts:
482
Group:
Coding Staff
Member
#2,122
Joined:
Jan 25, 2009
Code:
 
$("table.cat_head h2:contains('Shoutbox')").contents().filter(function() {
return this.nodeType==3&&this.nodeValue.indexOf("Shoutbox")!=-1;
})[0].nodeValue="Chatbox";
Try that :)
Posted Image
"To iterate is human, to recurse divine."

Offline Profile Goto Top
 
Poui May 7 2010, 01:42 AM Post #3
Member Avatar


Posts:
66
Group:
Member
Member
#2,982
Joined:
May 12, 2009
Coding language
HTML/CSS
oho, that does work. Thanks :D

In a similar vein, to rename it in the Archive as well, I tried:
Code:
 
$("div.topic h2.special:contains('Shoutbox')").text("Chatbox");
but no results were had.

What's wrong with this line?
Offline Profile Goto Top
 
Sacktapped_U May 7 2010, 05:33 AM Post #4
Member Avatar
Forbidden Leader

Posts:
102
Group:
Member
Member
#3,561
Joined:
Nov 8, 2009
Coding language
HTML/CSS
So, yet another noob question: "Where does this go?" Fix it into the CSS? Or Below the Board like 80% of all the codes on ZBCode. LOL
Posted Image
Offline Profile Goto Top
 
Kitsueki May 7 2010, 01:47 PM Post #5
Member Avatar
♠ Aizu

Posts:
742
Group:
Dedicated
Member
#3,453
Joined:
Aug 31, 2009
either Above or Below the board, I think.
It can't see it working without script tags, and you can use JS in the Appearance part of themes (at least i haven't seen it).
Kingdom of Etruria
Spoiler: click to toggle
Kingdom of Etruria


Starring in the Medieval times, this Kingdom is an isolated territory not bothered by any other Kingdoms.
The military has recently caught on to something big, and its their job to stop it.
Will you walk your own path, or aid the Etrurian Military in exterminating the evil that is about to come forth?
It's Ready!

Kingdom of Etruria is a Roleplaying forum I created, also with the help of a few friends.
You can pick from many classes, fight any way you want, and gain rank in the military, or even start your own Faction.
It all starts with a Character Registration, if you're interested in taking part of this RP, PM me and I'll be sure to give you the link when I open it.
There are many things to do at Kingdom of Etruria, so be sure to find out for yourself
Thanks for reading!

Offline Profile Goto Top
 
RedBldSandman May 7 2010, 02:48 PM Post #6
Member Avatar
ZIPPY!

Posts:
482
Group:
Coding Staff
Member
#2,122
Joined:
Jan 25, 2009
Poui
May 7 2010, 01:42 AM
oho, that does work. Thanks :D

In a similar vein, to rename it in the Archive as well, I tried:
Code:
 
$("div.topic h2.special:contains('Shoutbox')").text("Chatbox");
but no results were had.

What's wrong with this line?
I see nothing wrong with that, it seems to work from Firebug too xD Did you put it below the board?
Posted Image
"To iterate is human, to recurse divine."

Offline Profile Goto Top
 
Poui May 7 2010, 03:25 PM Post #7
Member Avatar


Posts:
66
Group:
Member
Member
#2,982
Joined:
May 12, 2009
Coding language
HTML/CSS
Ah, I got it now.

I had this:

Code:
 
<script type="text/javascript">
$("table.cat_head h2:contains('Shoutbox')").contents().filter(function() {
return this.nodeType==3&&this.nodeValue.indexOf("Shoutbox")!=-1;
})[0].nodeValue="Chatbox";
$("div.topic h2.special:contains('Shoutbox')").text("Chatbox");
</script>


whereas I needed to put the second snippet first, like so:
Code:
 
<script type="text/javascript">
$("div.topic h2.special:contains('Shoutbox')").text("Chatbox");
$("table.cat_head h2:contains('Shoutbox')").contents().filter(function() {
return this.nodeType==3&&this.nodeValue.indexOf("Shoutbox")!=-1;
})[0].nodeValue="Chatbox";
</script>
Offline Profile Goto Top
 
RedBldSandman May 7 2010, 04:13 PM Post #8
Member Avatar
ZIPPY!

Posts:
482
Group:
Coding Staff
Member
#2,122
Joined:
Jan 25, 2009
Ah, sorry, my first code causes an error if the textnode isn't found as it then cannot find the nodeValue for the specified node...since it doesn't exist xD And since it won't find the textnode on the archive page, it causes an error and the browser doesn't parse the rest of the script xD If you don't want it to cause an error (though it shouldn't really matter if you keep them as you have them now), then use this:
Code:
 
var node = $("table.cat_head h2:contains('Shoutbox')").contents().filter(function() {
return this.nodeType==3&&this.nodeValue.indexOf("Shoutbox")!=-1;
})[0];
if (node) node.nodeValue="Chatbox";
$("div.topic h2.special:contains('Shoutbox')").text("Chatbox");
:)
Posted Image
"To iterate is human, to recurse divine."

Offline Profile Goto Top
 
Poui May 7 2010, 04:44 PM Post #9
Member Avatar


Posts:
66
Group:
Member
Member
#2,982
Joined:
May 12, 2009
Coding language
HTML/CSS
Ah, that was the problem. I updated the code :)
Offline Profile Goto Top
 
RedBldSandman May 7 2010, 05:04 PM Post #10
Member Avatar
ZIPPY!

Posts:
482
Group:
Coding Staff
Member
#2,122
Joined:
Jan 25, 2009
Coolio :)

Solved!

We're glad we could help you out. If you have any other questions, feel free to start a new topic.
Posted Image
"To iterate is human, to recurse divine."

Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · InvisionFree and Zetaboards Support · Next Topic »
Locked Topic

Track Topic · E-mail Topic Time: 3:37 AM Jul 11
Hosted for free by ZetaBoards · Privacy Policy