equal
deleted
inserted
replaced
1 // TODO: Open share links in a small window |
1 // TODO: Open share links in a small window |
2 |
2 |
3 IriSP.Widgets.Social = function(player, config) { |
3 IriSP.Widgets.Social = function(player, config) { |
4 IriSP.Widgets.Widget.call(this, player, config); |
4 IriSP.Widgets.Widget.call(this, player, config); |
5 ZeroClipboard.setMoviePath( IriSP.getLib('zeroClipboardSwf') ); |
|
6 }; |
5 }; |
7 |
6 |
8 IriSP.Widgets.Social.prototype = new IriSP.Widgets.Widget(); |
7 IriSP.Widgets.Social.prototype = new IriSP.Widgets.Widget(); |
9 |
8 |
10 IriSP.Widgets.Social.prototype.defaults = { |
9 IriSP.Widgets.Social.prototype.defaults = { |
17 show_mail: true |
16 show_mail: true |
18 }; |
17 }; |
19 |
18 |
20 IriSP.Widgets.Social.prototype.template = |
19 IriSP.Widgets.Social.prototype.template = |
21 '<span class="Ldt-Social">{{#show_url}}<div class="Ldt-Social-Url-Container"><a href="#" draggable="true" target="_blank" class="Ldt-Social-Square Ldt-Social-Url Ldt-TraceMe" title="{{l10n.share_link}}">' |
20 '<span class="Ldt-Social">{{#show_url}}<div class="Ldt-Social-Url-Container"><a href="#" draggable="true" 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}}' |
21 + '</a><div class="Ldt-Social-UrlPop"><input class="Ldt-Social-Input"/></div></div>{{/show_url}}' |
23 + '{{#show_fb}}<a href="#" target="_blank" class="Ldt-Social-Fb Ldt-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Facebook"></a>{{/show_fb}}' |
22 + '{{#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-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Twitter"></a>{{/show_twitter}}' |
23 + '{{#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-Social-Ext Ldt-TraceMe" title="{{l10n.share_on}} Google+"></a>{{/show_gplus}}' |
24 + '{{#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>'; |
25 + '{{#show_mail}}<a href="#" target="_blank" class="Ldt-Social-Mail Ldt-TraceMe" title="{{l10n.share_mail}}"></a>{{/show_mail}}</span>'; |
27 |
26 |
66 }; |
65 }; |
67 |
66 |
68 IriSP.Widgets.Social.prototype.toggleCopy = function() { |
67 IriSP.Widgets.Social.prototype.toggleCopy = function() { |
69 var _pop = this.$.find(".Ldt-Social-UrlPop"); |
68 var _pop = this.$.find(".Ldt-Social-UrlPop"); |
70 _pop.toggle(); |
69 _pop.toggle(); |
71 if (_pop.is(":visible")) { |
70 this.$.find(".Ldt-Social-Input").val(this.url).focus(); |
72 if (typeof this.clip == "undefined") { |
|
73 this.clip = new ZeroClipboard.Client(); |
|
74 this.clip.setHandCursor( true ); |
|
75 this.clip.glue(this.clipId); |
|
76 var _this = this; |
|
77 this.clip.addEventListener( 'onMouseUp', function() { |
|
78 _pop.hide(); |
|
79 _this.clip.hide(); |
|
80 }); |
|
81 } |
|
82 this.clip.show(); |
|
83 this.clip.setText( this.url ); |
|
84 this.$.find(".Ldt-Social-Input").val(this.url).focus(); |
|
85 } else { |
|
86 this.clip.hide(); |
|
87 } |
|
88 }; |
71 }; |
89 |
72 |
90 IriSP.Widgets.Social.prototype.updateUrls = function(_url, _text) { |
73 IriSP.Widgets.Social.prototype.updateUrls = function(_url, _text) { |
91 this.url = _url; |
74 this.url = _url; |
92 this.text = _text; |
75 this.text = _text; |