mirror of
https://github.com/amark/gun.git
synced 2025-06-08 15:16:42 +00:00
Fix wrong element's dynamic identifier, semicols (#1080)
This commit is contained in:
parent
10b42525ad
commit
fe9ea62f61
@ -26,38 +26,38 @@
|
|||||||
const form = document.getElementById('form')
|
const form = document.getElementById('form')
|
||||||
|
|
||||||
const dynamicEvent = e => {
|
const dynamicEvent = e => {
|
||||||
const target = e.target
|
const target = e.target;
|
||||||
|
|
||||||
gun.get(target.id).put(null)
|
gun.get(target.id).put(null);
|
||||||
|
|
||||||
target.innerHTML = document.getElementById(target.innerHTML)
|
target.innerHTML = document.getElementById(target.id);
|
||||||
|
|
||||||
if (target.innerHTML === ' null' || target.innerHTML === ' ' || target.innerHTML === '') {
|
if (target.innerHTML === ' null' || target.innerHTML === ' ' || target.innerHTML === '') {
|
||||||
target.style.display = 'none'
|
target.style.display = 'none';
|
||||||
} else {
|
} else {
|
||||||
target.style.display = 'list-item'
|
target.style.display = 'list-item';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gun.map().on((thought, id) => {
|
gun.map().on((thought, id) => {
|
||||||
parentList.insertAdjacentHTML('beforeend', `<li id =${id}> ${thought}</li>`)
|
parentList.insertAdjacentHTML('beforeend', `<li id =${id}> ${thought}</li>`);
|
||||||
|
|
||||||
const links = parentList.getElementsByTagName('li')
|
const links = parentList.getElementsByTagName('li');
|
||||||
|
|
||||||
for (const link of links) {
|
for (const link of links) {
|
||||||
if (link.innerHTML === ' null' || link.innerHTML === ' ' || link.innerHTML === '') {
|
if (link.innerHTML === ' null' || link.innerHTML === ' ' || link.innerHTML === '') {
|
||||||
link.style.display = 'none'
|
link.style.display = 'none';
|
||||||
} else {
|
} else {
|
||||||
link.style.display = 'list-item'
|
link.style.display = 'list-item';
|
||||||
}
|
}
|
||||||
link.ondblclick = dynamicEvent
|
link.ondblclick = dynamicEvent;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
form.addEventListener('submit', e => {
|
form.addEventListener('submit', e => {
|
||||||
e.preventDefault()
|
e.preventDefault();
|
||||||
gun.set(input.value)
|
gun.set(input.value);
|
||||||
input.value = ''
|
input.value = '';
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user