j/s
I have some custom j/s in my theme. (It’s my solution to, Interactive SVG using <object>? - #9 by craigconstantine ) Eventually, I’ll move the j/s to a Git repo, and install it as a proper Theme component. For now, I simply have the j/s pasted into my Theme’s header. I suppose, this problem might go away if I installed this j/s as a proper component, but it doesn’t smell that way to me.
My j/s modifies the DOM before it’s sent to the browser…
api.decorateCooked(
$elem => $elem.children('.cooked div[data-custom="umbdv"]').umbdv(),
{ id: 'umbdv' }
);
In action…
It selects appropriate <div data-custom="…
, and then adds new elements. For example, in the following screenshot, everything below the arrows, is inserted by the j/s. (You can see it in action here, List of Movers Mindset Podcast Episodes - Public - Movers Mindset Forum )
What I’m seeing…
I’m using the Topic List Previews component ( https://github.com/merefield/discourse-topic-list-previews-theme.git ) and my j/s doesn’t seem to get called.
In this screenshot, the /vmm/gibberish…
string is the bare <div data-custom="…
contents showing through because my j/s never gets to it via api.decorateCooked(…
.
The same thing happens in emails that get sent out…
What I’d like…
I don’t actually want it do the full replacement. Long story. I’d just like to expand my j/s so it can put some static string there, rather than the bare gibberish from my <div data-custom="…
block.
Is there some other api.
method that I can hook into?