Schafkopf-Server/Public/elements.js
2021-11-29 11:06:20 +01:00

78 lines
1.8 KiB
JavaScript

/**
* This file acts as an abstraction layer between HTML and JS.
*/
function hideLoginWindow() {
document.getElementById("signup-window").style.display = "none"
}
function showLoginWindow() {
document.getElementById("signup-window").style.display = "table"
}
function hideTableListElements() {
document.getElementById("table-list-bar").style.display = "none"
document.getElementById("table-list").style.display = "none"
}
function showTableListElements() {
document.getElementById("table-list-bar").style.display = "grid"
document.getElementById("table-list").style.display = "inherit"
}
function setPlayerName(name) {
document.getElementById("player-name").innerHTML = name
}
function getPlayerName() {
return document.getElementById("player-name").innerHTML
}
function getLoginName() {
return document.getElementById("user-name").value
}
function clearLoginName() {
document.getElementById("user-name").value = ""
}
function getLoginPassword() {
return document.getElementById("user-pwd").value
}
function clearLoginPassword() {
document.getElementById("user-pwd").value = ""
}
function getSessionToken() {
return localStorage.getItem('token')
}
function setSessionToken(token) {
localStorage.setItem('token', token)
}
function deleteSessionToken() {
localStorage.removeItem('token')
}
function setLoginError(text) {
document.getElementById("login-error").innerHTML = text
}
function getTableName() {
return document.getElementById("table-name-field").value
}
function clearTableName() {
return document.getElementById("table-name-field").value = ""
}
function getTableVisibility() {
return document.getElementById("table-public-checkbox").checked
}
function setTableListContent(content) {
document.getElementById("table-list").innerHTML = content
}