integration/js/social.js
changeset 43 5a5024bc74e6
child 49 a21b851538b2
equal deleted inserted replaced
42:40909e8d6855 43:5a5024bc74e6
       
     1 $(function() {
       
     2     
       
     3     var url = document.location.href,
       
     4         text = $("title").text(),
       
     5         clipId = IriSP.Model.getUID(),
       
     6         clip;
       
     7 
       
     8     $(".Ldt-Social-CopyBtn").attr("id", this.clipId);
       
     9 
       
    10     $(".Ldt-Social-Url").click(function() {
       
    11         var _pop = $(".Ldt-Social-UrlPop");
       
    12         _pop.toggle();
       
    13         if (_pop.is(":visible")) {
       
    14             if (typeof clip == "undefined") {
       
    15                 clip = new ZeroClipboard.Client();
       
    16                 clip.setHandCursor( true );
       
    17                 clip.glue(clipId);
       
    18                 
       
    19                 clip.addEventListener( 'onMouseUp', function() {
       
    20                     _pop.hide();
       
    21                     clip.hide();
       
    22                 });
       
    23             }
       
    24             clip.show();
       
    25             clip.setText( url );
       
    26             $(".Ldt-Social-Input").val(url).focus();
       
    27         } else {
       
    28             clip.hide();
       
    29         }
       
    30         return false;
       
    31     });
       
    32     $(".Ldt-Social-Input").focus(function() {
       
    33         this.select();
       
    34     });
       
    35     $(".Ldt-Social-Ext").click(function() {
       
    36         window.open(
       
    37             $(this).attr("href"),
       
    38             "_blank",
       
    39             "height=300,width=450,left=100,top=100,toolbar=0,menubar=0,status=0,location=0");
       
    40         return false;
       
    41     });
       
    42     
       
    43     $(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + $.param({ u: url, t: text }));
       
    44     $(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + $.param({ url: url, text: text }));
       
    45     $(".Ldt-Social-Gplus").attr("href", "https://plus.google.com/share?" + $.param({ url: url, title: text }));
       
    46     $(".Ldt-Social-Mail").attr("href", "mailto:?" + $.param({ subject: text, body: text + ": " + url }));
       
    47 });