YouTube Header Relative Position

The top header will no longer scroll along with the page

目前為 2016-10-15 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name YouTube Header Relative Position
  3. // @namespace https://github.com/valera5505
  4. // @description The top header will no longer scroll along with the page
  5. // @author Valery Kirichenko
  6. // @homepage https://github.com/valera5505/Relative-YouTube-Header
  7. // @match *://www.youtube.com/*
  8. // @version 1.0
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. function setMasthead() {
  13. var isFixed;
  14. if (window.location.href.indexOf("watch") != -1)
  15. isFixed = false;
  16. else
  17. isFixed = true;
  18.  
  19. document.getElementById("masthead-positioner").style.position = isFixed ? 'fixed' : 'relative';
  20. document.getElementById("masthead-positioner-height-offset").style.display = isFixed ? 'block' : "none";
  21. }
  22.  
  23. setMasthead();
  24.  
  25. document.addEventListener("spfdone", function() {
  26. setMasthead();
  27. });