ao3 savior

Hide specified works on AO3

< Feedback on ao3 savior

Question/comment

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

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.

tuffAuthor
§
Posted: 2018-09-27

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

§
Posted: 2018-09-27

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

Sign in to post a reply.