--- a/web/polemicaltimeline.php Thu Jan 17 15:54:18 2013 +0100
+++ b/web/polemicaltimeline.php Thu Jan 24 18:52:38 2013 +0100
@@ -180,6 +180,10 @@
//foreign_url : "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}}",
container: "AnnotationsListContainer"
},
+ {
+ type: "Slideshare",
+ container: "Slideshare"
+ },
<?php endif; ?>
<?php endif; ?>
{ type: "Mediafragment"},
@@ -368,6 +372,7 @@
<!-- EXPLICATION -->
<div id="mdpgauche">
<ul class="accordeon">
+ <div id="Slideshare"></div>
<li class="acctitre">
<h3><?php echo($translate->_('config__title')); ?></h3>
</li>
--- a/web/res/metadataplayer/LdtPlayer-core.js Thu Jan 17 15:54:18 2013 +0100
+++ b/web/res/metadataplayer/LdtPlayer-core.js Thu Jan 24 18:52:38 2013 +0100
@@ -1072,17 +1072,6 @@
Model.Mashup.prototype = new Model.Playable();
-Model.Mashup.prototype.checkLoaded = function() {
- var loaded = !!this.segments.length;
- this.getMedias().forEach(function(_m) {
- loaded = loaded && _m.loaded;
- });
- this.loaded = loaded;
- if (loaded) {
- this.trigger("loadedmetadata");
- }
-}
-
Model.Mashup.prototype.updateTimes = function() {
var _time = 0;
this.segments.forEach(function(_segment) {
@@ -1450,6 +1439,9 @@
return Model;
})(IriSP);
+
+/* END model.js */
+
IriSP.language = 'en';
IriSP.libFiles = {
@@ -1595,8 +1587,10 @@
_this[_key] = _value;
});
+ this.$ = IriSP.jQuery('#' + this.container);
+
if (typeof this.width === "undefined") {
- this.width = player.config.width;
+ this.width = this.$.width();
}
/* Setting this.player at the end in case it's been overriden
@@ -1605,7 +1599,6 @@
this.player = player;
/* Adding classes and html attributes */
- this.$ = IriSP.jQuery('#' + this.container);
this.$.addClass("Ldt-TraceMe Ldt-Widget").attr("widget-type", _type);
this.l10n = (
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/res/metadataplayer/Slideshare.css Thu Jan 24 18:52:38 2013 +0100
@@ -0,0 +1,28 @@
+/* Slideshare widget */
+
+.Ldt-SlideShare h2, .Ldt-SlideShare-Container {
+ border: 1px solid #FFFFFF;
+ list-style: none outside none;
+ margin: 0 1px 1px;
+ position: relative;
+
+}
+
+.Ldt-SlideShare h2 {
+ background: none repeat scroll 0 0 #EFEFEF;
+ cursor: pointer;
+ color: #555555;
+ font-size: 16px;
+ font-weight: bold;
+ padding: 4px;
+}
+
+.Ldt-SlideShare hr {
+ display: none;
+}
+
+.Ldt-SlideShare-Container {
+ background: url("../css/twcx-img/bgdeplie.png") repeat-x scroll center top #EFEFEF;
+ font-size: 12px;
+ padding: 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/res/metadataplayer/Slideshare.js Thu Jan 24 18:52:38 2013 +0100
@@ -0,0 +1,117 @@
+/* TODO: Add Slide synchronization */
+
+IriSP.Widgets.Slideshare = function(player, config) {
+ IriSP.Widgets.Widget.call(this, player, config);
+}
+
+IriSP.Widgets.Slideshare.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.Slideshare.prototype.defaults = {
+ annotation_type: "slide",
+ sync: true,
+}
+
+IriSP.Widgets.Slideshare.prototype.messages = {
+ fr: {
+ slides_ : "Diapositives"
+ },
+ en: {
+ slides_ : "Slides"
+ }
+}
+
+IriSP.Widgets.Slideshare.prototype.template =
+ '<div class="Ldt-SlideShare"><h2>{{l10n.slides_}}</h2><hr /><div class="Ldt-SlideShare-Container"></div></div>';
+
+IriSP.Widgets.Slideshare.prototype.draw = function() {
+
+ 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('<div id="' + _id + '"></div>');
+ 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();
+ }
+
+ var _annotations = this.getWidgetAnnotations();
+ if (!_annotations.length) {
+ this.$.hide();
+ } else {
+ this.renderTemplate();
+ var _lastPres = "",
+ _embedObject = null,
+ _oembedCache = {},
+ _lastEmbedded = "",
+ _this = this
+ $container = this.$.find(".Ldt-SlideShare-Container");
+
+ this.embed_width = this.embed_width || $container.innerWidth();
+ this.embed_height = this.embed_height || Math.floor(this.embed_width * 3/4);
+
+ _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;
+
+ })
+ })
+ }
+}