bug1902399-recochoku.jp-hide-unsupported-browser-warning.js (940B)
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 1902399 - hide browser warning on recochoku.jp 9 */ 10 11 const callback = (mutations, observer) => { 12 const search = document.evaluate( 13 "//*[text()[contains(., 'Chromeブラウザの最新版をご利用ください')]]", 14 document, 15 null, 16 4 17 ); 18 const found = search.iterateNext(); 19 if (found) { 20 found.closest(".header-caution").remove(); 21 observer?.disconnect(); 22 } 23 }; 24 25 const observer = new MutationObserver(callback); 26 observer.observe(document.documentElement, { 27 childList: true, 28 subtree: true, 29 }); 30 31 window.addEventListener("DOMContentLoaded", () => { 32 const mutations = observer.takeRecords(); 33 observer.disconnect(); 34 if (mutations.length) { 35 callback(mutations); 36 } 37 });