Welcome Guest [Log In] [Register]
This board has been archived and is no longer accepting new questions. If you have a support question for your ZetaBoard, please visit us at the new support board. Registration is free and easy.


Visit the NEW ZetaBoards Support forum!

Username:   Password:
Add Reply
Add "New Topic" Button to View Topic Page
Topic Started: Dec 2 2007, 12:26 AM (5,446 Views)
Dennis
Member Avatar
Member Extraordinaire

This code will add a New Topic button next to the Add Reply button on the View Topic page, similar to how InvisionFree displays.

This code goes in your Theme Layout. Doesn't matter where, just not in the middle of another code. ;)

The two variables in red should be changed to suit your needs.

See it in this Preview.

Quote:
 
<script type="text/javascript">

/*************************
* Add "New Topic" button
* to Zetaboard's View Topic page.
* Pieced together by Dennis,
* with code and assistance
* from Ken, GenerationStudio
* and Chireru. Thanks guys. :)
**************************/
var replyimage = "http://209.85.62.24/static/1/t_addreply.png";
var newtopicimage = "http://209.85.62.24/static/1/t_newtopic.png";

if(location.href.match(/topic/)){
var tid = location.href.split("/")[5];
$(function(){
var a = $('#nav a:last').attr('href');
var b = a.split("/forum/");
var c = new RegExp("[^/]","g");
var d = b[1].match(c);
var fid = d.join("");

$(function(){$("div .topic-buttons").html("<a href='http://" + location.hostname + location.pathname + "post/?mode=2&type=1&f=3767&t=" + tid + "'><img src='" + replyimage + "' alt='Add Reply' /><a href='" + boardurl + "post/?type=1&mode=1&f=" + fid + "'><img src='" + newtopicimage + "' alt='Make New Topic' /></a>")});});};
</script>
Edited by Dennis, Mar 14 2008, 01:19 AM.
Offline Profile Quote Post Goto Top
 
Eureka
Member
[ *  *  * ]
Nice one dude! I love it :) But use this one as it's more safe. I bet you someone will screw up the board url thing with no / at the end. :)

Code:
 

<script type="text/javascript">

/*************************
* Add "New Topic" button
* to Zetaboard's View Topic page.
* Pieced together by Dennis,
* with code and assistance
* from Ken, GenerationStudio
* and Chireru. Thanks guys. :)
**************************/
var replyimage = "http://209.85.62.24/static/1/t_addreply.png";
var newtopicimage = "http://209.85.62.24/static/1/t_newtopic.png";

if(location.href.match(/topic/)){
var tid = location.href.split("/")[5];
$(function(){
var a = $('#nav a:last').attr('href');
var b = a.split("/forum/");
var c = new RegExp("[^/]","g");
var d = b[1].match(c);
var fid = d.join("");

$(function(){$("div .topic-buttons").html("<a href='http://" + location.hostname + location.pathname + "post/?mode=2&type=1&f=3767&t=" + tid + "'><img src='" + replyimage + "' alt='Add Reply' /><a href='" + boardurl + "post/?type=1&mode=1&f=" + fid + "'><img src='" + newtopicimage + "' alt='Make New Topic' /></a>")});});};
</script>


Nice code.
Offline Profile Quote Post Goto Top
 
Dennis
Member Avatar
Member Extraordinaire

Good idea. Updated accordingly. :)
Offline Profile Quote Post Goto Top
 
Kevin
Blog monster.
[ * ]
Nice code, Dennis.
Offline Profile Quote Post Goto Top
 
Eureka
Member
[ *  *  * ]
Wait there's a bug there. Sorry Dennis. I hurried out a code :(

This one works:

Code:
 

<script type="text/javascript">
/*************************
* Add "New Topic" button
* to Zetaboard's View Topic page.
* Pieced together by Dennis,
* with code and assistance
* from Ken, GenerationStudio
* and Chireru. Thanks guys.
**************************/

var newtopicimage = "http://209.85.62.24/static/1/t_newtopic.png";

$(function(){if (location.href.match(/topic/i)){var xnum = $("#nav li a:last").attr("href").split("forum")[1].split("/")[1], boardurl=location.hostname+location.pathname.split("topic")[0];$("div.topic-buttons").append("<a href='http://" + boardurl + "post/?type=1&mode=1&f=" + xnum + "'><img src='" + newtopicimage + "' alt='Make New Topic' /></a>");}});
</script>


Shorten it too :D I implemented my code for the Forum ID instead of using GS's, which works but oddly worded to me. GS, you have to explain to me how you did that. lol

Also, you didn't have to re-implement the add reply button. It's already there. I took that part out and appended the new button only.

Anyways, I plan to automate the new reply button so it'll change accordingly for each skin :). Though ZB should have this implemented and this code will be useless. lol
Edited by Eureka, Dec 2 2007, 12:54 AM.
Offline Profile Quote Post Goto Top
 
Coty Stargazer
Member Avatar
-*-
[ *  * ]
Thanks so much! We were just having a discussion about this =D
Offline Profile Quote Post Goto Top
 
SG-17
Member
[ * ]
Very nice ! :D
I was hoping something like this would appear, it saves me time when posting multiply topics.
Offline Profile Quote Post Goto Top
 
badtzmaru
Member Avatar
Member
[ *  *  * ]
Thanks, you four! :D Which code should we use?
Offline Profile Quote Post Goto Top
 
luciferxm
Member Avatar
Farewell zeta support
[ *  *  *  * ]
hmmm..i did add it as instructed..do you see it anywhere here?
Offline Profile Quote Post Goto Top
 
Eureka
Member
[ *  *  * ]
The one that works. :S

My previous post has it. I'm thinking of automating it so you don't have to update the button. This code will be a problem with skin changing. I need consent from Dennis to do this though.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · User Created Codes · Next Topic »
Add Reply