integration/js/common.js
author veltr
Tue, 04 Dec 2012 18:59:07 +0100
changeset 104 1b84c7b2aeee
parent 91 a94f5c62e4d7
child 115 e48bb5d43ac2
permissions -rw-r--r--
Added Translations
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15
56937307d7f4 cleaning css
veltr
parents:
diff changeset
     1
$(function(){
56937307d7f4 cleaning css
veltr
parents:
diff changeset
     2
56937307d7f4 cleaning css
veltr
parents:
diff changeset
     3
    $(".open-popin").click(function(){
56937307d7f4 cleaning css
veltr
parents:
diff changeset
     4
        var target = $(this).attr("href");
56937307d7f4 cleaning css
veltr
parents:
diff changeset
     5
        if($(target).is(':visible')){
16
7536b92a7775 a few changes before a merge
veltr
parents: 15
diff changeset
     6
            $(".popin").hide();
15
56937307d7f4 cleaning css
veltr
parents:
diff changeset
     7
        }else{
16
7536b92a7775 a few changes before a merge
veltr
parents: 15
diff changeset
     8
            $(".popin").hide();
15
56937307d7f4 cleaning css
veltr
parents:
diff changeset
     9
            $(target).show();
56937307d7f4 cleaning css
veltr
parents:
diff changeset
    10
        }
56937307d7f4 cleaning css
veltr
parents:
diff changeset
    11
        return false;
56937307d7f4 cleaning css
veltr
parents:
diff changeset
    12
    });
56937307d7f4 cleaning css
veltr
parents:
diff changeset
    13
    
56937307d7f4 cleaning css
veltr
parents:
diff changeset
    14
    $(".change-account").click(function() {
91
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    15
        $(".user-screen").hide();
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    16
        $(".user-screen.login").show();
15
56937307d7f4 cleaning css
veltr
parents:
diff changeset
    17
    });
56937307d7f4 cleaning css
veltr
parents:
diff changeset
    18
    $(".signup-button").click(function() {
91
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    19
        $(".user-screen").hide();
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    20
        $(".user-screen.signup").show();
15
56937307d7f4 cleaning css
veltr
parents:
diff changeset
    21
    });
16
7536b92a7775 a few changes before a merge
veltr
parents: 15
diff changeset
    22
    $(".login-form, .signup-form").submit(function() {
7536b92a7775 a few changes before a merge
veltr
parents: 15
diff changeset
    23
        $(".user").hide();
91
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    24
        $(".user-screen").hide();
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    25
        $(".user-screen.info").show();
16
7536b92a7775 a few changes before a merge
veltr
parents: 15
diff changeset
    26
    });
24
1fbf7d835dc2 - update segment and bg video list
Anthony Ly <anthonyly.com@gmail.com>
parents: 16
diff changeset
    27
91
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    28
});
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    29
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    30
// Social Plug-in
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    31
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    32
(function() {
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    33
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    34
var uid = 0;
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    35
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    36
window.social = function(opts) {
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    37
    
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    38
    var opts = opts || {};
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    39
    opts.sel = opts.sel || $(".Ldt-Social");
104
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    40
    opts.url = opts.url || document.location.href
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    41
    opts.text = opts.text || $("title").text();
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    42
    
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    43
    if (!opts.sel.length) {
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    44
        return;
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    45
    }
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    46
    
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    47
    opts.sel.addClass("Ldt-Social");
91
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    48
    
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    49
    if (opts.swf) {
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    50
        ZeroClipboard.setMoviePath(opts.swf);
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    51
    }
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    52
    
104
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    53
    var clipId = "Social-Clip-" + (++uid),
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    54
        clip,
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    55
        html = '<div class="Ldt-Social-Url-Container"><a href="#" target="_blank" class="Ldt-Social-Square Ldt-Social-Url" title="'
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    56
            + gettext("Share URL")
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    57
            + '"></a><span class="Ldt-Social-UrlPop"><input class="Ldt-Social-Input"/><div class="Ldt-Social-CopyBtn" id="'
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    58
            + clipId
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    59
            + '">'
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    60
            + gettext("Copy")
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    61
            + '</div></span></div><a href="http://www.facebook.com/share.php?'
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    62
            + $.param({ u: opts.url, t: opts.text })
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    63
            + '" target="_blank" class="Ldt-Social-Fb Ldt-Social-Ext" title="'
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    64
            + gettext("Share on Facebook")
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    65
            + '"></a><a href="https://twitter.com/intent/tweet?'
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    66
            + $.param({ url: opts.url, text: opts.text })
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    67
            + '" target="_blank" class="Ldt-Social-Twitter Ldt-Social-Ext" title="'
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    68
            + gettext("Share on Twitter")
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    69
            + '"></a><a href="https://plus.google.com/share?'
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    70
            + $.param({ url: opts.url, title: opts.text })
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    71
            + '" target="_blank" class="Ldt-Social-Gplus Ldt-Social-Ext" title="'
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    72
            + gettext("Share on Google+")
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    73
            + '"></a><a href="mailto:?'
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    74
            + $.param({ subject: opts.text, body: opts.text + ": " + opts.url })
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    75
            + '" target="_blank" class="Ldt-Social-Mail" title="'
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    76
            + gettext("Share via E-Mail")
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    77
            + '"></a></div>';
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    78
            
1b84c7b2aeee Added Translations
veltr
parents: 91
diff changeset
    79
    opts.sel.html(html);
91
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    80
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    81
    opts.sel.find(".Ldt-Social-Url").click(function() {
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    82
        var _pop = opts.sel.find(".Ldt-Social-UrlPop");
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    83
        _pop.toggle();
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    84
        if (_pop.is(":visible")) {
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    85
            if (typeof clip == "undefined") {
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    86
                clip = new ZeroClipboard.Client();
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    87
                clip.setHandCursor( true );
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    88
                clip.glue(clipId);
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    89
                
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    90
                clip.addEventListener( 'onMouseUp', function() {
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    91
                    _pop.hide();
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    92
                    clip.hide();
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    93
                });
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    94
            }
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    95
            clip.show();
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    96
            clip.setText( opts.url );
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    97
            opts.sel.find(".Ldt-Social-Input").val(opts.url).focus();
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    98
        } else {
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
    99
            clip.hide();
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   100
        }
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   101
        return false;
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   102
    });
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   103
    opts.sel.find(".Ldt-Social-Input").focus(function() {
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   104
        this.select();
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   105
    });
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   106
    opts.sel.find(".Ldt-Social-Ext").click(function() {
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   107
        window.open(
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   108
            opts.sel.find(this).attr("href"),
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   109
            "_blank",
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   110
            "height=300,width=450,left=100,top=100,toolbar=0,menubar=0,status=0,location=0");
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   111
        return false;
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   112
    });
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   113
}
a94f5c62e4d7 unified templates + modified login form popin
veltr
parents: 24
diff changeset
   114
}());