diff --git a/package.json b/package.json index b2e8413fb7..eabc1a2aa0 100644 --- a/package.json +++ b/package.json @@ -60,9 +60,9 @@ "nodebb-plugin-soundpack-default": "0.1.6", "nodebb-plugin-spam-be-gone": "0.4.10", "nodebb-rewards-essentials": "0.0.9", - "nodebb-theme-lavender": "3.0.14", - "nodebb-theme-persona": "4.1.61", - "nodebb-theme-vanilla": "5.1.41", + "nodebb-theme-lavender": "3.0.15", + "nodebb-theme-persona": "4.1.62", + "nodebb-theme-vanilla": "5.1.42", "nodebb-widget-essentials": "2.0.12", "nodemailer": "2.0.0", "nodemailer-sendmail-transport": "1.0.0", diff --git a/public/src/widgets.js b/public/src/widgets.js index ede518db4d..8d4eb10e1f 100644 --- a/public/src/widgets.js +++ b/public/src/widgets.js @@ -5,11 +5,11 @@ ajaxify.widgets = {}; ajaxify.widgets.reposition = function (location) { - $('body [no-widget-class]').each(function () { + $('body [has-widget-class]').each(function () { var $this = $(this); - if ($this.attr('no-widget-target') === location) { + if ($this.attr('has-widget-target') === location) { $this.removeClass(); - $this.addClass($this.attr('no-widget-class')); + $this.addClass($this.attr('has-widget-class')); } }); }; @@ -20,7 +20,7 @@ return callback(); } - var widgetLocations = ['sidebar', 'footer', 'header'], numLocations; + var widgetLocations = ['sidebar', 'footer', 'header']; $('#content [widget-area]').each(function () { var location = $(this).attr('widget-area'); @@ -29,71 +29,61 @@ } }); - numLocations = widgetLocations.length; - - if (!numLocations) { - ajaxify.widgets.reposition(); - } - - function renderWidgets(locations) { - $.get(config.relative_path + '/api/widgets/render' + (config['cache-buster'] ? '?v=' + config['cache-buster'] : ''), { - locations: locations, - template: template + '.tpl', - url: url, - isMobile: utils.isMobile() - }, function (renderedAreas) { - for (var x = 0; x < renderedAreas.length; ++x) { - var renderedWidgets = renderedAreas[x].widgets, - location = renderedAreas[x].location, - html = ''; - - for (var i = 0; i < renderedWidgets.length; ++i) { - html += templates.parse(renderedWidgets[i].html, {}); - } - - var area = $('#content [widget-area="' + location + '"]'); + $.get(config.relative_path + '/api/widgets/render' + (config['cache-buster'] ? '?v=' + config['cache-buster'] : ''), { + locations: widgetLocations, + template: template + '.tpl', + url: url, + isMobile: utils.isMobile() + }, function (renderedAreas) { + for (var x = 0; x < renderedAreas.length; ++x) { + var renderedWidgets = renderedAreas[x].widgets; + var location = renderedAreas[x].location; + var html = ''; + + for (var i = 0; i < renderedWidgets.length; ++i) { + html += templates.parse(renderedWidgets[i].html, {}); + } - if (!area.length && window.location.pathname.indexOf('/admin') === -1 && renderedWidgets.length) { - if (location === 'footer' && !$('#content [widget-area="footer"]').length) { - $('#content').append($('