Optimize the loading of Asteroids

This commit is contained in:
StevenJoeZhang 2019-08-07 01:12:42 +08:00
parent 2da4c8661c
commit aab6246545

View File

@ -24,9 +24,16 @@ function loadWidget(waifuPath, apiPath) {
function registerEventListener() {
$("#waifu-tool .fa-comment").click(showHitokoto);
$("#waifu-tool .fa-paper-plane").click(function() {
var s = document.createElement("script");
document.body.appendChild(s);
s.src = "https://cdn.jsdelivr.net/gh/GalaxyMimi/CDN/asteroids.js";
if (window.Asteroids) {
if (!window.ASTEROIDSPLAYERS) window.ASTEROIDSPLAYERS = [];
window.ASTEROIDSPLAYERS.push(new Asteroids());
} else {
$.ajax({
url: "https://cdn.jsdelivr.net/gh/GalaxyMimi/CDN/asteroids.js",
dataType: "script",
cache: true
});
}
});
$("#waifu-tool .fa-user-circle").click(loadOtherModel);
$("#waifu-tool .fa-street-view").click(loadRandModel);