Skip to content

Commit

Permalink
make copy friend code dependent on if we have steam id
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbasPL committed Apr 3, 2021
1 parent a09f999 commit 57bb48c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,6 @@ <h4 class="center black-text">Steam guard for account <span id="guard-acc-name">
td_ban.innerHTML = ban;
let td_action = document.createElement('td');
td_action.className = "actions";
let a_copy_code = document.createElement('a');
a_copy_code.className = "btn-floating btn-small red";
a_copy_code.innerHTML = '<i class="material-icons">code</i>';
a_copy_code.addEventListener('click', async e => {
clipboard.writeText(friendCode.encode(account.steamid), 'selection');
M.toast({html: 'Copied!', classes: 'green'});
});
let a_copy = document.createElement('a');
a_copy.className = "btn-floating btn-small red";
a_copy.innerHTML = '<i class="material-icons">password</i>';
Expand Down Expand Up @@ -238,7 +231,6 @@ <h4 class="center black-text">Steam guard for account <span id="guard-acc-name">
document.querySelector('.delete-btn').focus();
}
});
td_action.appendChild(a_copy_code);
td_action.appendChild(a_copy);
td_action.appendChild(a_refresh);
td_action.appendChild(a_delete);
Expand Down Expand Up @@ -278,7 +270,16 @@ <h4 class="center black-text">Steam guard for account <span id="guard-acc-name">
a_open_profile.addEventListener('click', async e => {
shell.openExternal('https://steamcommunity.com/profiles/' + account.steamid);
});
tr.querySelector(".actions").appendChild(a_open_profile);
}
if(account.steamid && !tr.querySelector(".copy-code")) {
let a_copy_code = document.createElement('a');
a_copy_code.className = "btn-floating btn-small red copy-code";
a_copy_code.innerHTML = '<i class="material-icons">code</i>';
a_copy_code.addEventListener('click', async e => {
clipboard.writeText(friendCode.encode(account.steamid), 'selection');
M.toast({html: 'Copied!', classes: 'green'});
});
tr.querySelector(".actions").prepend(a_copy_code);
}
}
}
Expand Down

0 comments on commit 57bb48c

Please sign in to comment.