Add button to return top of each page.
当前为
// ==UserScript==
// @name Back to Top
// @author figuccio
// @namespace https://greasyfork.org/users/237458
// @description Add button to return top of each page.
// @version 0.1
// @include *
// ==/UserScript==
// Create link to top.
function create_back_to_top() {
if(document.body){
var a = document.createElement('span');
a.innerHTML = "Top";
var c = "position:fixed;text-align:right;right:179px;bottom:0px;z-index:50000;";
c+='color:#fff!important;background-color:green;border:2px solid blue;padding:2px 9px;font-size:11pt;cursor:pointer;font-weight:bold;text-decoration:none;border-top-right-radius:7px;border-top-left-radius:7px;box-shadow:0 0 6px rgba(0,0,0,.5);';
a.style.cssText = c;
a.addEventListener('mouseover', function(){ a.style.opacity = 1; }, false);
a.addEventListener('mouseout', function(){ a.style.opacity = 0.85; }, false);
a.addEventListener('click', function(){ window.scrollTo(0,0); }, false);
document.body.appendChild(a);
}
};
if(self==top) create_back_to_top();