1986438-gamma.app-hide-unsupported.js (880B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 /** 8 * Bug 1986438 - hide browser warning on gamma.app 9 */ 10 11 const callback = (mutations, observer) => { 12 const search = document.evaluate( 13 "//*[text()[contains(., 'works best on Chrome')]]", 14 document, 15 null, 16 4 17 ); 18 const found = search.iterateNext(); 19 if (found) { 20 const alerts = found.closest(".chakra-alert"); 21 if (alerts.querySelectorAll(".chakra-stack").length === 1) { 22 alerts.remove(); 23 } else { 24 found.closest(".chakra-stack").remove(); 25 } 26 observer?.disconnect(); 27 } 28 }; 29 30 const observer = new MutationObserver(callback); 31 observer.observe(document.documentElement, { 32 childList: true, 33 subtree: true, 34 });