//———————————————————- //—— JAVASCRIPT HOOK FUNCTIONS FOR GRAVITY FORMS ——- //———————————————————- if ( ! gform ) { document.addEventListener( ‘gform_main_scripts_loaded’, function() { gform.scriptsLoaded = true; } ); window.addEventListener( ‘DOMContentLoaded’, function() { gform.domLoaded = true; } ); var gform = { domLoaded: false, scriptsLoaded: false, initializeOnLoaded: function( fn ) { if ( gform.domLoaded && gform.scriptsLoaded ) { fn(); } else if( ! gform.domLoaded && gform.scriptsLoaded ) { window.addEventListener( ‘DOMContentLoaded’, fn ); } else { document.addEventListener( ‘gform_main_scripts_loaded’, fn ); } }, hooks: { action: {}, filter: {} }, addAction: function( action, callable, priority, tag ) { gform.addHook( ‘action’, action, callable, priority, tag ); }, addFilter: function( action, callable, priority, tag ) { gform.addHook( ‘filter’, action, callable, priority, tag ); }, doAction: function( action ) { gform.doHook( ‘action’, action, arguments ); }, applyFilters: function( action ) { return gform.doHook( ‘filter’, action, arguments ); }, removeAction: function( action, tag ) { gform.removeHook( ‘action’, action, tag ); }, removeFilter: function( action, priority, tag ) { gform.removeHook( ‘filter’, action, priority, tag ); }, addHook: function( hookType, action, callable, priority, tag ) { if ( undefined == gform.hooks[hookType][action] ) { gform.hooks[hookType][action] = []; } var hooks = gform.hooks[hookType][action]; if ( undefined == tag ) { tag = action


To continue...read the full-length post originally published on this site.