# IN COMMON Theme

**URL:** https://meta.discourse.org/t/in-common-theme/101225
**Category:** Theme
**Created:** [November 3, 2018, 7:40pm UTC](https://meta.discourse.org/t/in-common-theme/101225 "2018-11-03T19:40:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [November 3, 2018, 7:40pm UTC](https://meta.discourse.org/t/in-common-theme/101225/1 "2018-11-03T19:40:53Z")

</div>

Hello there,

I started developing a – my first – theme for [https://talk.incommon.cc](https://talk.incommon.cc) that you can [preview on the theme creator](https://theme-creator.discourse.org/theme/hellekin/incommon-theme).

It’s not yet used on IN COMMON because I need to fix the JavaScript. [Help and pointers welcome!](https://framagit.org/incommon.cc/discourse-incommon-theme/issues/1 "Link to issue")

Here’s a screenshot:

 ![2018-11-03-203537](https://global.discourse-cdn.com/meta/original/3X/4/0/40c233e765338f59132489b27ca82e1bcb57f8f5.png)

---

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [November 5, 2018, 11:35am UTC](https://meta.discourse.org/t/in-common-theme/101225/2 "2018-11-05T11:35:51Z")

</div>

I managed to replace accents in category names, but not in cooked posts yet:

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

 api.decorateCooked(stripAccentsFromTitles)
</script>

```

---

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [November 5, 2018, 1:06pm UTC](https://meta.discourse.org/t/in-common-theme/101225/3 "2018-11-05T13:06:08Z")

</div>

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

```javascript
 <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](https://framagit.org/incommon.cc/discourse-incommon-theme/commits/javascript). \<= 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.

---

<div class="post-metadata">

### Author: ![Remah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/remah/32/70590_2.png) [@Remah](https://meta.discourse.org/u/Remah)
#### Post date: [November 3, 2019, 6:41am UTC](https://meta.discourse.org/t/in-common-theme/101225/4 "2019-11-03T06:41:55Z")

</div>

Interesting but the typeface is not easy to read. Wouldn’t it be easier to get a font that has accented characters?

I usually try to avoid typefaces that are slower to read because slowing reading is better reserved for text where slowing reading can increase comprehension.

P.S. Mainly posted so you get three more posts if you need them.
