40 lines
1.1 KiB
JavaScript
Raw Normal View History

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-10-14 22:38:07 -04:00
return {
// 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-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-10-14 22:38:07 -04:00
navigator.id.request();
}
2013-04-02 22:49:14 -04:00
}
})();