# HG changeset patch # User veltr # Date 1354205483 -3600 # Node ID e034099276f60e5a078654c6744b145ceec069e6 # Parent 97fef7a4b1891ae54350e3de89dd4306a7fee304 Added keyword passing between related videos diff -r 97fef7a4b189 -r e034099276f6 src/js/init.js --- a/src/js/init.js Wed Nov 21 16:33:51 2012 +0100 +++ b/src/js/init.js Thu Nov 29 17:11:23 2012 +0100 @@ -74,7 +74,7 @@ IriSP.Metadataplayer.prototype.onLibsLoaded = function() { IriSP.log("IriSP.Metadataplayer.prototype.onLibsLoaded"); if (typeof IriSP.jQuery === "undefined" && typeof window.jQuery !== "undefined") { - IriSP.jQuery = window.jQuery.noConflict(); + IriSP.jQuery = window.jQuery; } if (typeof IriSP._ === "undefined" && typeof window._ !== "undefined") { IriSP._ = window._; @@ -93,12 +93,28 @@ this.widgets = []; var _this = this; - for(var i = 0; i < this.config.widgets.length; i++) { - this.loadWidget(this.config.widgets[i], function(_widget) { - _this.widgets.push(_widget) + IriSP._(this.config.widgets).each(function(widgetconf, key) { + _this.widgets.push(null); + _this.loadWidget(widgetconf, function(widget) { + _this.widgets[key] = widget; }); - }; + }); this.$.find('.Ldt-Loader').detach(); + + var endload = false; + + this.on("widget-loaded", function() { + if (endload) { + return; + } + var isloaded = !IriSP._(_this.widgets).any(function(w) { + return !(w && w.isLoaded()) + }); + if (isloaded) { + endload = true; + _this.trigger("widgets-loaded"); + } + }); } IriSP.Metadataplayer.prototype.loadMetadata = function(_metadataInfo) { diff -r 97fef7a4b189 -r e034099276f6 src/js/widgets.js --- a/src/js/widgets.js Wed Nov 21 16:33:51 2012 +0100 +++ b/src/js/widgets.js Thu Nov 29 17:11:23 2012 +0100 @@ -17,13 +17,15 @@ IriSP.Widgets.Widget = function(player, config) { - + if( typeof player === "undefined") { /* Probably an abstract call of the class when * individual widgets set their prototype */ return; } + this.__subwidgets = []; + /* Setting all the configuration options */ var _type = config.type, _config = IriSP._.defaults({}, config, player.config.default_options, this.defaults), @@ -57,6 +59,7 @@ } _this.draw(); + player.trigger("widget-loaded"); }); /* Adding classes and html attributes */ @@ -137,11 +140,20 @@ }); } +IriSP.Widgets.Widget.prototype.isLoaded = function() { + var isloaded = !IriSP._(this.__subwidgets).any(function(w) { + return !(w && w.isLoaded()); + }); + return isloaded; +} + IriSP.Widgets.Widget.prototype.insertSubwidget = function(_selector, _widgetoptions, _propname) { var _id = _selector.attr("id"), _this = this, _type = _widgetoptions.type, - $L = $LAB; + $L = $LAB, + key = this.__subwidgets.length; + this.__subwidgets.push(null); if (typeof _id == "undefined") { _id = IriSP._.uniqueId(this.container + '_sub_widget_' + _widgetoptions.type); _selector.attr("id", _id); @@ -157,6 +169,7 @@ if (_propname) { _this[_propname] = _widget; } + _this.__subwidgets[key] = _widget; }); }); } diff -r 97fef7a4b189 -r e034099276f6 src/widgets/Annotation.css --- a/src/widgets/Annotation.css Wed Nov 21 16:33:51 2012 +0100 +++ b/src/widgets/Annotation.css Thu Nov 29 17:11:23 2012 +0100 @@ -19,8 +19,6 @@ background: url(img/pinstripe.png); padding: 5px; margin: 0; - max-height: 300px; - overflow: auto; } .Ldt-Annotation-Inner h3 { @@ -29,6 +27,11 @@ font-weight: bold; } +.Ldt-Annotation-Description { + max-height: 150px; + overflow: auto; +} + .Ldt-Annotation-Cleared { clear: both; } diff -r 97fef7a4b189 -r e034099276f6 src/widgets/KnowledgeConcierge.css --- a/src/widgets/KnowledgeConcierge.css Wed Nov 21 16:33:51 2012 +0100 +++ b/src/widgets/KnowledgeConcierge.css Thu Nov 29 17:11:23 2012 +0100 @@ -10,6 +10,11 @@ display: none; } +.Ldt-Kc-Related-Empty { + text-align: center; font-weight: bold; font-style: italic; + font-size: 14px; color: #999999; margin: 5px 0; +} + .Ldt-Kc-Related h2 { border: none; color: #330099; @@ -51,7 +56,7 @@ max-width: 80px; max-height: 60px; float: left; } -.Ldt-Kc-Related-Item h3, p { +.Ldt-Kc-Related-Item h3, .Ldt-Kc-Related-Item p { margin: 0 0 5px 85px; } diff -r 97fef7a4b189 -r e034099276f6 src/widgets/KnowledgeConcierge.js --- a/src/widgets/KnowledgeConcierge.js Wed Nov 21 16:33:51 2012 +0100 +++ b/src/widgets/KnowledgeConcierge.js Thu Nov 29 17:11:23 2012 +0100 @@ -20,20 +20,22 @@ "fr": { related_videos: "Vidéos liées", duration_: "Durée :", - for_keywords_: "pour le(s) mots-clé(s) :" + for_keywords_: "pour le(s) mots-clé(s) :", + no_matching_videos: "Pas de vidéos correspondantes" }, "en": { related_videos: "Related Videos", duration_: "Duration:", - for_keywords_: "for keyword(s):" + for_keywords_: "for keyword(s):", + no_matching_videos: "No matching videos" } } IriSP.Widgets.KnowledgeConcierge.prototype.template = '
' - + '' + ''; IriSP.Widgets.KnowledgeConcierge.prototype.draw = function() { @@ -58,8 +60,8 @@ currentNodesList = "", relatedCache = {}, relatedRequests = {}, - relatedTemplate = '