Implemented When will we be able to link direct to a js tab?

  • Thread starter Thread starter ragtek
  • Start date Start date
R

ragtek

Guest
see title:p

(if somebody doesn't know what i mean:
http://xenforo.com/community/members/ragtek.82/#info doesn't link to the information tab, the first tab is always active instead of #info in my example...
vs
http://www.vbulletin-germany.org/member.php?12-ragtek&tab=releases#releases
which links direct to my releases tab

it's really anoying, specially if you have addons which have to redirect to the same page after some action... e.g. when i create/delete a usernote, it redirects after the action to the profile posts tab instead of setting the user notes tab active
usernotes_tab-png.20946



It's a bug since the first beta, which is really very annoying...

The only way i'm aware of, is this:
Code:
<script type="text/javascript">
    $(document).bind('XenForoActivationComplete', function() {
        $test = document.URL.split("#")[1];
        if ($test && $test == 'invitestab') {
            $tabContainer = $('#ragtektabs');
            var $api = $tabContainer.data('tabs');
            $current = $api.click(1);
        }
 
$noTab = $("li.noTab");
console.log($noTab);
$noTab.bind('click', function(){
window.location = $noTab.data('url');
});
    });
</script>
but it's working only for own pages where i exactly know how many tabs exist and the possition, so it's not possible to use this "hack" for addons adding own tabs to the profile, because you never know the possition of your tab
 
Upvote 0
This suggestion has been implemented. Votes are no longer accepted.
I've noticed this as well, have yet to dig into it (I thought I had missed something myself, apparently not). Will let you know if I find anything, but most likely this just needs to be fixed by the devs. Shouldn't be too hard to create a workaround that works for all tabs though.
 
We've created this solution
Code:
<script type="text/javascript">
$(document).bind('XenForoActivationComplete', function() {
$tab= document.URL.split("#")[1];
if ($tab) {
$tabContainer = $('#tabcontainer');
var $api = $tabContainer.data('tabs');
var tabArray = $api.getTabs();
 
$.each(tabArray, function (i,val){
if (tabArray[i]['hash'] == '#'+$tab){
this.click();
}
});}});
</script>
Which works for all tabs in the tabcontainer:)

I think if i could find a way to hook into the xenforo_tabs method, it would work for all xenforo tabs.
The only problem is that it's working only for the tab, we can't jump to hash:/

e.g. http://xenforo.com/community/members/extralicense.45340/#profile-post works

http://xenforo.com/community/members/extralicense.45340/#profile-post-13806 works not because the tabname is wrong profile-post != profile-post-13806
 
Top Bottom