From c5ca7b634a47e8d1b22b8cbf19c827d2262b8dcb Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Fri, 25 Jan 2019 23:45:56 +0100 Subject: [PATCH 1/2] Remove broken speakerdeck embedding The current speakerdeck implementation is broken. An alternative implementation using oembed doesn't work due to CORS, which could be solved by proxying the speakerdeck API, but we decided to not do this. This patch provides the link to the speakerdeck presentation instead, and this way doesn't break existing notes. This is right now the best solution we could come up with. Signed-off-by: Sheogorath --- public/docs/features.md | 3 --- public/js/extra.js | 35 +++++++---------------------------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/public/docs/features.md b/public/docs/features.md index a4ffb63..e7ce89c 100644 --- a/public/docs/features.md +++ b/public/docs/features.md @@ -222,9 +222,6 @@ When you’re a carpenter making a beautiful chest of drawers, you’re not goin ### SlideShare {%slideshare briansolis/26-disruptive-technology-trends-2016-2018-56796196 %} -### Speakerdeck -{%speakerdeck sugarenia/xxlcss-how-to-scale-css-and-keep-your-sanity %} - ### PDF **Caution: this might be blocked by your browser if not using an `https` URL.** {%pdf https://papers.nips.cc/paper/5346-sequence-to-sequence-learning-with-neural-networks.pdf %} diff --git a/public/js/extra.js b/public/js/extra.js index 76e9563..f8e0eb2 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -459,34 +459,13 @@ export function finishView (view) { // speakerdeck view.find('div.speakerdeck.raw').removeClass('raw') .each((key, value) => { - const url = `https://speakerdeck.com/oembed.json?url=https%3A%2F%2Fspeakerdeck.com%2F${encodeURIComponent($(value).attr('data-speakerdeckid'))}` - // use yql because speakerdeck not support jsonp - $.ajax({ - url: 'https://query.yahooapis.com/v1/public/yql', - data: { - q: `select * from json where url ='${url}'`, - format: 'json' - }, - dataType: 'jsonp', - success (data) { - if (!data.query || !data.query.results) return - const json = data.query.results.json - const html = json.html - var ratio = json.height / json.width - $(value).html(html) - const iframe = $(value).children('iframe') - const src = iframe.attr('src') - if (src.indexOf('//') === 0) { iframe.attr('src', `https:${src}`) } - const inner = $('
').append(iframe) - const height = iframe.attr('height') - const width = iframe.attr('width') - ratio = (height / width) * 100 - inner.css('padding-bottom', `${ratio}%`) - $(value).html(inner) - if (window.viewAjaxCallback) window.viewAjaxCallback() - } - }) - }) + const url = `https://speakerdeck.com/${$(value).attr('data-speakerdeckid')}` + const inner = $('Speakerdeck') + inner.attr('href', url) + inner.attr('rel', 'noopener noreferrer') + inner.attr('target', '_blank') + $(value).append(inner) + }) // pdf view.find('div.pdf.raw').removeClass('raw') .each(function (key, value) { From 1f0fb127555ac80826e573a187a4232668323804 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Thu, 21 Feb 2019 01:36:26 +0100 Subject: [PATCH 2/2] Fix CI errors for unused variables Signed-off-by: Sheogorath --- public/js/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index a845b5d..76f952c 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1,7 +1,6 @@ /* eslint-env browser, jquery */ -/* global CodeMirror, Cookies, moment, editor, ui, Spinner, - modeType, Idle, serverurl, key, gapi, Dropbox, FilePicker - ot, MediaUploader, hex2rgb, num_loaded, Visibility */ +/* global CodeMirror, Cookies, moment, Spinner, Idle, serverurl, + key, Dropbox, ot, hex2rgb, Visibility */ require('../vendor/showup/showup')