Move confirmExit

This commit is contained in:
Pavel Djundik 2019-10-20 17:45:38 +03:00
parent b74cc4387a
commit f76ad57c63
3 changed files with 7 additions and 13 deletions

View File

@ -58,7 +58,6 @@ export default {
clearTimeout(this.dayChangeTimeout);
},
methods: {
isPublic: () => document.body.classList.contains("public"),
msUntilNextDay() {
// Compute how many milliseconds are remaining until the next day starts
const today = new Date();

View File

@ -6,7 +6,6 @@ const socket = require("../socket");
const webpush = require("../webpush");
const sidebar = $("#sidebar");
const storage = require("../localStorage");
const utils = require("../utils");
const constants = require("../constants");
const {vueApp, initChannel} = require("../vue");
@ -54,9 +53,14 @@ socket.on("init", function(data) {
}
vueApp.$nextTick(() => openCorrectChannel(previousActive, data.active));
utils.confirmExit();
vueApp.synchronizeNotifiedState();
if (document.body.classList.contains("public")) {
window.addEventListener(
"beforeunload",
() => "Are you sure you want to navigate away from this page?"
);
}
});
function openCorrectChannel(clientActive, serverActive) {

View File

@ -9,7 +9,6 @@ var serverHash = -1; // eslint-disable-line no-var
module.exports = {
findCurrentNetworkChan,
serverHash,
confirmExit,
scrollIntoViewNicely,
hasRoleInChannel,
move,
@ -42,14 +41,6 @@ function scrollIntoViewNicely(el) {
el.scrollIntoView({block: "center", inline: "nearest"});
}
function confirmExit() {
if ($(document.body).hasClass("public")) {
window.onbeforeunload = function() {
return "Are you sure you want to navigate away from this page?";
};
}
}
function move(array, old_index, new_index) {
if (new_index >= array.length) {
let k = new_index - array.length;