Sha256: 2a64572dae8d247a2478b8a3e688b9e75e55a8351dc45e32f9a20725a119566f
Contents?: true
Size: 1.11 KB
Versions: 24
Compression:
Stored size: 1.11 KB
Contents
FORGE.features.forms = { init: function () { var self = FORGE.features.forms; self.setupRadioSliders(); self.protectChanges(); }, protectChanges: function () { var self = FORGE.features.forms; self.changesMade = false; $('input, select, textarea').bind('keyup change', function() { if ($(this).attr('id') != "quick-search") { self.changesMade = true; } }); // don't run the check if the user is submitting a form of course $(document).on('submit', 'form', function() { window.onbeforeunload = null; }); window.onbeforeunload = self.confirmNavigation; }, confirmNavigation: function () { var self = FORGE.features.forms; if (typeof CKEDITOR != 'undefined') { for ( instance in CKEDITOR.instances ) if(CKEDITOR.instances[instance].checkDirty()) { self.changesMade = true} } if (self.changesMade) { return "You have unsaved changes, are you sure you want to leave this page?"; } }, setupRadioSliders: function () { $('.radio-slider').radioSlider({sliderImage: '<%= asset_path'forge/slider-button.png' %>'}); } }
Version data entries
24 entries across 24 versions & 1 rubygems