added creating blocks count to sidebar

master
Kevin Froman 2020-08-21 09:57:59 -05:00
parent 72653c1e93
commit 308fca7c22
3 changed files with 35 additions and 10 deletions

View File

@ -0,0 +1,4 @@
.quickview-body{
font-size: 1em;
background-color: #38292c;
}

View File

@ -1,17 +1,12 @@
<div id="quickviewDefault" class="quickview">
<header class="quickview-header">
<p class="title">Quickview title</p>
<span class="delete" data-dismiss="quickview"></span>
</header>
<div class="quickview-body">
<div class="quickview-block">
...
Inserting blocks: <span id="insertingBlocks">unknown</span>
</div>
</div>
<footer class="quickview-footer">
</footer>
</div>
<button class="button is-primary is-hidden sidebarBtn" data-show="quickview" data-target="quickviewDefault">Show quickview</button>

View File

@ -6,13 +6,39 @@ fetch('/shared/sidebar/sidebar.html', {
.then((resp) => resp.text())
.then(function(resp) {
document.getElementById('sidebarContainer').innerHTML = resp
var quickviews = bulmaQuickview.attach()
})
window.addEventListener("keydown", function(event) {
if (event.key === "s"){
let quickviews = bulmaQuickview.attach()
document.getElementsByClassName('sidebarBtn')[0].click()
if (document.activeElement.nodeName == "TEXTAREA" || document.activeElement.nodeName == "INPUT"){
if (! document.activeElement.hasAttribute("readonly")){
return
}
}
let refreshSideBar = function(){
if (document.hidden){return}
var existingValue = document.getElementById("insertingBlocks").innerText
fetch('/getgeneratingblocks', {
"method": "get",
headers: {
"token": webpass
}})
.then((resp) => resp.text())
.then(function(resp) {
console.debug(resp.length, existingValue)
if (resp.length <= 2 && existingValue !== "0"){
document.getElementById("insertingBlocks").innerText = "0"
return
}
if (existingValue === resp.split(',').length){
return
}
document.getElementById("insertingBlocks").innerText = resp.split(',').length - 1
})
}
setInterval(refreshSideBar, 3000)
setTimeout(function(){document.getElementsByClassName('sidebarBtn')[0].click()}, 300)
}
}, true)