FreeStyler / FastScroll Up & Down arrows

// ==UserScript==
// @name          FastScroll Up & Down arrows
// @version       0.1
// @description   FastScroll Up & Down arrows for all sites
// @namespace     FSUDallsites
// @include       *
// @match         *
// @author        zanygamer@gmail.com
// @grant         none
// @run-at        document-end
// @require       http://code.jquery.com/jquery-latest.js
// ==/UserScript==

function cl(m){console.log(m);}

FSDUdockContainer = document.getElementsByTagName('body')[0];
var css = '.MyFSUClass {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDoAABSCAABFVgAADqXAAAXb9daH5AAAAB/SURBVHja7NRRCsAgCAbgXOIZdv/T7QxC/XvZoEUvTlYw9CXxoQ9NYgBIC4LTogg44IADXgLTdWImTG1eVbGJfA5TX9hEyNo5O1B0NRPOTvTOzTg70de4ddSPC6tqapYKo/f3wsMOBpuMX38gAQcccMBzo5Ry5Jz3EwAA//8DAKsUHZFElBvTAAAAAElFTkSuQmCC) no-repeat #000; box-shadow:0px 0px 2px rgba(50, 50, 50, 0.75);}'+
'.MyFSUClass:hover {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDoAABSCAABFVgAADqXAAAXb9daH5AAAAB/SURBVHja7NRRCsAgCAbgXOIZdv/T7QxC/XvZoEUvTlYw9CXxoQ9NYgBIC4LTogg44IADXgLTdWImTG1eVbGJfA5TX9hEyNo5O1B0NRPOTvTOzTg70de4ddSPC6tqapYKo/f3wsMOBpuMX38gAQcccMBzo5Ry5Jz3EwAA//8DAKsUHZFElBvTAAAAAElFTkSuQmCC) no-repeat red;}';
head = document.getElementsByTagName('head')[0];
style = document.createElement('style');
style.type = 'text/css';
if(style.styleSheet) style.styleSheet.cssText=css; else style.appendChild(document.createTextNode(css));
head.appendChild(style);

FastScrollUpButton = document.createElement("a"); // our thumb button creation
FastScrollUpButton.setAttribute("id", "msb");
FastScrollUpButton.setAttribute("onclick", "window.scrollTo(0,0);");
FastScrollUpButton.setAttribute("title", "Up"); 	
FastScrollUpButton.setAttribute("class", "MyFSUClass"); 
FastScrollUpButton.setAttribute('style','-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;z-index:999;position:fixed;right:50px;bottom:52px;display:none;color:#333333;cursor:pointer; font:bold 0px "Helvetica Neue",Helvetica,Arial,sans-serif;'+
'text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);height:30px;width:30px;');
FSDUdockContainer.appendChild(FastScrollUpButton);

function getScroll() {
 if(window.pageYOffset!= undefined){
  return pageYOffset; //return [pageXOffset, pageYOffset];
 } else {
  var sx, sy, d= document, r= d.documentElement, b= d.body;
  sx= r.scrollLeft || b.scrollLeft || 0;
  sy= r.scrollTop || b.scrollTop || 0;
  return sy; //return [sx, sy];
 }
}

window.onscroll = function() {
 if(getScroll()>50) document.getElementById("msb").style.display = "block"; else document.getElementById("msb").style.display = "none";
}
if(getScroll()>50) document.getElementById("msb").style.display = "block"; else document.getElementById("msb").style.display = "none";



/*
(function() {
    'use strict';

    // Your code here...
})();*/

function check(){ //cl('document.documentElement.scrollHeight:'+document.body.scrollHeight);
 if(top.location.href == self.location.href && (document.documentElement.scrollHeight>1050 || parseInt(document.body.scrollHeight)>1050)) head.appendChild(style);
 if(top.location.href == self.location.href && (document.documentElement.scrollHeight>1050 || parseInt(document.body.scrollHeight)>1050)) FSDUdockContainer.appendChild(FastScrollDownButton);
}

var css = '.MyFSDClass {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDoAABSCAABFVgAADqXAAAXb9daH5AAAACLSURBVHja7NRRDoAgCAbg33CeofufrjOwKb3UZpRrmvrQ4MUXxzdE8CIimBgxxo2IVo/JQUQrAEyHzzDYYIMNHg6747zs9cSMJYTXez0qdnnSAtq1YskSu4eKnLrbtcclvBpteWqNowVt/dWi0cQsqt/DxinHq9Gvcyy/XiAGG2ywwbfYAQAA//8DAPkQHrCBTOyQAAAAAElFTkSuQmCC) no-repeat #000; box-shadow: 0px 0px 2px rgba(50, 50, 50, 0.75);}'+
'.MyFSDClass:hover {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDoAABSCAABFVgAADqXAAAXb9daH5AAAACLSURBVHja7NRRDoAgCAbg33CeofufrjOwKb3UZpRrmvrQ4MUXxzdE8CIimBgxxo2IVo/JQUQrAEyHzzDYYIMNHg6747zs9cSMJYTXez0qdnnSAtq1YskSu4eKnLrbtcclvBpteWqNowVt/dWi0cQsqt/DxinHq9Gvcyy/XiAGG2ywwbfYAQAA//8DAPkQHrCBTOyQAAAAAElFTkSuQmCC) no-repeat red;}';
head = document.getElementsByTagName('head')[0];
style = document.createElement('style');
style.type = 'text/css';

if(style.styleSheet) style.styleSheet.cssText = css; else style.appendChild(document.createTextNode(css));
if(top.location.href == self.location.href && document.documentElement.scrollHeight>document.documentElement.offsetHeight) head.appendChild(style);

FastScrollDownButton = document.createElement("a");
FastScrollDownButton.setAttribute('id','FastScrollDownButton');
FastScrollDownButton.setAttribute('onclick','window.scrollTo(0,99999999);');
FastScrollDownButton.setAttribute("class", "MyFSDClass");
FastScrollDownButton.setAttribute('style','-webkit-border-radius: 3px;-moz-border-radius: 3px;border-radius: 3px;z-index:999;position:fixed;right:50px;bottom:20px;color:#333333;cursor:pointer;font:bold 0px "Helvetica Neue",Helvetica,Arial,sans-serif; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);vertical-align: middle; height: 30px; width: 30px;');
	 
check();
setTimeout(check,2000);
setTimeout(check,3000);
setTimeout(check,4000);
setTimeout(check,5000);