From dcc293e7e7262991464f0d509e529ed8a1f4efb7 Mon Sep 17 00:00:00 2001 From: Paul Warren Date: Tue, 5 Sep 2023 17:54:25 +0100 Subject: [PATCH 1/2] Show "Concealed fact" tag on transparent facts. --- iXBRLViewerPlugin/viewer/src/js/ixnode.js | 4 +++- iXBRLViewerPlugin/viewer/src/js/util.js | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/iXBRLViewerPlugin/viewer/src/js/ixnode.js b/iXBRLViewerPlugin/viewer/src/js/ixnode.js index 5985eabee..34120dee9 100644 --- a/iXBRLViewerPlugin/viewer/src/js/ixnode.js +++ b/iXBRLViewerPlugin/viewer/src/js/ixnode.js @@ -1,5 +1,7 @@ // See COPYRIGHT.md for copyright information +import $ from 'jquery'; +import { isTransparent } from './util.js'; /* * Object to hold information related to iXBRL nodes in the HTML document. @@ -44,6 +46,6 @@ export class IXNode { } htmlHidden() { - return this.wrapperNodes.is(':hidden'); + return this.wrapperNodes.is(':hidden') || this.wrapperNodes.filter((i,e) => isTransparent($(e).css('color'))).length > 0; } } diff --git a/iXBRLViewerPlugin/viewer/src/js/util.js b/iXBRLViewerPlugin/viewer/src/js/util.js index 4e4c49546..c571b590d 100644 --- a/iXBRLViewerPlugin/viewer/src/js/util.js +++ b/iXBRLViewerPlugin/viewer/src/js/util.js @@ -149,3 +149,14 @@ export function titleCase(text) { .join(''); }).join(' '); } + +/** + * Extract the alpha value from an rgba(r,g,b,a) string and returns true if + * transparent (a < 10%). Returns false on rgb(r,g,b) strings. + * @param {String} rgba color string to parse + * @return {Boolean} whether the value is transparent + */ +export function isTransparent(rgba) { + const val = parseFloat(rgba.split(",")[3]); + return !isNaN(val) && val < 0.1; +} From 2a4672883735e9a22edbf408d1f4109ecd41a307 Mon Sep 17 00:00:00 2001 From: Paul Warren Date: Wed, 6 Sep 2023 22:56:11 +0100 Subject: [PATCH 2/2] Replace .filter() with .is() --- iXBRLViewerPlugin/viewer/src/js/ixnode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iXBRLViewerPlugin/viewer/src/js/ixnode.js b/iXBRLViewerPlugin/viewer/src/js/ixnode.js index 34120dee9..41a81c6ee 100644 --- a/iXBRLViewerPlugin/viewer/src/js/ixnode.js +++ b/iXBRLViewerPlugin/viewer/src/js/ixnode.js @@ -46,6 +46,6 @@ export class IXNode { } htmlHidden() { - return this.wrapperNodes.is(':hidden') || this.wrapperNodes.filter((i,e) => isTransparent($(e).css('color'))).length > 0; + return this.wrapperNodes.is(':hidden') || this.wrapperNodes.is((i,e) => isTransparent($(e).css('color'))); } }