Sha256: 59ff0a0ac85cf24166f3c0f871b377b9d49399d8fae5bc7b14b58e7ce03bd322
Contents?: true
Size: 801 Bytes
Versions: 7
Compression:
Stored size: 801 Bytes
Contents
// = require_self $(() => { 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; }); } });
Version data entries
7 entries across 7 versions & 1 rubygems