Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Pxls Chat Purged Message Viewer
- // @namespace http://tampermonkey.net/
- // @version 0.1.01
- // @description try to take over the world!
- // @author You
- // @match https://pxls.space/
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- var chatNodeHistory = new Map();
- function timer() {
- let chatBody = document.getElementById('chat-body');
- let oldSize = chatNodeHistory.size;
- for (let node of chatBody.childNodes) {
- let id = node.dataset.id;
- if (id) {
- chatNodeHistory.set(id, node);
- }
- }
- let newCount = chatNodeHistory.size - oldSize;
- if (newCount) console.log(`Saved ${newCount} nodes.`)
- let lastId = null;
- let purgedCount = 0;
- for (let [id, node] of chatNodeHistory) {
- let visibleNode = chatBody.querySelector(`[data-id="${id}"]`);
- if (!visibleNode) {
- node.querySelector(`span`).style.color = 'red';
- let lastNode = chatBody.querySelector(`[data-id="${lastId}"]`);
- if (lastNode) lastNode.after(node);
- purgedCount++;
- }
- lastId = id;
- }
- if (purgedCount) console.log(`Detected ${purgedCount} purged nodes.`)
- }
- var timerVar = setInterval(timer, 5000);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement