made the polemicwidget not show itself if it has no data to display.
--- a/src/js/widgets/polemicWidget.js Thu Jan 12 17:26:18 2012 +0100
+++ b/src/js/widgets/polemicWidget.js Fri Jan 13 12:36:32 2012 +0100
@@ -35,14 +35,6 @@
this.svgElements = {};
this.oldSearchMatches = [];
- // Make and define the Raphael area
- this.paper = Raphael(document.getElementById(this._id), config.width, config.height);
-
- // event handlers
- this._Popcorn.listen("IriSP.search", IriSP.wrap(this, function(searchString) { this.searchHandler(searchString); }));
- this._Popcorn.listen("IriSP.search.closed", IriSP.wrap(this, this.searchFieldClosedHandler));
- this._Popcorn.listen("IriSP.search.cleared", IriSP.wrap(this, this.searchFieldClearedHandler));
-
};
IriSP.PolemicWidget.prototype = new IriSP.Widget();
@@ -133,27 +125,39 @@
}
- this._serializer.sync(function(data) { loaded_callback.call(self, data) });
+ this._serializer.sync(function(data) { loaded_callback.call(self, data); return; });
function loaded_callback (json) {
var view_type = this._serializer.getTweets();
+
if (typeof(view_type) === "undefined") {
- var view_type = this._serializer.getTweetIds()[0];
+ var view_type = this._serializer.getTweetIds()[0];
if (typeof(view_type) === "undefined") {
// default to guessing if nothing else works.
- view = json.views[0];
+ var view = json.views[0];
if(typeof(view.annotation_types) !== "undefined") {
- if (view.annotation_types.length >= 1) {
- view_type = view.annotation_types[0];
+ if (view.annotation_types.length > 1) {
+ var view_type = view.annotation_types[1];
} else {
- console.log("PolemicWidget: invalid file");
+ console.log("PolemicWidget: invalid file - minimizing");
+ return;
}
}
}
}
+ // Make and define the Raphael area
+ this.paper = Raphael(document.getElementById(this._id), this._config.width, this._config.height);
+
+ // event handlers
+ this._Popcorn.listen("IriSP.search", IriSP.wrap(this, function(searchString) { this.searchHandler(searchString); }));
+ this._Popcorn.listen("IriSP.search.closed", IriSP.wrap(this, this.searchFieldClosedHandler));
+ this._Popcorn.listen("IriSP.search.cleared", IriSP.wrap(this, this.searchFieldClearedHandler));
+ this.selector.mouseleave(IriSP.wrap(this, function() { self.TooltipWidget.hide.call(self.TooltipWidget); }));
+ this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater));
+
for(var i = 0; i < json.annotations.length; i++) {
var item = json.annotations[i];
var MyTime = Math.floor(item.begin/duration*lineSize);
@@ -362,8 +366,7 @@
this.sliderTip.toFront();
}
- this.selector.mouseleave(IriSP.wrap(this, function() { self.TooltipWidget.hide.call(self.TooltipWidget); }));
- this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.sliderUpdater));
+
}
/** update the positionMarker as time passes */
--- a/test/integration/polemic-festival.htm Thu Jan 12 17:26:18 2012 +0100
+++ b/test/integration/polemic-festival.htm Fri Jan 13 12:36:32 2012 +0100
@@ -30,8 +30,25 @@
container:'LdtPlayer',
css:'../../src/css/LdtPlayer.css',
widgets: [
-
-
+ {type: "PolemicWidget",
+ width: 640, /* required for this widget */
+ height: 50,
+ metadata:{
+ format:'cinelab',
+ src:'polemic_fr.json',
+ type:'json'},
+
+ requires: [{
+ type: "TooltipWidget",
+ width: 180,
+ heigh: 160,
+ metadata : {
+ format:'cinelab',
+ src:'polemic.json',
+ type:'empty'
+ }
+ }],
+ },
{type: "AnnotationsListWidget",
container: "AnnotationsListContainer",
metadata:{
--- a/test/integration/polemic-platform.htm Thu Jan 12 17:26:18 2012 +0100
+++ b/test/integration/polemic-platform.htm Fri Jan 13 12:36:32 2012 +0100
@@ -32,13 +32,25 @@
container:'LdtPlayer',
css:'../../src/css/LdtPlayer.css',
widgets: [
- {type: "SliderWidget",
- metadata:{
- format:'cinelab',
- src:platf_url + 'cljson/id/' + project_id,
- type:'json'}
- },
-
+ {type: "PolemicWidget",
+ width: 640, /* required for this widget */
+ height: 50,
+ metadata:{
+ format:'cinelab',
+ src:platf_url + 'cljson/id/' + project_id,
+ type:'json'},
+
+ requires: [{
+ type: "TooltipWidget",
+ width: 180,
+ heigh: 160,
+ metadata : {
+ format:'cinelab',
+ src:platf_url + 'cljson/id/' + project_id,
+ type:'empty'
+ }
+ }],
+ },
{type: "AnnotationsListWidget",
container: "AnnotationsListContainer",
metadata:{
@@ -54,6 +66,12 @@
src:platf_url + 'cljson/id/' + project_id,
type:'json'}
},
+ {type: "SliderWidget",
+ metadata:{
+ format:'cinelab',
+ src:platf_url + 'cljson/id/' + project_id,
+ type:'json'}
+ },
{type: "PlayerWidget", // please note that type refers directly to the constructor of the widget.
mode: "radio",
metadata:{