Skip to content

Instantly share code, notes, and snippets.

@fredjoseph
Last active July 31, 2024 14:34
Show Gist options
  • Save fredjoseph/4612f7c4548c6f990f13428062c68a5a to your computer and use it in GitHub Desktop.
Save fredjoseph/4612f7c4548c6f990f13428062c68a5a to your computer and use it in GitHub Desktop.
bookmarklets

Useful bookmarklets

A bookmarklet to remove sticky elements and restore scrolling to web pages!

javascript:(function()%7Bdocument.querySelectorAll(%22body%20*%22).forEach(function(node)%7Bif(%5B%22fixed%22%2C%22sticky%22%5D.includes(getComputedStyle(node).position))%7Bnode.parentNode.removeChild(node)%7D%7D)%3Bdocument.querySelectorAll(%22html%20*%22).forEach(function(node)%7Bvar%20s%3DgetComputedStyle(node)%3Bif(%22hidden%22%3D%3D%3Ds%5B%22overflow%22%5D)%7Bnode.style%5B%22overflow%22%5D%3D%22visible%22%7Dif(%22hidden%22%3D%3D%3Ds%5B%22overflow-x%22%5D)%7Bnode.style%5B%22overflow-x%22%5D%3D%22visible%22%7Dif(%22hidden%22%3D%3D%3Ds%5B%22overflow-y%22%5D)%7Bnode.style%5B%22overflow-y%22%5D%3D%22visible%22%7D%7D)%3Bvar%20htmlNode%3Ddocument.querySelector(%22html%22)%3BhtmlNode.style%5B%22overflow%22%5D%3D%22visible%22%3BhtmlNode.style%5B%22overflow-x%22%5D%3D%22visible%22%3BhtmlNode.style%5B%22overflow-y%22%5D%3D%22visible%22%7D)()%3B%0A

A bookmarklet that removes all iframes from the current page.

javascript:void(function(){document.querySelectorAll('iframe').forEach(function(element){console.log('Iframe Killa - Removing Element:', element);element.parentNode.removeChild(element)})}());

Readable

Make a webpage more readable

javascript:(function(){document.querySelectorAll('p, li, div').forEach(function(n){n.style.color = '#000';n.style.font = '500 16px/1.7em sans-serif';});})();

Fixed and Sticky to Absolute

Transform fixed and sticky elements to absolute

javascript:(function() {document.querySelectorAll('*').forEach(function(n){var p = getComputedStyle(n).getPropertyValue('position');if (p === 'fixed' || p === 'sticky'){n.style.cssText += ' ; position: absolute !important;';}});})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment