mirror of
https://github.com/minoplhy/chhoto-url.git
synced 2024-11-22 01:06:46 +00:00
fix: Properly handle visibility of elements
This commit is contained in:
parent
5fb8587628
commit
3445d5366a
@ -48,7 +48,7 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p id="loading-text">Loading links table...</p>
|
<p id="loading-text">Loading links table...</p>
|
||||||
<table class="pure-table">
|
<table class="pure-table" hidden>
|
||||||
<caption>Active links</caption>
|
<caption>Active links</caption>
|
||||||
<br />
|
<br />
|
||||||
<thead>
|
<thead>
|
||||||
@ -66,7 +66,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div name="links-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"
|
<a id="version-number" href="https://github.com/SinTan1729/chhoto-url" target="_blank" rel="noopener noreferrer"
|
||||||
hidden>Source Code</a>
|
hidden>Source Code</a>
|
||||||
|
@ -46,8 +46,9 @@ const refreshData = async () => {
|
|||||||
let errorMsg = await res.text();
|
let errorMsg = await res.text();
|
||||||
console.log(errorMsg);
|
console.log(errorMsg);
|
||||||
if (errorMsg == "Using public mode.") {
|
if (errorMsg == "Using public mode.") {
|
||||||
|
document.getElementById("admin-button").hidden = false;
|
||||||
loading_text = document.getElementById("loading-text");
|
loading_text = document.getElementById("loading-text");
|
||||||
loading_text.style.display = "none";
|
loading_text.hidden = true;
|
||||||
showVersion();
|
showVersion();
|
||||||
} else {
|
} else {
|
||||||
getLogin();
|
getLogin();
|
||||||
@ -64,13 +65,14 @@ const displayData = async (data) => {
|
|||||||
admin_button = document.getElementById("admin-button");
|
admin_button = document.getElementById("admin-button");
|
||||||
admin_button.innerText = "logout";
|
admin_button.innerText = "logout";
|
||||||
admin_button.href = "javascript:logOut()";
|
admin_button.href = "javascript:logOut()";
|
||||||
|
admin_button.hidden = false;
|
||||||
|
|
||||||
table_box = document.querySelector(".pure-table");
|
table_box = document.querySelector(".pure-table");
|
||||||
loading_text = document.getElementById("loading-text");
|
loading_text = document.getElementById("loading-text");
|
||||||
|
|
||||||
if (data.length == 0) {
|
if (data.length == 0) {
|
||||||
table_box.style.visibility = "hidden";
|
table_box.hidden = true;
|
||||||
loading_text.style.display = "block";
|
loading_text.hidden = true;
|
||||||
loading_text.innerHTML = "No active links.";
|
loading_text.innerHTML = "No active links.";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -80,7 +82,7 @@ const displayData = async (data) => {
|
|||||||
const shortUrlHeader = document.getElementById("short-url-header");
|
const shortUrlHeader = document.getElementById("short-url-header");
|
||||||
shortUrlHeader.innerHTML = "Short URL<br>(right click and copy)";
|
shortUrlHeader.innerHTML = "Short URL<br>(right click and copy)";
|
||||||
}
|
}
|
||||||
table_box.style.visibility = "visible";
|
table_box.hidden = false;
|
||||||
table.innerHTML = ''; // Clear
|
table.innerHTML = ''; // Clear
|
||||||
data.forEach(tr => table.appendChild(TR(tr, site)));
|
data.forEach(tr => table.appendChild(TR(tr, site)));
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,6 @@ div[name="links-div"] {
|
|||||||
|
|
||||||
.pure-table {
|
.pure-table {
|
||||||
width: 98%;
|
width: 98%;
|
||||||
visibility: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pure-table caption {
|
.pure-table caption {
|
||||||
|
Loading…
Reference in New Issue
Block a user