Greasy Fork镜像 支持简体中文。

FloatingHeaders

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

  1. // ==UserScript==
  2. // @name FloatingHeaders
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.93
  5. // @description dodaje obsługę pływających nagłówków do mirko.
  6. // @author @ZasilaczKomputerowy
  7. // @match https://www.wykop.pl/mikroblog/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. var floatingHeaders = function() {
  14. var yOffset = window.pageYOffset+80;
  15.  
  16. if(yOffset < 160)
  17. {
  18. jQuery('.ellipsis').each(function (e) {
  19. $(this).removeAttr('style');
  20. });
  21. return;
  22. }
  23. var mostTopNode = {};
  24. jQuery('.entry').each(function (e) {
  25. var top = $(this).offset().top+50;
  26. if($.isEmptyObject(mostTopNode))
  27. {
  28. mostTopNode['node'] = this;
  29. mostTopNode['top'] = $(this).offset().top+50;
  30. }
  31. else
  32. {
  33. if(top < yOffset && top > mostTopNode['top'])
  34. {
  35. mostTopNode['node'] = this;
  36. mostTopNode['top'] = $(this).offset().top+50;
  37. }
  38. }
  39. });
  40.  
  41. var node = mostTopNode['node'];
  42. var author = $(node).find('.ellipsis').first();
  43. var width = parseInt($('.entry').last().find('.ellipsis').first().css('width').replace(/px/,'')) + 4 + 'px';
  44.  
  45. $(author).css({
  46. 'position': 'fixed',
  47. 'top': '50px',
  48. 'width': width,
  49. 'height': '30px',
  50. 'background-color': 'rgb(44, 44, 44)',
  51. 'opacity': '0.8',
  52. 'z-index': '99999'
  53. });
  54.  
  55. jQuery('.ellipsis').each(function (e) {
  56. if(this != author.get(0))
  57. {
  58. $(this).removeAttr('style');
  59. }
  60. });
  61. };
  62.  
  63. $(document).scroll(function(e) {
  64. floatingHeaders();
  65. });
  66.  
  67. $(document).resize(function(e) {
  68. floatingHeaders();
  69. });
  70. })();

QingJ © 2025

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