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] Script repair
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] Script repair
Tweet Topic Started: Sep 16 2009, 01:45 PM (401 Views)
Ava Sep 16 2009, 01:45 PM Post #1
Member Avatar
A.V.A

Posts:
276
Group:
Member
Member
#3,254
Joined:
Jun 25, 2009
I was given the following script from gorgor to change the "Topic Title" text in a forum :

<script>
if(location.href.match("f=FORUM NUMBER")){
$(".c_desc:contains('Topic Title')").html("NEW TEXT")
}
</script>

It works just fine for members, but for guests, it does not.

Any idea how this can be fixed?

Thanks.
Posted Image
Offline Profile Goto Top
 
Firestrife2 Sep 16 2009, 02:26 PM Post #2
Member Avatar


Posts:
159
Group:
Dedicated
Member
#2,094
Joined:
Jan 21, 2009
Strange...I don't see why it wouldn't :/.

Could you give a better description on what isn't working? I don't think I worded that correctly.

I also have a suggestion for this part of the code:

Code:
 
<script>
if(location.href.match("f=FORUM NUMBER")){


Change that to:

Code:
 
<script type="text/javascript">
if(location.href.match(/f=FORUM NUMBER/i)){


Posted Image

Posted Image
Offline Profile Goto Top
 
Ava Sep 16 2009, 04:07 PM Post #3
Member Avatar
A.V.A

Posts:
276
Group:
Member
Member
#3,254
Joined:
Jun 25, 2009
I've updated that, but it still doesn't work.

This script did work before ZB updated jquery. I don't know how else to explain it, really. I just pasted that code beneath the board section, and after the update, it stopped working.
Posted Image
Offline Profile Goto Top
 
... Sep 16 2009, 04:31 PM Post #4
...

Posts:
451
Group:
Dedicated
Member
#311
Joined:
Jul 26, 2008
I'm total noob of jQuery, however from what I remember, it stopped using $ signs. That newest version of it. So try removing it.
Offline Profile Goto Top
 
Firestrife2 Sep 16 2009, 04:34 PM Post #5
Member Avatar


Posts:
159
Group:
Dedicated
Member
#2,094
Joined:
Jan 21, 2009
No, $ signs are still being used xD.

I do believe @ signs were removed...and JQ doesn't like it when you use parenthesis inside of parenthesis in contains...which doesn't apply to you....try this:

Code:
 
<script type="text/javascript">
if(location.href.match(/f=FORUM NUMBER/i)){
$(".c_desc:contains(Topic Title)").html("NEW TEXT")
}
</script>


Posted Image

Posted Image
Offline Profile Goto Top
 
Ava Sep 16 2009, 04:36 PM Post #6
Member Avatar
A.V.A

Posts:
276
Group:
Member
Member
#3,254
Joined:
Jun 25, 2009
That didn't work either.
Posted Image
Offline Profile Goto Top
 
... Sep 16 2009, 04:37 PM Post #7
...

Posts:
451
Group:
Dedicated
Member
#311
Joined:
Jul 26, 2008
Firestrife2
Sep 16 2009, 04:34 PM
No, $ signs are still being used xD.

I do believe @ signs were removed...
Well.... so at least I remembered correctly that something was removed <3

(btw, sorry for bringing mess here)
Offline Profile Goto Top
 
RedBldSandman Sep 17 2009, 09:24 AM Post #8
Member Avatar
ZIPPY!

Posts:
482
Group:
Coding Staff
Member
#2,122
Joined:
Jan 25, 2009
When posting a topic as a guest, the url doesn't contain "f=FORUM NUMBER", so you have to use a different code. Use this:
Code:
 
<script type="text/javascript">
if (location.href.match(/post/i) && $("#nav li:last").prev().prev().text()=="FORUM NAME") {
$(".c_desc:contains('Topic Title')").text("NEW TEXT")
}
</script>
Make sure the FORUM NAME matches exactly (capitals and spaces etc.) and it should work ^_^
Posted Image
"To iterate is human, to recurse divine."

Offline Profile Goto Top
 
Dorith Sep 17 2009, 10:49 PM Post #9
Member Avatar
Has just entered the Matrix

Posts:
2,069
Group:
Former Staff
Member
#1,854
Joined:
Dec 23, 2008
Firestrife2
Sep 16 2009, 02:26 PM
Strange...I don't see why it wouldn't :/.

Could you give a better description on what isn't working? I don't think I worded that correctly.

I also have a suggestion for this part of the code:

Code:
 
<script>
if(location.href.match("f=FORUM NUMBER")){


Change that to:

Code:
 
<script type="text/javascript">
if(location.href.match(/f=FORUM NUMBER/i)){


I suggest using quotes instead of slashes. There's a really odd distinction but basically the slashes, I believe, is looking at it as a regExp, while the quotes does not. Not totally sure how to explain this, but Reid told me that it's more efficient to use quotes rather than the slashes.
Posted Image
Posted Image
(Made emoticon using Codes Rock's Smiley Generator)
Offline Profile Goto Top
 
Firestrife2 Sep 18 2009, 01:44 AM Post #10
Member Avatar


Posts:
159
Group:
Dedicated
Member
#2,094
Joined:
Jan 21, 2009
I was just testing around. And hey, maybe I like regExp xD.

Good job, RedBldSandman, I never noticed that...lolz.
Posted Image

Posted Image
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