XKit-Rewritten icon indicating copy to clipboard operation
XKit-Rewritten copied to clipboard

Create dev tools and css map tool

Open marcustyphoon opened this issue 2 years ago • 4 comments

Description

I have, like, zero opinion about what any of this is called, what format it uses, whatever.

This adds a CSS map translation tool within a "dev tools" extension that won't be visible unless the user edits their preference JSON manually.

The notable choice we have here is whether to:

  • use pageModifications, which has slightly less performance impact but will fail on elements that Tumblr updates the classList of (like when you switch dashboard tabs and the tab elements become highlighted/unhighlighted
  • use a mutation observer with attributeFilter: ['class'] and just querySelector the whole damn document, which is technically slower (though I run this as a userscript 100% of the time; the performance hit is not noticable)
  • use a mutation observer with attributeFilter: ['class'] and parse the mutationRecord (fancy~)

Testing steps

No specific tests; confirm feature functionality.

marcustyphoon avatar Aug 17 '23 22:08 marcustyphoon

third option plz :heart:

AprilSylph avatar Aug 17 '23 23:08 AprilSylph

Aw man.

I had this cute idea to add attribute change observation as an option for registering page modification handlers with our regular util, but that would probably only be a good idea if one could disable the mutation observer while we set classnames on stuff (and enable it again afterward) so that you don't get a cascading waterfall of onBeforeRepaint calls or whatever. But a) we usually do modifications asynchronously, so they're not actually inside onBeforeRepaint, and b) while I don't know of any way that a pageModifications handler could result in Redpop synchronously adding an element (which would then not get detected, if the observer was disabled), I'm not confident enough in that to potentially break XKit Rewritten for no actual reason*.

*besides that my weird alt text reminder PR would lose a few lines of code maybe

marcustyphoon avatar Aug 18 '23 00:08 marcustyphoon

image

marcustyphoon avatar Aug 18 '23 00:08 marcustyphoon