integration/js/common.js
changeset 91 a94f5c62e4d7
parent 24 1fbf7d835dc2
child 104 1b84c7b2aeee
--- a/integration/js/common.js	Sat Dec 01 23:48:11 2012 +0100
+++ b/integration/js/common.js	Mon Dec 03 13:06:28 2012 +0100
@@ -12,15 +12,79 @@
     });
     
     $(".change-account").click(function() {
-        $(".user").hide();
-        $(".user.login").show();
+        $(".user-screen").hide();
+        $(".user-screen.login").show();
     });
     $(".signup-button").click(function() {
-        $(".user").hide();
-        $(".user.signup").show();
+        $(".user-screen").hide();
+        $(".user-screen.signup").show();
     });
     $(".login-form, .signup-form").submit(function() {
         $(".user").hide();
+        $(".user-screen").hide();
+        $(".user-screen.info").show();
     });
 
-});
\ No newline at end of file
+});
+
+// Social Plug-in
+
+(function() {
+
+var uid = 0;
+
+window.social = function(opts) {
+    
+    var opts = opts || {};
+    opts.sel = opts.sel || $(".Ldt-Social");
+    opts.url = opts.url || document.location.href;
+    
+    if (opts.swf) {
+        ZeroClipboard.setMoviePath(opts.swf);
+    }
+    
+    var text = opts.sel.find("title").text(),
+        clipId = "Social-Clip-" + (++uid),
+        clip;
+
+    opts.sel.find(".Ldt-Social-CopyBtn").attr("id", clipId);
+
+    opts.sel.find(".Ldt-Social-Url").click(function() {
+        var _pop = opts.sel.find(".Ldt-Social-UrlPop");
+        _pop.toggle();
+        if (_pop.is(":visible")) {
+            if (typeof clip == "undefined") {
+                clip = new ZeroClipboard.Client();
+                clip.setHandCursor( true );
+                clip.glue(clipId);
+                
+                clip.addEventListener( 'onMouseUp', function() {
+                    _pop.hide();
+                    clip.hide();
+                });
+            }
+            clip.show();
+            clip.setText( opts.url );
+            opts.sel.find(".Ldt-Social-Input").val(opts.url).focus();
+        } else {
+            clip.hide();
+        }
+        return false;
+    });
+    opts.sel.find(".Ldt-Social-Input").focus(function() {
+        this.select();
+    });
+    opts.sel.find(".Ldt-Social-Ext").click(function() {
+        window.open(
+            opts.sel.find(this).attr("href"),
+            "_blank",
+            "height=300,width=450,left=100,top=100,toolbar=0,menubar=0,status=0,location=0");
+        return false;
+    });
+    
+    opts.sel.find(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + $.param({ u: opts.url, t: text }));
+    opts.sel.find(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + $.param({ url: opts.url, text: text }));
+    opts.sel.find(".Ldt-Social-Gplus").attr("href", "https://plus.google.com/share?" + $.param({ url: opts.url, title: text }));
+    opts.sel.find(".Ldt-Social-Mail").attr("href", "mailto:?" + $.param({ subject: text, body: text + ": " + opts.url }));
+}
+}());
\ No newline at end of file