-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcheckerV2.js
More file actions
34 lines (31 loc) · 1.17 KB
/
checkerV2.js
File metadata and controls
34 lines (31 loc) · 1.17 KB
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
((pluginName, window) => {
if (window.underscript) return;
const key = 'underscript.required';
if (!sessionStorage.getItem(key)) {
sessionStorage.setItem(key, '1'); // Set instantly to prevent multiple alerts happening
const message = "Looks like you don't have UnderScript installed, or you deactivated it! In order for plugins to work, you need to have it up and running. Until then, the features of this userscript will simply not work. Thank you for your understanding.";
if (window.SimpleToast) {
SimpleToast({
title: 'Missing Requirements',
text: message,
footer: pluginName,
});
} else if (window.BootstrapDialog) {
BootstrapDialog.show({
title: 'Oh No!',
type: BootstrapDialog.TYPE_WARNING,
message,
buttons: [{
label: 'Proceed',
cssClass: 'btn-primary',
action(dialog) {
dialog.close();
},
}],
});
} else {
sessionStorage.removeItem(key);
}
}
throw new Error(`${pluginName}: UnderScript required`);
})(this.GM_info?.script?.name ?? 'UNKNOWN', typeof unsafeWindow === 'object' ? unsafeWindow : globalThis);