谷变饼 -- Google 使用 Bing 壁纸

Google 使用 Bing 壁纸。

目前為 2022-02-04 提交的版本,檢視 最新版本

// ==UserScript==
// @name         谷变饼 -- Google 使用 Bing 壁纸
// @namespace    http://tampermonkey.net/
// @version      0.51-20220204
// @description  Google 使用 Bing 壁纸。
// @license      AGPL-3.0 License
// @author       plasma
// @grant        GM_xmlhttpRequest
// @grant        unsafeWindow
// @connect      global.bing.com
// @connect      www.bing.com
// @connect      cn.bing.com
// @include      *://www.google.com/
// @exclude      /^https?://www\.google\.com(\.[a-z]+)/.*search?q=.+/
// @exclude      /^https?://www\.google\.com(\.[a-z]+)/.*&q=.+/
// @exclude      /^https?://www\.google\.com\.hk/.*&q=.+/
// @exclude      /^https?://www.google.com/#newwindow=1&q=
// @exclude      /^https?://www.google.com.hk/#newwindow=1&q=

// ==/UserScript==

(function() {

    'use strict';

    //block float element
    document.getElementsByClassName("FPdoLc lJ9FBc")[0].remove()
    document.getElementsByClassName("vcVZ7d")[0].remove()
    document.getElementsByClassName("o3j99 c93Gbe")[0].remove()
    document.getElementsByClassName("LX3sZb")[0].remove()
    document.getElementsByClassName("lJ9FBc")[0].remove()
    document.getElementsByClassName("oBa0Fe aciXEb")[0].remove()
    document.getElementsByClassName("lnXdpd")[0].style.borderRadius='30px'
    //block end


    // Google2Bing, codes referenced from here:
    // https://gf.qytechs.cn/zh-CN/scripts/30152-google%E8%B0%83%E7%94%A8bing%E5%A3%81%E7%BA%B8
    // https://gf.qytechs.cn/zh-CN/scripts/25202-%E7%99%BEbing%E5%9B%BE

    var url="https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US"; //or 'mkt=zh-cn'

    GM_xmlhttpRequest({
        method: "GET",
        url: url,
        onload: function(response) {
            var jsonData = null;
            jsonData = JSON.parse(response.responseText);
            var bgUrl=jsonData.images[0].url;
            if(!/^https?:\/\//.test(bgUrl)){
                bgUrl="https://cn.bing.com"+bgUrl;
            }
            var newHTML = document.createElement ('div');
            newHTML.innerHTML = '<div id="cpBackgroundDiv" style="position: fixed;top: 0%;left: 0%; width: 100%;height: 100%;z-index: -1; visibility: visible;"><img id="cpBackgroundImg" src="'+bgUrl+'" style="width: 100%;height: 100%;"></div>';
            document.body.appendChild (newHTML);
        }
    });

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址