1

크롬에서 사용자 스크립트에 문제가 있습니다. Greasemonkey에서이 확장 버전을 오랫동안 사용해 왔지만 Chrome에서 NodeList를 구문 분석하는 방법을 알아낼 수 없습니다. 그것은 그리스 몽키에서와 같이 여기에 코드입니다 (사이트의 코드는, 정말 나쁜 점에 유의하시기 바랍니다 그래서 내 많은 코드를위한 계정 :크롬 사용자 스크립트

for each (table in response) { 
     pre = table.getElementsByTagName('pre'); 
     for each (tag in pre) { 
      if (findNotes.test(tag.textContent)) { 
       time = tag.parentNode.parentNode.parentNode.childNodes[0].childNodes[3].childNodes[3].textContent; 
       emailexp = new RegExp("*Excluded for anonymity*","g"); 
       email = emailexp.exec(tag.textContent); 
       oldstr = "Note From: " + email; 
       newstr = '<p style="font-weight:bold">Note From: ' + email + "\t" + time + "</p>" 
       noteStr += tag.textContent.replace(oldstr, newstr); 
       noteStr += "\n"; 
       var nodeToDelete = tag.parentNode.parentNode.parentNode.parentNode; 
       nodeToDelete.removeChild(nodeToDelete.childNodes[1]); 
      } 
     } 
    } 

오전 데 문제가 크롬 명예를하지 않는다는 것입니다 . 기능 '각'그래서, 난에 첫 번째 줄을 수정 할 수 있었다 :

response.forEach(function(table, index, array) { 

그러나 각 중첩 내가 일을 얻을 수없는 부분 인 '사전'변수는 NodeList를합니다. , 나는 개체를 사용할 수 없습니다. 각각의 방법을.

누구도 어떤 제안을 가지고 있습니까? 오, 내가이 일을 할 수 있니? 제가 일하고있는 모든 것에 ID 태그가 없으므로 일이 쉬워 질 것입니다 (headdesk).

답변

3

대신 :

for each (tag in pre) { 

사용 :

for (var i=pre.length, tag; i >= 0; i--) { 
    tag=pre.item(i);