inject code
This commit is contained in:
Vendored
+32
@@ -0,0 +1,32 @@
|
|||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
(function () {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const scriptUrl = 'https://dev.deadend.work/lingdar77/bcm-tool/raw/branch/main/dist/bcm_tool.js';
|
||||||
|
try {
|
||||||
|
const response = yield fetch(scriptUrl);
|
||||||
|
const code = yield response.text();
|
||||||
|
const blob = new Blob([code], { type: 'application/javascript' });
|
||||||
|
const blobUrl = URL.createObjectURL(blob);
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.src = blobUrl;
|
||||||
|
script.type = 'module';
|
||||||
|
script.onload = () => {
|
||||||
|
URL.revokeObjectURL(blobUrl);
|
||||||
|
console.log("插件加载成功");
|
||||||
|
};
|
||||||
|
document.head.appendChild(script);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.error("插件加载失败", e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
(async function ()
|
||||||
|
{
|
||||||
|
const scriptUrl = 'https://dev.deadend.work/lingdar77/bcm-tool/raw/branch/main/dist/bcm_tool.js';
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const response = await fetch(scriptUrl);
|
||||||
|
const code = await response.text();
|
||||||
|
const blob = new Blob([code], { type: 'application/javascript' });
|
||||||
|
const blobUrl = URL.createObjectURL(blob);
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.src = blobUrl;
|
||||||
|
script.type = 'module';
|
||||||
|
script.onload = () =>
|
||||||
|
{
|
||||||
|
URL.revokeObjectURL(blobUrl);
|
||||||
|
console.log("插件加载成功");
|
||||||
|
};
|
||||||
|
document.head.appendChild(script);
|
||||||
|
} catch (e)
|
||||||
|
{
|
||||||
|
console.error("插件加载失败", e);
|
||||||
|
}
|
||||||
|
})();
|
||||||
Reference in New Issue
Block a user