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

169
Views
¿Cómo hago para que este bookmarklet no resalte todas las mismas instancias sino solo la que he seleccionado?

¿Cómo hago para que este bookmarklet no resalte todas las mismas instancias sino solo la que he seleccionado? Si es posible, ¿podría agregar otra secuencia de comandos o forma de hacerlo para que pueda desmarcarlo seleccionando el texto nuevamente? Preferiría comenzar con mi problema original.

 javascript: (function() { var els, i, txt = ""; if (window.getSelection) { txt = window.getSelection(); } else if (document.getSelection) { txt = document.getSelection(); } else if (document.selection) { txt = document.selection.createRange().text; } else { txt = ""; } if (txt) { txt = txt.toString(); } if (!txt || txt.length == 0) { els = document.querySelectorAll(".hiColor"); i = els.length; while (i--) { els[i].style.backgroundColor = ""; els[i].className = ""; } return null; } function searchNode(node, te, len) { var pos, skip = 0, spannode, middlebit, endbit, middleclone; if (node.nodeType == 3) { pos = node.data.toUpperCase().indexOf(te); if (pos >= 0) { spannode = document.createElement("SPAN"); spannode.className = "hiColor"; middlebit = node.splitText(pos); endbit = middlebit.splitText(len); middleclone = middlebit.cloneNode(true); spannode.appendChild(middleclone); middlebit.parentNode.replaceChild(spannode, middlebit); skip = 1; } } else if (node.nodeType == 1 && node.childNodes && node.tagName.toUpperCase() != "SCRIPT" && node.tagName.toUpperCase != "STYLE") { for (var child = 0; child < node.childNodes.length; ++child) { child = child + searchNode(node.childNodes[child], te, len); } } return skip; } searchNode(document.body, txt.toUpperCase(), txt.length); els = document.querySelectorAll(".hiColor"); if (els && els.length) { for (var i = 0; i < els.length; i++) { els[i].style.backgroundColor = "lime"; } } return null; })();

Imágenes↓

Lo que quiero que haga Lo que hace

about 4 years ago · Juan Pablo Isaza
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!