9 |
9 |
10 IriSP.Widgets.Annotation.prototype = new IriSP.Widgets.Widget(); |
10 IriSP.Widgets.Annotation.prototype = new IriSP.Widgets.Widget(); |
11 |
11 |
12 IriSP.Widgets.Annotation.prototype.messages = { |
12 IriSP.Widgets.Annotation.prototype.messages = { |
13 fr: { |
13 fr: { |
14 share_: "Partager :", |
|
15 share_on: "Partager sur", |
|
16 watching: "Je regarde ", |
14 watching: "Je regarde ", |
17 on_site: " sur ", |
15 on_site: " sur ", |
18 tags_: "Mots-clés :", |
16 tags_: "Mots-clés :", |
19 description_: "Description :", |
17 description_: "Description :", |
20 excerpt_from: "Extrait de :" |
18 excerpt_from: "Extrait de :" |
21 }, |
19 }, |
22 en: { |
20 en: { |
23 share_: "Share:", |
|
24 share_on: "Share on", |
|
25 watching: "I'm watching ", |
21 watching: "I'm watching ", |
26 on_site: " on ", |
22 on_site: " on ", |
27 tags_: "Keywords:", |
23 tags_: "Keywords:", |
28 description_: "Description:", |
24 description_: "Description:", |
29 excerpt_from: "Excerpt from:" |
25 excerpt_from: "Excerpt from:" |
32 |
28 |
33 IriSP.Widgets.Annotation.prototype.template = |
29 IriSP.Widgets.Annotation.prototype.template = |
34 '<div class="Ldt-Annotation-Widget {{#show_top_border}}Ldt-Annotation-ShowTop{{/show_top_border}}">' |
30 '<div class="Ldt-Annotation-Widget {{#show_top_border}}Ldt-Annotation-ShowTop{{/show_top_border}}">' |
35 + '<div class="Ldt-Annotation-Inner Ldt-Annotation-Empty{{#start_minimized}} Ldt-Annotation-Minimized{{/start_minimized}}">' |
31 + '<div class="Ldt-Annotation-Inner Ldt-Annotation-Empty{{#start_minimized}} Ldt-Annotation-Minimized{{/start_minimized}}">' |
36 + '<div class="Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-MaxMinButton"></div>' |
32 + '<div class="Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-MaxMinButton"></div>' |
|
33 + '<div class="Ldt-Annotation-Social Ldt-Annotation-HiddenWhenMinimized"></div>' |
37 + '<h3 class="Ldt-Annotation-HiddenWhenEmpty"><span class="Ldt-Annotation-Title"></span> <span class="Ldt-Annotation-Time">' |
34 + '<h3 class="Ldt-Annotation-HiddenWhenEmpty"><span class="Ldt-Annotation-Title"></span> <span class="Ldt-Annotation-Time">' |
38 + '( <span class="Ldt-Annotation-Begin"></span> - <span class="Ldt-Annotation-End"></span> )</span></h3>' |
35 + '( <span class="Ldt-Annotation-Begin"></span> - <span class="Ldt-Annotation-End"></span> )</span></h3>' |
39 + '<h3 class="Ldt-Annotation-MashupOrigin Ldt-Annotation-HiddenWhenEmpty">{{l10n.excerpt_from}} <span class="Ldt-Annotation-MashupMedia"></span> <span class="Ldt-Annotation-Time">' |
36 + '<h3 class="Ldt-Annotation-MashupOrigin Ldt-Annotation-HiddenWhenEmpty">{{l10n.excerpt_from}} <span class="Ldt-Annotation-MashupMedia"></span> <span class="Ldt-Annotation-Time">' |
40 + '( <span class="Ldt-Annotation-MashupBegin"></span> - <span class="Ldt-Annotation-MashupEnd"></span> )</span></h3>' |
37 + '( <span class="Ldt-Annotation-MashupBegin"></span> - <span class="Ldt-Annotation-MashupEnd"></span> )</span></h3>' |
41 + '<div class="Ldt-Annotation-Cleared Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-Description-Block"><div class="Ldt-Annotation-Label">{{l10n.description_}}</div>' |
38 + '<div class="Ldt-Annotation-Cleared Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-Description-Block"><div class="Ldt-Annotation-Label">{{l10n.description_}}</div>' |
42 + '<p class="Ldt-Annotation-Labelled Ldt-Annotation-Description"></p></div>' |
39 + '<p class="Ldt-Annotation-Labelled Ldt-Annotation-Description"></p></div>' |
43 + '<div class="Ldt-Annotation-Tags-Block Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-Cleared">' |
40 + '<div class="Ldt-Annotation-Tags-Block Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty Ldt-Annotation-Cleared">' |
44 + '<div class="Ldt-Annotation-Label">{{l10n.tags_}}</div><ul class="Ldt-Annotation-Labelled Ldt-Annotation-Tags"></ul>' |
41 + '<div class="Ldt-Annotation-Label">{{l10n.tags_}}</div><ul class="Ldt-Annotation-Labelled Ldt-Annotation-Tags"></ul>' |
45 + '</div><div class="Ldt-Annotation-Cleared Ldt-Annotation-HiddenWhenMinimized Ldt-Annotation-HiddenWhenEmpty"><div class="Ldt-Annotation-Label">{{l10n.share_}}</div><p class="Ldt-Annotation-Labelled">' |
42 + '</div></div></div></div>'; |
46 + '<a href="#" target="_blank" class="Ldt-Annotation-Share Ldt-Annotation-Fb Ldt-TraceMe" title="{{l10n.share_on}} Facebook"></a>' |
|
47 + '<a href="#" target="_blank" class="Ldt-Annotation-Share Ldt-Annotation-Twitter Ldt-TraceMe" title="{{l10n.share_on}} Twitter"></a>' |
|
48 + '<a href="#" target="_blank" class="Ldt-Annotation-Share Ldt-Annotation-Gplus Ldt-TraceMe" title="{{l10n.share_on}} Google+"></a>' |
|
49 + '</p></div></div></div></div>'; |
|
50 |
43 |
51 IriSP.Widgets.Annotation.prototype.defaults = { |
44 IriSP.Widgets.Annotation.prototype.defaults = { |
52 annotation_type : "chap", |
45 annotation_type : "chap", |
53 start_minimized: false, |
46 start_minimized: true, |
54 show_top_border : false, |
47 show_top_border : false, |
55 site_name : "Lignes de Temps" |
48 site_name : "Lignes de Temps" |
56 } |
49 } |
57 |
50 |
58 IriSP.Widgets.Annotation.prototype.draw = function() { |
51 IriSP.Widgets.Annotation.prototype.draw = function() { |
59 this.renderTemplate(); |
52 this.renderTemplate(); |
|
53 this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), "socialWidget", { type: "Social" }); |
60 this.bindPopcorn("timeupdate","onTimeupdate"); |
54 this.bindPopcorn("timeupdate","onTimeupdate"); |
61 this.bindPopcorn("IriSP.Annotation.hide","hide"); |
55 this.bindPopcorn("IriSP.Annotation.hide","hide"); |
62 this.bindPopcorn("IriSP.Annotation.show","show"); |
56 this.bindPopcorn("IriSP.Annotation.show","show"); |
63 this.bindPopcorn("IriSP.Annotation.minimize","minimize"); |
57 this.bindPopcorn("IriSP.Annotation.minimize","minimize"); |
64 this.bindPopcorn("IriSP.Annotation.maximize","maximize"); |
58 this.bindPopcorn("IriSP.Annotation.maximize","maximize"); |
100 if (_tags.length) { |
94 if (_tags.length) { |
101 var _html = IriSP._(_tags).map(function(_tag) { |
95 var _html = IriSP._(_tags).map(function(_tag) { |
102 return '<li class="Ldt-Annotation-TagLabel"><span>' + _tag + '</span></li>'; |
96 return '<li class="Ldt-Annotation-TagLabel"><span>' + _tag + '</span></li>'; |
103 }).join(""); |
97 }).join(""); |
104 this.$.find(".Ldt-Annotation-Tags").html(_html); |
98 this.$.find(".Ldt-Annotation-Tags").html(_html); |
105 this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-NoTags"); |
99 this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-EmptyBlock"); |
106 |
100 |
107 /* Correct the empty tag bug */ |
101 /* Correct the empty tag bug */ |
108 this.$.find('.Ldt-Annotation-TagLabel').each(function() { |
102 this.$.find('.Ldt-Annotation-TagLabel').each(function() { |
109 var _el = IriSP.jQuery(this); |
103 var _el = IriSP.jQuery(this); |
110 if (!_el.text().replace(/(^\s+|\s+$)/g,'')) { |
104 if (!_el.text().replace(/(^\s+|\s+$)/g,'')) { |
114 |
108 |
115 this.$.find('.Ldt-Annotation-TagLabel').click(function() { |
109 this.$.find('.Ldt-Annotation-TagLabel').click(function() { |
116 _this.player.popcorn.trigger("IriSP.search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); |
110 _this.player.popcorn.trigger("IriSP.search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); |
117 }); |
111 }); |
118 } else { |
112 } else { |
119 this.$.find(".Ldt-Annotation-Tags-Block").hide(); |
113 this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-EmptyBlock"); |
120 } |
114 } |
121 this.$.find(".Ldt-Annotation-Title").html(_annotation.title); |
115 this.$.find(".Ldt-Annotation-Title").html(_annotation.title); |
122 var _desc = _annotation.description.replace(/(^\s+|\s+$)/g,''); |
116 var _desc = _annotation.description.replace(/(^\s+|\s+$)/g,''); |
123 if (_desc) { |
117 if (_desc) { |
124 this.$.find(".Ldt-Annotation-Description-Block").show(); |
118 this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock"); |
125 this.$.find(".Ldt-Annotation-Description").html(_desc); |
119 this.$.find(".Ldt-Annotation-Description").html(_desc); |
126 } else { |
120 } else { |
127 this.$.find(".Ldt-Annotation-Description-Block").hide(); |
121 this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock"); |
128 } |
122 } |
129 this.$.find(".Ldt-Annotation-Begin").html(_annotation.begin.toString()); |
123 this.$.find(".Ldt-Annotation-Begin").html(_annotation.begin.toString()); |
130 this.$.find(".Ldt-Annotation-End").html(_annotation.end.toString()); |
124 this.$.find(".Ldt-Annotation-End").html(_annotation.end.toString()); |
131 if (_annotation.elementType === "mashedAnnotation") { |
125 if (_annotation.elementType === "mashedAnnotation") { |
132 this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-isMashup"); |
126 this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-isMashup"); |
134 this.$.find(".Ldt-Annotation-MashupBegin").html(_annotation.annotation.begin.toString()); |
128 this.$.find(".Ldt-Annotation-MashupBegin").html(_annotation.annotation.begin.toString()); |
135 this.$.find(".Ldt-Annotation-MashupEnd").html(_annotation.annotation.end.toString()); |
129 this.$.find(".Ldt-Annotation-MashupEnd").html(_annotation.annotation.end.toString()); |
136 } else { |
130 } else { |
137 this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-isMashup"); |
131 this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-isMashup"); |
138 } |
132 } |
139 this.$.find(".Ldt-Annotation-Fb").attr("href", "http://www.facebook.com/share.php?" + IriSP.jQuery.param({ u: _url, t: _text })); |
133 if (typeof this.socialWidget !== "undefined") { |
140 this.$.find(".Ldt-Annotation-Twitter").attr("href", "https://twitter.com/intent/tweet?" + IriSP.jQuery.param({ url: _url, text: _text })); |
134 this.socialWidget.updateUrls(_url, _text); |
141 this.$.find(".Ldt-Annotation-Gplus").attr("href", "https://plusone.google.com/_/+1/confirm?" + IriSP.jQuery.param({ url: _url, title: _text })); |
135 } |
142 this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty"); |
136 this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty"); |
143 } |
137 } |
144 |
138 |
145 IriSP.Widgets.Annotation.prototype.hide = function() { |
139 IriSP.Widgets.Annotation.prototype.hide = function() { |
146 this.$.slideUp(); |
140 this.$.slideUp(); |