Neopets - Clock Always Visible

Will make the NST Clock visible when you scroll down.

As of 20.04.2020. See ბოლო ვერსია.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Neopets - Clock Always Visible
// @author       Vincent_r_a
// @match        http://www.neopets.com/*
// @version      1
// @namespace    Vincent_r_a
// @description  Will make the NST Clock visible when you scroll down.
// ==/UserScript==

function isVisible($el) {
  var winTop = $(window).scrollTop();
  var winBottom = winTop + $(window).height();
  var elTop = $el.offset().top;
  var elBottom = elTop + $el.height();
  return ((elBottom<= winBottom) && (elTop >= winTop));
}


$(window).scroll(function() {
    if (!isVisible($("#navigation"))) {
        $("#nst").css({
            "position":"fixed",
            "bottom":"5px",
            "right":"5px",
            "background-color":$("ul.dropdown").css("background-color"),
            "border":"1px solid black",
            "padding":"8px",
            "font-size":"12px"
        });
    } else {
        $("#nst").css({
            "position":"",
            "bottom":"",
            "right":"",
            "background-color":"",
            "border":"",
            "padding":"",
            "font-size":""
        });
    }
});