Request.Slideshare v1.0

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



Details

Author
Adrian Statescu
Current version
v1.0
GitHub
thinkphp/mooRequestSlideshare
Downloads
1853
Category
Widgets
Tags
Report
GitHub Issues

Releases


Dependencies

  • _self_/_current_:
    • Core/Element
    • Core/Request
    • /Log
  • core/1.3: *
  • more/1.2.4.4: Request.JSONP

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)

Discuss

A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.

Found a bug in this plugin? Please report it this repository's Github Issues.

blog comments powered by Disqus