Announcement

Collapse
No announcement yet.

"Bookmark This Thread" hack

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • "Bookmark This Thread" hack

    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:
    Code:
    </head>
    Insert Above:
    Code:
    <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,document.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:
    Code:
    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:
    Code:
    <smallfont><img src="images/sendtofriend.gif" border="0"> <a href="sendtofriend.php?threadid=$threadid">Email This Page to Someone!</a></smallfont>
    Add below:
    Code:
    <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]

  • #2
    You may want to change this:
    Code:
    <br>
    <smallfont><IMG SRC="images/bookmark.gif" BORDER=0>  <a href="javascript:addbookmark()">Click to here bookmark this thread!</a></smallfont>
    to this:
    Code:
    <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.
    Bike Forums.net

    Comment


    • #3
      huh ? What's the difference ?

      Comment


      • #4
        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?
        Bike Forums.net

        Comment


        • #5
          Aha!

          Oh! I was looking VERY carefully at the code...

          Comment


          • #6
            great job with this one, never saw this before.
            Works great, incredibly easy, and quite useful

            Comment


            • #7
              hehe another great addition... at this rate i don't think vbulletin forums will look like vbulletins.. lol
              :: Always Back Up Forum Database + Attachments BEFORE upgrading !
              :: Nginx SPDY SSL - World Flags Demo [video results]
              :: vBulletin hacked forums: Clean Up Guide for VPS/Dedicated hosting users [ vbulletin.com blog summary ]

              Comment


              • #8
                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.
                Peter E. Humphries

                Comment


                • #9
                  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:
                  Code:
                  window.external.AddFavorite(window.location.href,document.title);
                  to
                  Code:
                  window.external.AddFavorite(window.location.href,bookmarktitle);
                  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:
                  Code:
                  <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]
                  Peter E. Humphries

                  Comment


                  • #10
                    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.

                    Comment


                    • #11
                      NS Users

                      What would we need "if" statements for if there where only IE users?
                      Peter E. Humphries

                      Comment


                      • #12
                        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!

                        Comment


                        • #13
                          Luv you man

                          Works like a charm....Thanks
                          Webmaster: Dailydiva.com - My VB is OnTheHush.com

                          Comment


                          • #14
                            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

                            Comment


                            • #15
                              As you may notice, this thread is two years old. That may explain it.... (vB 1.1 was out at the time)

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...
                              X