View Full Version : "Bookmark This Thread" hack
Moonwolf
Tue 6th Jun '00, 1:13pm
Another one of those minor hacks that are so minor it's embarassing to say it's a hack at all.
Open showthread template
Find:
</head>
Insert Above:
<script language="JavaScript1.2">
var bookmarkurl="http://your.domain.here$REQUEST_URI"
var bookmarktitle="$threadtitle"
function addbookmark(){
if (document.all) {
window.external.AddFavorite(window.location.href,d ocument.title);
} else {
alert("Use Ctrl-D to add a bookmark in Netscape Navigator.");
}
}
</script>
Note you need to replace "http://your.domain.here" with the URL to your domain -itself-, not to the forums.
e.g. Forums on http://www.underlight.com
Code will read:
var bookmarkurl="http://www.underlight.com$REQUEST_URI"
The $REQUEST_URI part will fill in the path and variables to the thread you're book marking.
Then, in the showthread template, find:
<smallfont><img src="images/sendtofriend.gif" border="0"> <a href="sendtofriend.php?threadid=$threadid">Email This Page to Someone!</a></smallfont>
Add below:
<br>
<smallfont><IMG SRC="images/bookmark.gif" BORDER=0> <a href="javascript:addbookmark()">Click to here bookmark this thread!</a></smallfont>
Upload a bookmark icon, and you're all set.
Kath
[Edited by Moonwolf on 06-07-2000 at 10:19 AM]
Joe
Fri 9th Jun '00, 11:01am
You may want to change this:
<br>
<smallfont><IMG SRC="images/bookmark.gif" BORDER=0> <a href="javascript:addbookmark()">Click to here bookmark this thread!</a></smallfont>
to this:
<br>
<smallfont><IMG SRC="images/bookmark.gif" BORDER=0> <a href="javascript:addbookmark()">Click here to bookmark this thread!</a></smallfont>
Happy Day :)
Thanks for the hacks Moonwolf.
Craig Antill
Fri 9th Jun '00, 6:07pm
huh ? What's the difference ?
Joe
Sat 10th Jun '00, 6:15am
Click to here bookmark this thread! should be Click here to bookmark this thread!. Nothing big, but it just reads a bit better... dont think you so? :)
Craig Antill
Sat 10th Jun '00, 6:40am
Oh! I was looking VERY carefully at the code... :D
thetakerfan
Mon 31st Jul '00, 12:12am
great job with this one, never saw this before.
Works great, incredibly easy, and quite useful
eva2000
Mon 31st Jul '00, 1:46am
hehe another great addition... at this rate i don't think vbulletin forums will look like vbulletins.. lol
phumphries
Mon 31st Jul '00, 10:47am
Love it. Is there a variable to insert the domain automatically? My users are on an Intranet and some, due to configuration errors beyond my control, have to access the site by its IP address while others use its name.
phumphries
Mon 31st Jul '00, 12:39pm
Actually, I looked at the code a little more closely, and the bookmarkurl and bookmarktitle variables are not being used. So, the actual URL is already being inserted. :)
I eliminated the bookmarkurl variable and changed:
window.external.AddFavorite(window.location.href,d ocument.title); to window.external.AddFavorite(window.location.href,b ookmarktitle);so that the shorter Thread Title is used.
In looking around, I also found another JavaScript to display a message instead of a link for non IE users:
<br><smallfont><IMG SRC="images/bookmark.gif" BORDER=0>
<SCRIPT LANGUAGE="JavaScript">
if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
var url=window.location.href;
var title="$threadtitle";
document.write('<A HREF="javascript:window.ext');
document.write('ernal.AddFavorite(url,title);" ');
document.write('onMouseOver=" window.status=');
document.write("'Bookmark this thread!'; return true ");
document.write('"onMouseOut=" window.status=');
document.write("' '; return true ");
document.write('">Click here to bookmark this thread!</a>');
} else {
var msg = "Bookmark this thread!";
if(navigator.appName == "Netscape") msg += " (CTRL-D)";
document.write(msg);
}
</script></smallfont>
Just stick this between the "Send E-mail" and "Printable" links.
Now, I have to decide which I like better. Argh! Decisions!!
[Edited by phumphries on 07-31-2000 at 11:42 AM]
thetakerfan
Mon 31st Jul '00, 12:52pm
nice job phumphries.
But, I don't use text, just the img, so the non IE users will just have to figure it out themselves...
but then again, I'm just testing the board out, so I'll figure something out for those damned NS users later.
I just HATE that 7% of people that use NS.
phumphries
Mon 31st Jul '00, 1:02pm
What would we need "if" statements for if there where only IE users? :D
thetakerfan
Mon 31st Jul '00, 1:05pm
good point. If it wasn't for all the wonderful NS users out there, we would never have to deal with all the cross-browser compatibility issues, and all the formatting errors, etc. Now WHAT would the world be like without all of that???
Thank goodness for NS, thats all I have to say!
;)
datman99
Thu 5th Oct '00, 2:28pm
Works like a charm....Thanks
monica
Thu 12th Sep '02, 6:33pm
Hi ,
I carefully checked my "showthread template". I didn't find any
"send this link to a friend" in the code. Where do I insert this
Bookmark image. Plz help
MUG
Thu 12th Sep '02, 6:56pm
As you may notice, this thread is two years old. That may explain it.... ;) (vB 1.1 was out at the time)
monica
Fri 13th Sep '02, 10:25am
Thanks so much. Do you know how to bookmeark a thread in VB2.2.6
Thanks
monica
Fri 13th Sep '02, 10:42am
Actually, The feature is already there as " subscribe to this thread". Thanks so much though:D
phumphries
Sat 14th Sep '02, 11:47am
This is not the same as the "subscribe" feature; this actually puts a bookmark in the user's Favourites list (in IE) or tells them to press Ctrl-D to add it to their Netscape bookmarks.
Near the end of the showthread template in 2.2.6, you will find<!-- thread options links -->You need to add the code<img src="images/bookmark.gif" border="0" alt="" align="absmiddle"> <SCRIPT LANGUAGE="JavaScript" src="bookmark.js"></script>wherever you find most pleasing, and then put the attached bookmark.js JavaScript file in your main directory.
This is the contents of bookmark.js:if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
var url=window.location.href;
var title="$threadtitle";
document.write('<A HREF="javascript:window.ext');
document.write('ernal.AddFavorite(url,title);" ');
document.write('onMouseOver=" window.status=');
document.write("'Bookmark this thread!'; return true ");
document.write('"onMouseOut=" window.status=');
document.write("' '; return true ");
document.write('">Click here to bookmark this thread!</a>');
} else {
var msg = "Bookmark this thread!";
if(navigator.appName == "Netscape") msg += " (CTRL-D)";
document.write(msg);
}I also put a couple of possible bookmark pic's in there for you.
MUG
Sat 14th Sep '02, 11:49am
Actually, the thread title part wouldn't work because bookmark.js isn't parsed by vBulletin :)
phumphries
Sun 15th Sep '02, 7:22pm
None of my IE users have ever said anythimg to me! It used to be in the template; I guess that I will put it back.
So, just paste the bookmark.js code into your showthread template; then vBulletin will parse $threadtitle as usual.
monica
Mon 16th Sep '02, 12:48pm
Thanks :)
vBulletin® v3.8.0 Release Candidate 1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.