Created
June 18, 2021 03:06
-
-
Save LivingGhost/40a6a58476d0eba0cf57e86ba44e68f2 to your computer and use it in GitHub Desktop.
Bookmarkletで任意のJSライブラリをページに埋め込みつつ使いたいとき
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
javascript: (function () { | |
const libs = ["https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"]; | |
function import_script(urls){ | |
return Promise.all(urls.map(function(url){ | |
return new Promise(function(resolve,reject){ | |
var script = document.createElement('script'); | |
script.src = url; | |
script.onload = resolve; | |
document.head.appendChild(script); | |
}); | |
})); | |
} | |
import_script(libs).then(function(){ | |
swal("テスト"); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment