forked from KeyZox71/seekersrealcolor
-
Notifications
You must be signed in to change notification settings - Fork 2
/
extra-styling.js
104 lines (87 loc) · 3.55 KB
/
extra-styling.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.js :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yosyo <[email protected] > +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/13 02:05:21 by yosyo #+# #+# */
/* Updated: 2023/12/13 02:05:21 by yosyo ### ########.fr */
/* */
/* ************************************************************************** */
var all = document.getElementsByTagName("*");
var css = ":root { \n --theme-color: #D950FF;\n --theme-color-dark: #9d36ad;\n --theme-color-light: #e99cff;\n --logtime-chart-24h-color: #e99cff;\n}";
var styleSheet = document.createElement("style");
styleSheet.innerText = css;
document.head.appendChild(styleSheet);
function seekersUpdate()
{
var all = document.getElementsByTagName("*");
for (var i=0, max=all.length; i < max; i++) {
if (all[i].style)
{
if (all[i].style.color == 'rgb(255, 105, 80)')
{
all[i].style.color = '#D950FF';
}
if (all[i].style.backgroundColor == 'rgb(255, 105, 80)')
{
all[i].style.backgroundColor = '#D950FF';
}
if (all[i].style.fill == 'rgb(255, 105, 80)')
{
all[i].style.fill = '#D950FF';
}
}
}
}
seekersUpdate();
function addTag(user, tag, color)
{
pageUser = document.getElementsByClassName("login");
if (pageUser.length > 0) {
if (pageUser[0].dataset.login === user) {
document.getElementsByClassName("name")[0].insertAdjacentHTML("beforebegin", "<span class='user-badge' style='background-color: " + color + "; border-color:" + color + "'>" + tag + "</span>\n   \n");
}
}
}
async function applyBadges() {
const requestURL = "https://raw.githubusercontent.com/seekrs/improved-seekrs/main/data/badges.json";
const request = new Request(requestURL);
const response = await fetch(request);
const badges = await response.json();
for (id in badges) {
badge = badges[id];
addTag(badge.user, badge.tag, badge.color);
}
}
applyBadges();
function addTitle(user, prefix, suffix, format)
{
if (format === undefined) format = "%prefix% %user% %suffix%";
if (prefix === undefined) prefix = "";
if (suffix === undefined) suffix = "";
let titledName = format.replace("%prefix%", prefix).replace("%user%", user).replace("%suffix%", suffix);
pageUser = document.getElementsByClassName("login");
if (pageUser.length > 0) {
if (pageUser[0].dataset.login === user) {
pageUser[0].textContent = titledName;
}
}
document.querySelectorAll("#collapseEvaluations .reminder .project-item-text a").forEach((aTag) => {
if (aTag.dataset.userLink === user) {
aTag.textContent = titledName;
}
});
}
async function applyTitles() {
const requestURL = "https://raw.githubusercontent.com/seekrs/improved-seekrs/main/data/titles.json";
const request = new Request(requestURL);
const response = await fetch(request);
const titles = await response.json();
for (id in titles) {
title = titles[id];
addTitle(title.user, title.prefix, title.suffix, title.format);
}
}
applyTitles();