Skip to content

Instantly share code, notes, and snippets.

@stuartphilp
Last active February 27, 2018 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartphilp/a8e3f989c1d0364b876db7b45bf745a1 to your computer and use it in GitHub Desktop.
Save stuartphilp/a8e3f989c1d0364b876db7b45bf745a1 to your computer and use it in GitHub Desktop.
Fixed Position Bugzilla Bug Titles
// ==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";
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment