Commit 3593a24b authored by Mark Ghiorso's avatar Mark Ghiorso

Modified tutorial example to open a Youtube video

parent 68e13496
...@@ -40,7 +40,7 @@ class XkcdWidget extends Widget { ...@@ -40,7 +40,7 @@ class XkcdWidget extends Widget {
this.title.closable = true; this.title.closable = true;
this.addClass('jp-xkcdWidget'); this.addClass('jp-xkcdWidget');
this.img = document.createElement('img'); this.img = document.createElement('iframe');
this.img.className = 'jp-xkcdCartoon'; this.img.className = 'jp-xkcdCartoon';
this.node.appendChild(this.img); this.node.appendChild(this.img);
...@@ -61,17 +61,27 @@ class XkcdWidget extends Widget { ...@@ -61,17 +61,27 @@ class XkcdWidget extends Widget {
/** /**
* The image element associated with the widget. * The image element associated with the widget.
*/ */
readonly img: HTMLImageElement; //readonly img: HTMLImageElement; - original
readonly img: HTMLIFrameElement;
/** /**
* Handle update requests for the widget. * Handle update requests for the widget.
*/ */
onUpdateRequest(msg: Message): void { onUpdateRequest(msg: Message): void {
/*
ServerConnection.makeRequest({url: 'https://egszlpbmle.execute-api.us-east-1.amazonaws.com/prod'}, this.settings).then(response => { ServerConnection.makeRequest({url: 'https://egszlpbmle.execute-api.us-east-1.amazonaws.com/prod'}, this.settings).then(response => {
this.img.src = response.data.img; this.img.src = response.data.img;
this.img.alt = response.data.title; this.img.alt = response.data.title;
this.img.title = response.data.alt; this.img.title = response.data.alt;
}); });
*/
//ServerConnection.makeRequest({url: 'https://www.youtube.com/embed/R7ZhuhOhu38'}, this.settings).then(response => {
this.img.src = "https://www.youtube.com/embed/R7ZhuhOhu38";
this.img.width = "800";
this.img.height = "450";
this.img.frameBorder = "0";
this.img.allowFullscreen = true;
//});
} }
}; };
...@@ -111,7 +121,7 @@ function activate(app: JupyterLab, palette: ICommandPalette, restorer: ILayoutRe ...@@ -111,7 +121,7 @@ function activate(app: JupyterLab, palette: ICommandPalette, restorer: ILayoutRe
}); });
// Add the command to the palette. // Add the command to the palette.
palette.addItem({ command, category: 'Tutorial' }); palette.addItem({ command, category: '0Tutorial' });
// Track and restore the widget state // Track and restore the widget state
let tracker = new InstanceTracker<Widget>({ namespace: 'xkcd' }); let tracker = new InstanceTracker<Widget>({ namespace: 'xkcd' });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment