Enhance SlideShare widget for it to point the a specified div (like annotationListWidget).
authorcavaliet
Thu, 19 Apr 2012 15:47:34 +0200
changeset 871 a5607fa1ef0b
parent 869 faae5df935de
child 873 a6602ce57aca
Enhance SlideShare widget for it to point the a specified div (like annotationListWidget).
src/js/widgets/slideShareWidget.js
src/templates/slideShareWidget.html
test/integration/test-slideshare.htm
--- a/src/js/widgets/slideShareWidget.js	Wed Apr 18 13:37:00 2012 +0200
+++ b/src/js/widgets/slideShareWidget.js	Thu Apr 19 15:47:34 2012 +0200
@@ -9,8 +9,13 @@
 IriSP.SlideShareWidget.prototype.draw = function() {
   var self = this;
   
+  // If the div supposed to host the slides does not exist, we cancel
+  if(this.selector.length==0){
+	  if(console){ if(console.log){ console.log("No div for slideshare widget, this widget is canceled. id = " + this._id); } }
+	  return;
+  }
   var templ = Mustache.to_html(IriSP.slideShareWidget_template);
-  this.selector.append(templ);
+  this.selector.html(templ);
   
   // Synchro management
   this._disableUpdate = false;
@@ -36,7 +41,8 @@
   var annotations = this._serializer._data.annotations;
   var view_type = this._serializer.getSlideShareType();
   if(typeof(view_type) === "undefined") {
-    return;  
+	  if(console){ if(console.log){ console.log("No annotation-type for slideshare widget, this widget is canceled."); } }
+	  return;
   }
   var i = 0;
   this.segments_slides = [];
--- a/src/templates/slideShareWidget.html	Wed Apr 18 13:37:00 2012 +0200
+++ b/src/templates/slideShareWidget.html	Thu Apr 19 15:47:34 2012 +0200
@@ -1,2 +1,2 @@
 {{! template for the slideShare widget of the other }}
-<div class='Ldt-SlideShare'><!-- >p class='sync_links'><a class='sync_on'>Synchronise</a> - <a class='sync_off'>Ne synchronise pas</a></p--><div class='SlideShareContainer'></div></div>
\ No newline at end of file
+<div class='Ldt-SlideShare'><!--p> class='sync_links'><a class='sync_on'>Synchronise</a> - <a class='sync_off'>Ne synchronise pas</a></p--><div class='SlideShareContainer'></div></div>
\ No newline at end of file
--- a/test/integration/test-slideshare.htm	Wed Apr 18 13:37:00 2012 +0200
+++ b/test/integration/test-slideshare.htm	Thu Apr 19 15:47:34 2012 +0200
@@ -62,7 +62,8 @@
                             height : 160,
                         }]
                     }, {
-                        type : "SlideShareWidget"
+                        type : "SlideShareWidget",
+                        container : "MySlideShareContainer"
                     }, {
                         type : "createAnnotationWidget",
                         polemic_mode : false,
@@ -97,6 +98,7 @@
             IriSP.initPlayer(config, json_url);
 
         </script>
+    <div id="MySlideShareContainer" style="float: left; width: 400px;"></div>
     <div id="MyListContainer" style="float: left; width: 400px;"></div>
     </body>
 </html>