diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 9325a88be2..ccf35aa214 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -156,6 +156,14 @@ var ajaxify = {}; return tpl_url; }; + ajaxify.repositionNoWidgets = function() { + $('body [no-widget-class]').each(function() { + var $this = $(this); + $this.removeClass(); + $this.addClass($this.attr('no-widget-class')); + }); + }; + ajaxify.renderWidgets = function(tpl_url, url, callback) { var widgetLocations = [], numLocations; @@ -165,6 +173,10 @@ var ajaxify = {}; numLocations = widgetLocations.length; + if (!numLocations) { + ajaxify.repositionNoWidgets(); + } + function renderWidgets(location) { var area = $('#content [widget-area="' + location + '"]'); @@ -175,11 +187,7 @@ var ajaxify = {}; })).removeClass('hidden'); if (!renderedWidgets.length) { - $('body [no-widget-class]').each(function() { - var $this = $(this); - $this.removeClass(); - $this.addClass($this.attr('no-widget-class')); - }); + ajaxify.repositionNoWidgets(); } } diff --git a/public/src/forum/category.js b/public/src/forum/category.js index 289c0b7e42..7fe306bdbf 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -204,7 +204,10 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { topic.find('span.timeago').timeago(); app.createUserTooltips(); - $(window).trigger('action:categories.new_topic.loaded'); + + ajaxify.renderWidgets('category', window.location.pathname.slice(1), function() { + $(window).trigger('action:categories.new_topic.loaded'); + }); }); }); };