--- a/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js Thu Nov 29 23:03:22 2012 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js Fri Nov 30 11:51:03 2012 +0100
@@ -81,7 +81,7 @@
var rgxp = _this.source.getAnnotations().regexp || /^$/,
repl = '<span class="Ldt-Annotation-Highlight">$1</span>';
title = title.replace(rgxp,repl);
- description = description.replace(rgxp,repl);
+ description = description.replace(rgxp,repl).replace(/[\n\r]+/gm,'<br />');
}
_this.$.find(".Ldt-Annotation-Title").html(title || "(" + _this.l10n.untitled + ")");
if (description) {
@@ -100,6 +100,7 @@
_text = _this.l10n.watching + _annotation.title + (_this.site_name ? _this.l10n.on_site + _this.site_name : ''),
_tags = _annotation.getTags(),
_tagblock = _this.$.find(".Ldt-Annotation-Tags");
+ _tagblock.empty();
if (_tags.length) {
_this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-EmptyBlock");
_tags.forEach(function(_tag) {
--- a/src/ldt/ldt/static/ldt/metadataplayer/KnowledgeConcierge.js Thu Nov 29 23:03:22 2012 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/KnowledgeConcierge.js Fri Nov 30 11:51:03 2012 +0100
@@ -60,8 +60,8 @@
currentNodesList = "",
relatedCache = {},
relatedRequests = {},
- relatedTemplate = '<div class="Ldt-Kc-Related-Item"><a href="{{ widget.video_url_base }}{{ media.iri_id }}"><img src="{{ media.image }}"></a>'
- + '<h3><a href="{{ widget.video_url_base }}{{ media.iri_id }}">{{ media.title }}</a></h3><p>{{ description }}</p>'
+ relatedTemplate = '<div class="Ldt-Kc-Related-Item"><a href="{{ widget.video_url_base }}{{ media.iri_id }}#keyword={{ escaped_keyword }}"><img src="{{ media.image }}"></a>'
+ + '<h3><a href="{{ widget.video_url_base }}{{ media.iri_id }}#keyword={{ escaped_keyword }}">{{ media.title }}</a></h3><p>{{ description }}</p>'
+ '<p>{{ widget.l10n.duration_ }} <span class="Ldt-Kc-Item-Duration">{{ duration }}</span></p>'
+ '</a><div class="Ldt-Kc-Clearer"></div></div>';
@@ -81,7 +81,8 @@
widget: _this,
media: media,
description: media.description.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1…'),
- duration: new IriSP.Model.Time(media.duration).toString()
+ duration: new IriSP.Model.Time(media.duration).toString(),
+ escaped_keyword: encodeURIComponent(keywords.split(",")[0])
}
_html += Mustache.to_html(relatedTemplate, _tmpldata);
if (i % 2) {
@@ -210,7 +211,7 @@
setTimeout(bindJavascript, 1000);
}
}
- var currentSelection = null, lockMode = false;
+ var currentSelection = null;
var _fns = {
adjacentnodes: function(id, proj, adj, both) {
jQuery.ajax({
@@ -276,7 +277,7 @@
},
mousemove: function(selection) {
if (selection !== currentSelection) {
- if (selection && !lockMode) {
+ if (selection) {
triggerSearch(selection.name);
}
currentSelection = selection;
@@ -284,12 +285,10 @@
},
click: function(selection) {
if (selection) {
- lockMode = true;
triggerSearch(selection.name);
showRelated(selection.name);
} else {
- lockMode = false;
- triggerSearch()
+ triggerSearch();
}
}
}
@@ -322,6 +321,13 @@
});
});
+ var keywmatch = document.location.hash.match(/keyword=([^#?&]+)/);
+ if (keywmatch) {
+ this.player.on("widgets-loaded", function() {
+ triggerSearch(keywmatch[1]);
+ })
+ }
+
bindJavascript();
}
--- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js Thu Nov 29 23:03:22 2012 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js Fri Nov 30 11:51:03 2012 +0100
@@ -96,7 +96,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._;
@@ -115,12 +115,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) {
@@ -1548,13 +1564,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),
@@ -1588,6 +1606,7 @@
}
_this.draw();
+ player.trigger("widget-loaded");
});
/* Adding classes and html attributes */
@@ -1668,11 +1687,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);
@@ -1688,6 +1716,7 @@
if (_propname) {
_this[_propname] = _widget;
}
+ _this.__subwidgets[key] = _widget;
});
});
}