|
Viewing Single Post From: Add "New Topic" Button to View Topic Page
|
|
Eureka
|
Dec 2 2007, 12:30 AM
|
- Posts:
- 402
- Group:
- Members
- Member
- #256
- Joined:
- Dec 1, 2007
|
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.
|
|
|