src/widgets/Slideshare.js
changeset 1072 ac1eacb3aa33
parent 1013 392ddcd212d7
--- a/src/widgets/Slideshare.js	Sun Nov 12 22:07:33 2017 +0100
+++ b/src/widgets/Slideshare.js	Wed Sep 04 17:32:50 2024 +0200
@@ -1,17 +1,19 @@
 /* TODO: Add Slide synchronization */
+import slideshareStyles from "./Slideshare.module.css";
+import jQuery from "jquery";
 
-IriSP.Widgets.Slideshare = function(player, config) {
-    IriSP.Widgets.Widget.call(this, player, config);
+const Slideshare = function(ns) {
+    return class extends ns.Widgets.Widget {
+        constructor(player, config) {
+    super(player, config);
 };
 
-IriSP.Widgets.Slideshare.prototype = new IriSP.Widgets.Widget();
-
-IriSP.Widgets.Slideshare.prototype.defaults = {
+static defaults = {
     annotation_type: "slide",
     sync: true,
 };
 
-IriSP.Widgets.Slideshare.prototype.messages = {
+static messages =  {
     fr: {
         slides_ : "Diapositives"
     },
@@ -20,10 +22,10 @@
     }
 };
 
-IriSP.Widgets.Slideshare.prototype.template =
+static template =
     '<div class="Ldt-SlideShare"><h2>{{l10n.slides_}}</h2><hr /><div class="Ldt-SlideShare-Container"></div></div>';
 
-IriSP.Widgets.Slideshare.prototype.draw = function() {
+draw() {
     
     function insertSlideshare(_presentation, _slide) {
         if (_lastEmbedded === _presentation) {
@@ -32,7 +34,7 @@
             }
         } else {
             _lastEmbedded = _presentation;
-            var _id = IriSP.Model.getUID(),
+            var _id = ns.Model.getUID(),
                 _params = {
                     allowScriptAccess: "always"
                 },
@@ -92,7 +94,7 @@
                             var _ajaxUrl = "http://www.slideshare.net/api/oembed/1?url="
                                 + encodeURIComponent(_presentation)
                                 + "&format=jsonp&callback=?";
-                            IriSP.jQuery.getJSON(_ajaxUrl, function(_oembedData) {
+                            jQuery.getJSON(_ajaxUrl, function(_oembedData) {
                                 var _presmatch = _oembedData.html.match(/doc=([a-z0-9\-_%]+)/i);
                                 if (_presmatch && _presmatch.length > 1) {
                                     _oembedCache[_presentation] =  _presmatch[1];
@@ -115,3 +117,6 @@
         });
     }
 };
+    }}
+
+export { Slideshare, slideshareStyles };
\ No newline at end of file