src/widgets/Social.js
changeset 982 cfcbac34d020
parent 927 977a39c4ee80
child 993 a7efd386872a
equal deleted inserted replaced
981:982d2226771c 982:cfcbac34d020
    18 }
    18 }
    19 
    19 
    20 IriSP.Widgets.Social.prototype.template =
    20 IriSP.Widgets.Social.prototype.template =
    21     '<span class="Ldt-Social">{{#show_url}}<div class="Ldt-Social-Url-Container"><a href="#" target="_blank" class="Ldt-Social-Square Ldt-Social-Url Ldt-TraceMe" title="{{l10n.share_link}}">'
    21     '<span class="Ldt-Social">{{#show_url}}<div class="Ldt-Social-Url-Container"><a href="#" target="_blank" class="Ldt-Social-Square Ldt-Social-Url Ldt-TraceMe" title="{{l10n.share_link}}">'
    22     + '</a><div class="Ldt-Social-UrlPop"><input class="Ldt-Social-Input"/><div class="Ldt-Social-CopyBtn">{{l10n.copy}}</div></div></div>{{/show_url}}'
    22     + '</a><div class="Ldt-Social-UrlPop"><input class="Ldt-Social-Input"/><div class="Ldt-Social-CopyBtn">{{l10n.copy}}</div></div></div>{{/show_url}}'
    23     + '{{#show_fb}}<a href="#" target="_blank" class="Ldt-Social-Fb Ldt-TraceMe" title="{{l10n.share_on}} Facebook"></a>{{/show_fb}}'
    23     + '{{#show_fb}}<a href="#" target="_blank" class="Ldt-Social-Fb Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Facebook"></a>{{/show_fb}}'
    24     + '{{#show_twitter}}<a href="#" target="_blank" class="Ldt-Social-Twitter Ldt-TraceMe" title="{{l10n.share_on}} Twitter"></a>{{/show_twitter}}'
    24     + '{{#show_twitter}}<a href="#" target="_blank" class="Ldt-Social-Twitter Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Twitter"></a>{{/show_twitter}}'
    25     + '{{#show_gplus}}<a href="#" target="_blank" class="Ldt-Social-Gplus Ldt-TraceMe" title="{{l10n.share_on}} Google+"></a>{{/show_gplus}}'
    25     + '{{#show_gplus}}<a href="#" target="_blank" class="Ldt-Social-Gplus Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Google+"></a>{{/show_gplus}}'
    26     + '{{#show_mail}}<a href="#" target="_blank" class="Ldt-Social-Mail Ldt-TraceMe" title="{{l10n.share_mail}}"></a>{{/show_mail}}</span>';
    26     + '{{#show_mail}}<a href="#" target="_blank" class="Ldt-Social-Mail Ldt-TraceMe" title="{{l10n.share_mail}}"></a>{{/show_mail}}</span>';
    27 
    27 
    28 IriSP.Widgets.Social.prototype.messages = {
    28 IriSP.Widgets.Social.prototype.messages = {
    29     "fr": {
    29     "fr": {
    30         share_on: "Partager sur",
    30         share_on: "Partager sur",
    49         _this.toggleCopy();
    49         _this.toggleCopy();
    50         return false;
    50         return false;
    51     });
    51     });
    52     this.$.find(".Ldt-Social-Input").focus(function() {
    52     this.$.find(".Ldt-Social-Input").focus(function() {
    53         this.select();
    53         this.select();
       
    54     });
       
    55     this.$.find(".Ldt-Social-Ext").click(function() {
       
    56         window.open(
       
    57             IriSP.jQuery(this).attr("href"),
       
    58             "_blank",
       
    59             "height=300,width=450,left=100,top=100,toolbar=0,menubar=0,status=0,location=0");
       
    60         return false;
    54     });
    61     });
    55     this.updateUrls(this.url, this.text);
    62     this.updateUrls(this.url, this.text);
    56 }
    63 }
    57 
    64 
    58 IriSP.Widgets.Social.prototype.toggleCopy = function() {
    65 IriSP.Widgets.Social.prototype.toggleCopy = function() {
    80 IriSP.Widgets.Social.prototype.updateUrls = function(_url, _text) {
    87 IriSP.Widgets.Social.prototype.updateUrls = function(_url, _text) {
    81     this.url = _url;
    88     this.url = _url;
    82     this.text = _text;
    89     this.text = _text;
    83     this.$.find(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + IriSP.jQuery.param({ u: _url, t: _text }));
    90     this.$.find(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + IriSP.jQuery.param({ u: _url, t: _text }));
    84     this.$.find(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + IriSP.jQuery.param({ url: _url, text: _text }));
    91     this.$.find(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + IriSP.jQuery.param({ url: _url, text: _text }));
    85     this.$.find(".Ldt-Social-Gplus").attr("href", "https://plusone.google.com/_/+1/confirm?" + IriSP.jQuery.param({ url: _url, title: _text }));
    92     this.$.find(".Ldt-Social-Gplus").attr("href", "https://plus.google.com/share?" + IriSP.jQuery.param({ url: _url, title: _text }));
    86     this.$.find(".Ldt-Social-Mail").attr("href", "mailto:?" + IriSP.jQuery.param({ subject: _text, body: _text + ": " + _url }));
    93     this.$.find(".Ldt-Social-Mail").attr("href", "mailto:?" + IriSP.jQuery.param({ subject: _text, body: _text + ": " + _url }));
    87 }
    94 }