From 34453cff321a28b0e682b47c1d557eae87658c3b Mon Sep 17 00:00:00 2001 From: jeena Date: Sun, 25 Aug 2013 16:34:49 +0200 Subject: [PATCH] added info bubble --- css/screen.css | 21 +++++++++++++++++++++ index.html | 5 ++++- js/App.js | 37 +++++++++++++++++++++++++++++++++++++ js/Login.js | 10 +++++++--- manifest.webapp | 2 +- 5 files changed, 70 insertions(+), 5 deletions(-) diff --git a/css/screen.css b/css/screen.css index 1ed0155..0ebb201 100644 --- a/css/screen.css +++ b/css/screen.css @@ -63,6 +63,10 @@ label { display: none; } +.hidden { + display: none; +} + section { display: none; } @@ -197,6 +201,23 @@ canvas { text-decoration: underline; } +.info { + border: 3px solid black; + background: white; + border-radius: 10px; + box-shadow: 0 0 5px black; + color: black; + padding: 0 1em; +} + +.info.swipe { + width: 60%; + position: absolute; + top: 50%; + left: 15%; + margin: auto; +} + #settings ul { list-style-type: none; padding-left: 0; diff --git a/index.html b/index.html index 2b8258f..92d169e 100644 --- a/index.html +++ b/index.html @@ -74,7 +74,7 @@
Back - Set unread + Set unread
@@ -84,6 +84,9 @@

+
+

Swipe with your finger right and left to navigate to next and previous article.

+
diff --git a/js/App.js b/js/App.js index 8ef3509..ec9c28f 100644 --- a/js/App.js +++ b/js/App.js @@ -35,8 +35,29 @@ function App() { _this.showFull(_this.unread_articles[i]); } else if(url == "#unread") { _this.setCurrentUnread(); + } else if(url == "#logout") { + _this.logout(); + } else if(url == "#reset-info") { + alert("Info bubbles will be shown again.") + $$(".info").forEach(function(o) { + o.removeClass("hidden"); + }); } + + // this is here so you can tap on a button more then once + // and it will still call onhashchange + window.location.hash = "#"; } + + $(".info.swipe").ontouchend = function(e) { + localStorage.info_swipe = true; + $(".info.swipe").addClass("hidden"); + }; + + if(localStorage.info_swipe) { + $(".info.swipe").addClass("hidden"); + } + }; App.prototype.authenticate = function() { @@ -50,6 +71,13 @@ App.prototype.after_login = function() { this.reload(); }; +App.prototype.logout = function() { + this.ttrss.logOut(); + this.unread_articles = []; + this.populateList(); + this.login.log_out(); +}; + App.prototype.changeToPage = function(page) { // FIXME @@ -195,6 +223,13 @@ App.prototype.showFull = function(article, slide_back) { $(page_id + " .author").innerHTML = "– " + article.author; $(page_id + " .article").innerHTML = article.content; + + if(article.set_unread) { + $("#setunread").innerHTML = "✔ unread"; + } else { + $("#setunread").innerHTML = "Set unread"; + } + }; App.prototype.showNext = function() { @@ -238,6 +273,8 @@ App.prototype.setCurrentUnread = function() { this.updateList(); var _this = this; setTimeout(function() { _this.ttrss.setArticleUnread(article.id); }, 100); + + $("#setunread").innerHTML = "✔ unread"; }; App.prototype.goToList = function() { diff --git a/js/Login.js b/js/Login.js index fe92782..27f67b1 100644 --- a/js/Login.js +++ b/js/Login.js @@ -53,6 +53,10 @@ Login.prototype.authenticate = function(e) { localStorage.server_url = server_url; localStorage.session_id = data.session_id; _this.app.after_login(); + + $("#url").value = ""; + $("#un").value = ""; + $("#pw").value = ""; } }); @@ -60,8 +64,8 @@ Login.prototype.authenticate = function(e) { }; Login.prototype.log_out = function() { - localStorage.server_url = null; - localStorage.session_id = null; - localStorage.unread_articles = null; + localStorage.removeItem("server_url"); + localStorage.removeItem("session_id"); + localStorage.removeItem("unread_articles"); this.log_in(); } \ No newline at end of file diff --git a/manifest.webapp b/manifest.webapp index e0a6b94..afd10fe 100644 --- a/manifest.webapp +++ b/manifest.webapp @@ -19,5 +19,5 @@ } }, "installs_allowed_from": ["*"], - "version": "0.1" + "version": "0.2" } \ No newline at end of file