Scroll Up

Tool to let you scroll to the top of the page

Stan na 30-08-2017. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Scroll Up
// @version      1.0
// @description  Tool to let you scroll to the top of the page
// @author       A Meaty Alt
// @exclude      https://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=21
// @include      /fairview.deadfrontier.com/
// @exclude      https://fairview.deadfrontier.com/onlinezombiemmo/ExternalLoginReg.php
// @exclude      http://chat.deadfrontier.com
// @require       https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js
// @grant        none
// @namespace 
// ==/UserScript==

(function() {
    'use strict';
    var scroller = document.createElement("img");
    scroller.src = "https://puu.sh/xluRH/c8dd354a59.png";
    scroller.id = "scroller";
    scroller.style.opacity = 0.3;
    scroller.style.position = "fixed";
    scroller.style.zIndex = 99;
    scroller.style.cursor = "pointer";
    scroller.style.bottom = "30px";
    scroller.style.right = "20px";
    scroller.height = 100;
    scroller.width = 100;
    
    function defineOnClickEvent(){
        $(scroller).click(function() {
            $("html, body").animate({ scrollTop: 0 }, "slow");
            return false;
        });
    }
    
    function defineOnScrollEvent(){
        $(document).scroll(function() {
            if($(window).scrollTop() === 0) {
                $("#scroller").css("opacity", 0.3);
            }
            else
                $("#scroller").css("opacity", 1);
        });
    }
    defineOnScrollEvent();
    defineOnClickEvent();
    
    document.getElementsByTagName("body")[0].appendChild(scroller);
})();