Last active
February 27, 2018 16:29
-
-
Save stuartphilp/a8e3f989c1d0364b876db7b45bf745a1 to your computer and use it in GitHub Desktop.
Revisions
-
stuartphilp renamed this gist
Feb 27, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
stuartphilp created this gist
Feb 27, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ // ==UserScript== // @name ScrollingBugTitlez // @description Pins the bug title header and other useful context so it's always visible when scrolling longer bugs // @include https://bugzilla.mozilla.org/show_bug.cgi?id=* // @author Stuart Philp // ==/UserScript== /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/licenses/publicdomain/ */ var bugzillaBody = document.querySelector("#bugzilla-body"); var elementPosition = document.querySelector("section.module"); bugzillaBody.addEventListener('scroll', function() { var rect = elementPosition.getBoundingClientRect(); if (bugzillaBody.scrollTop > rect.top) { elementPosition.style.position = "fixed"; elementPosition.style.width = "100%"; elementPosition.style.left = 0; elementPosition.style.top = '44px'; } else { elementPosition.style.position = "static"; } });