feathermost/js/main.js
Midgard 0f8559f22a
Mark incoming messages in current channel as read
but only if tab is focused. When tab gets focus, mark channel as read.
2022-06-09 15:25:55 +02:00

33 lines
984 B
JavaScript

"use strict";
byId("server_selection_add").addEventListener("click", e => { e.stopPropagation(); e.preventDefault(); window.location = "#login"; return false; });
byId("login").addEventListener("submit", e => { logIn(); e.stopPropagation(); e.preventDefault(); return false; });
byId("login_no_button").addEventListener("click", e => { e.stopPropagation(); e.preventDefault(); window.location = "#"; return false; });
byId("compose").addEventListener("keydown", e => {
if (checkKeyPress(e)) {
e.stopPropagation(); e.preventDefault();
return false;
}
return true;
});
updateComposeHeight();
checkScrolledToBottom();
populateServerSelectionList();
localstorage_credentials.getServers()
.map(server => server.endpoint)
.forEach(mm_client.getOrCreate);
populateChannelList();
window.hasFocus = true;
window.addEventListener("focus", _ => {
window.hasFocus = true;
pubsub.publish("WINDOW_FOCUSED");
});
window.addEventListener("blur", _ => {
window.hasFocus = false;
});