Skip to content

Instantly share code, notes, and snippets.

@yuryshulaev
Forked from alisdair/kill-sticky.js
Created October 23, 2015 00:28
Show Gist options
  • Save yuryshulaev/fa1181ee1c9a73bed808 to your computer and use it in GitHub Desktop.
Save yuryshulaev/fa1181ee1c9a73bed808 to your computer and use it in GitHub Desktop.
Kill sticky headers.
// ==UserScript==
// @name Kill Sticky Headers (Ctrl/Cmd+Shift+K)
// @homepage http://alisdair.mcdiarmid.org/kill-sticky-headers/
// @version 0.1
// @description Kill sticky headers
// @match *://*/*
// @grant none
// ==/UserScript==
function killSticky() {
var elements = document.querySelectorAll('body *');
for (var i = 0, len = elements.length; i < len; ++i) {
var element = elements[i];
if (getComputedStyle(element).position === 'fixed') {
element.parentNode.removeChild(element);
}
}
}
window.addEventListener('keydown', function (e) {
if (e.shiftKey && (e.ctrlKey || e.metaKey) && e.keyCode === 75 /* k */) {
killSticky();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment