2013-10-14 22:38:07 -04:00
|
|
|
var Miniflux = {};
|
2013-02-24 14:04:56 -05:00
|
|
|
|
2013-10-14 22:38:07 -04:00
|
|
|
Miniflux.App = (function() {
|
2013-09-14 12:10:38 -04:00
|
|
|
|
2013-10-14 22:38:07 -04:00
|
|
|
return {
|
2014-02-22 21:50:54 -05:00
|
|
|
// Blink the refresh icon to avoid to load an image and just for fun
|
|
|
|
BlinkIcon: function() {
|
|
|
|
var icons = document.querySelectorAll(".loading-icon");
|
|
|
|
|
|
|
|
[].forEach.call(icons, function(icon) {
|
|
|
|
icon.classList.toggle("loading-icon-blink");
|
|
|
|
});
|
|
|
|
},
|
2013-10-14 22:38:07 -04:00
|
|
|
Run: function() {
|
|
|
|
Miniflux.Event.ListenKeyboardEvents();
|
|
|
|
Miniflux.Event.ListenMouseEvents();
|
|
|
|
},
|
|
|
|
MozillaAuth: function(action) {
|
|
|
|
navigator.id.watch({
|
|
|
|
onlogin: function(assertion) {
|
2013-09-11 15:00:00 -07:00
|
|
|
|
2013-10-14 22:38:07 -04:00
|
|
|
var xhr = new XMLHttpRequest();
|
2013-12-22 21:43:29 -05:00
|
|
|
xhr.open("POST", "?action=" + action + "&token=" + assertion, true);
|
2013-10-14 22:38:07 -04:00
|
|
|
xhr.setRequestHeader("Connection", "close");
|
2013-02-24 14:04:56 -05:00
|
|
|
|
2013-10-14 22:38:07 -04:00
|
|
|
xhr.onload = function () {
|
|
|
|
window.location.href = this.responseText;
|
|
|
|
};
|
2013-02-24 14:04:56 -05:00
|
|
|
|
2013-10-14 22:38:07 -04:00
|
|
|
xhr.send("token=" + assertion);
|
|
|
|
},
|
|
|
|
onlogout: function() {}
|
|
|
|
});
|
2013-07-28 20:10:07 -04:00
|
|
|
|
2013-10-14 22:38:07 -04:00
|
|
|
navigator.id.request();
|
2013-07-14 13:01:45 -04:00
|
|
|
}
|
2013-04-02 22:49:14 -04:00
|
|
|
}
|
|
|
|
|
2013-07-10 16:44:53 +02:00
|
|
|
})();
|