Moving newsfeed styling from js to a new css file

This commit is contained in:
buxxi
2021-01-16 11:52:55 +01:00
parent 132c98b767
commit 8538d83520
2 changed files with 22 additions and 13 deletions

View File

@@ -0,0 +1,14 @@
iframe.newsfeed-fullarticle {
width: 100vw;
/* very large height value to allow scrolling */
height: 3000px;
top: 0;
left: 0;
border: none;
z-index: 1;
}
.region.bottom.bar.newsfeed-fullarticle {
bottom: inherit;
top: -90px;
}

View File

@@ -44,6 +44,11 @@ Module.register("newsfeed", {
return ["moment.js"]; return ["moment.js"];
}, },
//Define required styles.
getStyles: function () {
return ["newsfeed.css"];
},
// Define required translations. // Define required translations.
getTranslations: function () { getTranslations: function () {
// The translations for the default modules are defined in the core translation files. // The translations for the default modules are defined in the core translation files.
@@ -135,16 +140,8 @@ Module.register("newsfeed", {
if (this.config.showFullArticle) { if (this.config.showFullArticle) {
const fullArticle = document.createElement("iframe"); const fullArticle = document.createElement("iframe");
fullArticle.className = ""; fullArticle.className = "newsfeed-fullarticle";
fullArticle.style.width = "100vw";
// very large height value to allow scrolling
fullArticle.height = "3000";
fullArticle.style.height = "3000";
fullArticle.style.top = "0";
fullArticle.style.left = "0";
fullArticle.style.border = "none";
fullArticle.src = this.getActiveItemURL(); fullArticle.src = this.getActiveItemURL();
fullArticle.style.zIndex = 1;
wrapper.appendChild(fullArticle); wrapper.appendChild(fullArticle);
} }
@@ -335,8 +332,7 @@ Module.register("newsfeed", {
this.config.showFullArticle = false; this.config.showFullArticle = false;
this.scrollPosition = 0; this.scrollPosition = 0;
// reset bottom bar alignment // reset bottom bar alignment
document.getElementsByClassName("region bottom bar")[0].style.bottom = "0"; document.getElementsByClassName("region bottom bar")[0].classList.remove("newsfeed-fullarticle");
document.getElementsByClassName("region bottom bar")[0].style.top = "inherit";
if (!this.timer) { if (!this.timer) {
this.scheduleUpdateInterval(); this.scheduleUpdateInterval();
} }
@@ -406,8 +402,7 @@ Module.register("newsfeed", {
this.config.showFullArticle = !this.isShowingDescription; this.config.showFullArticle = !this.isShowingDescription;
// make bottom bar align to top to allow scrolling // make bottom bar align to top to allow scrolling
if (this.config.showFullArticle === true) { if (this.config.showFullArticle === true) {
document.getElementsByClassName("region bottom bar")[0].style.bottom = "inherit"; document.getElementsByClassName("region bottom bar")[0].classList.add("newsfeed-fullarticle");
document.getElementsByClassName("region bottom bar")[0].style.top = "-90px";
} }
clearInterval(this.timer); clearInterval(this.timer);
this.timer = null; this.timer = null;