Last active
September 22, 2018 13:11
-
-
Save hcz/4cfb35bcc3df7861f00db222b422c5ce to your computer and use it in GitHub Desktop.
Adds scripts from CDN in browser console or via bookmarklet
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
| /** | |
| * Adds scripts on page without CORS to use additional scripts from CDN | |
| * Creates scripts inside <head> tag | |
| * | |
| * @license MIT | |
| * @copyright Sergei Osipov 2017 | |
| */ | |
| ((cdnList) => { | |
| cdnList | |
| .filter((cdn)=>{ | |
| return (typeof cdn === 'string' || cdn instanceof String) ? String(cdn) : false; | |
| }) | |
| .forEach((cdn) => { | |
| const _ = document.createElement('script'); | |
| _.src = cdn; | |
| document.getElementsByTagName('head')[0].appendChild(_); | |
| }) | |
| })([ | |
| // todo: Fix list here | |
| 'https://cdn.jsdelivr.net/npm/lodash@4.17.5/lodash.min.js', | |
| 'https://unpkg.com/react@16/umd/react.development.js', | |
| 'https://unpkg.com/react-dom@16/umd/react-dom.development.js' | |
| ]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment