From 744515dac4c6740159ad5c4bc04322615d90d7b5 Mon Sep 17 00:00:00 2001 From: Matt Mascarenhas Date: Fri, 11 Jun 2021 17:39:48 +0100 Subject: [PATCH] cinera_clear.js: Fix the placement of the clear --- cinera/cinera.c | 6 +++--- cinera/cinera_clear.js | 19 +++++++++++++------ cinera/cinera_search_post.js | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/cinera/cinera.c b/cinera/cinera.c index dbf5948..b950825 100644 --- a/cinera/cinera.c +++ b/cinera/cinera.c @@ -23,7 +23,7 @@ typedef struct version CINERA_APP_VERSION = { .Major = 0, .Minor = 8, - .Patch = 21 + .Patch = 22 }; #include // NOTE(matt): varargs @@ -14220,11 +14220,11 @@ SearchToBuffer(buffers *CollationBuffers, db_header_project *StoredP, project *P AppendStringToBuffer(B, Wrap0("\n")); + OpenNodeCNewLine(B, &IndentationLevel, NODE_DIV, "cineraIndexList"); + asset *JSClear = GetAsset(Wrap0(BuiltinAssets[ASSET_JS_CLEAR].Filename), ASSET_JS); AppendScriptNode(B, &URL, &IndentationLevel, JSClear, FALSE, PAGE_SEARCH); - OpenNodeCNewLine(B, &IndentationLevel, NODE_DIV, "cineraIndexList"); - AppendLandmarkedBuffer(B, &Index, PAGE_SEARCH); FreeBuffer(&Index); diff --git a/cinera/cinera_clear.js b/cinera/cinera_clear.js index d019143..cd3ccf8 100644 --- a/cinera/cinera_clear.js +++ b/cinera/cinera_clear.js @@ -1,16 +1,23 @@ +// NOTE(matt): To use, source this file inside the element you wish to be obscured while processing occurs. +// After processing is complete, call FlipClear() + +var ThisScriptElement = document.currentScript; +var NodeToHide = ThisScriptElement.parentNode; + var CineraClearElement = document.createElement("DIV"); CineraClearElement.style.position = "fixed"; CineraClearElement.style.height = "100%"; CineraClearElement.style.width = "100%"; CineraClearElement.style.zIndex = 64; -var CineraPlacedClear = document.body.appendChild(CineraClearElement); -var Col = getBackgroundColourRGB(CineraPlacedClear); -CineraPlacedClear.style.background = "rgb(" + Col.R + ", " + Col.G + ", " + Col.B + ")" + +var CineraPlacedClear = NodeToHide.appendChild(CineraClearElement); +var Colour = getBackgroundColourRGB(CineraPlacedClear); +CineraPlacedClear.style.background = "rgb(" + Colour.R + ", " + Colour.G + ", " + Colour.B + ")" document.body.style.overflowY = "hidden"; function -FlipClear() +FlipClear(BodyOverflowY) { - document.body.style.overflowY = null; - document.body.removeChild(CineraPlacedClear); + document.body.style.overflowY = BodyOverflowY ? BodyOverflowY : null; + CineraPlacedClear.parentNode.removeChild(CineraPlacedClear); } diff --git a/cinera/cinera_search_post.js b/cinera/cinera_search_post.js index 4202ed6..5ae1a3b 100644 --- a/cinera/cinera_search_post.js +++ b/cinera/cinera_search_post.js @@ -45,7 +45,7 @@ InitPrototypes(Search.ResultsContainer); prepareProjects(); SyncNavState(); -FlipClear(); +FlipClear("scroll"); // ////