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