-
Notifications
You must be signed in to change notification settings - Fork 6
/
owners-on-hover.user.js
49 lines (46 loc) · 1.28 KB
/
owners-on-hover.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ==UserScript==
// @name Room owner + janitor hover
// @namespace https://not.jew.dance
// @version 4.1
// @description Show da owner und janitors
// @author Polish cuck
// @icon https://volafile.org/favicon.ico
// @match https://volafile.org/r/*
// @require https://cdn.jsdelivr.net/gh/volafiled/volascripts@a9c0424e5498deea9fd437c15b2137c3bec07c61/dry.min.js
// @grant none
// @run-at document-start
// ==/UserScript==
/* globals dry */
dry.once("load", () => {
'use strict';
function wrapLines(arr, len) {
len = len || 40;
let cur = "";
const rv = [];
for (let i of arr) {
if (!i) {
continue;
}
let n = cur ? `${cur}, ${i}` : i;
if (n.length > len && cur) {
rv.push(cur);
cur = i;
continue;
}
cur = n;
}
if (cur) {
rv.push(cur);
}
return rv.join("\n");
}
const room_title = document.getElementById("name_container");
dry.exts.connection.on("config", cfg => {
let rv = [cfg.owner ? `Room owner: ${cfg.owner}` : "No owner"];
if (Array.isArray(cfg.janitors) && cfg.janitors.length) {
rv.push("Janitors:");
rv.push(wrapLines(cfg.janitors.slice(0).sort(), 36));
}
room_title.title = rv.join("\n");
});
});