web/res/metadataplayer/LdtPlayer-core.js
changeset 755 d50aeed9a54b
parent 726 d82d070cf23e
child 765 8cde4d15a173
--- a/web/res/metadataplayer/LdtPlayer-core.js	Tue Dec 18 17:16:26 2012 +0100
+++ b/web/res/metadataplayer/LdtPlayer-core.js	Wed Dec 19 16:52:21 2012 +0100
@@ -119,6 +119,9 @@
         _this.widgets.push(null);
         _this.loadWidget(widgetconf, function(widget) {
             _this.widgets[key] = widget;
+            if (widget.isLoaded()) {
+                _this.trigger("widget-loaded");
+            }
         });
     });
     this.$.find('.Ldt-Loader').detach();
@@ -491,7 +494,8 @@
     var _iexact = _iexact || false,
         _rgxp =  Model.regexpFromTextOrArray(_text, true);
     return this.filter(function(_element) {
-        return _rgxp.test(_element.description) || _rgxp.test(_element.title);
+        var keywords = (_element.keywords || _element.getTagTexts() || []).join(", ");
+        return _rgxp.test(_element.description) || _rgxp.test(_element.title) || _rgxp.test(keywords);
     });
 }
 
@@ -676,7 +680,7 @@
     }
     _res += pad(2, _hms.minutes) + ':' + pad(2, _hms.seconds);
     if (showCs) {
-        _res += "." + Math.round(_hms.milliseconds / 100)
+        _res += "." + Math.floor(_hms.milliseconds / 100)
     }
     return _res;
 }
@@ -1252,12 +1256,12 @@
 
 Model.Source.prototype.getList = function(_listId, _global) {
     _global = (typeof _global !== "undefined" && _global);
-    if (_global || typeof this.contents[_listId] === "undefined") {
+    if (_global) {
         return this.directory.getGlobalList().filter(function(_e) {
             return (_e.elementType === _listId);
         });
     } else {
-        return this.contents[_listId];
+        return this.contents[_listId] || new IriSP.Model.List(this.directory);
     }
 }
 
@@ -1391,6 +1395,7 @@
         url: this.url,
         dataType: dataType,
         data: urlparams,
+        traditional: true,
         success: function(_result) {
             _this.deSerialize(_result);
             _this.handleCallbacks();
@@ -1491,6 +1496,9 @@
         noCss: true,
         requires: [ "popcorn" ]
     },
+    HtmlPlayer: {
+        noCss: true
+    },
     JwpPlayer: {
         noCss: true,
         requires: [ "jwplayer" ]
@@ -1591,24 +1599,6 @@
      */
     this.player = player;
     
-    /* Getting metadata */
-    this.source = player.loadMetadata(this.metadata);
-    
-    /* Call draw when loaded */
-    this.source.onLoad(function() {
-        if (_this.media_id) {
-            _this.media = this.getElement(_this.media_id);
-        } else {
-            var _mediaopts = {
-                is_mashup: _this.is_mashup || false
-            }
-            _this.media = this.getCurrentMedia(_mediaopts);
-        }
-        
-        _this.draw();
-        player.trigger("widget-loaded");
-    });
-   
     /* Adding classes and html attributes */
     this.$ = IriSP.jQuery('#' + this.container);
     this.$.addClass("Ldt-TraceMe Ldt-Widget").attr("widget-type", _type);
@@ -1623,6 +1613,31 @@
         )
     );
     
+    /* Loading Metadata if required */
+    
+    if (this.metadata) {
+        /* Getting metadata */
+        this.source = player.loadMetadata(this.metadata);
+        
+        /* Call draw when loaded */
+        this.source.onLoad(function() {
+            if (_this.media_id) {
+                _this.media = this.getElement(_this.media_id);
+            } else {
+                var _mediaopts = {
+                    is_mashup: _this.is_mashup || false
+                }
+                _this.media = this.getCurrentMedia(_mediaopts);
+            }
+            
+            _this.draw();
+            player.trigger("widget-loaded");
+        });
+    } else {
+        this.draw();
+    }
+    
+    
 };
 
 IriSP.Widgets.Widget.prototype.defaults = {}