-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtamper.js
174 lines (136 loc) · 5.06 KB
/
tamper.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
// ==UserScript==
// @name Zulip
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://macandcheese.zulipchat.com
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
(function () {
"use strict";
function get_header() {
function header() {
return document.querySelector("#top_navbar");
}
function logo() {
const elem = header().querySelector(".column-left");
return { elem };
}
function search_bar() {
const elem = header().querySelector(".top-navbar-container");
return { elem };
}
const elem = header();
return { logo, search_bar };
}
function get_app() {
function app() {
return document.querySelector(".app");
}
function left_sidebar() {
function shortcuts() {
const elem = parent.querySelector("#global_filters");
return { elem };
}
function dm_list() {
function header() {
function title() {
const elem = parent.querySelector("h4");
return { elem };
}
// ANNOYINGLY, the header is not part of the list, so we
// use parent.
const elem = parent.querySelector(
"#private_messages_section_header"
);
return { elem, title };
}
const elem = parent.querySelector("#private_messages_list");
return { elem, header };
}
function streams_list() {
function header() {
function title() {
const elem = lst.querySelector("h4");
return { elem };
}
const elem = lst.querySelector("#streams_header");
return { elem, title };
}
const elem = parent.querySelector("#streams_list");
const lst = elem;
return { elem, header };
}
const elem = app().querySelector("#left-sidebar");
const parent = elem;
return { elem, shortcuts, dm_list, streams_list };
}
function middle_panel() {
function message_list() {
const elem = parent.querySelector("#zfilt");
return { elem };
}
function bottom_whitespace() {
const elem = parent.querySelector("#bottom_whitespace");
return { elem };
}
function compose_box() {
const elem = parent.querySelector("#compose-content");
return { elem };
}
const elem = app().querySelector(".column-middle-inner");
const parent = elem;
return { elem, message_list, bottom_whitespace, compose_box };
}
function right_sidebar() {
function shortcuts() {
const elem = app().querySelector(".right-sidebar-shortcuts");
return { elem };
}
const elem = app().querySelector("#right-sidebar");
return { elem, shortcuts };
}
return { left_sidebar, middle_panel, right_sidebar };
}
function tamper() {
function style(elem, f, v) {
elem.style[f] = v;
}
const { logo, search_bar } = get_header();
style(logo().elem, "background", "khaki");
style(search_bar().elem, "background", "darkseagreen");
const { left_sidebar, middle_panel, right_sidebar } = get_app();
style(left_sidebar().shortcuts().elem, "background", "blanchedalmond");
style(
left_sidebar().dm_list().header().elem,
"background",
"cadetblue"
);
style(left_sidebar().dm_list().header().title().elem, "color", "red");
style(left_sidebar().dm_list().elem, "background", "khaki");
style(
left_sidebar().streams_list().header().elem,
"background",
"cadetblue"
);
style(
left_sidebar().streams_list().header().title().elem,
"color",
"red"
);
style(left_sidebar().streams_list().elem, "background", "khaki");
style(middle_panel().elem, "background", "khaki");
style(middle_panel().message_list().elem, "background", "cadetblue");
style(
middle_panel().bottom_whitespace().elem,
"background",
"deepskyblue"
);
style(middle_panel().compose_box().elem, "background", "cadetblue");
style(right_sidebar().elem, "background", "darkseagreen");
style(right_sidebar().shortcuts().elem, "background", "cadetblue");
}
setTimeout(tamper, 2000);
})();