{:uriI"file:///Library/WebServer/Documents/work/fine/_fae/app/assets/javascripts/fae/form/_cancel.js?type=application/javascript&pipeline=self&id=32308cec1f48f67281fbb3d41f4b7655624b7cd9d299a84f6c5d27090d3bcbcc:ET:load_pathI"G/Library/WebServer/Documents/work/fine/_fae/app/assets/javascripts;F: filenameI"[/Library/WebServer/Documents/work/fine/_fae/app/assets/javascripts/fae/form/_cancel.js;T: nameI"fae/form/_cancel;T:logical_pathI"fae/form/_cancel.self.js;T:content_typeI"application/javascript;T: sourceI"/* global Fae */ /** * Fae form cancel * @namespace form.cancel * @memberof form */ Fae.form.cancel = { init: function() { this.detectCancelledUrls(); this.addCancelParam(); }, /** * If URL has cancelled param, update the history */ detectCancelledUrls: function() { var params = window.location.search; if (params.length && params.toLowerCase().indexOf("cancelled") >= 0 && params.indexOf("&") !== 0) { window.history.replaceState(null, null, window.location.pathname); }; }, /** * Once any field changes, add cancelled param to button to ensure user knows data will be lost */ addCancelParam: function() { function updateCancel() { var $cancel_btn = $('#js-header-cancel'); var new_href = $cancel_btn.attr('href') + '?cancelled=true'; $cancel_btn.attr('href', new_href); $('form').off('change', 'input, textarea, select', updateCancel); } $('form').on('change', 'input, textarea, select', updateCancel); } }; ;T: metadata{ :dependencieso:Set: @hash{ I"environment-version;TTI"environment-paths;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"ifile-digest:///Library/WebServer/Documents/work/fine/_fae/app/assets/javascripts/fae/form/_cancel.js;TT: requiredo;;{: stubbedo;;{: linkso;;{: charsetI" utf-8;F: digest"%%'\kmp?']7sWk: lengthi:integrityI"Xni:///sha-256;ihglj_6QJwFcpRbF_-T4tGttcH8_0yddqzfoc1dr77c?ct=application/javascript;T:dependencies_digest"%3+<'n 6)2Dơv .`3:idI"E32308cec1f48f67281fbb3d41f4b7655624b7cd9d299a84f6c5d27090d3bcbcc;F: mtimel+BlRW