Last active
December 6, 2025 23:44
-
-
Save WouterG/2e1b609bda53d699c88d585175f9688e to your computer and use it in GitHub Desktop.
PlugDJ Hacks / Tampermonkey script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name PlugDJ Hacks | |
| // @version 1.5.6.10852 | |
| // @description Modify HACK_CONFIG to your own settings. Allows user property overrides and replaces the staff list with a better one | |
| // @author Wouto1997 | |
| // @match https://plug.dj/* | |
| // @grant none | |
| // ==/UserScript== | |
| // to find your user id you can use the developer console (F12) and run JS command "API.getUser().id" | |
| // * * * * * * * * * * * * * * // | |
| // * * * * * * * * * * * * * * // | |
| // ENTER YOUR USER ID HERE // | |
| var YOUR_USER_ID = -1; | |
| // * * * * * * * * * * * * * * // | |
| // * * * * * * * * * * * * * * // | |
| var DEFAULTS = { | |
| username: undefined, | |
| id: YOUR_USER_ID, | |
| gRole: undefined, | |
| tastycat_avatar: false, | |
| avatar: undefined, | |
| sub: undefined, | |
| badge: undefined, | |
| minimum_role: 0, | |
| become_host: undefined, | |
| priority: undefined | |
| }; | |
| // CONFIG: | |
| var HACK_CONFIG = { | |
| username: undefined, // set a value to change your username appearance | |
| id: DEFAULTS.id, // auto-set from defaults | |
| gRole: 2500, // Global role, 0 is no global role, 500 is promoter, 750 PLOT, 2500 site moderator, 3000 brand ambassador, 5000 admin | |
| tastycat_avatar: false, // Apply tastycat avatar in /tastycat. Only works if you select a base avatar (works in the room) | |
| avatar: undefined, // Currently selected avatar, see https://rcs.radiant.dj/avatars | |
| sub: 1, // Whether you're subscribed, 0 is not subscribed, 1 is subscribed. | |
| badge: undefined, // Currently selected badge, see https://rcs.radiant.dj/badges | |
| minimum_role: 0, // If your role is lower than this, it'll be put to this. Valids are 0=default, 1000=res dj, 2000=bouncer, 3000=manager, 4000=cohost, 5000=host. | |
| become_host: false, // Set your user as the host of every room you enter | |
| priority: 100 // I'm not sure what priority does but you can override it here | |
| }; | |
| /* uncomment to reset: */ | |
| // HACK_CONFIG = DEFAULTS; | |
| var override_data = undefined; // put a complete user object in here to turn into this user entirely | |
| // Don't edit below unless you know what you're doing. | |
| var apply = function() { | |
| // await jQuery loaded | |
| if (window["$"] === undefined) { | |
| setTimeout(apply, 50); | |
| return; | |
| } | |
| $(document).ready(function() { | |
| function modGUI() { | |
| // replace the staff list content | |
| $(".button.staff").on('click', function() { | |
| var start = function() { | |
| for (var i = 0; i < window.staff_list.length; i++) { | |
| var staff = window.staff_list[i]; | |
| var userDivs = $(".list.staff .jspPane .user"); | |
| for (var j = 0; j < userDivs.length; j++) { | |
| var compName = staff.username.replace(/ +(?= )/g,'').trim(); | |
| if (userDivs[j].innerText != null && userDivs[j].innerText.trim() == compName) { | |
| if (!userDivs[j].classList.contains('__rank')) { | |
| var r = ''; | |
| if (staff.role == 5000) { | |
| r = 'host'; | |
| } else if (staff.role >= 4000) { | |
| r = 'cohost'; | |
| } else if (staff.role >= 3000) { | |
| r = 'manager'; | |
| } else if (staff.role >= 2000) { | |
| r = 'bouncer'; | |
| } else if (staff.role >= 1000) { | |
| r = 'dj'; | |
| } | |
| $(userDivs[j]).addClass('__rank').addClass('__rank_' + r); | |
| } | |
| var chatchar = 'icon-chat-subscriber'; | |
| var color = '#eee'; | |
| var icon_webkit = false; | |
| if (staff.gRole >= 5000) { | |
| chatchar = 'icon-chat-admin'; | |
| color = '#30C7FB'; | |
| } else if (staff.gRole >= 3000) { | |
| chatchar = 'icon-chat-ambassador'; | |
| color = '#95CB00'; | |
| } else if (staff.gRole >= 2500) { | |
| chatchar = 'icon-chat-sitemod'; | |
| color = '#e74c3c'; | |
| } else if (staff.gRole >= 750) { | |
| chatchar = 'icon-chat-plot'; | |
| color = '#e67e22'; | |
| } else if (staff.gRole >= 500) { | |
| chatchar = 'icon-chat-promoter'; | |
| color = '#1abc9c'; | |
| } else if (staff.role == 5000 || staff.role >= 4000) { | |
| chatchar = 'icon-chat-host'; | |
| color = '#9F68FF'; | |
| } else if (staff.role >= 3000) { | |
| color = '#9F68FF'; | |
| chatchar = 'icon-chat-manager'; | |
| } else if (staff.role >= 2000) { | |
| chatchar = 'icon-chat-bouncer'; | |
| color = '#9F68FF'; | |
| } else if (staff.role >= 1000) { | |
| chatchar = 'icon-chat-dj'; | |
| color = '#9F68FF'; | |
| } else { | |
| chatchar = 'icon-chat-subscriber'; | |
| color = '#c59840'; | |
| } | |
| $(userDivs[j]).find('.icon').remove(); | |
| var icon1 = document.createElement('i'); | |
| $(icon1) | |
| .addClass('icon') | |
| .addClass(chatchar) | |
| .css('top', '8px') | |
| .css('left', '16px'); | |
| if (chatchar == 'icon-chat-admin') { | |
| $(icon1).css('left', '17px'); | |
| } | |
| $(userDivs[j]).append(icon1); | |
| $(userDivs[j]).find('.name').attr('style', 'color: ' + color + ' !important'); | |
| } | |
| } | |
| } | |
| var stafflist = $(".list.staff .jspContainer .jspPane").children(); | |
| var lasthost = -1; | |
| var hasCoHosts = false; | |
| var hasCoHostsLabel = false; | |
| for (var i = 0; i < stafflist.length; i++) { | |
| if ($(stafflist[i]).hasClass('host')) { | |
| $("span", stafflist[0]).html("Hosts"); | |
| } else if ($(stafflist[i]).hasClass('__rank_host')) { | |
| lasthost = i; | |
| } else if ($(stafflist[i]).hasClass('__rank_cohost')) { | |
| hasCoHosts = true; | |
| } else if ($(stafflist[i]).hasClass('cohost')) { | |
| hasCoHostsLabel = true; | |
| } | |
| } | |
| if (hasCoHosts && !hasCoHostsLabel) { | |
| var divCode = '<div class="group cohost"><i class="icon icon-chat-host"></i><span>Co-Hosts</span></div>'; | |
| $(divCode).insertAfter(stafflist[lasthost]); | |
| } | |
| }; | |
| var check = function() { | |
| if (window["staff_list"] === undefined || $(".list.staff .jspPane .user").length == 0) { | |
| setTimeout(check, 10); | |
| } else { | |
| start(); | |
| } | |
| }; | |
| check(); | |
| }); | |
| } | |
| var modGUIWait = function() { | |
| if ($(".button.staff").length == 0) { | |
| setTimeout(modGUIWait, 100); | |
| } else { | |
| modGUI(); | |
| } | |
| }; | |
| modGUIWait(); | |
| (function() { | |
| var ajax = $.ajax; | |
| $.ajax = function() { | |
| var req = arguments[0]; | |
| console.log('handling: ' + req.url); | |
| if (req.url == '/_/users/me') { | |
| var orSuc = req.success; | |
| req.success = function(t, n, i) { | |
| if (override_data !== undefined) { | |
| var other = override_data; | |
| var me = t.data[0]; | |
| for (var id in other) { | |
| if (me.hasOwnProperty(id) && other.hasOwnProperty(id)) { | |
| me[id] = other[id]; | |
| } | |
| } | |
| t.data[0] = me; | |
| orSuc.apply(this, arguments); | |
| return; | |
| } | |
| if (HACK_CONFIG.gRole !== undefined) { | |
| t.data[0].gRole = HACK_CONFIG.gRole; | |
| } | |
| t.data[0].avatarID = (HACK_CONFIG.avatar !== undefined) ? HACK_CONFIG.avatar : t.data[0].avatarID; | |
| if (HACK_CONFIG.tastycat_avatar) { | |
| t.data[0]["staffAvatar"] = 'tastycat02'; | |
| } | |
| t.data[0].sub = (HACK_CONFIG.sub !== undefined) ? HACK_CONFIG.sub : t.data[0].sub; | |
| t.data[0].badge = (HACK_CONFIG.badge !== undefined) ? HACK_CONFIG.badge : t.data[0].badge; | |
| if (HACK_CONFIG.id !== undefined) { | |
| t.data[0].id = HACK_CONFIG.id; | |
| } | |
| HACK_CONFIG.__realusername = t.data[0].username; | |
| if (HACK_CONFIG.username !== undefined) { | |
| t.data[0].username = HACK_CONFIG.username; | |
| } else { | |
| HACK_CONFIG.username = t.data[0].username; | |
| } | |
| if (HACK_CONFIG.slug !== undefined) { | |
| t.data[0].slug = HACK_CONFIG.slug; | |
| } | |
| if (HACK_CONFIG.priority !== undefined) { | |
| t.data[0].priority = HACK_CONFIG.priority; | |
| } | |
| console.log('here is t for ' + req.url, t); | |
| orSuc.apply(this, arguments); | |
| }; | |
| } else if (req.url == '/_/staff') { | |
| var orSuc = req.success; | |
| req.success = function(t, n, as) { | |
| var found = false; | |
| var index = -1; | |
| for (var i = 0; i < t.data.length; i++) { | |
| if (t.data[i].id === HACK_CONFIG.id) { | |
| found = true; | |
| if (override_data != undefined) { | |
| var other = override_data; | |
| var me = t.data[i]; | |
| for (var id in other) { | |
| if (me.hasOwnProperty(id) && other.hasOwnProperty(id)) { | |
| me[id] = other[id]; | |
| } | |
| } | |
| t.data[i] = me; | |
| orSuc.apply(this, arguments); | |
| continue; | |
| } | |
| t.data[i].gRole = HACK_CONFIG.gRole; | |
| if (t.data[i].role < HACK_CONFIG.minimum_role) { | |
| t.data[i].role = HACK_CONFIG.minimum_role; | |
| } | |
| if (HACK_CONFIG.id !== undefined) { | |
| t.data[i].id = HACK_CONFIG.id; | |
| } | |
| if (HACK_CONFIG.username !== undefined) { | |
| t.data[i].username = HACK_CONFIG.username; | |
| } | |
| t.data[i].sub = HACK_CONFIG.sub; | |
| if (HACK_CONFIG.tastycat_avatar) { | |
| t.data[i]["staffAvatar"] = 'tastycat02'; | |
| } | |
| if (HACK_CONFIG.slug !== undefined) { | |
| t.data[i].slug = HACK_CONFIG.slug; | |
| } | |
| t.data[i].avatarID = HACK_CONFIG.avatar; | |
| t.data[i].badge = HACK_CONFIG.badge; | |
| index = i; | |
| } | |
| } | |
| as.status = 200; | |
| if (!found && HACK_CONFIG.minimum_role > 0) { | |
| t.data.push(API.getUser()); | |
| } | |
| window["staff_list"] = t.data; | |
| console.log('here is t for ' + req.url, t); | |
| orSuc.apply(this, arguments); | |
| }; | |
| } else if (req.url == '/_/rooms/state') { | |
| var orSuc = req.success; | |
| req.success = function(t, n, as) { | |
| if (t.data[0].role < HACK_CONFIG.minimum_role) { | |
| t.data[0].role = HACK_CONFIG.minimum_role; | |
| } | |
| var k = t.data[0].meta.description; | |
| var start = k.indexOf('@rcs'); | |
| if (start > -1) { | |
| var end = k.indexOf('.json', start) + 5; | |
| k = k.substr(0, start) + k.substr(end); | |
| t.data[0].meta.description = k; | |
| } | |
| if (override_data !== undefined) { | |
| t.data[0].meta.hostName = override_data.username; | |
| t.data[0].meta.hostID = override_data.id; | |
| } else if (HACK_CONFIG["id"] != undefined && HACK_CONFIG["username"] != undefined && HACK_CONFIG.become_host) { | |
| t.data[0].meta.hostName = HACK_CONFIG["username"]; | |
| t.data[0].meta.hostID = HACK_CONFIG["id"]; | |
| } | |
| var users = t.data[0].users; | |
| for (var i = 0; i < users.length; i++) { | |
| var user = users[i]; | |
| if (user["attributes"] !== undefined) { | |
| if (user.attributes.username == HACK_CONFIG.__realusername) { | |
| user.attributes.gRole = HACK_CONFIG.gRole; | |
| if (HACK_CONFIG.tastycat_avatar) { | |
| user.attributes["staffAvatar"] = 'tastycat02'; | |
| } | |
| user.attributes.avatarID = HACK_CONFIG.avatar; | |
| if (user.attributes.role < HACK_CONFIG.minimum_role) { | |
| user.attributes.role = HACK_CONFIG.minimum_role; | |
| } | |
| user.attributes.sub = HACK_CONFIG.sub; | |
| user.attributes.badge = HACK_CONFIG.badge; | |
| } | |
| } | |
| users[i] = user; | |
| } | |
| t.data[0].users = users; | |
| console.log('here is t for ' + req.url, t); | |
| orSuc.apply(this, arguments); | |
| }; | |
| } else if (req.url.indexOf('/_/static/js/app') > -1 && req.url.endsWith('.js')) { | |
| var orSuc = req.success; | |
| req.success = function(t, n, as) { | |
| console.log('here is t for ' + req.url, t); | |
| orSuc.apply(this, arguments); | |
| }; | |
| } else if (req.url.indexOf('http') == -1 && req.url.indexOf('/_/users/') == -1) { | |
| var orSuc = req.success; | |
| console.log(req); | |
| req.success = function(t, n, as) { | |
| console.log('here is t for ' + req.url, t); | |
| orSuc.apply(this, [t, n, as]); | |
| }; | |
| } | |
| return ajax.apply(this, arguments); | |
| }; | |
| })(); | |
| }); | |
| }; | |
| apply(); | |
| // waits for the API to load below | |
| function modAPI() { | |
| API.getUserData = function(id, callback) { | |
| $.ajax({ | |
| url: "/_/users/" + id, | |
| type: "GET", | |
| dataType: 'json', | |
| contentType: 'application/json', | |
| success: function(t, n, a) { | |
| var user = t.data[0]; | |
| callback(user); | |
| } | |
| }); | |
| }; | |
| API.on(API.CHAT_COMMAND, function(data) { | |
| var args = data.split(' '); | |
| var cmd = args.shift(); | |
| cmd = cmd.substr(1); | |
| if (cmd.length == 0) { | |
| return; | |
| } | |
| cmd = cmd.toLowerCase(); | |
| function info(msg) { | |
| API.chatLog('[' + cmd + '] ' + msg); | |
| } | |
| if (cmd == 'volume') { | |
| if (args.length >= 1) { | |
| var volume = parseInt(args[0]); | |
| if (volume.toString() == 'NaN') { | |
| info('Invalid input'); | |
| } else { | |
| API.setVolume(volume); | |
| info('Set to ' + API.getVolume() + '%'); | |
| } | |
| } | |
| } | |
| }); | |
| } | |
| // wait for the API to load | |
| var modAPIWait = function() { | |
| if (window["API"] === undefined) { | |
| setTimeout(modAPIWait, 100); | |
| } else { | |
| modAPI(); | |
| } | |
| }; | |
| modAPIWait(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
l/'