hide publish button for nono TTRSS
This commit is contained in:
parent
d1c7059751
commit
3e4be0fe29
3 changed files with 45 additions and 54 deletions
|
@ -83,7 +83,7 @@ label {
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
display: none;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
section {
|
section {
|
||||||
|
@ -125,7 +125,6 @@ section > header h1 {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.invisible { display: none; }
|
|
||||||
.inactive { opacity: 0.4; }
|
.inactive { opacity: 0.4; }
|
||||||
|
|
||||||
.settings, .list {
|
.settings, .list {
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
<section id="full">
|
<section id="full">
|
||||||
<header class="bar">
|
<header class="bar">
|
||||||
<a class="button icon list" href="#list"></a>
|
<a class="button icon list" href="#list"></a>
|
||||||
<a id="setpublished" class="button icon inactive invisible" href="#published"></a>
|
<a id="setpublished" class="button icon inactive hidden" href="#published"></a>
|
||||||
<a id="setstarred" class="button icon inactive" href="#starred">★</a>
|
<a id="setstarred" class="button icon inactive" href="#starred">★</a>
|
||||||
<a id="setunread" class="button icon inactive" href="#unread">✓</a>
|
<a id="setunread" class="button icon inactive" href="#unread">✓</a>
|
||||||
<canvas width="40" height="40"></canvas>
|
<canvas width="40" height="40"></canvas>
|
||||||
|
|
88
js/App.js
88
js/App.js
|
@ -33,7 +33,7 @@ App.prototype.after_login = function(backend) {
|
||||||
|
|
||||||
// do not reload page
|
// do not reload page
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
var url = window.location.hash;
|
var url = window.location.hash;
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ App.prototype.after_login = function(backend) {
|
||||||
this.backend = new Pond(this, localStorage.server_url, localStorage.session_id)
|
this.backend = new Pond(this, localStorage.server_url, localStorage.session_id)
|
||||||
} else {
|
} else {
|
||||||
this.backend = new TinyTinyRSS(this, localStorage.server_url, localStorage.session_id);
|
this.backend = new TinyTinyRSS(this, localStorage.server_url, localStorage.session_id);
|
||||||
$("#setpublished").removeClass("invisible");
|
$("#setpublished").removeClass("hidden");
|
||||||
}
|
}
|
||||||
|
|
||||||
var numArticles = localStorage.numArticles;
|
var numArticles = localStorage.numArticles;
|
||||||
|
@ -167,44 +167,42 @@ App.prototype.gotUnreadFeeds = function(new_articles) {
|
||||||
|
|
||||||
if(new_articles == null || !this.validate(new_articles)) {
|
if(new_articles == null || !this.validate(new_articles)) {
|
||||||
|
|
||||||
// Check if we did not get a NOT_LOGGED_IN error, and ask the
|
// Check if we did not get a NOT_LOGGED_IN error, and ask the
|
||||||
// user to login again if it is the case.
|
// user to login again if it is the case.
|
||||||
// This can happen with TT-RSS backend
|
// This can happen with TT-RSS backend
|
||||||
if (new_articles.error && new_articles.error === "NOT_LOGGED_IN") {
|
if (new_articles.error && new_articles.error === "NOT_LOGGED_IN") {
|
||||||
alert("Your TinyTinyRSS session has expired. Please login again");
|
alert("Your TinyTinyRSS session has expired. Please login again");
|
||||||
this.login.fillLoginFormFromLocalStorage();
|
this.login.fillLoginFormFromLocalStorage();
|
||||||
this.login.log_in();
|
this.login.log_in();
|
||||||
}
|
} else {
|
||||||
else {
|
// On other errors, load the saved unread articles.
|
||||||
// On other errors, load the saved unread articles.
|
var old_articles = localStorage.unread_articles;
|
||||||
var old_articles = localStorage.unread_articles;
|
if(old_articles) {
|
||||||
if(old_articles) {
|
this.unread_articles = JSON.parse(old_articles);
|
||||||
this.unread_articles = JSON.parse(old_articles);
|
}
|
||||||
}
|
this.populateList();
|
||||||
this.populateList();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.unread_articles = this.unread_articles.concat(new_articles);
|
this.unread_articles = this.unread_articles.concat(new_articles);
|
||||||
|
|
||||||
if(new_articles.length > 0) {
|
if(new_articles.length > 0) {
|
||||||
try {
|
try {
|
||||||
//To check if when it fails it is the same
|
//To check if when it fails it is the same
|
||||||
localStorage.unread_articles = JSON.stringify(this.unread_articles);
|
localStorage.unread_articles = JSON.stringify(this.unread_articles);
|
||||||
var size = parseInt(localStorage.maxDownload);
|
var size = parseInt(localStorage.maxDownload);
|
||||||
if(localStorage.unread_articles.length < size) {
|
if(localStorage.unread_articles.length < size) {
|
||||||
var num = parseInt(localStorage.numArticles);
|
var num = parseInt(localStorage.numArticles);
|
||||||
this.backend.getUnreadFeeds(this.gotUnreadFeeds.bind(this), this.unread_articles,num);
|
this.backend.getUnreadFeeds(this.gotUnreadFeeds.bind(this), this.unread_articles,num);
|
||||||
} else {
|
} else {
|
||||||
alert("Limit size reached: Downloaded: " + this.unread_articles.length + " articles. Reached: " + localStorage.unread_articles.length +" bytes");
|
alert("Limit size reached: Downloaded: " + this.unread_articles.length + " articles. Reached: " + localStorage.unread_articles.length +" bytes");
|
||||||
}
|
}
|
||||||
}
|
} catch (e) {
|
||||||
catch (e) {
|
alert("Reached maximum memory by app " + e.name + " " + e.message + ". We will keep working in anycase with: " + localStorage.unread_articles.length);
|
||||||
alert("Reached maximum memory by app " + e.name + " " + e.message + ". We will keep working in anycase with: " + localStorage.unread_articles.length);
|
}
|
||||||
}
|
this.populateList();
|
||||||
this.populateList();
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -425,7 +423,6 @@ App.prototype.toggleAllRead = function() {
|
||||||
$("#all-read").removeClass('inactive');
|
$("#all-read").removeClass('inactive');
|
||||||
|
|
||||||
this.updateList();
|
this.updateList();
|
||||||
|
|
||||||
this.backend.setArticlesRead(articles);
|
this.backend.setArticlesRead(articles);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -441,7 +438,6 @@ App.prototype.toggleAllRead = function() {
|
||||||
this.updateList();
|
this.updateList();
|
||||||
|
|
||||||
this.backend.setArticlesUnread(articles);
|
this.backend.setArticlesUnread(articles);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -454,8 +450,7 @@ App.prototype.toggleStarred = function() {
|
||||||
this.updateList();
|
this.updateList();
|
||||||
this.backend.setArticleStarred(article);
|
this.backend.setArticleStarred(article);
|
||||||
$("#setstarred").removeClass('inactive');
|
$("#setstarred").removeClass('inactive');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
article.marked = false;
|
article.marked = false;
|
||||||
this.updateList();
|
this.updateList();
|
||||||
this.backend.setArticleUnstarred(article);
|
this.backend.setArticleUnstarred(article);
|
||||||
|
@ -472,8 +467,7 @@ App.prototype.togglePublished = function() {
|
||||||
article.published = true;
|
article.published = true;
|
||||||
this.backend.setArticlePublished(article);
|
this.backend.setArticlePublished(article);
|
||||||
$("#setpublished").removeClass('inactive');
|
$("#setpublished").removeClass('inactive');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
article.published = false;
|
article.published = false;
|
||||||
this.backend.setArticleUnpublished(article);
|
this.backend.setArticleUnpublished(article);
|
||||||
$("#setpublished").addClass('inactive');
|
$("#setpublished").addClass('inactive');
|
||||||
|
@ -518,20 +512,18 @@ App.prototype.fontChange = function(size) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
App.prototype.numArticles= function(askfor) {
|
App.prototype.numArticles = function(askfor) {
|
||||||
if(askfor < 200 && askfor > 0) {
|
if(askfor < 200 && askfor > 0) {
|
||||||
localStorage.numArticles=askfor;
|
localStorage.numArticles=askfor;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
localStorage.numArticles=100;
|
localStorage.numArticles=100;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
App.prototype.maxDownload= function(maxdata) {
|
App.prototype.maxDownload = function(maxdata) {
|
||||||
if(maxdata < 5000000 && maxdata > 100000) {
|
if(maxdata < 5000000 && maxdata > 100000) {
|
||||||
localStorage.maxDownload=maxdata;
|
localStorage.maxDownload=maxdata;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
localStorage.maxDownload=500000;
|
localStorage.maxDownload=500000;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue