Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

341
Views
No puedo afectar la causa DOM del error "Se negó a ejecutar el controlador de eventos en línea". -Extensiones cromadas

A menudo pierdo el tiempo leyendo comentarios de youtube mientras estudio. Así que se me ocurrió una idea, decidí hacer una extensión que ocultaría la sección de comentarios. Encontré la ID del elemento, hice una extensión simple pero no funcionó debido al siguiente error:

El archivo html de mi extensión:

 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Comminator | Youtube Comment Terminator</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <button id="main" onclick="hide()">Terminate</button> <script type="text/javascript"> var comments = document.getElementById("comments"); //"comments" is the ID of comments section in youtube function hide() { comments.style.display = "none"; } </script> </body> </html>
Archivo JSON:

 { "manifest_version": 2, "name": "Comminator", "description": "Youtube Comment Hider", "version": "1.0", "icons": {"128": "icon_128.png"}, "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" }, "permissions": ["activeTab"] }

¿No somos capaces de interferir con los elementos? Chrome no lo permite?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  • Parece que no le gusta el código en línea onclick="hide()" , así que use eventListener en su lugar
  • hay varios comentarios con id=comentario. No se puede acceder a ellos por getElementById

 const comments = document.querySelectorAll("[id=comment]"); //"comment" is the ID of each comment in youtube document.getElementById("main").addEventListener("click", function(e) { e.preventDefault(); // in case the button ends up in a form comments.forEach(comment => comment.style.display = "none")) })

Alternativamente, simplemente tenga un bookmarklet:

 javascript:(() => document.querySelectorAll("[id=comment]").forEach(comment => comment.style.display = "none"))()

Haga un marcador y cambie la URL a la anterior y se ocultará cuando haga clic en él

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!