// ==UserScript==
//
@Name Ozon: Подсветка баллов + Удаление рассрочки
//
@namespace https://www.ozon.ru/
// @version 2.0
// @description Подсвечивает баллы за отзывы и удаляет блок "0% до 140 дней"
// @match
https://www.ozon.ru/my/reviews/promo*
// @match
https://www.ozon.ru/highlight/*
// @match
https://www.ozon.ru/product/*
//
@GranT none
// ==/UserScript==
(function() {
'use strict';
// ========== 1. Удаление блока "0% до 140 дней" ==========
function removeInstallmentBlock() {
let removed = false;
document.querySelectorAll('div, span, a, p').forEach(el => {
if (el.textContent.trim() === '0% до 140 дней') {
const parent = el.closest('[data-widget="webMarketingLabels"], .a9v, .b5_6_4');
if (parent) {
parent.style.display = 'none';
} else {
el.style.display = 'none';
}
removed = true;
}
});
if (removed) console.log('

Удалён блок "0% до 140 дней"');
}
// ========== 2. Подсветка баллов ==========
function getBonusColor(bonus) {
if (bonus < 100) return '#FFE4B5';
if (bonus < 200) return '#FFD700';
if (bonus === 200) return '#90EE90';
if (bonus < 300) return '#FF6B6B';
if (bonus < 400) return '#FF8C00';
return '#9400D3';
}
function highlightBonuses() {
const allSpans = document.querySelectorAll('span');
let found = 0;
allSpans.forEach(span => {
const text = span.textContent;
if (text && text.match(/\d+\s*балл/)) {
const match = text.match(/(\d+)\s*балл/);
if (match) {
const bonus = parseInt(match[1]);
const color = getBonusColor(bonus);
span.style.backgroundColor = color;
span.style.padding = '2px 6px';
span.style.borderRadius = '4px';
span.style.display = 'inline-block';
span.style.fontWeight = 'bold';
found++;
const parentCard = span.closest('[data-original-order]');
if (parentCard && parentCard.innerText.includes('видео')) {
if (!span.textContent.includes('

')) {
span.textContent = '

' + span.textContent;
span.style.backgroundColor = '#DDA0DD';
}
}
}
}
});
if (found) console.log(`

Подсвечено ${found} элементов с баллами`);
}
// ========== Запуск ==========
function run() {
removeInstallmentBlock();
highlightBonuses();
}
window.addEventListener('load', () => {
setTimeout(run, 500);
setTimeout(run, 1000);
setTimeout(run, 2000);
setTimeout(run, 3000);
});
const observer = new MutationObserver(() => run());
observer.observe(document.body, { childList: true, subtree: true });
setTimeout(() => observer.disconnect(), 15000);
console.log('

Объединённый скрипт запущен');
})();