source: OpenRLabs-Git/deploy/rlabs-docker/web2py-rlabs/applications/admin/static/js/share.js

main
Last change on this file was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100755
File size: 2.6 KB
Line 
1/**
2
3   Created and copyrighted by Massimo Di Pierro <massimo.dipierro@gmail.com>
4   (MIT license) 
5
6   Example:
7
8   <script src="share.js"></script>
9
10**/
11
12jQuery(function(){
13        var script_source = jQuery('script[src*="share.js"]').attr('src');
14        var params = function(name,default_value) {
15            var match = RegExp('[?&]' + name + '=([^&]*)').exec(script_source);
16            return match && decodeURIComponent(match[1].replace(/\+/g, ' '))||default_value;
17        }
18        var path = params('static','social');
19        var url = encodeURIComponent(window.location.href);
20        var host =  window.location.hostname;
21        var title = escape(jQuery('title').text());
22        var twit = 'http://twitter.com/home?status='+title+'%20'+url;
23        var facebook = 'http://www.facebook.com/sharer.php?u='+url;
24        var gplus = 'https://plus.google.com/share?url='+url;
25        var tbar = '<div id="socialdrawer"><span>Share<br/></span><div id="sicons"><a href="'+twit+'" id="twit" title="Share on twitter"><img src="'+path+'/twitter.png"  alt="Share on Twitter" width="32" height="32" /></a><a href="'+facebook+'" id="facebook" title="Share on Facebook"><img src="'+path+'/facebook.png"  alt="Share on facebook" width="32" height="32" /></a><a href="'+gplus+'" id="gplus" title="Share on Google Plus"><img src="'+path+'/gplus-32.png"  alt="Share on Google Plus" width="32" height="32" /></a></div></div>';       
26        // Add the share tool bar.
27        jQuery('body').append(tbar);
28        var st = jQuery('#socialdrawer');
29        st.css({'opacity':'.7','z-index':'3000','background':'#FFF','border':'solid 1px #666','border-width':' 1px 0 0 1px','height':'20px','width':'40px','position':'fixed','bottom':'0','right':'0','padding':'2px 5px','overflow':'hidden','-webkit-border-top-left-radius':' 12px','-moz-border-radius-topleft':' 12px','border-top-left-radius':' 12px','-moz-box-shadow':' -3px -3px 3px rgba(0,0,0,0.5)','-webkit-box-shadow':' -3px -3px 3px rgba(0,0,0,0.5)','box-shadow':' -3px -3px 3px rgba(0,0,0,0.5)'});
30        jQuery('#socialdrawer a').css({'float':'left','width':'32px','margin':'3px 2px 2px 2px','padding':'0','cursor':'pointer'});
31        jQuery('#socialdrawer span').css({'float':'left','margin':'2px 3px','text-shadow':' 1px 1px 1px #FFF','color':'#444','font-size':'12px','line-height':'1em'});
32        jQuery('#socialdrawer img').hide();
33        // hover
34        st.click(function(){
35                jQuery(this).animate({height:'40px', width:'160px', opacity: 0.95}, 300);
36                jQuery('#socialdrawer img').show();
37            });
38        //leave
39        st.mouseleave(function(){
40            st.animate({height:'20px', width: '40px', opacity: .7}, 300);
41            jQuery('#socialdrawer img').hide();
42            return false;
43            }  );
44    });
Note: See TracBrowser for help on using the repository browser.