The script now removes any element with the class name seventv-yt-theater-mode-button-container on YouTube, instead of only targeting the specific button element with the aria label "Theater mode". This should make the script more robust to changes in the aria label or other attributes of the button element.
The removeElementByXpath function used in the previous version of the script has been replaced with a simpler removeElementsByClassName function that uses the getElementsByClassName method to find and remove all elements with the target class name. This should make the script more efficient and easier to read.
The targetXPath variable used in the previous version of the script has been replaced with the targetClassName variable to reflect the change in the target element selector.
The if statement inside the mutation observer has been modified to check whether the added node has a classList property and contains the target class name before removing elements. This should prevent errors when the added node does not have a classList property, such as when a text node is added to the DOM.
The script should now work for any element on YouTube with the seventv-yt-theater-mode-button-container class name, not just the specific button element with the aria label "Theater mode".