Skip to content

Commit c304d4a

Browse files
committed
added troubleshoot for brave users
1 parent f67421e commit c304d4a

File tree

5 files changed

+105
-1
lines changed

5 files changed

+105
-1
lines changed

data/data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "V2.2.1.3"
2+
"version": "V2.2.1.4"
33
}
44

images/troubleshoot.png

55.5 KB
Loading

images/troubleshoot/brave.gif

272 KB
Loading

index.html

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,48 @@ <h1>
8282
<a href="/feedback" class="social-icon" data-tooltip="Feedback">
8383
<img src="/images/feedback.png" style="width: 30px; height: 30px; margin-top: 10px;" alt="Feedback">
8484
</a>
85+
<script src="/js/detect.js"></script>
86+
<style>
87+
.troubleshoot-popup {
88+
position: fixed;
89+
top: 50%;
90+
left: 50%;
91+
transform: translate(-50%, -50%);
92+
background: rgb(0, 0, 0);
93+
padding: 20px;
94+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
95+
z-index: 1000;
96+
border-radius: 10px;
97+
width: 300px;
98+
text-align: center;
99+
}
100+
101+
@media (min-width: 768px) {
102+
.troubleshoot-popup {
103+
top: 100px;
104+
transform: translateX(-50%);
105+
}
106+
}
107+
108+
.troubleshoot-popup img {
109+
width: 100%;
110+
margin-top: 10px;
111+
}
112+
113+
.troubleshoot-close-button {
114+
margin-top: 10px;
115+
padding: 5px 10px;
116+
background: #ff4d4d;
117+
color: rgb(0, 0, 0);
118+
border: none;
119+
border-radius: 5px;
120+
cursor: pointer;
121+
}
122+
123+
.troubleshoot-close-button:hover {
124+
background: #cc0000;
125+
}
126+
</style>
85127
<script src="/js/version.js">
86128

87129
</script>

js/detect.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
async function isBraveBrowser() {
2+
if (navigator.brave && (await navigator.brave.isBrave())) {
3+
return true;
4+
}
5+
return false;
6+
}
7+
8+
document.addEventListener("DOMContentLoaded", async function () {
9+
if (await isBraveBrowser()) {
10+
const troubleshootElement = document.createElement("a");
11+
troubleshootElement.href = "#";
12+
troubleshootElement.className = "social-icon";
13+
troubleshootElement.dataset.tooltip = "Troubleshoot";
14+
15+
const img = document.createElement("img");
16+
img.src = "/images/troubleshoot.png";
17+
img.style.width = "30px";
18+
img.style.height = "30px";
19+
img.style.marginTop = "10px";
20+
img.alt = "Troubleshoot";
21+
22+
troubleshootElement.appendChild(img);
23+
24+
troubleshootElement.addEventListener("click", function(event) {
25+
event.preventDefault();
26+
const popup = document.createElement("div");
27+
popup.className = "troubleshoot-popup";
28+
popup.style.position = "fixed";
29+
popup.style.top = "20%";
30+
popup.style.left = "50%";
31+
popup.style.transform = "translate(-50%, 0)";
32+
popup.style.background = "black";
33+
popup.style.padding = "20px";
34+
popup.style.boxShadow = "0 0 10px rgba(0,0,0,0.5)";
35+
popup.style.zIndex = "1000";
36+
popup.style.borderRadius = "10px";
37+
38+
const text = document.createElement("p");
39+
text.textContent = "Looks like you are using the brave browser. If you experience any issues please try turning off brave shields";
40+
41+
const gif = document.createElement("img");
42+
gif.src = "/images/troubleshoot/brave.gif";
43+
gif.style.width = "100%";
44+
gif.style.marginTop = "10px";
45+
46+
const closeButton = document.createElement("button");
47+
closeButton.className = "troubleshoot-close-button";
48+
closeButton.textContent = "Close";
49+
closeButton.style.marginTop = "10px";
50+
closeButton.addEventListener("click", function() {
51+
document.body.removeChild(popup);
52+
});
53+
54+
popup.appendChild(text);
55+
popup.appendChild(gif);
56+
popup.appendChild(closeButton);
57+
document.body.appendChild(popup);
58+
});
59+
60+
document.querySelector("footer").appendChild(troubleshootElement);
61+
}
62+
});

0 commit comments

Comments
 (0)