Skip to content

Commit c5ca7b6

Browse files
committed
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 <sheogorath@shivering-isles.com>
1 parent 806f403 commit c5ca7b6

File tree

2 files changed

+7
-31
lines changed

2 files changed

+7
-31
lines changed

public/docs/features.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,6 @@ When you’re a carpenter making a beautiful chest of drawers, you’re not goin
222222
### SlideShare
223223
{%slideshare briansolis/26-disruptive-technology-trends-2016-2018-56796196 %}
224224

225-
### Speakerdeck
226-
{%speakerdeck sugarenia/xxlcss-how-to-scale-css-and-keep-your-sanity %}
227-
228225
### PDF
229226
**Caution: this might be blocked by your browser if not using an `https` URL.**
230227
{%pdf https://papers.nips.cc/paper/5346-sequence-to-sequence-learning-with-neural-networks.pdf %}

public/js/extra.js

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -459,34 +459,13 @@ export function finishView (view) {
459459
// speakerdeck
460460
view.find('div.speakerdeck.raw').removeClass('raw')
461461
.each((key, value) => {
462-
const url = `https://speakerdeck.com/oembed.json?url=https%3A%2F%2Fspeakerdeck.com%2F${encodeURIComponent($(value).attr('data-speakerdeckid'))}`
463-
// use yql because speakerdeck not support jsonp
464-
$.ajax({
465-
url: 'https://query.yahooapis.com/v1/public/yql',
466-
data: {
467-
q: `select * from json where url ='${url}'`,
468-
format: 'json'
469-
},
470-
dataType: 'jsonp',
471-
success (data) {
472-
if (!data.query || !data.query.results) return
473-
const json = data.query.results.json
474-
const html = json.html
475-
var ratio = json.height / json.width
476-
$(value).html(html)
477-
const iframe = $(value).children('iframe')
478-
const src = iframe.attr('src')
479-
if (src.indexOf('//') === 0) { iframe.attr('src', `https:${src}`) }
480-
const inner = $('<div class="inner"></div>').append(iframe)
481-
const height = iframe.attr('height')
482-
const width = iframe.attr('width')
483-
ratio = (height / width) * 100
484-
inner.css('padding-bottom', `${ratio}%`)
485-
$(value).html(inner)
486-
if (window.viewAjaxCallback) window.viewAjaxCallback()
487-
}
488-
})
489-
})
462+
const url = `https://speakerdeck.com/${$(value).attr('data-speakerdeckid')}`
463+
const inner = $('<a>Speakerdeck</a>')
464+
inner.attr('href', url)
465+
inner.attr('rel', 'noopener noreferrer')
466+
inner.attr('target', '_blank')
467+
$(value).append(inner)
468+
})
490469
// pdf
491470
view.find('div.pdf.raw').removeClass('raw')
492471
.each(function (key, value) {

0 commit comments

Comments
 (0)