mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
refactoring newsfeed, moving hiding of module while loading away from dom-generation
This commit is contained in:
@@ -80,6 +80,9 @@ Module.register("newsfeed", {
|
|||||||
this.generateFeed(payload);
|
this.generateFeed(payload);
|
||||||
|
|
||||||
if (!this.loaded) {
|
if (!this.loaded) {
|
||||||
|
if (this.config.hideLoading) {
|
||||||
|
this.show();
|
||||||
|
}
|
||||||
this.scheduleUpdateInterval();
|
this.scheduleUpdateInterval();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,18 +147,10 @@ Module.register("newsfeed", {
|
|||||||
fullArticle.src = this.getActiveItemURL();
|
fullArticle.src = this.getActiveItemURL();
|
||||||
wrapper.appendChild(fullArticle);
|
wrapper.appendChild(fullArticle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.hideLoading) {
|
|
||||||
this.show();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (this.config.hideLoading) {
|
|
||||||
this.hide();
|
|
||||||
} else {
|
} else {
|
||||||
wrapper.innerHTML = this.translate("LOADING");
|
wrapper.innerHTML = this.translate("LOADING");
|
||||||
wrapper.className = "small dimmed";
|
wrapper.className = "small dimmed";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return wrapper;
|
return wrapper;
|
||||||
},
|
},
|
||||||
@@ -340,7 +335,9 @@ Module.register("newsfeed", {
|
|||||||
|
|
||||||
notificationReceived: function (notification, payload, sender) {
|
notificationReceived: function (notification, payload, sender) {
|
||||||
const before = this.activeItem;
|
const before = this.activeItem;
|
||||||
if (notification === "ARTICLE_NEXT") {
|
if (notification === "MODULE_DOM_CREATED" && this.config.hideLoading) {
|
||||||
|
this.hide();
|
||||||
|
} else if (notification === "ARTICLE_NEXT") {
|
||||||
this.activeItem++;
|
this.activeItem++;
|
||||||
if (this.activeItem >= this.newsItems.length) {
|
if (this.activeItem >= this.newsItems.length) {
|
||||||
this.activeItem = 0;
|
this.activeItem = 0;
|
||||||
|
Reference in New Issue
Block a user