change Popup.children to Popup.child
This commit is contained in:
parent
97be029dee
commit
2df9a7f977
@ -57,7 +57,7 @@ class PopupProxyHost {
|
|||||||
const popup = new Popup(id, depth, this.frameIdPromise);
|
const popup = new Popup(id, depth, this.frameIdPromise);
|
||||||
if (parent !== null) {
|
if (parent !== null) {
|
||||||
popup.parent = parent;
|
popup.parent = parent;
|
||||||
parent.children.push(popup);
|
parent.child = popup;
|
||||||
}
|
}
|
||||||
this.popups[id] = popup;
|
this.popups[id] = popup;
|
||||||
return popup;
|
return popup;
|
||||||
|
@ -24,7 +24,7 @@ class PopupProxy {
|
|||||||
this.id = null;
|
this.id = null;
|
||||||
this.idPromise = null;
|
this.idPromise = null;
|
||||||
this.parent = null;
|
this.parent = null;
|
||||||
this.children = [];
|
this.child = null;
|
||||||
this.depth = 0;
|
this.depth = 0;
|
||||||
|
|
||||||
this.container = null;
|
this.container = null;
|
||||||
|
@ -24,7 +24,7 @@ class Popup {
|
|||||||
this.frameIdPromise = frameIdPromise;
|
this.frameIdPromise = frameIdPromise;
|
||||||
this.frameId = null;
|
this.frameId = null;
|
||||||
this.parent = null;
|
this.parent = null;
|
||||||
this.children = [];
|
this.child = null;
|
||||||
this.container = document.createElement('iframe');
|
this.container = document.createElement('iframe');
|
||||||
this.container.id = 'yomichan-float';
|
this.container.id = 'yomichan-float';
|
||||||
this.container.addEventListener('mousedown', e => e.stopPropagation());
|
this.container.addEventListener('mousedown', e => e.stopPropagation());
|
||||||
@ -212,19 +212,9 @@ class Popup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hideChildren() {
|
hideChildren() {
|
||||||
if (this.children.length === 0) {
|
// recursively hides all children
|
||||||
return;
|
if (this.child && !this.child.isContainerHidden()) {
|
||||||
}
|
this.child.hide();
|
||||||
|
|
||||||
const targets = this.children.slice(0);
|
|
||||||
while (targets.length > 0) {
|
|
||||||
const target = targets.shift();
|
|
||||||
if (target.isContainerHidden()) { continue; }
|
|
||||||
|
|
||||||
target.hide();
|
|
||||||
for (const child of target.children) {
|
|
||||||
targets.push(child);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user