From e2bf22831ab9aa26a6f30ff75c584202f79dc523 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Mon, 9 Mar 2020 02:10:28 +0200 Subject: start popup depth from 1 on search page --- ext/fg/js/popup-proxy-host.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ext/fg/js/popup-proxy-host.js') diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index 7d86aa67..fdb54cdd 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -47,7 +47,7 @@ class PopupProxyHost { ])); } - getOrCreatePopup(id=null, parentId=null) { + getOrCreatePopup(id=null, parentId=null, depth=0) { // Find by existing id if (id !== null) { const popup = this._popups.get(id); @@ -76,7 +76,12 @@ class PopupProxyHost { } // Create new popup - const depth = (parent !== null ? parent.depth + 1 : 0); + if (parent !== null) { + if (depth !== 0) { + throw new Error('Depth cannot be set when parent exists'); + } + depth = parent.depth + 1; + } const popup = new Popup(id, depth, this._frameIdPromise); if (parent !== null) { popup.setParent(parent); -- cgit v1.2.3 From 2ca88b9b9f2a6152e8e953cac284f31c8a285446 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Mon, 9 Mar 2020 11:56:06 +0200 Subject: strict check if popup depth has been set --- ext/fg/js/popup-proxy-host.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ext/fg/js/popup-proxy-host.js') diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index fdb54cdd..49123ee1 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -47,7 +47,7 @@ class PopupProxyHost { ])); } - getOrCreatePopup(id=null, parentId=null, depth=0) { + getOrCreatePopup(id=null, parentId=null, depth=null) { // Find by existing id if (id !== null) { const popup = this._popups.get(id); @@ -77,10 +77,12 @@ class PopupProxyHost { // Create new popup if (parent !== null) { - if (depth !== 0) { + if (depth !== null) { throw new Error('Depth cannot be set when parent exists'); } depth = parent.depth + 1; + } else if (depth === null) { + depth = 0; } const popup = new Popup(id, depth, this._frameIdPromise); if (parent !== null) { -- cgit v1.2.3