Skip to content

Commit

Permalink
Added ping to Added Custom Instances libredirect/browser_extension#680
Browse files Browse the repository at this point in the history
  • Loading branch information
RustomDuck committed May 16, 2023
1 parent 6228b0e commit bbe10d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/pages/options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ async function calcCustomInstances(frontend) {
.map(
x => `
<div>
${x}
<x>
<a href="${x}" target="_blank">${x}</a>
</x>
<button class="add clear-${x}">
<svg xmlns="https://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
Expand Down Expand Up @@ -273,9 +275,11 @@ if (r) loadPage(r[1])
else loadPage("general")

async function ping(frontend) {
let instanceElements = document.getElementById(frontend)
.getElementsByClassName('clearnet')[0]
.getElementsByTagName('x')
const instanceElements = [
...document.getElementById(frontend).getElementsByClassName("custom-checklist")[0].getElementsByTagName('x'),
...document.getElementById(frontend).getElementsByClassName('clearnet')[0].getElementsByTagName('x')
]

for (const element of instanceElements) {
let span = element.getElementsByClassName('ping')[0]
if (!span) span = document.createElement('span')
Expand Down Expand Up @@ -303,8 +307,6 @@ async function ping(frontend) {
color = "red"
text = 'Server not found'
}

span.innerHTML = `<span style="color:${color};">${text}</span>`

}
}
}
2 changes: 1 addition & 1 deletion src/pages/stylesheets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ div.checklist-popup div div {
margin: 0;
}

div.custom-checklist {
div.custom-checklist x a {
color: var(--active);
}

Expand Down

0 comments on commit bbe10d6

Please sign in to comment.