You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.0 KiB
1.0 KiB
Un bookmarklet es un marcador que, en lugar de apuntar a una dirección URL, hace referencia a una pequeña porción de código JavaScript para ejecutar ciertas tareas automáticamente[..]
Mostrar un borde rosa en todos los elementos para debuggear
javascript:(()=>{let style=document.head.querySelector('style#outline');if(style){style.remove()}else{style=document.createElement('style');style.id='outline';document.head.appendChild(style);style.append(`*{outline: 1px solid pink}`)}})()
Deestructurado:
// Hacer un bloque que se auto-ejecuta, aislando sus variables del entorno global
(() => {
// Intentar buscar si ya aplicamos el estilo
let style = document.head.querySelector('style#outline')
if (style) {
// Si lo hicimos, borrarlo
style.remove()
} else {
// Si no, crearlo
style = document.createElement('style')
style.id = 'outline'
document.head.appendChild(style)
style.append(`*{outline: 1px solid pink}`)
}
})()