必应首页壁纸一键下载,用来做电脑壁纸妥妥的

必应首页壁纸一键下载,用来做电脑壁纸妥妥的,后期考虑加入其它壁纸下载...

// ==UserScript==
// @name         必应首页壁纸一键下载,用来做电脑壁纸妥妥的
// @namespace    juziaiku_background_download
// @version      1.0.1
// @description  必应首页壁纸一键下载,用来做电脑壁纸妥妥的,后期考虑加入其它壁纸下载...
// @author       橘子爱哭
// @include      *://cn.bing.com/
// @include      *://cn.bing.com/?FORM=*
// @grant        GM_download
// @grant        GM_openInTab
// @require      https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js
// @run-at       document-idle
// @charset		 UTF-8
// ==/UserScript==

(function(){
	'use strict';
	var $ = $ || window.$;
	const window_href = window.location.href;
	const website_host = window.location.host;
	
	//必应背景下载
	const biying={};
	biying.backgroundImageurl = null;
	biying.getBackgroundImage = function(){
		var backgroundImageurl = $("#bgDiv").css("background-image");
		return backgroundImageurl.replace("url(\"","").replace("\")","");
	};
	biying.addHtml = function(backgroundImageurl){
		$("#plugin-script-downloadimage").remove();
		var downloadimage ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAEzElEQVR4Xu2bW8hVRRTH/38IijKDMrQIie5ETxVGl4eil+69lJEPmWIU2QWi6OshCAzSoIRCI7sXZGhBSWhFgUQaUfoS+dCFouh+gbAeguAfK9bYtNlnz+zL+Q5yZmBz+PaeWZffXjOzZp3zEVPeOOX+owAoETDlBMoUmFQASDoBwGcAfgawnOTrk7BlYhEgaSuAi93pzSQXTxsARQ5vJ3lBATABApOcAiUCyhT4j0BZA8oiWHaBsg2WPGACacDk6gGSSh5Q8oCSB+wjUBKhkgiVRKgkQiURKonQBAiUitCQ0CVZldequ7tJPtoku20qLOlWAKcAeJPklqHsHjQCJP0K4HA37iWS144ytA0ASZsAXO2ydpE8c1YASLoPwA0AtgG4n+RXibf6JYBjoz4vkLyubkwugIrzJiqZNUo6CIBBOw7AyyTNj9rWGAEVI5eRfDYB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Yl+VhauNXaGvHZDeAvAOSfvSZfA2NgCxpZIOBXCZ1xetyGol9/BpXb/3Enz4/MAXT5suY22zAmCsHvQUXgD0BLjfDy8RsN+/wp4OTH0E/APb2Chfnm53kAAAAABJRU5ErkJggg==";
		var html = '<a id="plugin-script-downloadimage" title="点击下载背景" href="'+backgroundImageurl+'" target="_blank">'+
						'<div style="overflow: hidden;width: 40px;height: 40px;line-height:40px;text-align:center;;margin: 0 10px;background-position-x: 0;"><img style="width:100%;" src="'+downloadimage+'" /></div>'+
					'</a>';
		$("#sh_rdiv").append(html);
	};
	biying.start = function(){
		if(window.location.href.indexOf("bing.com")!=-1){
			setInterval(function(){
				var backgroundImageurl = biying.getBackgroundImage();
				if(biying.backgroundImageurl !== backgroundImageurl){
					biying.addHtml(backgroundImageurl);
					biying.backgroundImageurl = backgroundImageurl;
				}
			},100);
		}
	};
	biying.start();
})();