src/js/widgets.js
changeset 986 f9d51dd4a3fe
parent 984 e034099276f6
child 988 eefd336335f9
equal deleted inserted replaced
985:9859c4bae904 986:f9d51dd4a3fe
    42     /* Setting this.player at the end in case it's been overriden
    42     /* Setting this.player at the end in case it's been overriden
    43      * by a configuration option of the same name :-(
    43      * by a configuration option of the same name :-(
    44      */
    44      */
    45     this.player = player;
    45     this.player = player;
    46     
    46     
    47     /* Getting metadata */
       
    48     this.source = player.loadMetadata(this.metadata);
       
    49     
       
    50     /* Call draw when loaded */
       
    51     this.source.onLoad(function() {
       
    52         if (_this.media_id) {
       
    53             _this.media = this.getElement(_this.media_id);
       
    54         } else {
       
    55             var _mediaopts = {
       
    56                 is_mashup: _this.is_mashup || false
       
    57             }
       
    58             _this.media = this.getCurrentMedia(_mediaopts);
       
    59         }
       
    60         
       
    61         _this.draw();
       
    62         player.trigger("widget-loaded");
       
    63     });
       
    64    
       
    65     /* Adding classes and html attributes */
    47     /* Adding classes and html attributes */
    66     this.$ = IriSP.jQuery('#' + this.container);
    48     this.$ = IriSP.jQuery('#' + this.container);
    67     this.$.addClass("Ldt-TraceMe Ldt-Widget").attr("widget-type", _type);
    49     this.$.addClass("Ldt-TraceMe Ldt-Widget").attr("widget-type", _type);
    68     
    50     
    69     this.l10n = (
    51     this.l10n = (
    73             IriSP.language.length > 2 && typeof this.messages[IriSP.language.substr(0,2)] !== "undefined"
    55             IriSP.language.length > 2 && typeof this.messages[IriSP.language.substr(0,2)] !== "undefined"
    74             ? this.messages[IriSP.language.substr(0,2)]
    56             ? this.messages[IriSP.language.substr(0,2)]
    75             : this.messages["en"]
    57             : this.messages["en"]
    76         )
    58         )
    77     );
    59     );
       
    60     
       
    61     /* Loading Metadata if required */
       
    62     
       
    63     if (this.metadata) {
       
    64         /* Getting metadata */
       
    65         this.source = player.loadMetadata(this.metadata);
       
    66         
       
    67         /* Call draw when loaded */
       
    68         this.source.onLoad(function() {
       
    69             if (_this.media_id) {
       
    70                 _this.media = this.getElement(_this.media_id);
       
    71             } else {
       
    72                 var _mediaopts = {
       
    73                     is_mashup: _this.is_mashup || false
       
    74                 }
       
    75                 _this.media = this.getCurrentMedia(_mediaopts);
       
    76             }
       
    77             
       
    78             _this.draw();
       
    79             player.trigger("widget-loaded");
       
    80         });
       
    81     } else {
       
    82         this.draw();
       
    83     }
       
    84     
    78     
    85     
    79 };
    86 };
    80 
    87 
    81 IriSP.Widgets.Widget.prototype.defaults = {}
    88 IriSP.Widgets.Widget.prototype.defaults = {}
    82 
    89