Made sure info menu is not placed in the incorrect container.

This commit is contained in:
Ajay Ramachandran
2019-09-01 21:08:29 -04:00
parent f2c2fd0d29
commit f310c53f88

View File

@@ -791,11 +791,18 @@ function openInfoMenu() {
//add the close button
popup.prepend(closeButton);
let parentNode = document.getElementById("secondary");
let parentNodes = document.querySelectorAll("#secondary");
let parentNode = null;
for (let i = 0; i < parentNodes.length; i++) {
if (parentNodes[i].firstElementChild !== null) {
parentNode = parentNodes[i];
}
}
if (parentNode == null) {
//old youtube theme
parentNode = document.getElementById("watch7-sidebar-contents");
}
//make the logo source not 404
//query selector must be used since getElementByID doesn't work on a node and this isn't added to the document yet