|
|
|
@@ -90,7 +90,7 @@ Module.register("newsfeed",{
|
|
|
|
|
|
|
|
|
|
if (this.config.feedUrl) {
|
|
|
|
|
wrapper.className = "small bright";
|
|
|
|
|
wrapper.innerHTML = "The configuration options for the newsfeed module have changed.<br>Please check the documentation.";
|
|
|
|
|
wrapper.innerHTML = this.translate("configuration_changed");
|
|
|
|
|
return wrapper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -123,21 +123,21 @@ Module.register("newsfeed",{
|
|
|
|
|
|
|
|
|
|
//Remove selected tags from the beginning of rss feed items (title or description)
|
|
|
|
|
|
|
|
|
|
if (this.config.removeStartTags == "title" || this.config.removeStartTags == "both") {
|
|
|
|
|
if (this.config.removeStartTags === "title" || this.config.removeStartTags === "both") {
|
|
|
|
|
|
|
|
|
|
for (f=0; f<this.config.startTags.length;f++) {
|
|
|
|
|
if (this.newsItems[this.activeItem].title.slice(0,this.config.startTags[f].length) == this.config.startTags[f]) {
|
|
|
|
|
if (this.newsItems[this.activeItem].title.slice(0,this.config.startTags[f].length) === this.config.startTags[f]) {
|
|
|
|
|
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].title.slice(this.config.startTags[f].length,this.newsItems[this.activeItem].title.length);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.config.removeStartTags == "description" || this.config.removeStartTags == "both") {
|
|
|
|
|
if (this.config.removeStartTags === "description" || this.config.removeStartTags === "both") {
|
|
|
|
|
|
|
|
|
|
if (this.isShowingDescription) {
|
|
|
|
|
for (f=0; f<this.config.startTags.length;f++) {
|
|
|
|
|
if (this.newsItems[this.activeItem].description.slice(0,this.config.startTags[f].length) == this.config.startTags[f]) {
|
|
|
|
|
if (this.newsItems[this.activeItem].description.slice(0,this.config.startTags[f].length) === this.config.startTags[f]) {
|
|
|
|
|
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].description.slice(this.config.startTags[f].length,this.newsItems[this.activeItem].description.length);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -149,14 +149,14 @@ Module.register("newsfeed",{
|
|
|
|
|
|
|
|
|
|
if (this.config.removeEndTags) {
|
|
|
|
|
for (f=0; f<this.config.endTags.length;f++) {
|
|
|
|
|
if (this.newsItems[this.activeItem].title.slice(-this.config.endTags[f].length)==this.config.endTags[f]) {
|
|
|
|
|
if (this.newsItems[this.activeItem].title.slice(-this.config.endTags[f].length)===this.config.endTags[f]) {
|
|
|
|
|
this.newsItems[this.activeItem].title = this.newsItems[this.activeItem].title.slice(0,-this.config.endTags[f].length);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.isShowingDescription) {
|
|
|
|
|
for (f=0; f<this.config.endTags.length;f++) {
|
|
|
|
|
if (this.newsItems[this.activeItem].description.slice(-this.config.endTags[f].length)==this.config.endTags[f]) {
|
|
|
|
|
if (this.newsItems[this.activeItem].description.slice(-this.config.endTags[f].length)===this.config.endTags[f]) {
|
|
|
|
|
this.newsItems[this.activeItem].description = this.newsItems[this.activeItem].description.slice(0,-this.config.endTags[f].length);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -338,7 +338,7 @@ Module.register("newsfeed",{
|
|
|
|
|
|
|
|
|
|
notificationReceived: function(notification, payload, sender) {
|
|
|
|
|
Log.info(this.name + " - received notification: " + notification);
|
|
|
|
|
if(notification == "ARTICLE_NEXT"){
|
|
|
|
|
if(notification === "ARTICLE_NEXT"){
|
|
|
|
|
var before = this.activeItem;
|
|
|
|
|
this.activeItem++;
|
|
|
|
|
if (this.activeItem >= this.newsItems.length) {
|
|
|
|
@@ -347,7 +347,7 @@ Module.register("newsfeed",{
|
|
|
|
|
this.resetDescrOrFullArticleAndTimer();
|
|
|
|
|
Log.info(this.name + " - going from article #" + before + " to #" + this.activeItem + " (of " + this.newsItems.length + ")");
|
|
|
|
|
this.updateDom(100);
|
|
|
|
|
} else if(notification == "ARTICLE_PREVIOUS"){
|
|
|
|
|
} else if(notification === "ARTICLE_PREVIOUS"){
|
|
|
|
|
var before = this.activeItem;
|
|
|
|
|
this.activeItem--;
|
|
|
|
|
if (this.activeItem < 0) {
|
|
|
|
@@ -358,9 +358,9 @@ Module.register("newsfeed",{
|
|
|
|
|
this.updateDom(100);
|
|
|
|
|
}
|
|
|
|
|
// if "more details" is received the first time: show article summary, on second time show full article
|
|
|
|
|
else if(notification == "ARTICLE_MORE_DETAILS"){
|
|
|
|
|
else if(notification === "ARTICLE_MORE_DETAILS"){
|
|
|
|
|
// full article is already showing, so scrolling down
|
|
|
|
|
if(this.config.showFullArticle == true){
|
|
|
|
|
if(this.config.showFullArticle === true){
|
|
|
|
|
this.scrollPosition += this.config.scrollLength;
|
|
|
|
|
window.scrollTo(0, this.scrollPosition);
|
|
|
|
|
Log.info(this.name + " - scrolling down");
|
|
|
|
@@ -369,18 +369,18 @@ Module.register("newsfeed",{
|
|
|
|
|
else {
|
|
|
|
|
this.showFullArticle();
|
|
|
|
|
}
|
|
|
|
|
} else if(notification == "ARTICLE_SCROLL_UP"){
|
|
|
|
|
if(this.config.showFullArticle == true){
|
|
|
|
|
} else if(notification === "ARTICLE_SCROLL_UP"){
|
|
|
|
|
if(this.config.showFullArticle === true){
|
|
|
|
|
this.scrollPosition -= this.config.scrollLength;
|
|
|
|
|
window.scrollTo(0, this.scrollPosition);
|
|
|
|
|
Log.info(this.name + " - scrolling up");
|
|
|
|
|
Log.info(this.name + " - ARTICLE_SCROLL_UP, scroll position: " + this.config.scrollLength);
|
|
|
|
|
}
|
|
|
|
|
} else if(notification == "ARTICLE_LESS_DETAILS"){
|
|
|
|
|
} else if(notification === "ARTICLE_LESS_DETAILS"){
|
|
|
|
|
this.resetDescrOrFullArticleAndTimer();
|
|
|
|
|
Log.info(this.name + " - showing only article titles again");
|
|
|
|
|
this.updateDom(100);
|
|
|
|
|
} else if (notification == "ARTICLE_TOGGLE_FULL"){
|
|
|
|
|
} else if (notification === "ARTICLE_TOGGLE_FULL"){
|
|
|
|
|
if (this.config.showFullArticle){
|
|
|
|
|
this.activeItem++;
|
|
|
|
|
this.resetDescrOrFullArticleAndTimer();
|
|
|
|
@@ -396,7 +396,7 @@ Module.register("newsfeed",{
|
|
|
|
|
this.isShowingDescription = !this.isShowingDescription;
|
|
|
|
|
this.config.showFullArticle = !this.isShowingDescription;
|
|
|
|
|
// 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].style.top = "-90px";
|
|
|
|
|
}
|
|
|
|
|