mirror of
https://github.com/minoplhy/chhoto-url.git
synced 2024-12-22 19:57:57 +00:00
fix: Properly handle visibility of elements
This commit is contained in:
parent
5fb8587628
commit
3445d5366a
@ -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>
|
||||
|
||||
<a id="version-number" href="https://github.com/SinTan1729/chhoto-url" target="_blank" rel="noopener noreferrer"
|
||||
hidden>Source Code</a>
|
||||
|
@ -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)));
|
||||
}
|
||||
|
@ -73,7 +73,6 @@ div[name="links-div"] {
|
||||
|
||||
.pure-table {
|
||||
width: 98%;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.pure-table caption {
|
||||
|
Loading…
Reference in New Issue
Block a user