Last active
October 5, 2018 11:20
-
-
Save theotherdy/572406dce62dc51f8dfd392f3458e7e7 to your computer and use it in GitHub Desktop.
Using gist-embed to embed GitHub gists nicely in instructure Canvas - see: https://learntech.imsu.ox.ac.uk/blog/embedding-a-github-gist-in-instructure-canvas/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { //method from: https://community.canvaslms.com/thread/22500-mobile-javascript-development | |
// The following function will retrieve and load a JavaScript file - https://www.nczonline.net/blog/2009/07/28/the-best-way-to-load-external-javascript/ | |
function loadScript(url, callback) { | |
var script = document.createElement("script"); | |
script.type = "text/javascript"; | |
if (script.readyState) { //IE | |
script.onreadystatechange = function () { | |
if (script.readyState == "loaded" || script.readyState == "complete") { | |
script.onreadystatechange = null; | |
callback(); | |
} | |
}; | |
} else { //Others | |
script.onload = function () { | |
callback(); | |
}; | |
} | |
script.src = url; | |
document.getElementsByTagName("head")[0].appendChild(script); | |
} | |
// First load jQuery and then load jQuery UI | |
loadScript("https://code.jquery.com/jquery-1.9.1.min.js", function () { | |
//Now load anything that depenfds on JQuery | |
loadScript("https://cdnjs.cloudflare.com/ajax/libs/gist-embed/2.7.1/gist-embed.min.js", function () { | |
//shoud be able to use now in Page - see: http://blairvanderhoof.com/gist-embed/ | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment