mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-05 13:46:37 +02:00
implemented caching for widgets
This commit is contained in:
@@ -31,7 +31,8 @@
|
||||
}
|
||||
|
||||
function renderWidgets(location) {
|
||||
var area = $('#content [widget-area="' + location + '"]');
|
||||
var area = $('#content [widget-area="' + location + '"]')
|
||||
.html(localStorage.getItem('cache:widgets:' + url + ':' + location));
|
||||
|
||||
socket.emit('widgets.render', {template: tpl_url + '.tpl', url: url, location: location}, function(err, renderedWidgets) {
|
||||
var html = '';
|
||||
@@ -56,6 +57,7 @@
|
||||
}
|
||||
|
||||
area.html(html);
|
||||
localStorage.setItem('cache:widgets:' + url + ':' + location, html);
|
||||
|
||||
if (!renderedWidgets.length) {
|
||||
area.addClass('hidden');
|
||||
|
||||
Reference in New Issue
Block a user