-
-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathinjectScriptToWebsite.js
37 lines (33 loc) · 1010 Bytes
/
injectScriptToWebsite.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { UfsGlobal } from "./content-scripts/ufs_global.js";
export default {
icon: '<i class="fa-solid fa-virus fa-lg"></i>',
name: {
en: "Inject script to website",
vi: "Nhúng script vào trang web",
},
description: {
en: "Inject script url to current website, eg. jquery, library, etc.",
vi: "Nhúng link script vào website, ví dụ nhúng jquery, thư viện js, ...",
},
pageScript: {
onClick: function () {
let url = prompt(
"Enter script url / Nhập link script: ",
"//code.jquery.com/jquery-3.6.1.min.js"
);
if (url) {
UfsGlobal.DOM.injectScriptSrc(url, (success, error) => {
if (success) {
alert("Inject SUCCESS.\n\n" + url);
} else {
alert("Inject FAILED.\n\n" + JSON.stringify(error));
}
});
}
},
},
};
function backup() {
// https://stackoverflow.com/a/38840724/11898496
// Script loader: https://plnkr.co/edit/b9O19f?p=preview&preview
}