integration/js/common.js
changeset 91 a94f5c62e4d7
parent 24 1fbf7d835dc2
child 104 1b84c7b2aeee
equal deleted inserted replaced
90:1a78608617aa 91:a94f5c62e4d7
    10         }
    10         }
    11         return false;
    11         return false;
    12     });
    12     });
    13     
    13     
    14     $(".change-account").click(function() {
    14     $(".change-account").click(function() {
    15         $(".user").hide();
    15         $(".user-screen").hide();
    16         $(".user.login").show();
    16         $(".user-screen.login").show();
    17     });
    17     });
    18     $(".signup-button").click(function() {
    18     $(".signup-button").click(function() {
    19         $(".user").hide();
    19         $(".user-screen").hide();
    20         $(".user.signup").show();
    20         $(".user-screen.signup").show();
    21     });
    21     });
    22     $(".login-form, .signup-form").submit(function() {
    22     $(".login-form, .signup-form").submit(function() {
    23         $(".user").hide();
    23         $(".user").hide();
       
    24         $(".user-screen").hide();
       
    25         $(".user-screen.info").show();
    24     });
    26     });
    25 
    27 
    26 });
    28 });
       
    29 
       
    30 // Social Plug-in
       
    31 
       
    32 (function() {
       
    33 
       
    34 var uid = 0;
       
    35 
       
    36 window.social = function(opts) {
       
    37     
       
    38     var opts = opts || {};
       
    39     opts.sel = opts.sel || $(".Ldt-Social");
       
    40     opts.url = opts.url || document.location.href;
       
    41     
       
    42     if (opts.swf) {
       
    43         ZeroClipboard.setMoviePath(opts.swf);
       
    44     }
       
    45     
       
    46     var text = opts.sel.find("title").text(),
       
    47         clipId = "Social-Clip-" + (++uid),
       
    48         clip;
       
    49 
       
    50     opts.sel.find(".Ldt-Social-CopyBtn").attr("id", clipId);
       
    51 
       
    52     opts.sel.find(".Ldt-Social-Url").click(function() {
       
    53         var _pop = opts.sel.find(".Ldt-Social-UrlPop");
       
    54         _pop.toggle();
       
    55         if (_pop.is(":visible")) {
       
    56             if (typeof clip == "undefined") {
       
    57                 clip = new ZeroClipboard.Client();
       
    58                 clip.setHandCursor( true );
       
    59                 clip.glue(clipId);
       
    60                 
       
    61                 clip.addEventListener( 'onMouseUp', function() {
       
    62                     _pop.hide();
       
    63                     clip.hide();
       
    64                 });
       
    65             }
       
    66             clip.show();
       
    67             clip.setText( opts.url );
       
    68             opts.sel.find(".Ldt-Social-Input").val(opts.url).focus();
       
    69         } else {
       
    70             clip.hide();
       
    71         }
       
    72         return false;
       
    73     });
       
    74     opts.sel.find(".Ldt-Social-Input").focus(function() {
       
    75         this.select();
       
    76     });
       
    77     opts.sel.find(".Ldt-Social-Ext").click(function() {
       
    78         window.open(
       
    79             opts.sel.find(this).attr("href"),
       
    80             "_blank",
       
    81             "height=300,width=450,left=100,top=100,toolbar=0,menubar=0,status=0,location=0");
       
    82         return false;
       
    83     });
       
    84     
       
    85     opts.sel.find(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + $.param({ u: opts.url, t: text }));
       
    86     opts.sel.find(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + $.param({ url: opts.url, text: text }));
       
    87     opts.sel.find(".Ldt-Social-Gplus").attr("href", "https://plus.google.com/share?" + $.param({ url: opts.url, title: text }));
       
    88     opts.sel.find(".Ldt-Social-Mail").attr("href", "mailto:?" + $.param({ subject: text, body: text + ": " + opts.url }));
       
    89 }
       
    90 }());