// ==UserScript==
// @name Убирает плашки "Распродажа" и т.п. везде на Ozon
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Убирает плашки "Распродажа" и т.п. везде на Ozon
// @author а.б
// @match https://www.ozon.ru/*
// @match https://www.ozon.ru/seller/*
// @match https://www.ozon.ru/search/*
// @require https://cdnjs.cloudflare.com/ajax/libs/arrive/2.4.1/arrive.min.js
// @icon https://www.google.com/s2/favicons?sz=64&domain=ozon.ru
// @grant none
// ==/UserScript==
(function() {
'use strict';
const targets = [
"Новинка",
"Вау-цены",
"Распродажа",
"Постоплата",
"Рассрочка 0%",
"Цена что надо",
"0% на 120 дней",
"0% до 140 дней",
"Скидка от 2 ед",
];
const hideBadges = (element) => {
const potentialBadges = element.querySelectorAll('span, div');
potentialBadges.forEach(badge => {
const text = badge.innerText.trim();
if (targets.includes(text)) {
const hasImage = badge.querySelector('img') || (badge.parentElement && badge.parentElement.querySelector('img'));
if (!hasImage) {
badge.style.setProperty('display', 'none', 'important');
let parent = badge.parentElement;
if (parent && parent.innerText.trim() === text && !parent.querySelector('img')) {
parent.style.setProperty('display', 'none', 'important');
}
}
}
});
};
const selectors = [
'div[class*="tile-root"]', // Поиск
'div[data-widget="webAspects"]', // Плашки на главной картинке товара
'div[data-widget="webProductHeading"]' // Заголовок и область цены
];
selectors.forEach(selector => {
document.querySelectorAll(selector).forEach(hideBadges);
document.arrive(selector, function() {
hideBadges(this);
});
});
hideBadges(document.body);
// Скрываем Оплатить позже
const hideInstallment = () => {
const installment = document.querySelector('[data-widget="webInstallmentPurchase"]');
if (installment) {
installment.style.setProperty('display', 'none', 'important');
}
};
hideInstallment();
document.arrive('[data-widget="webInstallmentPurchase"]', function() {
hideInstallment();
});
})();