src/js/widgets.js
branchnew-model
changeset 874 38b65761a7d5
parent 872 d777d05a16e4
child 875 43629caa77bc
--- a/src/js/widgets.js	Thu Apr 19 19:20:41 2012 +0200
+++ b/src/js/widgets.js	Fri Apr 20 19:13:11 2012 +0200
@@ -59,12 +59,15 @@
     /* Does the widget require other widgets ? */
     if (typeof this.requires !== "undefined") {
         for (var _i = 0; _i < this.requires.length; _i++) {
-            var _subconfig = this.requires[_i],
-                _div = IriSP.jQuery('<div>');
-            _subconfig.container = IriSP._.uniqueId(this.container + '_' + _subconfig.type + '_');
-            _div.id = _subconfig.container;
-            this.$.append(_div);
-            this[_subconfig.type] = new IriSP.Widgets(player, _subconfig);
+            var _subconfig = this.requires[_i];
+            if (typeof IriSP[_subconfig.type] !== "undefined") {
+                _subconfig.container = IriSP._.uniqueId(this.container + '_' + _subconfig.type + '_');
+                this.$.append(IriSP.jQuery('<div>').attr("id",_subconfig.container));
+                console.log(this.$.html());
+                this[_subconfig.type] = new IriSP[_subconfig.type](player, _subconfig);
+            } else {
+                console.log("Error, Call to Undefined Widget Type : "+_subconfig.type);
+            }
         }
     }