forked from lg188/volafile-scripts
-
Notifications
You must be signed in to change notification settings - Fork 2
/
volafile-clear-chat.user.js
37 lines (32 loc) · 1.19 KB
/
volafile-clear-chat.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
// ==UserScript==
// @name Volafile clear chat
// @namespace volafile.clearchat
// @description Clears every chat message on volafile.
// @include https://volafile.org/r/*
// @match https://volafile.org/r/*
// @version 2
// @grant none
// ==/UserScript==
function id(input) {
return document.getElementById(input);
}
var messages = document.getElementsByClassName('chat_message');
function clear_chat() {
messages = document.getElementsByClassName('chat_message');
for(var i = 0; i < messages.length; i++) {
messages[i].parentNode.removeChild(messages[i]);
}
}
var switchButton = document.createElement('BUTTON');
var switchButtonText = document.createTextNode('C');
switchButton.setAttribute('id', 'clear_chat_button');
switchButton.setAttribute('class', 'button');
switchButton.style.display = 'inline-block';
switchButton.style.color = '#3A4040';
switchButton.style.marginRight = '0.30em';
switchButton.style.paddingRight = '0.30em';
switchButton.style.paddingLeft = '0.30em';
switchButton.style.border = 'none';
switchButton.addEventListener('click', clear_chat, false);
switchButton.appendChild(switchButtonText);
id('upload_container').appendChild(switchButton);