src/widgets/CreateAnnotation.js
changeset 1047 c3bf174e0ef8
parent 1038 e78b889a75e1
child 1050 0b287ecbc2cb
--- a/src/widgets/CreateAnnotation.js	Tue Sep 01 15:31:46 2015 +0200
+++ b/src/widgets/CreateAnnotation.js	Tue Sep 01 15:57:54 2015 +0200
@@ -51,7 +51,8 @@
     project_id: "",
     after_send_timeout: 0,
     close_after_send: false,
-    tag_prefix: "#"
+    tag_prefix: "#",
+    pause_when_displaying: false,
 };
 
 IriSP.Widgets.CreateAnnotation.prototype.messages = {
@@ -60,6 +61,7 @@
         to_time: "to",
         at_time: "at",
         submit: "Submit",
+        cancel: "Cancel",
         add_keywords_: "Add keywords:",
         add_polemic_keywords_: "Add polemic attributes :",
         your_name_: "Your name:",
@@ -81,6 +83,7 @@
         to_time: "à",
         at_time: "à",
         submit: "Envoyer",
+        cancel: "Annuler",
         add_keywords_: "Ajouter des mots-clés\u00a0:",
         add_polemic_keywords_: "Ajouter des attributs polémiques\u00a0:",
         your_name_: "Votre nom\u00a0:",
@@ -112,6 +115,7 @@
     + '<textarea class="Ldt-CreateAnnotation-Description empty" placeholder="{{l10n.type_description}}"></textarea>'
     + '<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>'
     + '<input type="submit" class="Ldt-CreateAnnotation-Submit" value="{{l10n.submit}}" />'
+    + '<input type="button" class="Ldt-CreateAnnotation-Cancel" value="{{l10n.cancel}}" />'
     + '{{#show_mic_record}}<div class="Ldt-CreateAnnotation-RecBlock"><div class="Ldt-CreateAnnotation-RecLabel">Add voice annotation</div>'
     + '    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="220" height="160">'
     + '        <param name="movie" value="{{record_swf}}" />'
@@ -223,6 +227,9 @@
             }
         });
     }
+    this.$.find(".Ldt-CreateAnnotation-Cancel").click(function() {
+        _this.player.trigger("CreateAnnotation.hide");
+    });
     this.$.find(".Ldt-CreateAnnotation-Close").click(function() {
         _this.close_after_send
         ? _this.hide()
@@ -270,6 +277,9 @@
 IriSP.Widgets.CreateAnnotation.prototype.show = function() {
     if (!this.visible){
         this.visible = true;
+        if (this.pause_when_displaying){
+            this.media.pause();
+        }
         this.showScreen('Main');
         this.$.find(".Ldt-CreateAnnotation-Description").val("").css("border-color", "#666666").addClass("empty");
         if (this.show_title_field) {