login only with pond now
This commit is contained in:
parent
69c5c270ad
commit
5a0950a8ee
6 changed files with 39 additions and 36 deletions
|
@ -165,6 +165,7 @@ canvas {
|
|||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#list p {
|
||||
|
@ -284,10 +285,14 @@ canvas {
|
|||
float: left;
|
||||
}
|
||||
|
||||
#full article header p:nth-child(3) {
|
||||
#full article header p:nth-child(2) {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#full article header p:nth-child(3) {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#full .article {
|
||||
clear: both;
|
||||
padding-top: 1em;
|
||||
|
|
|
@ -64,14 +64,7 @@
|
|||
<p class="smallogo">
|
||||
<img src="img/icon-128.png" alt="Logo, an ape head">
|
||||
</p>
|
||||
<p class="backends">
|
||||
<label class="button"><input type="radio" name="backend" value="TinyTinyRSS" checked="checked" /> Tiny Tiny RSS</label>
|
||||
<label class="button"><input type="radio" name="backend" value="OwnCloud" /> ownCloud News</label>
|
||||
<label class="button"><input type="radio" name="backend" value="Pond" /> Pond</label>
|
||||
</p>
|
||||
<p>
|
||||
<label for="url">URL:</label>
|
||||
<input class="button" type="text" name="url" id="url" value="" placeholder="http://example.com/tt-rss/" />
|
||||
<label for="un">Username:</label>
|
||||
<input class="button" type="text" name="user" id="un" value="" placeholder="username" />
|
||||
<label for="pw">Password:</label>
|
||||
|
|
26
js/App.js
26
js/App.js
|
@ -7,6 +7,16 @@ function App() {
|
|||
if(!color) color = "red";
|
||||
this.setColor(color);
|
||||
this.fontChange();
|
||||
|
||||
var _this = this;
|
||||
|
||||
window.onkeydown = function(e) {
|
||||
if(e.keyCode == 39) {
|
||||
_this.showNext();
|
||||
} else if(e.keyCode == 37) {
|
||||
_this.showPrevious();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
App.prototype.authenticate = function() {
|
||||
|
@ -15,10 +25,13 @@ App.prototype.authenticate = function() {
|
|||
|
||||
App.prototype.after_login = function(backend) {
|
||||
|
||||
/*
|
||||
var request = window.navigator.mozApps.getSelf();
|
||||
request.onsuccess = function() {
|
||||
$("#version").innerHTML = request.result.manifest.version;
|
||||
}
|
||||
if(request.result) {
|
||||
$("#version").innerHTML = request.result.manifest.version;
|
||||
}
|
||||
}*/
|
||||
|
||||
var _this = this;
|
||||
|
||||
|
@ -276,8 +289,8 @@ App.prototype.showFull = function(article, slide_back) {
|
|||
|
||||
$(page_id + " .date").innerHTML = (new Date(parseInt(article.updated, 10) * 1000)).toLocaleString();
|
||||
|
||||
var title = $(page_id + " .title");
|
||||
title.innerHTML = article.title;
|
||||
var title = $(page_id + " .link");
|
||||
title.innerHTML = article.link;
|
||||
title.href = article.link;
|
||||
|
||||
$(page_id + " .feed_title").innerHTML = article.feed_title;
|
||||
|
@ -286,7 +299,10 @@ App.prototype.showFull = function(article, slide_back) {
|
|||
if(article.author && article.author.length > 0)
|
||||
$(page_id + " .author").innerHTML = "– " + article.author;
|
||||
|
||||
$(page_id + " .article").innerHTML = article.content;
|
||||
|
||||
var content = article.content
|
||||
if(content.replace(/^\s+|\s+$/g,'').length == 0) content = article.title;
|
||||
$(page_id + " .article").innerHTML = content.urlify();
|
||||
$$(page_id + " .article a").forEach(function(o, i) {
|
||||
o.target = "_blank";
|
||||
});
|
||||
|
|
20
js/Login.js
20
js/Login.js
|
@ -17,19 +17,6 @@ Login.prototype.is_logged_in = function() {
|
|||
|
||||
Login.prototype.log_in = function() {
|
||||
this.app.changeToPage("#login");
|
||||
$("#login form").backend.forEach(function(o, i) {
|
||||
o.addEventListener("change", function(e) {
|
||||
if(e.target.checked) {
|
||||
if(e.target.value == "OwnCloud") {
|
||||
$("#url").placeholder = "http://example.com/owncloud/";
|
||||
} else if(e.target.value == "Pond") {
|
||||
$("#url").placeholder = "http://example.com/pond/";
|
||||
} else {
|
||||
$("#url").placeholder = "http://example.com/tt-rss/";
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#login form").addEventListener('submit', this.authenticate.bind(this));
|
||||
};
|
||||
|
||||
|
@ -38,11 +25,10 @@ Login.prototype.authenticate = function(e) {
|
|||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
var backend = "TinyTinyRSS";
|
||||
if($("#login form").backend[1].checked) backend = "OwnCloud";
|
||||
else if($("#login form").backend[2].checked) backend = "Pond";
|
||||
var backend = "Pond";
|
||||
|
||||
var server_url = $("#url").value;
|
||||
var server_url = window.location.href.split("#")[0].replace(/\/FeedMonkey\//, '');
|
||||
console.log(server_url)
|
||||
var user = $("#un").value;
|
||||
var password = $("#pw").value;
|
||||
|
||||
|
|
10
js/Pond.js
10
js/Pond.js
|
@ -46,7 +46,7 @@ Pond.prototype.doOperation = function(method, operation, new_options, callback)
|
|||
body = a.join("&");
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest({mozSystem: true});
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function() {
|
||||
if(xhr.readyState == 4) {
|
||||
if(xhr.status == 200) {
|
||||
|
@ -76,7 +76,7 @@ Pond.prototype.reload = function(callback) {
|
|||
|
||||
Pond.prototype.getUnreadFeeds = function(callback, skip) {
|
||||
var options = {
|
||||
status: "all",
|
||||
status: "unread",
|
||||
limit: 100
|
||||
};
|
||||
|
||||
|
@ -134,8 +134,6 @@ Pond.prototype.normalizeArticle = function(article) {
|
|||
|
||||
var timestamp = new Date(article.published_at).getTime() / 1000;
|
||||
|
||||
console.log(article.read)
|
||||
|
||||
return {
|
||||
id: article.id,
|
||||
guid_hash: article.url + article.id,
|
||||
|
@ -195,7 +193,7 @@ Pond.prototype.setArticleUnstarred = function(articles, callback) {
|
|||
}
|
||||
|
||||
Pond.prototype.logOut = function() {
|
||||
this.doOperation("auth/sessions/" + this.session_token );
|
||||
this.doOperation("DELETE", "auth/sessions/" + this.session_token );
|
||||
localStorage.feeds = null;
|
||||
}
|
||||
|
||||
|
@ -209,7 +207,7 @@ Pond.login = function(server_url, user, password, callback) {
|
|||
var password_hash = md5(user + ':' + password)
|
||||
var options = "username=" + user.toLowerCase() + "&" + "password=" + password_hash;
|
||||
|
||||
var xhr = new XMLHttpRequest({mozSystem: true});
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function() {
|
||||
if(xhr.readyState == 4) {
|
||||
if(xhr.status == 201) {
|
||||
|
|
|
@ -63,5 +63,10 @@ String.prototype.capitalize = function() {
|
|||
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||
}
|
||||
|
||||
String.prototype.urlify = function() {
|
||||
var exp = /^\>(\b(http):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
||||
return this.replace(exp,"<a href='$1'>$1</a>");
|
||||
}
|
||||
|
||||
if(!window.app) window.app = new App();
|
||||
|
||||
|
|
Reference in a new issue