miniflux-legacy/assets/js/app.js

40 lines
1.1 KiB
JavaScript
Raw Normal View History

2013-10-15 04:38:07 +02:00
var Miniflux = {};
2013-02-24 20:04:56 +01:00
2013-10-15 04:38:07 +02:00
Miniflux.App = (function() {
2013-10-15 04:38:07 +02: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-15 04:38:07 +02:00
Run: function() {
Miniflux.Event.ListenKeyboardEvents();
Miniflux.Event.ListenMouseEvents();
},
MozillaAuth: function(action) {
navigator.id.watch({
onlogin: function(assertion) {
2013-10-15 04:38:07 +02:00
var xhr = new XMLHttpRequest();
2013-12-23 03:43:29 +01:00
xhr.open("POST", "?action=" + action + "&token=" + assertion, true);
2013-10-15 04:38:07 +02:00
xhr.setRequestHeader("Connection", "close");
2013-02-24 20:04:56 +01:00
2013-10-15 04:38:07 +02:00
xhr.onload = function () {
window.location.href = this.responseText;
};
2013-02-24 20:04:56 +01:00
2013-10-15 04:38:07 +02:00
xhr.send("token=" + assertion);
},
onlogout: function() {}
});
2013-10-15 04:38:07 +02:00
navigator.id.request();
}
2013-04-03 04:49:14 +02:00
}
})();