Use CrossOrigin.json for Github Gist embedding.

This commit is contained in:
ccd0 2018-09-18 01:24:20 -07:00
parent f86d947377
commit f21e57e67f

View File

@ -277,15 +277,13 @@ Embedding =
el = $.el 'pre', el = $.el 'pre',
hidden: true hidden: true
id: "gist-embed-#{counter++}" id: "gist-embed-#{counter++}"
$.ajax "https://api.github.com/gists/#{a.dataset.uid}", CrossOrigin.json "https://api.github.com/gists/#{a.dataset.uid}", ->
responseType: 'json' el.textContent = Object.values(@response.files)[0].content
onload: -> el.className = 'prettyprint'
el.textContent = Object.values(@response.files)[0].content $.global ->
el.className = 'prettyprint' window.prettyPrint? (() ->), document.getElementById(document.currentScript.dataset.id).parentNode
$.global -> , id: el.id
window.prettyPrint? (() ->), document.getElementById(document.currentScript.dataset.id).parentNode el.hidden = false
, id: el.id
el.hidden = false
el el
title: title:
api: (uid) -> "https://api.github.com/gists/#{uid}" api: (uid) -> "https://api.github.com/gists/#{uid}"