src/widgets/Slideshare.js
changeset 988 eefd336335f9
parent 965 eadb7290c325
child 1013 392ddcd212d7
equal deleted inserted replaced
987:7b65bf78873a 988:eefd336335f9
     7 IriSP.Widgets.Slideshare.prototype = new IriSP.Widgets.Widget();
     7 IriSP.Widgets.Slideshare.prototype = new IriSP.Widgets.Widget();
     8 
     8 
     9 IriSP.Widgets.Slideshare.prototype.defaults = {
     9 IriSP.Widgets.Slideshare.prototype.defaults = {
    10     annotation_type: "slide",
    10     annotation_type: "slide",
    11     sync: true,
    11     sync: true,
    12     embed_width: 400,
       
    13     embed_height: 300
       
    14 }
    12 }
    15 
    13 
    16 IriSP.Widgets.Slideshare.prototype.messages = {
    14 IriSP.Widgets.Slideshare.prototype.messages = {
    17     fr: {
    15     fr: {
    18         slides_ : "Diapositives :"
    16         slides_ : "Diapositives"
    19     },
    17     },
    20     en: {
    18     en: {
    21         slides_ : "Slides:"
    19         slides_ : "Slides"
    22     }
    20     }
    23 }
    21 }
    24 
    22 
    25 IriSP.Widgets.Slideshare.prototype.template =
    23 IriSP.Widgets.Slideshare.prototype.template =
    26     '<div class="Ldt-SlideShare"><h2>{{l10n.slides_}}</h2><hr /><div class="Ldt-SlideShare-Container"></div></div>';
    24     '<div class="Ldt-SlideShare"><h2>{{l10n.slides_}}</h2><hr /><div class="Ldt-SlideShare-Container"></div></div>';
    27 
    25 
    28 IriSP.Widgets.Slideshare.prototype.draw = function() {
    26 IriSP.Widgets.Slideshare.prototype.draw = function() {
    29     
    27     
    30     var _embedObject = null,
       
    31         $container,
       
    32         _lastEmbedded = "",
       
    33         _this = this;
       
    34     
       
    35     function insertSlideshare(_presentation, _slide) {
    28     function insertSlideshare(_presentation, _slide) {
    36         if (_lastEmbedded === _presentation) {
    29         if (_lastEmbedded === _presentation) {
    37             if (_.embedObject && typeof _embedObject.jumpTo === "function") {
    30             if (_embedObject && typeof _embedObject.jumpTo === "function") {
    38                 _embedObject.jumpTo(parseInt(_slide));
    31                 _embedObject.jumpTo(parseInt(_slide));
    39             }
    32             }
    40         } else {
    33         } else {
    41             _lastEmbedded = _presentation;
    34             _lastEmbedded = _presentation;
    42             var _id = IriSP.Model.getUID(),
    35             var _id = IriSP.Model.getUID(),
    73     } else {
    66     } else {
    74         this.renderTemplate();
    67         this.renderTemplate();
    75         var _lastPres = "",
    68         var _lastPres = "",
    76             _embedObject = null,
    69             _embedObject = null,
    77             _oembedCache = {},
    70             _oembedCache = {},
    78             _this = this;
    71             _lastEmbedded = "",
    79         $container = this.$.find(".Ldt-SlideShare-Container");
    72             _this = this
       
    73             $container = this.$.find(".Ldt-SlideShare-Container");
       
    74             
       
    75         this.embed_width = this.embed_width || $container.innerWidth();
       
    76         this.embed_height = this.embed_height || Math.floor(this.embed_width * 3/4);
       
    77         
    80         _annotations.forEach(function(_a) {
    78         _annotations.forEach(function(_a) {
    81             _a.on("leave", function() {
    79             _a.on("leave", function() {
    82                 $container.hide();
    80                 $container.hide();
    83                 _lastPres = "";
    81                 _lastPres = "";
    84             });
    82             });