TB54 That's a practical extension! Just a problem: it doesn't work well when the tag page is set as the welcome page (in that case, the house button and the tag button lead to the same place: the tag page). A way to solve this could be to replace (or let the possibility in admin panel to replace) the house button by an "all discussion" button, for the extension to work in all setups.
function tweakMobiletab() {
let mobileTab, mobileTabTags, mobileTabHome, mobileTabHomeTags, mobileTabLoggedIn, mobileTabAllDiscussions, mobileTabPrivateDiscussions;
try {
mobileTab = document.getElementsByClassName("MobileTab")[0];
try { mobileTabHome = mobileTab.getElementsByClassName("item-home")[0]; }catch{}
try { mobileTabTags = mobileTab.getElementsByClassName("item-tags")[0]; }catch{}
try { mobileTabLoggedIn = mobileTab.getElementsByClassName("item-session")[0]; }catch{}
if(mobileTabHome != undefined || mobileTabHome != null) {
if(mobileTabLoggedIn != undefined || mobileTabLoggedIn != null) {
mobileTabPrivateDiscussions = document.createElement('li');
mobileTabPrivateDiscussions.classList.add('item-private-discussions');
mobileTabPrivateDiscussions.innerHTML = '<a class="hasIcon" aria-label="Private Discussions" href="/private" active="false"><i aria-hidden="true" class="icon fas fa-comment Button-icon"></i><span class="Button-label">Private Discussions</span></a>';
mobileTabTags.insertAdjacentElement("afterend", mobileTabPrivateDiscussions);
mobileTabPrivateDiscussions.getElementsByTagName("a")[0].addEventListener('click',function(e){e.preventDefault();m.route.set('/private');});
}
mobileTabAllDiscussions = document.createElement('li');
mobileTabAllDiscussions.classList.add('item-discussions');
mobileTabAllDiscussions.innerHTML = '<a class="hasIcon" aria-label="All Discussions" href="/all" active="false"><i aria-hidden="true" class="icon far fa-comments Button-icon"></i><span class="Button-label">All Discussions</span></a>';
mobileTabTags.insertAdjacentElement("afterend", mobileTabAllDiscussions);
mobileTabAllDiscussions.getElementsByTagName("a")[0].addEventListener('click',function(e){e.preventDefault();m.route.set('/all');});
mobileTabTags.remove();
}
}catch{}
}
function classChanged(){
const url = self.location.href;
tweakMobiletab();
try{
let mobileTabItems = document.getElementsByClassName("MobileTab-items")[0].getElementsByTagName("li");
if(mobileTabItems != undefined || mobileTabItems != null)
for(i=0, j=5; i<5; i++){
if(mobileTabItems[i].getElementsByTagName("a")[0].href === url)
mobileTabItems[i].getElementsByTagName("a")[0].setAttribute('active','true');
else
mobileTabItems[i].getElementsByTagName("a")[0].setAttribute('active','false');
}
}catch{}
}
let appF = document.getElementById("app"), ob = new MutationObserver(function(){classChanged();});
ob.observe(appF,{attributes: true, attributeFilter: ["class"]});