-
Notifications
You must be signed in to change notification settings - Fork 6
/
admin.reportsbinder.user.js
35 lines (35 loc) · 1.25 KB
/
admin.reportsbinder.user.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
// ==UserScript==
// @name Vola Tab Report Binder
// @version 1
// @namespace https://volafile.org
// @icon https://volafile.org/favicon.ico
// @author Hefty Chungus
// @match https://volafile.org/r/*
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @require https://cdn.jsdelivr.net/gh/volafiled/volascripts/dry.js
// @grant none
// @run-at document-start
// ==/UserScript==
/* globals dry GM config */
dry.once("dom", () => {
'use strict';
console.log("running", GM.info.script.name, GM.info.script.version, dry.version);
const bindtab = GM.info.script.name;
const tabbind = function () {
return localStorage.getItem(bindtab);
};
new class extends dry.Commands {
bindreports() {
localStorage.setItem(bindtab, config.room_id);
dry.appendMessage("Binder", "Reports are bound to this tab now");
dry.exts.connection.call("command", dry.exts.user.info.nick, "reports", "");
}
}();
new class extends dry.MessageFilter {
showMessage(orig, nick, message, options) {
if (nick === "Log" && tabbind() === config.room_id && !options.report) {
dry.exts.connection.call("command", dry.exts.user.info.nick, "reports", "");
}
}
}();
});