-
Notifications
You must be signed in to change notification settings - Fork 3
/
volafile-only-chat-or-upload.user.js
145 lines (114 loc) · 3.74 KB
/
volafile-only-chat-or-upload.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// ==UserScript==
// @name Volafile only chat or upload script
// @namespace keystrokes.se
// @description Shows only the chat or the file bin. There's an option for showing both but it would be better to just turn off the script for showing both.
// @match *://volafile.io/*
// @include *://volafile.io/*
// @version 3
// @author Dongmaster
// ==/UserScript==
var switchVar = 0;
var showingBoth = false;
var showingBothCounter = 0;
var fix = 3;
function id(id) {
return document.getElementById(id);
}
function retry() {
if(showingBoth === false) {
setTimeout(function() {
id('chat_frame').style.width = '100%';
if(id('chat_frame').getAttribute('width') !== '100%') {
retry();
}
}, 100);
}
}
retry();
function switchPage() {
switchVar++;
if(switchVar === 1) {
id('file_list').style.display = 'block';
id('files_frame').style.display = 'block';
id('files_frame').style.left = '0px';
id('chat_frame').style.display = 'none';
id('switch_page_button').innerHTML = 'C';
}
if(switchVar === 2 && showingBoth === false) {
id('file_list').style.display = 'none';
id('files_frame').style.display = 'none';
id('chat_frame').style.display = 'block';
id('switch_page_button').innerHTML = 'U';
switchVar = 0;
}
}
function fiwWidth() {
if(fix > 0) {
setTimeout(function() {
fix--;
id('chat_frame').style.width = '27.1%';
if(fix !== 0) {
fixWidth();
}
});
}
}
function showBoth() {
showingBothCounter++;
if(showingBothCounter === 1) {
id('files_frame').style.display = 'block';
id('file_list').style.display = 'block';
id('chat_frame').style.display = 'block';
id('chat_frame').style.width = '27.1%';
id('files_frame').style.left = '27.1%';
id('switch_page_button').style.display = 'none';
showingBoth = true;
if(fix !== 0) {
fixWidth();
}
}
if(showingBothCounter === 2) {
id('files_frame').style.display = 'none';
id('file_list').style.display = 'none';
id('chat_frame').style.display = 'block';
id('chat_frame').style.width = '100%';
id('files_frame').style.left = '0px';
switchVar = 0;
id('switch_page_button').innerHTML = 'U';
id('switch_page_button').style.display = 'inline-block';
showingBoth = false;
showingBothCounter = 0;
}
}
id('file_list').style.display = 'none';
id('files_frame').style.display = 'none';
//id('room_name_container').style.border = 'none';
id('chat_frame').style.width = '100%';
id('uploadButton').style.marginRight = '0.30em';
id('files_frame').style.left = '0px';
var switchButton = document.createElement('BUTTON');
var switchButtonText = document.createTextNode('U');
switchButton.setAttribute('id', 'switch_page_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', switchPage, false);
switchButton.appendChild(switchButtonText);
id('upload_container').appendChild(switchButton);
var showBothButton = document.createElement('BUTTON');
var showBothButtonText = document.createTextNode('B');
showBothButton.setAttribute('id', 'show_both_button');
showBothButton.setAttribute('class', 'button');
showBothButton.style.display = 'inline-block';
showBothButton.style.color = '#3A4040';
showBothButton.style.marginRight = '0.30em';
showBothButton.style.paddingRight = '0.30em';
showBothButton.style.paddingLeft = '0.30em';
showBothButton.style.border = 'none';
showBothButton.addEventListener('click', showBoth, false);
showBothButton.appendChild(showBothButtonText);
id('upload_container').appendChild(showBothButton);