Last active
July 5, 2022 04:21
-
-
Save mebinum/a336167b97d410ea6df25146fa501658 to your computer and use it in GitHub Desktop.
Code to show to to embed a gist url into Webflow
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
<script> | |
// define the load gist function | |
var loadGist = function(elem) { | |
var gistUrl = $(elem).text().match(/\bhttps?:\/\/\S+(.js)/gi); | |
if (typeof gistUrl === 'undefined' || gistUrl === null || gistUrl.length == 0) | |
return; | |
//load gist | |
$(elem).show(); | |
$(elem).empty(); | |
postscribe(elem, '<script src=' + gistUrl+ '><\/script>'); | |
}; | |
if (postscribe) { | |
var gists = $('p:contains("CODE:")'); | |
gists.hide(); | |
gists.toArray().forEach(loadGist); | |
} else { | |
console.log("you need to include postscribe in your site for this to work") | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment