integration/js/social.js
changeset 86 4857ac3892e3
parent 82 e36c35fb4468
equal deleted inserted replaced
84:0c699d2767f8 86:4857ac3892e3
     1 IriSP.social = function(opts) {
     1 (function() {
       
     2 
       
     3 var uid = 0;
       
     4 
       
     5 window.social = function(opts) {
     2     
     6     
     3     var opts = opts || {};
     7     var opts = opts || {};
     4     opts.sel = opts.sel || $(".Ldt-Social");
     8     opts.sel = opts.sel || $(".Ldt-Social");
     5     opts.url = opts.url || document.location.href;
     9     opts.url = opts.url || document.location.href;
     6     
    10     
     7     if (opts.swf) {
    11     if (opts.swf) {
     8         ZeroClipboard.setMoviePath(opts.swf);
    12         ZeroClipboard.setMoviePath(opts.swf);
     9     }
    13     }
    10     
    14     
    11     var text = opts.sel.find("title").text(),
    15     var text = opts.sel.find("title").text(),
    12         clipId = IriSP.Model.getUID(),
    16         clipId = "Social-Clip-" + (++uid),
    13         clip;
    17         clip;
    14 
    18 
    15     opts.sel.find(".Ldt-Social-CopyBtn").attr("id", clipId);
    19     opts.sel.find(".Ldt-Social-CopyBtn").attr("id", clipId);
    16 
    20 
    17     opts.sel.find(".Ldt-Social-Url").click(function() {
    21     opts.sel.find(".Ldt-Social-Url").click(function() {
    50     opts.sel.find(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + $.param({ u: opts.url, t: text }));
    54     opts.sel.find(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + $.param({ u: opts.url, t: text }));
    51     opts.sel.find(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + $.param({ url: opts.url, text: text }));
    55     opts.sel.find(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + $.param({ url: opts.url, text: text }));
    52     opts.sel.find(".Ldt-Social-Gplus").attr("href", "https://plus.google.com/share?" + $.param({ url: opts.url, title: text }));
    56     opts.sel.find(".Ldt-Social-Gplus").attr("href", "https://plus.google.com/share?" + $.param({ url: opts.url, title: text }));
    53     opts.sel.find(".Ldt-Social-Mail").attr("href", "mailto:?" + $.param({ subject: text, body: text + ": " + opts.url }));
    57     opts.sel.find(".Ldt-Social-Mail").attr("href", "mailto:?" + $.param({ subject: text, body: text + ": " + opts.url }));
    54 }
    58 }
    55 
    59 }());
    56 /* END social.js */
    60 /* END social.js */