// ==UserScript==
// @name         返回顶部
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  返回顶部
// @author       Daniel Duyiixin
// @match        *.bidding.csg.cn/fzbgg/*
// @match        *.bidding.csg.cn/zbhxrgs/*
// @match        *.bidding.csg.cn/zbgg/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=www.csg.cn
// @grant        none
// ==/UserScript==

(function () {
	var backtotopbtn = document.createElement("button");
	backtotopbtn.innerText = "返回顶部";
	backtotopbtn.style.width = "80px";
	backtotopbtn.style.height = "30px";
	backtotopbtn.style.cursor = "pointer";
	backtotopbtn.style.position = "fixed";
	backtotopbtn.style.bottom = "20px";
	backtotopbtn.style.right = "20px";
	backtotopbtn.style.borderRadius = "10px";
	backtotopbtn.style.fontFamily = "80px";
	backtotopbtn.style.border = "2px solid gray";
	backtotopbtn.style.fontFamily = "思源黑体 CN Medium";
	document.querySelector("body").appendChild(backtotopbtn);
	var timer;
	backtotopbtn.onclick = function () {
		//设表先关
		clearInterval(timer);
		timer = setInterval(function () {
			//不断让scrooltop减少
			document.documentElement.scrollTop -= 50;
			//定时器要停
			if (document.documentElement.scrollTop <= 0) {
				clearInterval(timer);
			}
		}, 10);
	};
})();

