Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.4 kB
3
Indexable
function applyStyles() {
  let elements = document.querySelectorAll('*');
  elements.forEach(element => {
      let style = window.getComputedStyle(element);
      let parentStyle = element.parentNode?.tagName?.toLowerCase() === 'div' ? window.getComputedStyle(element.parentNode) : undefined;
      if (parentStyle?.backgroundColor === 'rgb(197, 221, 254)' || parentStyle?.backgroundColor === '#c5ddfe' || parentStyle?.backgroundColor === '#C5DDFE' ||
          parentStyle?.backgroundColor === 'rgb(225, 237, 254)' || parentStyle?.backgroundColor === '#e1edfe' || parentStyle?.backgroundColor === '#E1EDFE') {
          console.log('here', element.classList)
          element.style.backgroundColor = '';
      } else if (
          (
              style.color === 'rgb(0, 0, 0)' || style.color === '#000' || style.color === 'black'
          ) ||
          (
              (style.color === 'rgb(127, 156, 245)' || style.color === '#7f9cf5' || style.color === '#7f9cf5') &&
              (style.fontWeight === '1000')
          )
      ) {
          if (element.textContent.trim() !== '') // check if the text content is not empty or just spaces
              element.style.backgroundColor = 'lightBlue';
      } else {
          element.style.backgroundColor = '';
      }
  });
}

setInterval(applyStyles, 50); // Execute applyStyles every 50ms
Leave a Comment