// ==UserScript== // @name No Google Doodle // @namespace https://github.com/Procyon-b // @version 0.7 // @description Get rid of Google Doodle logos and link // @author Achernar // @include https://www.google.tld/ // @include https://www.google.tld/?* // @include https://www.google.tld/webhp* // @include https://www.google.tld/search?* // @include /^https:\/\/www\.google\.co\.[^.]+\/$/ // @include /^https:\/\/www\.google\.co\.[^.]+\/\?.*/ // @include /^https:\/\/www\.google\.co\.[^.]+\/webhp.*/ // @include /^https:\/\/www\.google\.co\.[^.]+\/search\?.*/ // @run-at document-start // @grant none // @downloadURL none // ==/UserScript== (function() { "use strict"; function addSt(s) { if (!s) return; var r=document.documentElement || document.head; if (!r) { setTimeout(function(){addSt(s)},0); return; } var st=document.createElement('style'); r.appendChild(st); st.textContent=s; } var logo, outer=false, fixed=false, style='#replacedDoodle ~ div, #replacedDoodle ~ canvas {display:none;}'; if (location.pathname.startsWith('/search')) addSt('.sfbg,.logo.doodle{display: none;}.logo.doodleFixed img{height:30px;width:92px;}'); addSt('#hplogo > *:not(#replacedDoodle), a img#hplogo {display: none;}'+style); if (document.readyState != 'loading') fix(); else { document.addEventListener('DOMContentLoaded', function(){ obs.disconnect(); fix(); }); const obs = new MutationObserver(function(muts){ for (let mut of muts) { for (let n of mut.addedNodes) { if (n.classList && n.classList.contains('o3j99')) { if (n.querySelector('#hplogo')) { this.disconnect(); fix(); return; } } } } }); obs.observe(document, { attributes: false, childList: true, subtree: true}); } function fix() { if (location.pathname.startsWith('/search')) { logo=document.querySelector('.logo.doodle'); if (logo) logo.outerHTML=''; return; } if ( (document.title!='Google') || fixed ) return; fixed=true; logo=document.querySelector('div#hplogo'); if (!logo) { if (logo = document.querySelector(':scope a img#hplogo')) { logo=logo.closest('a'); outer=true; } } if (logo) { let h=''; if (outer) logo.outerHTML=h; else logo.innerHTML=h; setTimeout(function(){ var a=document.querySelectorAll('#replacedDoodle ~ :not(style)'); a.forEach(function(e){ e.remove(); }); }, 300); } else { st.remove(); } } })();