Apply the Today on Bing wallpapers to the homepage of Google.
< Σχολιασμός για τον κώδικα Bing Wallpaper for Google
Hi, @dewbie. Sorry for being late. I did not get any notification or email for your comment.
Currently, Gooogle homepage has the following code:
<div class="k1zIA rSk4se"><style>...</style><img class="lnXdpd" alt="Google" src="/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" srcset="/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png 1x, /images/branding/googlelogo/2x/googlelogo_color_272x92dp.png 2x" data-atf="1" width="272" height="92"></div>
var oldLogo = document.querySelector('.k1zIA img')
should work. It is a CSS selector trick. .k1zIA img
indicates the child <img>
element of a parental element with its class to be k1zIA
. MDN has detailed explanations: https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors , https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector , and https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors . document.querySelector('.lnXdpd')
, which indicates an element that is of class lnXdpd
, should also work.
Because Google changes their homepage stylesheets frequently, it might need updating often. Typically, the stylesheet would be different from the usual when there is Doodle.
Cool... is there a way to change the google logo? I had a script but they changed the id from hplogo to k1zIA and I can't get it to work
Can you help? This is the code...
// ==UserScript==
// @name Google Doodle
// @namespace http://localhost
// @description Replace the Google logo with a hosted image
// @version 1.1
// @include http://*.google.*/*
// @include https://*.google.*/*
// @resource logo https://lh6.googleusercontent.com/-Bi8HSHjvdWA/U6S9n302OoI/AAAAAAAAD9c/gxXC46BNoVQ/s0/logo11w50pc1.png
// @grant GM_getResourceURL
// ==/UserScript==
//
var oldLogo = document.getElementById('k1zIA');
var newLogo = document.createElement('img');
newLogo.id = "User-Logo";
newLogo.border = 'no'
newLogo.src ="data:image/png;base64,MY IMAGE CODE";
oldLogo.parentNode.replaceChild(newLogo, oldLogo);