')
- .addClass("Ldt-Slice")
+ this.renderTemplate();
+
+ this.$slider = this.$.find(".Ldt-Slice");
- this.$.append(this.$slider);
+ if (this.show_arrow) {
+ this.insertSubwidget(this.$.find(".Ldt-Slice-Arrow"), { type: "Arrow" },"arrow");
+ }
this.min = 0;
- this.max = this.source.getDuration().valueOf();
+ this.max = this.media.duration.valueOf();
var _this = this,
_currentTime;
this.$slider.slider({
range: true,
- values: [0, 0],
+ values: [0, this.max],
min: 0,
max: this.max,
change: function(event, ui) {
- _this.player.trigger("Arrow.updatePosition",{
- widget:_this.type,
- time:Math.floor((ui.values[0]+ui.values[1])/2)
- });
- _this.player.trigger("Slice.boundsChanged",[ui.values[0], ui.values[1]]);
+ if (_this.arrow) {
+ _this.arrow.moveToTime((ui.values[0]+ui.values[1])/2)
+ }
+ if (_this.onBoundsChanged) {
+ _this.onBoundsChanged(ui.values[0],ui.values[1]);
+ }
},
start: function() {
_this.sliding = true;
@@ -54,9 +54,6 @@
_currentTime = _this.media.getCurrentTime();
},
slide: function(event, ui) {
- if (!_this.override_bounds && (ui.value < _this.min || ui.value > _this.max)) {
- return false;
- }
_this.media.setCurrentTime(ui.value);
},
stop: function() {
@@ -64,36 +61,21 @@
_this.media.setCurrentTime(_currentTime);
}
});
+
this.$slider.find(".ui-slider-handle:first").addClass("Ldt-Slice-left-handle");
this.$slider.find(".ui-slider-handle:last").addClass("Ldt-Slice-right-handle");
- if (this.start_visible) {
- this.show();
- } else {
- this.hide();
- }
- this.onMdpEvent("Slice.show","show");
- this.onMdpEvent("Slice.hide","hide");
- this.onMdpEvent("Annotation.boundsChanged","storeBounds");
- this.player.trigger("Annotation.getBounds");
+
+ this.getWidgetAnnotations().forEach(function(_a) {
+ _a.on("enter", function() {
+ _this.$slider.slider("values",[_a.begin, _a.end]);
+ });
+ });
};
IriSP.Widgets.Slice.prototype.show = function() {
this.$slider.show();
- this.player.trigger("Arrow.takeover",this.type);
- this.$slider.slider("values", [this.min, this.max]);
}
IriSP.Widgets.Slice.prototype.hide = function() {
this.$slider.hide();
- this.player.trigger("Arrow.release");
}
-
-IriSP.Widgets.Slice.prototype.storeBounds = function(_values) {
- if (!this.media.getPaused() && (this.min != _values[0] || this.max != _values[1])) {
- this.min = _values[0];
- this.max = _values[1];
- if (this.live_update && !this.sliding) {
- this.$slider.slider("values", [this.min, this.max]);
- }
- }
-}
\ No newline at end of file
diff -r 87598228cfbb -r 8d62f45fe393 src/ldt/ldt/static/ldt/metadataplayer/Slider.css
--- a/src/ldt/ldt/static/ldt/metadataplayer/Slider.css Mon Sep 24 11:29:35 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slider.css Mon Sep 24 18:37:53 2012 +0200
@@ -12,3 +12,8 @@
background: #747474;
}
+.Ldt-Slider-Time {
+ position: absolute; top: -16px; background: #ffffc0; color: #000000; border-radius: 3px; z-index: 8;
+ font-size: 9px; width: 34px; border: 1px solid #999999; padding: 1px; margin-left: -20px;
+ display: none; text-align: center; font-weight: bold;
+}
diff -r 87598228cfbb -r 8d62f45fe393 src/ldt/ldt/static/ldt/metadataplayer/Slider.js
--- a/src/ldt/ldt/static/ldt/metadataplayer/Slider.js Mon Sep 24 11:29:35 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slider.js Mon Sep 24 18:37:53 2012 +0200
@@ -15,12 +15,16 @@
set to zero for fixed slider */
};
+IriSP.Widgets.Slider.prototype.template =
+ '
'
+
IriSP.Widgets.Slider.prototype.draw = function() {
- this.$slider = IriSP.jQuery('
')
- .addClass("Ldt-Slider");
+ this.renderTemplate();
- this.$.append(this.$slider);
+ this.$time = this.$.find(".Ldt-Slider-Time");
+
+ this.$slider = this.$.find(".Ldt-Slider");
var _this = this;
@@ -45,13 +49,21 @@
this.$slider.css(this.calculateSliderCss(this.minimized_height));
this.$handle.css(this.calculateHandleCss(this.minimized_height));
- this.$
- .mouseover(this.functionWrapper("onMouseover"))
- .mouseout(this.functionWrapper("onMouseout"));
-
this.maximized = false;
this.timeoutId = false;
}
+
+ this.$
+ .mouseover(function() {
+ _this.$time.show();
+ _this.onMouseover();
+ })
+ .mouseout(this.functionWrapper("onMouseout"))
+ .mousemove(function(_e) {
+ var _x = _e.pageX - _this.$.offset().left,
+ _t = new IriSP.Model.Time(_this.media.duration * _x / _this.width);
+ _this.$time.text(_t.toString()).css("left",_x);
+ });
};
IriSP.Widgets.Slider.prototype.onTimeupdate = function(_time) {
@@ -73,6 +85,7 @@
}
IriSP.Widgets.Slider.prototype.onMouseout = function() {
+ this.$time.hide();
if (this.minimize_timeout) {
if (this.timeoutId) {
window.clearTimeout(this.timeoutId);
diff -r 87598228cfbb -r 8d62f45fe393 src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js
--- a/src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js Mon Sep 24 11:29:35 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Slideshare.js Mon Sep 24 18:37:53 2012 +0200
@@ -2,12 +2,6 @@
IriSP.Widgets.Slideshare = function(player, config) {
IriSP.Widgets.Widget.call(this, player, config);
- this.lastSlide = {
- presentation: "",
- slide: 0
- }
- this.embedObject = null;
- this.oembedCache = {}
}
IriSP.Widgets.Slideshare.prototype = new IriSP.Widgets.Widget();
@@ -32,99 +26,94 @@
'
';
IriSP.Widgets.Slideshare.prototype.draw = function() {
- var _hide = false;
- if (typeof this.annotation_type !== "undefined" && this.annotation_type) {
- var _annType = this.source.getAnnotationTypes().searchByTitle(this.annotation_type);
- _hide = !_annType.length;
+
+ var _embedObject = null,
+ $container,
+ _lastEmbedded = "",
+ _this = this;
+
+ function insertSlideshare(_presentation, _slide) {
+ if (_lastEmbedded === _presentation) {
+ if (_.embedObject && typeof _embedObject.jumpTo === "function") {
+ _embedObject.jumpTo(parseInt(_slide));
+ }
+ } else {
+ _lastEmbedded = _presentation;
+ var _id = IriSP.Model.getUID(),
+ _params = {
+ allowScriptAccess: "always"
+ }
+ _atts = {
+ id: _id
+ },
+ _flashvars = {
+ doc : _presentation,
+ startSlide : _slide
+ };
+ $container.html('
');
+ swfobject.embedSWF(
+ "http://static.slidesharecdn.com/swf/ssplayer2.swf",
+ _id,
+ _this.embed_width,
+ _this.embed_height,
+ "8",
+ null,
+ _flashvars,
+ _params,
+ _atts
+ );
+ _embedObject = document.getElementById(_id);
+ }
+ $container.show();
}
- if (_hide) {
+
+ var _annotations = this.getWidgetAnnotations();
+ if (!_annotations.length) {
this.$.hide();
} else {
this.renderTemplate();
- this.$container = this.$.find(".Ldt-SlideShare-Container");
- this.onMediaEvent("timeupdate","onTimeupdate");
- this.onTimeupdate(0);
+ var _lastPres = "",
+ _embedObject = null,
+ _oembedCache = {},
+ _this = this;
+ $container = this.$.find(".Ldt-SlideShare-Container");
+ _annotations.forEach(function(_a) {
+ _a.on("leave", function() {
+ $container.hide();
+ _lastPres = "";
+ });
+ _a.on("enter", function() {
+ var _description = _a.description,
+ _isurl = /^https?:\/\//.test(_description),
+ _presentation = _description.replace(/#.*$/,''),
+ _slidematch = _description.match(/(#|\?|&)id=(\d+)/),
+ _slide = parseInt(_slidematch && _slidematch.length > 2 ? _slidematch[2] : 1);
+ if (_presentation !== _lastPres) {
+ if (_isurl) {
+ if (typeof _oembedCache[_presentation] === "undefined") {
+ var _ajaxUrl = "http://www.slideshare.net/api/oembed/1?url="
+ + encodeURIComponent(_presentation)
+ + "&format=jsonp&callback=?";
+ IriSP.jQuery.getJSON(_ajaxUrl, function(_oembedData) {
+ var _presmatch = _oembedData.html.match(/doc=([a-z0-9\-_%]+)/i);
+ if (_presmatch && _presmatch.length > 1) {
+ _oembedCache[_presentation] = _presmatch[1];
+ insertSlideshare(_presmatch[1], _slide);
+ }
+ });
+ } else {
+ insertSlideshare(_oembedCache[_presentation], _slide);
+ }
+ } else {
+ insertSlideshare(_presentation, _slide);
+ }
+ }
+ if (_this.sync && _embedObject && typeof _embedObject.jumpTo === "function") {
+ _embedObject.jumpTo(parseInt(_slide));
+ }
+ _lastPres = _presentation;
+
+ })
+ })
}
}
-
-IriSP.Widgets.Slideshare.prototype.onTimeupdate = function(_time) {
- var _list = this.getWidgetAnnotationsAtTime();
- if (_list.length) {
- var _description = _list[0].description,
- _isurl = /^https?:\/\//.test(_description),
- _presentation = _description.replace(/#.*$/,''),
- _slidematch = _description.match(/(#|\?|&)id=(\d+)/),
- _slide = parseInt(_slidematch && _slidematch.length > 2 ? _slidematch[2] : 1),
- _this = this;
- if (_presentation !== this.lastSlide.presentation) {
- if (_isurl) {
- if (typeof this.oembedCache[_presentation] === "undefined") {
- var _ajaxUrl = "http://www.slideshare.net/api/oembed/1?url="
- + encodeURIComponent(_presentation)
- + "&format=jsonp&callback=?";
- IriSP.jQuery.getJSON(_ajaxUrl, function(_oembedData) {
- var _presmatch = _oembedData.html.match(/doc=([a-z0-9\-_%]+)/i);
- if (_presmatch && _presmatch.length > 1) {
- _this.oembedCache[_presentation] = _presmatch[1];
- _this.insertSlideshare(_presmatch[1], _slide);
- }
- });
- } else {
- this.insertSlideshare(this.oembedCache[_presentation], _slide);
- }
- } else {
- this.insertSlideshare(_presentation, _slide);
- }
- }
- if (_slide != this.lastSlide.slide && this.sync && this.embedObject && typeof this.embedObject.jumpTo === "function") {
- this.embedObject.jumpTo(parseInt(_slide));
- }
- this.lastSlide = {
- presentation: _presentation,
- slide: _slide
- }
- } else {
- if (this.lastSlide.presentation) {
- this.$container.hide();
- this.lastSlide = {
- presentation: "",
- slide: 0
- }
- }
- }
-}
-
-IriSP.Widgets.Slideshare.prototype.insertSlideshare = function(_presentation, _slide) {
- if (this.lastEmbedded === _presentation) {
- if (this.embedObject && typeof this.embedObject.jumpTo === "function") {
- this.embedObject.jumpTo(parseInt(_slide));
- }
- } else {
- this.lastEmbedded = _presentation;
- var _id = IriSP.Model.getUID(),
- _params = {
- allowScriptAccess: "always"
- }
- _atts = {
- id: _id
- },
- _flashvars = {
- doc : _presentation,
- startSlide : _slide
- };
- this.$container.html('
');
- swfobject.embedSWF(
- "http://static.slidesharecdn.com/swf/ssplayer2.swf",
- _id,
- this.embed_width,
- this.embed_height,
- "8",
- null,
- _flashvars,
- _params,
- _atts
- );
- this.embedObject = document.getElementById(_id);
- }
- this.$container.show();
-}
diff -r 87598228cfbb -r 8d62f45fe393 src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js Mon Sep 24 11:29:35 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tagcloud.js Mon Sep 24 18:37:53 2012 +0200
@@ -44,35 +44,27 @@
this.onMdpEvent("search.cleared", "onSearch");
if (this.segment_annotation_type) {
- this.onMediaEvent("timeupdate","onTimeupdate");
+ var _this = this;
+ this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).forEach(function(_a) {
+ _a.on("enter", function() {
+ _this.redraw(_a.begin, _a.end);
+ })
+ });
} else {
this.redraw();
}
}
-IriSP.Widgets.Tagcloud.prototype.onTimeupdate = function(_time) {
- var _list = this.source.getAnnotationsByTypeTitle(this.segment_annotation_type).filter(function(_annotation) {
- return _annotation.begin <= _time && _annotation.end > _time;
- });
- if (_list.length) {
- if (_list[0].begin !== this.begin_time || _list[0].end !== this.end_time) {
- this.begin_time = _list[0].begin;
- this.end_time = _list[0].end;
- this.redraw();
- }
- }
-}
-
-IriSP.Widgets.Tagcloud.prototype.redraw = function() {
+IriSP.Widgets.Tagcloud.prototype.redraw = function(_from, _to) {
var _urlRegExp = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g,
_regexpword = /[^\s\.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g,
_words = {},
_this = this,
_annotations = this.getWidgetAnnotations();
- if (typeof this.begin_time !== "undefined" && typeof this.end_time !== "undefined") {
+ if (typeof _from !== "undefined" && typeof _to !== "undefined") {
_annotations = _annotations.filter(function(_annotation) {
- return _annotation.begin >= _this.begin_time && _annotation.end <= _this.end_time;
+ return _annotation.begin >= _from && _annotation.end <= _to;
})
}
diff -r 87598228cfbb -r 8d62f45fe393 src/ldt/ldt/static/ldt/metadataplayer/Tweet.js
--- a/src/ldt/ldt/static/ldt/metadataplayer/Tweet.js Mon Sep 24 11:29:35 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Tweet.js Mon Sep 24 18:37:53 2012 +0200
@@ -25,6 +25,7 @@
"color" : "#05aae6"
}
],
+ annotation_type: "tweet",
pin_at_start: false
}
@@ -66,7 +67,6 @@
IriSP.Widgets.Tweet.prototype.draw = function() {
this.renderTemplate();
- this.onMdpEvent("Tweet.show","show");
this.pinned = this.pin_at_start;
var _this = this;
this.$.find(".Ldt-Tweet-Pin").click(function() {
@@ -84,10 +84,14 @@
_this.hide();
});
this.$.hide();
+ this.getWidgetAnnotations().forEach(function(_annotation) {
+ _annotation.on("click", function() {
+ _this.show(_annotation);
+ });
+ });
}
-IriSP.Widgets.Tweet.prototype.show = function(_id) {
- var _tweet = this.source.getElement(_id);
+IriSP.Widgets.Tweet.prototype.show = function(_tweet) {
if (typeof _tweet !== "undefined" && typeof _tweet.source !== "undefined") {
var _entities = [];
for (var _i = 0; _i < _tweet.source.entities.hashtags.length; _i++) {