|
543
|
1 |
IriSP.createAnnotationWidget = function(Popcorn, config, Serializer) { |
|
|
2 |
IriSP.Widget.call(this, Popcorn, config, Serializer); |
|
|
3 |
this._hidden = true; |
|
547
|
4 |
this.keywords = IriSP.widgetsDefaults["createAnnotationWidget"].keywords; |
|
543
|
5 |
}; |
|
|
6 |
|
|
|
7 |
|
|
|
8 |
IriSP.createAnnotationWidget.prototype = new IriSP.Widget(); |
|
|
9 |
|
|
|
10 |
IriSP.createAnnotationWidget.prototype.clear = function() { |
|
|
11 |
this.selector.find(".Ldt-SaTitle").text(""); |
|
|
12 |
this.selector.find(".Ldt-SaDescription").text(""); |
|
|
13 |
this.selector.find(".Ldt-SaKeywordText").text(""); |
|
|
14 |
}; |
|
|
15 |
|
|
|
16 |
IriSP.createAnnotationWidget.prototype.showWidget = function() { |
|
|
17 |
this.layoutManager.slice.after("ArrowWidget") |
|
|
18 |
.before("createAnnotationWidget") |
|
|
19 |
.jQuerySelector().hide(); |
|
|
20 |
this.selector.show(); |
|
|
21 |
}; |
|
|
22 |
|
|
|
23 |
IriSP.createAnnotationWidget.prototype.hideWidget = function() { |
|
|
24 |
this.selector.hide(); |
|
|
25 |
this.layoutManager.slice.after("ArrowWidget") |
|
|
26 |
.before("createAnnotationWidget") |
|
|
27 |
.jQuerySelector().show(); |
|
|
28 |
}; |
|
|
29 |
|
|
|
30 |
IriSP.createAnnotationWidget.prototype.draw = function() { |
|
|
31 |
var _this = this; |
|
|
32 |
|
|
548
|
33 |
var annotationMarkup = IriSP.templToHTML(IriSP.createAnnotationWidget_template); |
|
543
|
34 |
this.selector.append(annotationMarkup); |
|
548
|
35 |
|
|
543
|
36 |
this.selector.hide(); |
|
548
|
37 |
for (var i = 0; i < this.keywords.length; i++) { |
|
|
38 |
var templ = IriSP.templToHTML("<span class='Ldt-createAnnotation-absent-keyword'>{{keyword}}</span>", |
|
|
39 |
{keyword: this.keywords[i]}); |
|
|
40 |
|
|
|
41 |
this.selector.find(".Ldt-createAnnotation-keywords").append(templ); |
|
|
42 |
} |
|
|
43 |
|
|
543
|
44 |
|
|
|
45 |
this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", |
|
547
|
46 |
IriSP.wrap(this, this.handleAnnotateSignal)); |
|
543
|
47 |
}; |
|
|
48 |
|
|
|
49 |
IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() { |
|
|
50 |
if (this._hidden == false) { |
|
|
51 |
this.selector.hide(); |
|
|
52 |
this._hidden = true; |
|
|
53 |
} else { |
|
|
54 |
this.selector.show(); |
|
|
55 |
this._hidden = false; |
|
|
56 |
} |
|
|
57 |
}; |