small refactor in js and added exit btn to friend info overlay

This commit is contained in:
Kevin Froman 2019-03-12 23:56:26 -05:00
parent fdd3ff0a9d
commit 5d45db8f8d
3 changed files with 6 additions and 5 deletions

View File

@ -13,6 +13,7 @@
<body> <body>
<div id="friendInfo" class='overlay'> <div id="friendInfo" class='overlay'>
<div class='overlayContent'> <div class='overlayContent'>
<span class='closeOverlay' overlay='friendInfo'></span>
<div>Name: <span id='friendName'></span></div> <div>Name: <span id='friendName'></span></div>
<label>Public Key: <input id='friendPubkey' type='text' readonly></label> <label>Public Key: <input id='friendPubkey' type='text' readonly></label>
<button id='defriend' class='warnBtn'>Unfriend</button> <button id='defriend' class='warnBtn'>Unfriend</button>

View File

@ -304,11 +304,6 @@ for (var i = 0; i < document.getElementsByClassName('refresh').length; i++){
document.getElementsByClassName('refresh')[i].style.float = 'right' document.getElementsByClassName('refresh')[i].style.float = 'right'
} }
for (var i = 0; i < document.getElementsByClassName('closeOverlay').length; i++){
document.getElementsByClassName('closeOverlay')[i].onclick = function(e){
document.getElementById(e.target.getAttribute('overlay')).style.visibility = 'hidden'
}
}
fetch('/friends/list', { fetch('/friends/list', {
headers: { headers: {

View File

@ -87,3 +87,8 @@ for(var i = 0; i < refreshLinks.length; i++) {
} }
} }
for (var i = 0; i < document.getElementsByClassName('closeOverlay').length; i++){
document.getElementsByClassName('closeOverlay')[i].onclick = function(e){
document.getElementById(e.target.getAttribute('overlay')).style.visibility = 'hidden'
}
}