SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Editing the **** script

    Hi,

    I'm hoping someone can help me with this. I'm trying to integrate the **** button on my site using this code:

    Code:
    <script type="text/javascript">
    ****_url = 'URL';
    ****_bgcolor = '#efefef';
    ****_skin = 'compact';
    </script>
    <script src="http://****.com/tools/diggthis.js" type="text/javascript"></script>
    However I need to automatically create the URL string somehow. I looked up how to use some javascript like this...

    Code:
    <SCRIPT LANGUAGE="JavaScript">
      
               <!--
               {
                 document.write(location.href);
               }
               // -->
    </SCRIPT>
    But i'm not sure if this is possible to edit into the **** script and if it's the best way?

    I'd appreciate any help.

    Thanks.

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Isn't the URL supposed to be the URL of the current page? In that case, it should be
    Code:
    ****_url = window.location.href;
    You'll have noticed that the site in question's name is censored here at sitepoint.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops, sorry, I pasted the question from another forum and didn't think about the name.

    Thanks for the reply, I didn't think it would be that easy. Is there anyway I could also include the url string within a link?

    For example href="awebsitehere.com/submit?url=URL&title=The+Article+Title"

    I'm not sure if the title in the link is also possible, but I thought I'd leave it in just in case.

    Thanks again for any more help.

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Code:
    ****_url = 'awebsitehere.com/submit?url=' + window.location.href + '&title=' + document.title;

  5. #5
    SitePoint Wizard jimbo_dk's Avatar
    Join Date
    May 2005
    Location
    Singapore
    Posts
    1,261
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just being curious here....why is the name **** censored?
    Winners Respond. Losers React.
    Singapore Web Designer

  6. #6
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Apparently **** asked for it after they received too much free advertising. I think they're afraid we would discuss them and portray them in a negative light or something of the sort. I'm not sure though, search the forums and I'm sure you'll find the reason.

  7. #7
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Raffles View Post
    Code:
    ****_url = 'awebsitehere.com/submit?url=' + window.location.href + '&title=' + document.title;
    Thanks Raffles, I meant in an actual href statement though. The link I need to edit is the following:

    Code:
    <a href="http://www.stumbleupon.com/submit?url=http://www.yoursite.com/article.php&title=The+Article+Title">
    Thanks for your help.

  8. #8
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Wait, I thought this was for D&#237;gg? What exactly are you trying to do? Do you want to create a link with that href attribute somewhere on your page? I thought that's what this was doing:
    Code:
    <script src="http://****.com/tools/diggthis.js" type="text/javascript"></script>
    In any case, I would have thought you'd be able to adapt it yourself:

    Code:
    http://www.stumbleupon.com/submit?url=' + window.location.href + '&title=' + 'document.title
    Isn't the link created by the external linked javascript file?

  9. #9
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The **** button works great now (thanks for the help) and wanted to also sort out the stumbleupon link to get that to work, so **** is a script and the stumleupon is just a link that needs editing and doesn't come as a script so that's why I wasn't sure how to adapt it.

  10. #10
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ah I see. What you need to do is give the link an ID, as follows:
    HTML Code:
    <a href="http://www.stumbleupon.com/submit" id="stumblesubmit">Submit to StumbleUpon</a>
    Then you need an external javascript file. Do you have one yet? You have to add this:
    Code:
    function stumblelink() {
      document.getElementById('stumblesubmit').href += '?url=' + window.location.href  + '&title=' + document.title;
    }
    
    if (window.addEventListener) window.addEventListener('load', stumblelink, false);
    else if (window.attachEvent) window.attachEvent('onload', stumblelink);
    Or adapt that to any JS you already have.

    If javascript is unavailable, the user will just be taken to the stumbleupon submit form.

  11. #11
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, great, thanks Raffle.

    Thanks again for your help (and your patience!), I'm completely useless at coding so that's helped a great deal.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •