From 308fca7c22a030056f593653b0cde16bbdce6927 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Fri, 21 Aug 2020 09:57:59 -0500 Subject: [PATCH] added creating blocks count to sidebar --- static-data/www/shared/sidebar/sidebar.css | 4 +++ static-data/www/shared/sidebar/sidebar.html | 7 +---- static-data/www/shared/sidebar/sidebar.js | 34 ++++++++++++++++++--- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/static-data/www/shared/sidebar/sidebar.css b/static-data/www/shared/sidebar/sidebar.css index e69de29b..1ba8edef 100644 --- a/static-data/www/shared/sidebar/sidebar.css +++ b/static-data/www/shared/sidebar/sidebar.css @@ -0,0 +1,4 @@ +.quickview-body{ + font-size: 1em; + background-color: #38292c; +} \ No newline at end of file diff --git a/static-data/www/shared/sidebar/sidebar.html b/static-data/www/shared/sidebar/sidebar.html index 06d3805b..75e5cbe4 100644 --- a/static-data/www/shared/sidebar/sidebar.html +++ b/static-data/www/shared/sidebar/sidebar.html @@ -1,17 +1,12 @@
-

Quickview title

- ... + Inserting blocks: unknown
- -
- -
diff --git a/static-data/www/shared/sidebar/sidebar.js b/static-data/www/shared/sidebar/sidebar.js index 5af867c6..de97d4d4 100644 --- a/static-data/www/shared/sidebar/sidebar.js +++ b/static-data/www/shared/sidebar/sidebar.js @@ -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)