您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
替换百度搜索首页背景为微软必应每日壁纸
当前为
// ==UserScript== // @name Baiduing // @namespace Starry // @version 2.0.0 // @description 替换百度搜索首页背景为微软必应每日壁纸 // @homepage http://greasyfork.icu/zh-CN/scripts/371549-baiduing // @author Starry // @grant GM_xmlhttpRequest // @grant GM_addStyle // @connect cn.bing.com // @include *://www.baidu.com/* // ==/UserScript== //获取bing壁纸 GM_xmlhttpRequest({ method: 'GET', url: "http://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&pid=hp&video=0&n=1", onload: function (result) { let jsonData = null; try { jsonData = JSON.parse(result.responseText); let URL = "https://cn.bing.com" + jsonData.images[0].url; console.log("bing壁纸链接:" + URL); if (document.getElementsByClassName("s-skin-container s-isindex-wrap")[0]) { document.getElementsByClassName("s-skin-container s-isindex-wrap")[0].style.backgroundImage = "url(" + URL + ")"; } else { // 未登录状态 let wallpaperDiv = document.createElement("div"); wallpaperDiv.className = "s-skin-container s-isindex-wrap"; wallpaperDiv.style.backgroundImage = "url(" + URL + ")"; wallpaperDiv.style.position = "fixed"; wallpaperDiv.style.top = "0"; wallpaperDiv.style.left = "0"; wallpaperDiv.style.height = "100%"; wallpaperDiv.style.width = "100%"; wallpaperDiv.style.minWidth = "1000px"; wallpaperDiv.style.zIndex = "-10"; wallpaperDiv.style.backgroundPosition = "center"; wallpaperDiv.style.backgroundRepeat = "no-repeat"; wallpaperDiv.style.backgroundSize = "cover"; wallpaperDiv.style.webkitBackgroundSize = "cover"; wallpaperDiv.style.zoom = "1"; wallpaperDiv.cssText = "-webkit-background-size:cover;zoom:1" document.getElementById("wrapper").appendChild(wallpaperDiv); } let copyrightLink = jsonData.images[0].copyrightlink; let baiduLink = "https://www.baidu.com/s?wd=" + copyrightLink.slice(10, copyrightLink.indexOf("&")); addBingCopyright("© " + jsonData.images[0].copyright, baiduLink); } catch (e) { console.log(e); } } }); // 百度热榜(未登录时) if (document.getElementById("s-hotsearch-wrapper")) { document.getElementsByClassName("title-text c-font-medium c-color-t")[0].style.color = "rgb(255,255,255)"; document.getElementsByClassName("title-text c-font-medium c-color-t")[0].style.textShadow = "1px 1px 2px #000000"; let hotsearch = document.getElementsByClassName("title-content c-link c-font-medium c-line-clamp1"); for (let i = 0; i < hotsearch.length; i++) { hotsearch[i].style.color = "rgb(255,255,255)"; hotsearch[i].style.textShadow = "1px 1px 2px #000000"; } } // 顶部banner if (document.getElementById("s_top_wrap")) { document.getElementById("s_top_wrap").style.background = "rgba(0,0,0,0.3)"; let topBannerText = document.getElementsByClassName("c-font-normal c-color-t"); for (let i = 0; i < topBannerText.length; i++) { // 跳过 7 - 15 (更多弹出框) if (i == 7) { i = 15; } topBannerText[i].style.color = "rgba(255,255,255,0.8)"; } } // 底部banner if (document.getElementById("bottom_layer")) { document.getElementById("bottom_layer").style.background = "rgba(0,0,0,0.3)"; let bottomBannerTextLeft = document.getElementsByClassName("c-color-gray2"); for (let i = 0; i < bottomBannerTextLeft.length; i++) { bottomBannerTextLeft[i].style.color = "rgba(255,255,255,0.8)"; } let bottomBannerTextRight = document.getElementsByClassName("lh"); for (let i = 0; i < bottomBannerTextRight.length; i++) { if (i > 6) { bottomBannerTextRight[i].style.display = "none"; } else { bottomBannerTextRight[i].style.color = "rgba(255,255,255,0.8)"; } } } // 右下角添加bing图片信息 function addBingCopyright(copyrightText, baiduLink) { let bingCopyright = document.createElement("a"); bingCopyright.innerText = copyrightText; bingCopyright.href = baiduLink; bingCopyright.target = "_black" bingCopyright.className = "1h"; bingCopyright.style.color = "rgba(255,255,255,0.8)"; bingCopyright.style.marginRight = "20px"; document.getElementById("s-bottom-layer-right").appendChild(bingCopyright); }