FloatingHeaders

dodaje obsługę pływających nagłówków do mirko.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         FloatingHeaders
// @namespace    http://tampermonkey.net/
// @version      0.93
// @description  dodaje obsługę pływających nagłówków do mirko.
// @author       @ZasilaczKomputerowy
// @match        https://www.wykop.pl/mikroblog/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var floatingHeaders = function() {
        var yOffset =  window.pageYOffset+80;

        if(yOffset < 160)
        {
            jQuery('.ellipsis').each(function (e) {
                $(this).removeAttr('style');
            });
            return;
        }
        var mostTopNode = {};
        jQuery('.entry').each(function (e) {
            var top = $(this).offset().top+50;
            if($.isEmptyObject(mostTopNode))
            {
                mostTopNode['node'] = this;
                mostTopNode['top'] = $(this).offset().top+50;
            }
            else
            {
                if(top < yOffset && top > mostTopNode['top'])
                {
                    mostTopNode['node'] = this;
                    mostTopNode['top'] = $(this).offset().top+50;
                }
            }
        });

        var node = mostTopNode['node'];
        var author = $(node).find('.ellipsis').first();
        var width = parseInt($('.entry').last().find('.ellipsis').first().css('width').replace(/px/,'')) + 4 + 'px';

        $(author).css({
            'position': 'fixed',
            'top': '50px',
            'width': width,
            'height': '30px',
            'background-color': 'rgb(44, 44, 44)',
            'opacity': '0.8',
            'z-index': '99999'
        });

        jQuery('.ellipsis').each(function (e) {
            if(this != author.get(0))
            {
                $(this).removeAttr('style');
            }
        });
    };

    $(document).scroll(function(e) {
        floatingHeaders();
    });

    $(document).resize(function(e) {
        floatingHeaders();
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址