Skip to content

Instantly share code, notes, and snippets.

@mittsh
Forked from anonymous/inject.js
Created December 12, 2016 23:49
Show Gist options
  • Save mittsh/49d9fb84952e1226ddf9767fb076140f to your computer and use it in GitHub Desktop.
Save mittsh/49d9fb84952e1226ddf9767fb076140f to your computer and use it in GitHub Desktop.
(function(afterEl, descriptionUrl){
var fn = function() {
console.log('ready')
var html = '<a href="#" class="oic-button" data-mode="url" data-source="swagger" data-url="' + descriptionUrl + '"><img src="https://console.rest/github.io/assets/buttons/run_with_blue.svg" style="border: none;" /></a>'
var containerTag = document.createElement('div')
containerTag.innerHTML = html
afterEl.parentNode.insertBefore(containerTag, afterEl.nextSibling)
ConsoleRest.bindModalToButtons()
}
var scriptTag = document.createElement('script')
scriptTag.src = 'https://console.rest/github.io/libs/console-rest.js'
scriptTag.onload = function() {
console.log('loaded script')
ConsoleRest.ready.then(fn)
loadVisuals()
}
document.body.appendChild(scriptTag)
})(
document.getElementById('api-endpoints'),
'https://api.apis.guru/v2/specs/instagram.com/1.0.0/swagger.json'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment