From b2e82f65bc7ef4f3e93fe7d1de515c261b654d99 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 7 May 2022 18:19:11 +0300 Subject: [PATCH] fix right-side column displaying on the initial page loading #28 --- theme_nin_original/js/theme_option.js | 49 +++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/theme_nin_original/js/theme_option.js b/theme_nin_original/js/theme_option.js index bfd5536..6e64326 100644 --- a/theme_nin_original/js/theme_option.js +++ b/theme_nin_original/js/theme_option.js @@ -55,15 +55,50 @@ $(function () { }); }); -function testRightSide() { // if rightside is empty, don't show it and engarge postboard + +/* #28 + * + * async blocks could not to be loaded completely on this test running, + * listening API or DOMSubtreeModified events allows to correctly check that right side container is really empty. + * in this solution we just checking that right-side modules enabled. + * + * please join following issue for details + * https://github.com/twisterarmy/twister-html/issues/28 + * + * function testRightSide() { // if rightside is empty, don't show it and engarge postboard + * var container = $('.dashboard.right'); + + * if (container.children('.module:not(:empty)').length) { + * container.show(); + * $('.wrapper .postboard').removeClass('large'); + * } else { + * container.hide(); + * $('.wrapper .postboard').addClass('large'); + * } + * } + */ + +function testRightSide() { // if at least the one right-side module enabled, hide right column and enlarge postboard + var container = $('.dashboard.right'); + var postboard = $('.wrapper .postboard'); + + switch ('enable') { + + case $.Options.TopTrends.val: + case $.Options.WhoToFollow.val: + case $.Options.TwistdayReminder.val: + case $.Options.NewUsers.val: + + container.show(); + postboard.removeClass('large'); + + break; + + default: - if (container.children('.module:not(:empty)').length) { - container.show(); - $('.wrapper .postboard').removeClass('large'); - } else { - container.hide(); - $('.wrapper .postboard').addClass('large'); + container.hide(); + postboard.addClass('large'); } }