1
0
Fork 0
mirror of https://github.com/SinTan1729/chhoto-url synced 2024-12-25 23:28:37 -06:00

fix: Properly handle visibility of elements

This commit is contained in:
Sayantan Santra 2024-05-29 09:15:25 -05:00
parent 5fb8587628
commit 3445d5366a
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F
3 changed files with 8 additions and 7 deletions

View file

@ -48,7 +48,7 @@
</form>
<p id="loading-text">Loading links table...</p>
<table class="pure-table">
<table class="pure-table" hidden>
<caption>Active links</caption>
<br />
<thead>
@ -66,7 +66,7 @@
</div>
<div name="links-div">
<a id="admin-button" href="javascript:getLogin()">login</a>
<a id="admin-button" href="javascript:getLogin()" hidden>login</a>
&nbsp;
<a id="version-number" href="https://github.com/SinTan1729/chhoto-url" target="_blank" rel="noopener noreferrer"
hidden>Source Code</a>

View file

@ -46,8 +46,9 @@ const refreshData = async () => {
let errorMsg = await res.text();
console.log(errorMsg);
if (errorMsg == "Using public mode.") {
document.getElementById("admin-button").hidden = false;
loading_text = document.getElementById("loading-text");
loading_text.style.display = "none";
loading_text.hidden = true;
showVersion();
} else {
getLogin();
@ -64,13 +65,14 @@ const displayData = async (data) => {
admin_button = document.getElementById("admin-button");
admin_button.innerText = "logout";
admin_button.href = "javascript:logOut()";
admin_button.hidden = false;
table_box = document.querySelector(".pure-table");
loading_text = document.getElementById("loading-text");
if (data.length == 0) {
table_box.style.visibility = "hidden";
loading_text.style.display = "block";
table_box.hidden = true;
loading_text.hidden = true;
loading_text.innerHTML = "No active links.";
}
else {
@ -80,7 +82,7 @@ const displayData = async (data) => {
const shortUrlHeader = document.getElementById("short-url-header");
shortUrlHeader.innerHTML = "Short URL<br>(right click and copy)";
}
table_box.style.visibility = "visible";
table_box.hidden = false;
table.innerHTML = ''; // Clear
data.forEach(tr => table.appendChild(TR(tr, site)));
}

View file

@ -73,7 +73,6 @@ div[name="links-div"] {
.pure-table {
width: 98%;
visibility: hidden;
}
.pure-table caption {