Skip to content

Instantly share code, notes, and snippets.

@hden
Last active December 14, 2015 13:08
Show Gist options
  • Select an option

  • Save hden/5091070 to your computer and use it in GitHub Desktop.

Select an option

Save hden/5091070 to your computer and use it in GitHub Desktop.

markdown code injection

Works with jQuery enabled sites

Inject needen script by calling require

require = (url) ->
  script = document.createElement('script')
  script.type = 'text/javascript'
  script.src = url
  $('body').append(script)

packages = [
  'http://cdnjs.cloudflare.com/ajax/libs/d3/3.0.1/d3.v3.min.js'
  'http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js'
  'https://raw.github.com/gist/5091070/notifier.js'
]

require src for src in packages
$(document).trigger('injected');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment