// ==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"; } });