// ==UserScript== // @name 谷变饼 -- Google 使用 Bing 壁纸 // @namespace http://tampermonkey.net/ // @version 0.5 // @description Google 使用 Bing 壁纸。大部分代码来自:https://greasyfork.org/zh-CN/scripts/30152-google%E8%B0%83%E7%94%A8bing%E5%A3%81%E7%BA%B8 和 https://greasyfork.org/zh-CN/scripts/25202-%E7%99%BEbing%E5%9B%BE // @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/ // @include *://www.google.com.hk/ // @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= // @downloadURL none // ==/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() //block end // Google2Bing, codes referenced from here: // https://greasyfork.org/zh-CN/scripts/30152-google%E8%B0%83%E7%94%A8bing%E5%A3%81%E7%BA%B8 // https://greasyfork.org/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 = '