Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

231
Visualizações
Browser Extension: Attempting to replace page content and not working

I'm trying to get my extension to automatically change all content with "views" into "Views hidden" and something similar for "watching" (live streams), but when I run the extension it seems to do nothing. I'm thinking it might have something to do with me not knowing the permissions required or some other thing, but I can't seem to figure it out. This is my first time using javascript.

manifest.json

{"manifest_version": 2,
    "name": "SimplyWatch",
    "description": "Simply watch YouTube videos without any views, comments, or ratings data displayed for an experience unbiased by others' opinions.",
    "version": "1.0",
    "author": "Diamivore",
    "browser_action": {
        "default_icon": "tab-icon.png",
        "default_title": "SimplyWatch",
        "default_popup": "popup.html"
    },
    "permissions": ["activeTab", "tabs"],

    "content_scripts": [
        {
            "matches": ["<all_urls>"],
            "js": ["content.js"]
        }
    ]
}

content.js

const text = document.querySelectorAll('h1, h2, h3, h4, h5, p, li, td, caption, a, span')

document.addEventListener("DOMContentLoaded", function(){
    for (let i=0; i < text.length; i++) {
        if (text[i].innerHTML.includes('views')) {
            text[i].innerHTML = "Views hidden"
        } else if (text[i].innerHTML.includes('watching')) {
            text[i].innerHTML = "Watchers hidden"
        }
    }
});

Any help?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda