Sha256: c6e3a36be3555c720f49ad74295f9f6a32a2a40109c432c0c06ba52af058be3d
Contents?: true
Size: 1.65 KB
Versions: 9
Compression:
Stored size: 1.65 KB
Contents
// = require ./progressFixed // = require_self $(() => { const $projects = $("#projects, #project"); const $budgetSummaryTotal = $(".budget-summary__total"); const $budgetExceedModal = $("#budget-excess"); const $budgetSummary = $(".budget-summary__progressbox"); const totalBudget = parseInt($budgetSummaryTotal.attr("data-total-budget"), 10); const cancelEvent = (event) => { event.stopPropagation(); event.preventDefault(); }; $projects.on("click", ".budget-list__action", (event) => { const currentBudget = parseInt($budgetSummary.attr("data-current-budget"), 10); const $currentTarget = $(event.currentTarget); const projectBudget = parseInt($currentTarget.attr("data-budget"), 10); if ($currentTarget.attr("disabled")) { cancelEvent(event); } else if (($currentTarget.attr("data-add") === "true") && ((currentBudget + projectBudget) > totalBudget)) { $budgetExceedModal.foundation("toggle"); cancelEvent(event); } }); if ($("#order-progress [data-toggle=budget-confirm]").length > 0) { const safeUrl = $(".budget-summary").attr("data-safe-url").split("?")[0]; $(document).on("click", "a", (event) => { window.exitUrl = event.currentTarget.href; }); $(document).on("submit", "form", (event) => { window.exitUrl = event.currentTarget.action; }); window.onbeforeunload = () => { const currentBudget = parseInt($budgetSummary.attr("data-current-budget"), 10); const exitUrl = window.exitUrl; window.exitUrl = null; if (currentBudget === 0 || (exitUrl && exitUrl.startsWith(safeUrl))) { return null; } return ""; } } });
Version data entries
9 entries across 9 versions & 1 rubygems