Sha256: 43fb15ad1a00d6d613a311c86953ea57c1bb77149c87cd75e46dffbb896ae4cb
Contents?: true
Size: 801 Bytes
Versions: 6
Compression:
Stored size: 801 Bytes
Contents
$(() => { const $form = $("form.awesome-edit-config"); if ($form.length > 0) { $form.find("input, textarea, select").on("change", () => { $form.data("changed", true); }); const safePath = $form.data("safe-path").split("?")[0]; $(document).on("click", "a", (event) => { window.exitUrl = event.currentTarget.href; }); $(document).on("submit", "form", (event) => { window.exitUrl = event.currentTarget.action; }); window.addEventListener("beforeunload", (event) => { const exitUrl = window.exitUrl; const hasChanged = $form.data("changed"); window.exitUrl = null; if (!hasChanged || (exitUrl && exitUrl.includes(safePath))) { return null; } event.returnValue = true; return true; }); } });
Version data entries
6 entries across 6 versions & 1 rubygems