javascript - Find, Change multiple instances of text on page is Slow and Unresponsive, but Works -


EDIT: StackOverFlow is changing Japanese characters with the translation when saving my question.

It looks like I'm replacing the same text with the same text.

The first item (of the dupes below) should be Japanese text.

Using the script described here:

I Yahoo Japan auction pages (Yes, I have a translation engine, but I have reason to Have been gone about trying to translate ...)

Example Page:

Some scripts have tried and when If the script works, I have to wait and click on "unresponsive script" shortly before the change (10-20 seconds)

Anki I believe that my implementation is very small, uncertain how to proceed. The script may include more than 200 change items. These are killed down for space considerations.

Version 1 script:

  function newTheOlds (node) {node = node || Document.body; If (node.Nodtip == 3) {// Text node node. NodeValue = node.nodeValue.split ('car, bike'). Join ('car, bike'); Node NodeValue = node.nodeValue.split ('Current $'). Joining ('current $'); Node.nodeValue = node.nodeValue.split ('Buy It Now'). Join ('Buy It Now'); Node NodeValue = Node. NodeValue.split ('bid'). Join ('bid'); Node.nodeValue = node.nodeValue.split ('remaining time'). Joining ('remaining time'); Node NodeValue = node.nodeValue.split ('popular-latest') included ('popular-latest'); } And {var nodes = node.cildnode; If (nodes) {var i = nodes.length; While (i--) the newTheOlds (nodes [i]); }}} NewTheOlds ();   

version 2 script:

  function htmlreplace (a, b, element) {if (! Element) element = document.body; Var node = element.childNodes; (Var n = 0; n & lt; nodes.length; n ++) {if (nodes [n] .nodeType == Node.TEXT_NODE) ​​{var r = New RegExp (a, 'gi'); Nodes [n] .textcontent = nodes [n] .textcontent.replace (r, b); } Else {htmlreplace (A, B, node [n]); }}} Htmlreplace ('car, bike', 'car, bike'); Htmlreplace ('Current $', 'Current $'); Htmlreplace ('Buy It Now', 'Buy It Now'); Htmlreplace ('bid', 'bid'); Htmlreplace ('remaining time', 'remaining time'); Htmlreplace ('popular-latest', 'popular-latest'); Htmlreplace ('display', 'display'); Htmlreplace ('music', 'music'); Htmlreplace ('Hobby', 'Hobby'); Htmlreplace ('Books / Magazines', 'Books / Magazines'); Htmlreplace ('Antiques', 'Antiques'); Htmlreplace ('Comics / Anime', 'Comics / Anime'); Htmlreplace ('movie / video', 'movie / video'); Htmlreplace ('computer', 'computer'); Htmlreplace ('other', 'other');   

"text">

While my Believe that my implementation is small, how precarious it is to move forward.

  • Multiple node.nodeValue = An assignment for a document
  • Multiple key in a key / value object htmlreplace move the strings to the calls
  • Call the childNodes
  • > Change the match using a transcript callback that references the object

    Reference



Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -