| author | ymh <ymh.work@gmail.com> |
| Fri, 02 Oct 2015 11:27:17 +0200 | |
| changeset 1068 | 7623f9af9272 |
| parent 1033 | c20df1c080e6 |
| child 1072 | ac1eacb3aa33 |
| permissions | -rw-r--r-- |
| 1033 | 1 |
/* This widget displays the image associated to the annotation in the given container */ |
2 |
||
3 |
IriSP.Widgets.ImageDisplay = function(player, config) { |
|
4 |
IriSP.Widgets.Widget.call(this, player, config); |
|
5 |
} |
|
6 |
||
7 |
IriSP.Widgets.ImageDisplay.prototype = new IriSP.Widgets.Widget(); |
|
8 |
||
9 |
IriSP.Widgets.ImageDisplay.prototype.defaults = { |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1033
diff
changeset
|
10 |
annotation_type: "Slides" |
| 1033 | 11 |
// container: "imageContainer" |
12 |
} |
|
13 |
||
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1033
diff
changeset
|
14 |
IriSP.Widgets.ImageDisplay.prototype.template = '<div class="Ldt-ImageDisplay-Container"><div class="Ldt-ImageDisplay-Overlay Ldt-ImageDisplay-Overlay-Left"></div><div class="Ldt-ImageDisplay-Overlay Ldt-ImageDisplay-Overlay-Right"></div></div>'; |
| 1033 | 15 |
|
16 |
IriSP.Widgets.ImageDisplay.prototype.annotationTemplate = ''; |
|
17 |
||
18 |
IriSP.Widgets.ImageDisplay.prototype.update = function(annotation) { |
|
19 |
// Update the widget with data corresponding to the annotation |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1033
diff
changeset
|
20 |
this.image.css("background-image", "url(" + annotation.thumbnail + ")"); |
|
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1033
diff
changeset
|
21 |
this.image.attr("title", IriSP.textFieldHtml(annotation.title) + " - " + annotation.begin.toString()); |
| 1033 | 22 |
}; |
23 |
||
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1033
diff
changeset
|
24 |
IriSP.Widgets.ImageDisplay.prototype.draw = function() { |
| 1033 | 25 |
var _annotations = this.getWidgetAnnotations().sortBy(function(_annotation) { |
26 |
return _annotation.begin; |
|
27 |
}); |
|
28 |
var _this = this; |
|
29 |
_this.renderTemplate(); |
|
|
1068
7623f9af9272
merge pull request #3 from O. Auber
ymh <ymh.work@gmail.com>
parents:
1033
diff
changeset
|
30 |
_this.image = _this.$.find(".Ldt-ImageDisplay-Container"); |
| 1033 | 31 |
|
32 |
_this.$.find(".Ldt-ImageDisplay-Overlay-Left").on("click", function () { _this.navigate(-1); }); |
|
33 |
_this.$.find(".Ldt-ImageDisplay-Overlay-Right").on("click", function () { _this.navigate(+1); }); |
|
34 |
||
35 |
_annotations.forEach(function(_a) { |
|
36 |
_a.on("enter", function() { |
|
37 |
_this.update(_a); |
|
38 |
}); |
|
39 |
}); |
|
40 |
if (_annotations.length) |
|
41 |
_this.update(_annotations[0]); |
|
42 |
} |