Lazy-load dashboard widgets

This commit is contained in:
Raphael Michel
2019-08-12 12:19:02 +02:00
parent 9bdb715874
commit 5363f4206e
6 changed files with 139 additions and 67 deletions

View File

@@ -0,0 +1,13 @@
/*global $,gettext*/
$(function () {
if ($("div[data-lazy-id]").length == 0) {
return;
}
$.getJSON("widgets.json", function (data) {
$.each(data.widgets, function (k, v) {
$("[data-lazy-id=" + v.lazy + "]").removeClass("widget-lazy-loading");
$("[data-lazy-id=" + v.lazy + "] .widget").html(v.content);
});
});
});