This is a plugin MooTools which tries to retrieve slides from any user SlideShare and puts them into a badge using YQL and executing JavaScript in Open Data Table.
PHP JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Docs
Source
test
README.md
package.yml

README.md

Request.Slideshare

This is a small plugin MooTools which tries to retrieve slides from any user SlideShare using YQL and executing JavaScript in Open Data Table.

Screenshot

How to use

First you must to include the JS files in the head of your HTML document.

    #HTML
    <script type="text/javascript" src="mootools-core.js"></script>
    <script type="text/javascript" src="JSONP.js"></script>
    <script type="text/javascript" src="Request.Slideshare.js"></script>

In your JS.

   #JS
   window.addEvent('domready',function(){
     //variant 1
     var c = $('badge').get('class');
     var usernamematch = /username-(\w+)/, amountmatch = /amount-(\d+)/; 
     var username = usernamematch.exec(c);
         username = username ? username[1] : 'stoyan';  
     var amount = amountmatch.exec(c);
         amount = amount ? amount[1] : '5';  
         new Request.Slideshare(username, amount, {
             onSuccess: function(o) {
                 if(o.results[0].indexOf('<error') != -1) {
                    if(window.console){console.log(o);}
                    var r = o.results[0]; 
                    var clean = r.replace(/<\/?error[^>]*>/,' '); 
                    $('badge').set('html','<h2 class="error">'+clean+'</h2>');

                 } else {
                    $('bd').setStyle('height','auto');
                    if(window.console){console.log(o);}
                    $('badge').set('html',o.results[0]);
                    $('badge').fade('hide'); 
                    $('badge').fade(1);
                 }
             },
             onRequest: function(script){
               var span = new Element('span',{'class': 'loading'}).set('text','Loading...').inject($('badge'));
             }  
        }).send();

  //variant 2
  //you can write less; called this method
  $('badge2').loadSlideshare('thinkphp', 10);

});

In your HTML.

   #HTML
   <div id="badge" class="username-stoyan amount-10"></div>       
   <div id="badge2"></div>       

Notes:

You can view in action:

Requirements:

  • MooTools Core 1.3
  • MooTools More (Request.JSONP)