diff --git a/css/area_footer.less b/css/area_footer.less index 4bdf3b1..86f66d6 100755 --- a/css/area_footer.less +++ b/css/area_footer.less @@ -27,6 +27,10 @@ bdi { font-weight: bold; + max-width: 100%; + display: inline-block; + overflow: auto; + vertical-align: bottom; } } diff --git a/js/meta-box.js b/js/meta-box.js index 1b540cf..170d29e 100755 --- a/js/meta-box.js +++ b/js/meta-box.js @@ -1,6 +1,7 @@ -jQuery(function () { - var $metaBox = jQuery('#spr__meta-box'); - if (!$metaBox.length) return; + + +(function($) { + /** * Register the click handler for the tabs @@ -8,32 +9,53 @@ jQuery(function () { * Tabs can be added dynamically later on and this handler will still * provide the open/close functionality */ - $metaBox.on('click', '.meta-tabs a', function (e) { - e.preventDefault(); - var $tab = jQuery(this), - isopen = $tab.attr('aria-expanded') === 'true'; + var registerClickForTabsInMetaBox = function($metaBox) { - // disable all existing tabs - $metaBox.find('.meta-tabs li') - .removeClass('active') - .find('a') - .attr('aria-expanded', 'false'); - $metaBox.find('.meta-content .tab-pane') - .removeClass('active') - .attr('aria-hidden', 'false'); + $metaBox.on('click', '.meta-tabs a', function (e) { + e.preventDefault(); + var $tab = $(this), + isopen = $tab.attr('aria-expanded') === 'true'; - if (isopen) return; // tab was open, we closed it. we're done + // disable all existing tabs + $metaBox.find('.meta-tabs li') + .removeClass('active') + .find('a') + .attr('aria-expanded', 'false'); + $metaBox.find('.meta-content .tab-pane') + .removeClass('active') + .attr('aria-hidden', 'false'); - // enable current tab - $tab - .attr('aria-expanded', 'true') - .closest('li') - .addClass('active'); - $metaBox.find($tab.attr('href')) - .addClass('active') - .attr('aria-hidden', 'false'); + if (isopen) return; // tab was open, we closed it. we're done + // enable current tab + $tab + .attr('aria-expanded', 'true') + .closest('li') + .addClass('active'); + $metaBox.find($tab.attr('href')) + .addClass('active') + .attr('aria-hidden', 'false'); + + }); + + /** + * in admin templates show toc tab, if available + */ + if($('body').hasClass('do-admin')) { + var $tocLink = $metaBox.find('a[href="#spr__tab-toc"]'); + if($tocLink.length === 1) { + $tocLink.trigger('click'); + } + } + }; + + + $(function(){ + var $metaBox = $('#spr__meta-box'); + if (!$metaBox.length) return; + + registerClickForTabsInMetaBox($metaBox); }); -}); +})(jQuery);