~qeef/damn-client.js

f8a10d500177dd287016845df1ae0a812e89148f — Jiri Vlasak 9 days ago 0f8f2b6
Wrap failable functions to try-catch
1 files changed, 9 insertions(+), 0 deletions(-)

M static/fn.js
M static/fn.js => static/fn.js +9 -0
@@ 45,21 45,30 @@ SOFTWARE.
// shortcuts
function up(w, i, append=false)
{
    try {
    if (append)
        document.getElementById(w).innerHTML += i;
    else
        document.getElementById(w).innerHTML = i;
    } catch(e) {
        console.log(
            "failed to append/set (" + append + ") " + w + " with " + i);
    }
}
function sh(w, show=true)
{
    try {
    if (show)
        document.getElementById(w).style = "display: block";
    else
        document.getElementById(w).style = "display: none";
    } catch(e) { console.log("failed to show/hide (" + show + ") " + w); }
}
function fo(w)
{
    try {
    document.getElementById(w).focus();
    } catch(e) { console.log("failed to focus " + w); }
}
function sa(w)
{