Subscribe for updates and more.

JavaScript Bookmarklets

Planted 02021-01-19

A bookmarklet is a bookmark stored in a web browser that contains JavaScript commands that add new features to the browser.

Want to save JavaScript into a bookmarklet? Use Coles Bookmarklet Creator.

My Bookmarklets

Test them out by clicking the links. To use them anywhere simply drag the links to your bookmark bar.

Docs view toggles a Google doc between ‘edit’ and ‘preview’.

javascript:(function() {
  let path = window.location.pathname;
  if (path.endsWith('/edit')) {
    path = path.replace('/edit', '/preview');
  } else if (path.endsWith('/preview')) {
    path = path.replace('/preview', '/edit');
  }
  window.location.pathname = path;
})();

Remove URL Parameters removes URL parameters and copies the URL to the clipboard.

Kill Sticky checks the document for any elements with sticky or fixed CSS every 5 seconds and removes them.

// Function to remove elements with fixed or sticky positioning
function removeFixedStickyElements() {
    // Get all elements from the DOM
    const allElements = document.querySelectorAll("*");

    // Loop through each element
    allElements.forEach(element => {
        // Get the computed style of the element
        const computedStyle = window.getComputedStyle(element);

        // Check if the computed position is fixed or sticky
        const position = computedStyle.getPropertyValue('position');

        if (position === 'fixed' || position === 'sticky') {
            // Remove the element from the DOM
            element.remove();
        }
    });
}

// Run the function initially
removeFixedStickyElements();

// Set interval to continuously check for fixed or sticky elements every 5 seconds
setInterval(removeFixedStickyElements, 5000);

Word Counter returns an alert with the word count of text you’ve selected.

Lorem Ipsum turns all text on the page into lorem ipsum text.

Reveal Bullshit is a best-of-breed, mission-critical enterprise JavaScript bookmarklet that will empower you to evaluate the high impact of market-driven text on any Web resource, cultivating process-centric innovation and out-of-the-box thinking.

ANDI is ANDI is an open source project created by the Accessible Solutions Branch of the Social Security Administration to test websites for accessibility.

Official page for Reveal Bullshit and Official page for ANDI.

ct.css

Take a look inside your <head> with ct.css.

Add CSS Bookmarklet