Add button to top navigation bar

CSS will not work, so I resorted to the following solution which I happed to find elsewhere on the forum:


Discourse.ExternalNavItem = Discourse.NavItem.extend({
    href : function() {
        return this.get('href');
    }.property('href')
});

// Add navigation button 'Mijn berichten'

Discourse.NavItem.reopenClass({
    buildList : function(category, args) {
        console.log(`NavItem#buildList(), category="${category?category.get('name'):'null'}", args="${JSON.stringify(args)}"`);
        var list = this._super(category, args);
        if (!category && args.filterMode !== 'posted') {
            console.log('NavItem#buildList() => add posted button ');
            list.push(Discourse.ExternalNavItem.create({href: '/posted', name: 'posted'}));
        }
        return list;
    }
});