added support for the polemic tweet buttons. popcorn-port
authorhamidouk
Thu, 26 Jan 2012 16:22:06 +0100
branchpopcorn-port
changeset 722 ed12570ebd64
parent 721 0c53eba54b11
child 723 bbf9914a5f99
added support for the polemic tweet buttons.
assets/polemic_buttons_sprite.psd
src/css/LdtPlayer.css
src/css/imgs/polemic_buttons_sprite.png
src/js/widgets/createAnnotationWidget.js
src/templates/createAnnotationWidget.html
Binary file assets/polemic_buttons_sprite.psd has changed
--- a/src/css/LdtPlayer.css	Thu Jan 26 14:57:36 2012 +0100
+++ b/src/css/LdtPlayer.css	Thu Jan 26 16:22:06 2012 +0100
@@ -695,9 +695,60 @@
   height: 17px;
   width: 17px;
   right: 0px;
-  top: -5px;
+}
+
+/* polemic tweet annotation buttons */
+.Ldt-createAnnotation-polemics {
+  padding-top: 2px;
+}
+
+.Ldt-createAnnotation-polemic-button {
+  margin: 0;
+  border: 0;
+  padding: 0;
+  margin-right: 2px;
+  width: 38px;
+  height: 26px;
+  text-indent: -999px;
+  background: url(imgs/polemic_buttons_sprite.png);
+}
+
+.Ldt-createAnnotation-polemic-positive:hover {
+    background-position: 0 -26px;
+}
+.Ldt-createAnnotation-polemic-positive.Ldt-createAnnotation-polemic-active {
+    background-position: 0 -52px;
 }
 
+.Ldt-createAnnotation-polemic-negative {
+    background-position: -38px 0;
+}
+.Ldt-createAnnotation-polemic-negative:hover {
+    background-position: -38px -26px;
+}
+.Ldt-createAnnotation-polemic-negative.Ldt-createAnnotation-polemic-active {
+    background-position: -38px -52px;
+}
+
+.Ldt-createAnnotation-polemic-reference {
+    background-position: -76px 0;
+}
+.Ldt-createAnnotation-polemic-reference:hover {
+    background-position: -76px -26px;
+}
+.Ldt-createAnnotation-polemic-reference.Ldt-createAnnotation-polemic-active {
+    background-position: -76px -52px;
+}
+
+.Ldt-createAnnotation-polemic-question {
+    background-position: -114px 0;
+}
+.Ldt-createAnnotation-polemic-question:hover {
+    background-position: -114px -26px;
+}
+.Ldt-createAnnotation-polemic-question.Ldt-createAnnotation-polemic-active {
+    background-position: -114px -52px;
+}
 /* AnnotationsListWidget */
 
 .Ldt-AnnotationsListWidget {
Binary file src/css/imgs/polemic_buttons_sprite.png has changed
--- a/src/js/widgets/createAnnotationWidget.js	Thu Jan 26 14:57:36 2012 +0100
+++ b/src/js/widgets/createAnnotationWidget.js	Thu Jan 26 16:22:06 2012 +0100
@@ -75,7 +75,7 @@
 
       var classname = IriSP.templToHTML("Ldt-createAnnotation-polemic-{{classname}}", {classname : this.polemics[polemic]});
 
-      var templ = IriSP.templToHTML("<button class='{{classname}}'>{{polemic}}</button>",
+      var templ = IriSP.templToHTML("<button class='{{classname}} Ldt-createAnnotation-polemic-button'>{{polemic}}</button>",
                   {classname: classname, polemic: polemic});
                   
       this.selector.find(".Ldt-createAnnotation-polemics").append(templ);
@@ -135,6 +135,7 @@
       
       code = {start: annotation.begin / 1000, end: annotation.end / 1000,
               onStart: function(annotation) { return function() {
+                      console.log("runned ?", annotation);
                       if (typeof(annotation.content) !== "undefined")
                         _this.selector.find(".Ldt-createAnnotation-Title").html(annotation.content.title);
 
@@ -204,6 +205,14 @@
     this._Popcorn.trigger("IriSP.SliceWidget.position", [left, width]);
     this._Popcorn.listen("IriSP.SliceWidget.zoneChange", IriSP.wrap(this, this.handleSliderChanges));
     this._Popcorn.trigger("IriSP.SliceWidget.show");
+    
+    this.selector.find(".Ldt-createAnnotation-Title").html(currentChapter.content.title);
+
+    this._currentcurrentChapter = currentChapter;
+    var beginTime = IriSP.msToTime(currentChapter.begin);
+    var endTime = IriSP.msToTime(currentChapter.end);
+    var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime });
+    this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate);
   }
 };
 
@@ -229,6 +238,20 @@
       }
     }
   }
+  
+  if (this.polemic_mode) {
+    /* Also go through the polemics to highlight the buttons */
+    for (var polemic in this.polemics) {
+      /* Add the active class to the button */
+      var classname = "Ldt-createAnnotation-polemic-" + this.polemics[polemic];
+      if (contents.indexOf(polemic) != -1) {        
+        this.selector.find("." + classname).addClass("Ldt-createAnnotation-polemic-active");
+      } else {
+        if (this.selector.find("." + classname).addClass("Ldt-createAnnotation-polemic-active"))
+          this.selector.find("." + classname).removeClass("Ldt-createAnnotation-polemic-active")
+      }
+    }
+  }
 };
 
 IriSP.createAnnotationWidget.prototype.showStartScreen = function() {
--- a/src/templates/createAnnotationWidget.html	Thu Jan 26 14:57:36 2012 +0100
+++ b/src/templates/createAnnotationWidget.html	Thu Jan 26 16:22:06 2012 +0100
@@ -6,10 +6,11 @@
       <div style='margin-bottom: 7px; overflow: auto;'>
         <div class='Ldt-createAnnotation-Title'></div>
         <div class='Ldt-createAnnotation-TimeFrame'></div>
+        {{^cinecast_version}}
+          <img src='{{img_dir}}/minimize.png' class='Ldt-createAnnotation-Minimize' alt='Cancel'></img>
+        {{/cinecast_version}}
       </div>
-      {{^cinecast_version}}
-      <img src='{{img_dir}}/minimize.png' class='Ldt-createAnnotation-Minimize' alt='Cancel'></img>
-      {{/cinecast_version}}
+      
       <div class='Ldt-createAnnotation-Container'>
         <textarea class='Ldt-createAnnotation-Description'></textarea>
         <div class='Ldt-createAnnotation-profileArrow'>