Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^4: Facebook 'like' button. (atypical)

by jozef (Sexton)
on Jul 15, 2011 at 12:04 UTC ( #914576=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Facebook 'like' button. (atypical)
in thread Facebook 'like' button.

What about:

<script> var shareLinks = { "facebook.com": {"url": "http://www.facebook.com/share.php?u=_url_ +&t=_title_", "name": "Facebook"}, "google.com":{"url":"http://www.google.com/buzz/post?url=_url_&mes +sage=_title_","name":"Google Buzz"}, "twitter.com":{"url":"http://twitter.com/home?status=_url_","name" +:"Twitter"}, "digg.com": {"url": "http://digg.com/submit?phase=2&url=_url_&titl +e=_title_&bodytext=_title_", "name": "Digg"}, "del.icio.us":{"url":"http://del.icio.us/post?url=_url_&title=_tit +le_","name":"del.icio.us"}, "reddit.com":{"url":"http://reddit.com/submit?url=_url_&title=_tit +le_","name":"reddit"}, "www.stumbleupon.com":{"url":"http://www.stumbleupon.com/submit?ur +l=_url_&title=_title_","name":"StumbleUpon"}, "technorati.com": {"url": "http://technorati.com/faves?add=_url_", + "name": "Technorati"}, "www.furl.net":{"url":"http://www.furl.net/storeIt.jsp?t=_title_&u +=_url_","name":"Furl"}, "ma.gnolia.com":{"url":"http://ma.gnolia.com/bookmarklet/add?url=_ +url_&title=_title_","name":"ma.gnolia"}, "blinkbits.com":{"url":"http://blinkbits.com/bookmarklets/save.php +?v=1&source_url=_url_&Title=_title_","name":"BlinkBits"}, "www.blinklist.com":{"url":"http://www.blinklist.com/index.php?Act +ion=Blink/addblink.php&Url=_url_&Title=_title_","name":"BlinkList"}, "blogmarks.net":{"url":"http://blogmarks.net/my/new.php?mini=1&tit +le=_title_&url=_url_","name":"Blogmarks"}, "buddymarks.com":{"url":"http://buddymarks.com/add_bookmark.php?bo +okmark_title=_title_&bookmark_url=_url_","name":"Buddymarks"}, "www.citeulike.org":{"url":"http://www.citeulike.org/posturl?url=_ +url_&title=_title_","name":"CiteUlike"}, "www.diigo.com":{"url":"http://www.diigo.com/post?url=_url_&title= +_title_","name":"Diigo"}, "www.dzone.com":{"url":"http://www.dzone.com/links/add.html?url=_u +rl_&title=_title_","name":"DZone"}, "myfavorites.earthlink.net":{"url":"http://myfavorites.earthlink.n +et/my/add_favorite?v=1&url=_url_&title=_title_","name":"Earthlink"}, "www.feedmarker.com":{"url":"http://www.feedmarker.com/admin.php?d +o=bookmarklet_mark&url=_url_&title=_title_;","name":"FeedMarker"}, "www.flogz.com":{"url":"http://www.flogz.com/submit?url=_url_","na +me":"Flog this!"}, "feedmelinks.com":{"url":"http://feedmelinks.com/categorize?from=t +oolbar&op=submit&name=_title_&url=_url_","name":"feedmelinks"}, "www.givealink.org":{"url":"http://www.givealink.org/cgi-pub/bookm +arklet/bookmarkletLogin.cgi?&uri=_url_&title=_title_","name":"Give a +Link"}, "www.gravee.com":{"url":"http://www.gravee.com/account/bookmarkpop +?u=_url_&t=_title_","name":"Gravee"}, "www.igooi.com":{"url":"http://www.igooi.com/addnewitem.aspx?self= +1&noui=yes&jump=close&url=_url_&title=_title_","name":"igooi"}, "scoop.isedb.com":{"url":"http://scoop.isedb.com/submit.php?url=_u +rl_&title=_title_","name":"ISEdb"}, "lister.lilisto.com":{"url":"http://lister.lilisto.com/?t=_title_& +l=_url_","name":"Lilisto"}, "www.linkagogo.com":{"url":"http://www.linkagogo.com/go/AddNoPopup +?title=_title_&url=_url_","name":"Linkagogo"}, "linkroll.com":{"url":"http://linkroll.com/insert.php?url=_url_&ti +tle=_title_","name":"Linkroll"}, "api.looklater.com":{"url":"http://api.looklater.com/bookmarks/sav +e?url=_url_&title=_title_","name":"Looklater"}, "www.marktd.com":{"url":"http://www.marktd.com/submit.php?url=_url +_&title=_title_","name":"Marktd"}, "www.mister-wong.com":{"url":"http://www.mister-wong.com/index.php +?action=addurl&bm_url=_url_&bm_description=_title_","name":"Mr. Wong" +}, "user.my-tuts.com":{"url":"http://user.my-tuts.com/tag-tutorial/?t +itle=_title_&url=_url_","name":"My-Tuts"}, "www.netscape.com":{"url":"http://www.netscape.com/submit/?U=_url_ +&T=_title_","name":"Netscape"}, "www.netvouz.com":{"url":"http://www.netvouz.com/action/submitBook +mark?url=_url_&title=_title_&popup=no","name":"Netvouz"}, "www.newsvine.com":{"url":"http://www.newsvine.com/_wine/save?popo +ff=0&u=_url_&h=_title_","name":"Newsvine"}, "nshout.com":{"url":"http://nshout.com/submit.php?url=_url_&title= +_title_","name":"NShout"}, "www.onlywire.com":{"url":"http://www.onlywire.com/b/?u=_url_&t=_t +itle_;","name":"Onlywire"}, "www.plugim.com":{"url":"http://www.plugim.com/submit?url=_url_&ti +tle=_title_&trackback=","name":"PlugIM"}, "www.rawsugar.com":{"url":"http://www.rawsugar.com/pages/tagger.fa +ces?turl=_url_&tttl=_title_","name":"RawSugar"}, "www.dehsoftware.com":{"url":"http://www.dehsoftware.com/recommend +zit/submit.php?url=_url_&title=_title_&description=","name":"Recommen +dzIt"}, "scuttle.org":{"url":"http://scuttle.org/bookmarks.php/pass?action +=add&address=_url_&title=_title_","name":"Scuttle"}, "battellemedia.com":{"url":"http://battellemedia.com/searchmob/sub +mit.php?url=_url_&title=_title_","name":"SearchMob"}, "segnalo.com":{"url":"http://segnalo.com/post.html.php?url=_url_&t +itle=_title_&description=","name":"Segnalo"}, "www.shadows.com":{"url":"http://www.shadows.com/features/tcr.htm? +url=_url_&title=_title_","name":"Shadows"}, "simpy.com":{"url":"http://simpy.com/simpy/LinkAdd.do?note=_title_ +&href=_url_","name":"Simpy"}, "www.sphinn.com":{"url":"http://www.sphinn.com/submit.php?url=_url +_&title=_title_","name":"Sphinn"}, "www.spurl.net":{"url":"http://www.spurl.net/spurl.php?url=_url_&t +itle=_title_","name":"Spurl"}, "www.squidoo.com":{"url":"http://www.squidoo.com/lensmaster/bookma +rk?_url_","name":"Squidoo"}, "taggly.com":{"url":"http://taggly.com/bookmarks.php/pass?action=a +dd&address=_url_","name":"Taggly"}, "www.tagtooga.com":{"url":"http://www.tagtooga.com/tapp/db.exe?c=j +sEntryForm&b=fx&title=_title_&url=_url_","name":"tagtooga"}, "www.talkdigger.com":{"url":"http://www.talkdigger.com/index.php?s +url=_url_","name":"TalkDigger"}, "tellfriends.com":{"url":"http://tellfriends.com/topics/create?url +=_url_","name":"Tellfriends"}, "www.wink.com":{"url":"http://www.wink.com/_/tag?url=_url_&doctitl +e=_title_","name":"Wink"}, "myweb2.search.yahoo.com":{"url":"http://myweb2.search.yahoo.com/m +yresults/bookmarklet?t=_title_&u=_url_","name":"Yahoo MyWeb"}, "linkedin.com": {"url": "http://www.linkedin.com/shareArticle?mini +=true&url=_url_&title=_title_", "name": "LinkedIn"} }; function shareThisPage () { shareLinksHTML = ''; for (var i in shareLinks) { var shareName = shareLinks`[i`].name; var shareUrl = shareLinks`[i`].url.replace('_url_', window.lo +cation.href).replace('_title_', document.title); shareLinksHTML += '<a target="_blank" href="'+shareUrl+'">'+sh +areName+'</a> | '; } shareLinksHTML.replace(/ | $/, ''); document.getElementById('shareThisPage').innerHTML = shareLinksHTM +L; return false; } </script> <p id="shareThisPage"><a href="#" onclick="return shareThisPage()">Tha +nk you, I will share it!</a></p>

Kudos goes to sixtease and his project csobo for the enormous list of share links.


Comment on Re^4: Facebook 'like' button. (atypical)
Download Code
Re^5: Facebook 'like' button. (atypical)
by Corion (Pope) on Jul 16, 2011 at 13:44 UTC

    This is a very good approach, and in my limited testing it works directly when pasted into the Free Nodelet.

    Personally, I would rewrite the Javascript a bit so it adds the "Share This" links to all replies on the current page as well (with the appropriate links), but that's a small matter of XPath queries and shouldn't prevent anybody from using this.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://914576]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (16)
As of 2015-07-01 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (3 votes), past polls