";
IriSP.overlay_marker_template = "{{! the template for the small bars which is z-indexed over our segment widget }}";
@@ -1115,6 +1115,7 @@
IriSP.search_template = "{{! template for the search container }}
";
IriSP.share_template = "{{! social network sharing template }}";
IriSP.sliceWidget_template = "{{! template for the slice widget }}
{{! the whole bar }} {{! the zone which represents our slice }}
";
+IriSP.slideShareWidget_template = "{{! template for the slideShare widget of the other }}
";
IriSP.sliderWidget_template = "{{! template for the slider widget - it's composed of two divs we one overlayed on top of the other }}";
IriSP.tooltip_template = "{{! template used by the jquery ui tooltip }}
{{title}}
{{begin}} : {{end}}
{{description}}
";
IriSP.tooltipWidget_template = "{{! template for the tooltip widget }}
";
@@ -1633,7 +1634,7 @@
};
IriSP.Serializer.prototype.sync = function(callback) {
- this._DataLoader.get(this._url, callback, force_refresh);
+ callback.call(this, this._data);
};
IriSP.SerializerFactory = function(DataLoader) {
@@ -1644,7 +1645,6 @@
/* This function returns serializer set-up with the correct
configuration - takes a metadata struct describing the metadata source
*/
-
if (metadataOptions === undefined)
/* return an empty serializer */
return IriSP.Serializer("", "");
@@ -1761,7 +1761,8 @@
"SparklineWidget" : {
lineColor : "#7492b4",
fillColor : "#aeaeb8",
- lineWidth : 2
+ lineWidth : 2,
+ cinecast_version : false
},
"AnnotationsListWidget" : {
ajax_mode : true, /* use ajax to get information about the annotations.
@@ -2145,11 +2146,10 @@
var ret_widgets = [];
var index;
-
- for (index = 0; index < guiOptions.widgets.length; index++) {
+ for (index = 0; index < guiOptions.widgets.length; index++) {
var widget = IriSP.instantiateWidget(popcornInstance, serialFactory, layoutManager, guiOptions.widgets[index], default_options);
- ret_widgets.push(widget);
+ ret_widgets.push(widget);
};
return ret_widgets;
@@ -2185,8 +2185,12 @@
*/
IriSP.instantiateWidget = function(popcornInstance, serialFactory, layoutManager, widgetConfig, defaultOptions) {
- if (IriSP.null_or_undefined(defaultOptions))
+ if (IriSP.null_or_undefined(defaultOptions)) {
defaultOptions = {};
+ }
+ if (IriSP.null_or_undefined(widgetConfig)) {
+ return;
+ }
widgetConfig = IriSP.underscore.defaults(widgetConfig, defaultOptions);
@@ -3446,10 +3450,10 @@
_rx = IriSP.regexpFromText(_keyword),
_contents = _field.val();
_contents = ( _rx.test(_contents)
- ? _contents.replace(_rx,"").replace(" "," ").trim()
- : _contents.trim() + " " + _keyword
+ ? _contents.replace(_rx,"").replace(" "," ").replace(/(^\s+|\s+$)/g,'')
+ : _contents.replace(/(^\s+|\s+$)/g,'') + " " + _keyword
);
- _field.val(_contents.trim()).trigger("js_mod");
+ _field.val(_contents.replace(/(^\s+|\s+$)/g,'')).trigger("js_mod");
}
/** handles clicks on the annotate button. Works only for the non-cinecast version */
@@ -3615,7 +3619,7 @@
if (_this._state == "waitScreen") {
_this.showEndScreen(annotation);
if (_this.cinecast_version) {
- window.setTimeout(function() { _this.showStartScreen(); }, 5000);
+ window.setTimeout(function() { _this.showStartScreen(); }, typeof this.disable_share !== "undefined" && this.disable_share ? 5000 : 10000);
}
}
// hide the slicer widget
@@ -3754,7 +3758,7 @@
var _an_ids = IriSP.underscore(this._serializer._data.annotations).map(function(_a) {
return _a.id.toLowerCase();
});
- if (_an_ids.indexOf(annotation.id.toLowerCase()) == -1) {
+ if (IriSP._(_an_ids).indexOf(annotation.id.toLowerCase()) == -1) {
_this._serializer._data.annotations.push(annotation);
}
@@ -4883,7 +4887,139 @@
IriSP.SliceWidget.prototype.hide = function() {
this.selector.hide();
-};IriSP.SliderWidget = function(Popcorn, config, Serializer) {
+};
+/** A widget to display slide show from embed slide share */
+IriSP.SlideShareWidget = function(Popcorn, config, Serializer) {
+ IriSP.Widget.call(this, Popcorn, config, Serializer);
+};
+
+IriSP.SlideShareWidget.prototype = new IriSP.Widget();
+
+IriSP.SlideShareWidget.prototype.draw = function() {
+ var self = this;
+
+ var templ = Mustache.to_html(IriSP.slideShareWidget_template);
+ this.selector.append(templ);
+
+ // Synchro management
+ this._disableUpdate = false;
+ this.selector.find('.sync_on').click(function(event) { self.syncHandler.call(self, event); });
+ this.selector.find('.sync_off').click(function(event) { self.unSyncHandler.call(self, event); });
+
+ // global variables used to keep the position and width of the zone.
+ this.zoneLeft = 0;
+ this.zoneWidth = 0;
+ // global variable to save the last slide url
+ this.lastSlide = "";
+ this.containerDiv = this.selector.find('.SlideShareContainer');
+
+ // Update the slide from timeupdate event
+ this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.slideShareUpdater));
+
+ this._Popcorn.listen("IriSP.SlideShareWidget.show", IriSP.wrap(this, this.show));
+ this._Popcorn.listen("IriSP.SlideShareWidget.hide", IriSP.wrap(this, this.hide));
+
+ // Get data from "slideshare" cutting/annotation-type
+ var annotations = this._serializer._data.annotations;
+ var view_type = this._serializer.getSlideShareType();
+ if(typeof(view_type) === "undefined") {
+ return;
+ }
+ var i = 0;
+ this.segments_slides = [];
+ var nb_annot = annotations.length;
+ for (i = 0; i < nb_annot; i++) {
+ var annotation = annotations[i];
+ /* filter the annotations whose type is not the one we want */
+ if (view_type != "" && typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined"
+ && annotation.meta["id-ref"] != view_type) {
+ continue;
+ }
+ this.segments_slides.push(annotation);
+ }
+};
+
+/* update the slider and the position marker as time passes */
+IriSP.SlideShareWidget.prototype.slideShareUpdater = function() {
+ // If it is asked not to synchronize, we do nothing
+ if(this._disableUpdate)
+ return;
+
+ var self = this;
+
+ // We search if a segments_slides is in the current timecode
+ var time = this._Popcorn.currentTime() * 1000;
+ var nb_slides = this.segments_slides.length;
+ var found = false;
+ for (i = 0; i < nb_slides; i++) {
+ var segment_slide = this.segments_slides[i];
+ if(segment_slide.begin