Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Patrick http://www.hunlock.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Broadcasting DZONE Shares

// This snippet will allow you to show your DZONE shares
// on your web page. Visit your shares page, click on the "feed" link
// to get the URL of your personal shares feed then paste it in the first line
// in the script.

   1  
   2  var sharedURL='';  // Place your url between the quotes.
   3  
   4  function getFeed(url, callback) {
   5     var newScript = document.createElement('script');
   6         newScript.type = 'text/javascript';
   7         newScript.src = 'http://pipes.yahoo.com/pipes/9oyONQzA2xGOkM4FqGIyXQ/run?&_render=JSON&_callback='+callback+'&feed=' + sharedURL;
   8     document.getElementsByTagName("head")[0].appendChild(newScript);
   9  }
  10  
  11  function dzone(feed) {
  12     var tmp='';
  13     for (var i=0; i<feed.value.items.length; i++) {
  14        tmp+='<a href="'+feed.value.items[i].link+'" rel="nofollow">';
  15        tmp+=feed.value.items[i].title+'</a><br>';
  16     }
  17     document.getElementById('dzoneLinks').innerHTML=tmp;
  18  }
  19  
  20  getFeed(sharedURL, 'dzone');


// Paste that code at the end of your page. In your HTML place the following two divisions
// where you would like your feed to appear. (feel free to style the divisions however you wish)
// you can add to/subtract from the outer division but the inner division will always be overwritten
// with your shares.

   1  
   2  <div id='dzoneLayer'>
   3  My DZONE Recommendations
   4     <div id='dzoneLinks'>
   5     </div>
   6  </div>

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS