ao3 savior

Hide specified works on AO3

< Feedback on ao3 savior

Câu hỏi/Bình luận

§
Posted: 18-09-2018
Edited: 19-09-2018

Use of innerHTML disrupts other userscripts which use addEventListener

Hi, thank you for sharing this script, my fanfiction time is more enjoyable.

I made a userscirpt to manipulate tags via addEventListener. But my userscript didn't function properly at hided work by ao3 savivor. I searched solution and discovered this answer.

I edited getCut function to use appendChild instead innerHTML.

var getCut = function getCut(work) {
  var cut = document.createElement('div');

  cut.className = CSS_NAMESPACE + '-cut';
  //cut.innerHTML = work.innerHTML
  Array.from(work.childNodes).forEach(function(child) {
    cut.appendChild(child)
  });

  return cut;
};

I appreciate if you could include this in next update, provided changed code doesn't produce unexpected errors.

Thanks.

tuffTác giả
§
Posted: 27-09-2018

That's done with 1.12 - thanks for the snippet!

§
Posted: 27-09-2018

If you want to change only words in visible text, and not in the tags and attributes, do not use .innerHTML. Use another method. This script has an example of changing certain displayed words: https://greasyfork.org/en/scripts/23624-profanity-filter.

Post reply

Đăng nhập để bình luận