Skip to content

Instantly share code, notes, and snippets.

@ozturkoktay
Last active February 26, 2026 18:50
Show Gist options
  • Select an option

  • Save ozturkoktay/b4b771b61afc95a6c3e240b229129804 to your computer and use it in GitHub Desktop.

Select an option

Save ozturkoktay/b4b771b61afc95a6c3e240b229129804 to your computer and use it in GitHub Desktop.
Automatically clicks the close annoying Rufus panel on Amazon with class rufus-panel-header-close
// ==UserScript==
// @name Auto-Close Amazon Rufus Panel
// @namespace http://tampermonkey.net/
// @version 1.0
// @downloadURL https://gist.github.com/ozturkoktay/b4b771b61afc95a6c3e240b229129804/raw/8b88a84a81bce8af0d86866749f5b30a639e5299/auto-close-amazon-rufus-panel.user.js
// @updateURL https://gist.github.com/ozturkoktay/b4b771b61afc95a6c3e240b229129804/raw/8b88a84a81bce8af0d86866749f5b30a639e5299/auto-close-amazon-rufus-panel.user.js
// @match *://*.amazon.com/*
// @match *://amazon.com/*
// @description Automatically clicks the close button on Amazon with class rufus-panel-header-close
// @author Oktay Ozturk
// @license MIT
// ==/UserScript==
(function() {
'use strict';
const targetClass = 'rufus-panel-header-close';
const clickCloseButton = () => {
const closeButton = document.querySelector(`.${targetClass}:not([data-handled="true"])`);
if (closeButton) {
// Mark it so we don't click the same element again in the next millisecond
closeButton.setAttribute('data-handled', 'true');
closeButton.click();
console.log('Rufus panel closed.');
}
};
const observer = new MutationObserver(() => {
clickCloseButton();
});
observer.observe(document.body, {
childList: true,
subtree: true
});
clickCloseButton();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment