IN COMMON Theme

Ha! I manage to fix in cooked posts, but then, I lost category names :stuck_out_tongue:

 <script type="text/discourse-plugin" version="0.1">
 // Remove accents in titles since the font does not support them.
 api.decorateCooked($elem =>
   $elem.children('h1, h2, h3, h4, .category-name').each(function(_, e) {
     e.textContent = e.textContent.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
   }));
</script>

I will let others explain what’s wrong to me, because it’s still Vogon poetry.

Duh. I give up. <= link to numerous commits to try (and fail) variations… Without understanding anything, I cannot do anything else.

v0.4.1 update

Right, this is v0.4.1 of this theme. The accent removal mostly works with a few exceptions that belong to in-page events not covered yet. The code is a bit ugly since it’s redundant. I guess once I figure out the appEvents I can use a cleaner way to do my thing.

Here’s an example bug:

  1. We can see the title has been converted to unaccented characters (on café).

  2. But then when we scroll, the title moves to the banner, and this event is not covered by the stripAccentsFromTitle function

Does anyone have a pointer to a list of appEvents and how to use them?

p.s.: I can’t reply to myself more than three times, so I edited this post. Sorry.