src/js/widgets.js
branchpopcorn-port
changeset 842 4ae2247a59f4
parent 835 a8af9da7c622
child 866 3bf7aa8216e5
equal deleted inserted replaced
841:8da49ff273e0 842:4ae2247a59f4
    55   if (typeof this.selector != "undefined") {
    55   if (typeof this.selector != "undefined") {
    56       this.selector.addClass("Ldt-TraceMe").addClass("Ldt-Widget");
    56       this.selector.addClass("Ldt-TraceMe").addClass("Ldt-Widget");
    57       this.selector.attr("widget-type", this._config.type);
    57       this.selector.attr("widget-type", this._config.type);
    58   }
    58   }
    59   
    59   
       
    60   // Parsing Widget Defaults
       
    61   var _this = this;
       
    62   
       
    63   if (typeof config.type == "string" && typeof IriSP.widgetsDefaults[config.type] == "object") {
       
    64       IriSP._(IriSP.widgetsDefaults[config.type]).each(function(_v, _k) {
       
    65           if (typeof config[_k] != "undefined") {
       
    66               _this[_k] = config[_k];
       
    67           } else {
       
    68               _this[_k] = _v;
       
    69           }
       
    70       });
       
    71   }
       
    72   
    60 };
    73 };
    61 
    74 
    62 // This functions checks for configuration options
       
    63 
    75 
    64 IriSP.Widget.prototype.checkOption = function(_name, _default) {
    76 IriSP.Widget.prototype.currentMedia = function() {
    65     this[_name] = (
    77     return this._serializer.currentMedia();
    66         typeof this._config[_name] != "undefined"
    78 }
    67         ? this._config[_name]
    79 
    68         : (
    80 IriSP.Widget.prototype.getDuration = function() {
    69             (typeof IriSP.widgetsDefaults[this._config.type] != "undefined" && IriSP.widgetsDefaults[this._config.type][_name] != "undefined")
    81     return this._serializer.getDuration();
    70             ? IriSP.widgetsDefaults[this._config.type][_name]
       
    71             : (
       
    72                 typeof _default != "undefined"
       
    73                 ? _default
       
    74                 : null
       
    75             )
       
    76         )
       
    77     )
       
    78 }
    82 }
    79 
    83 
    80 /**
    84 /**
    81   * This method responsible of drawing a widget on screen.
    85   * This method responsible of drawing a widget on screen.
    82   */
    86   */