From 15fe54bdcab0d321effbf629848d1a237336fa78 Mon Sep 17 00:00:00 2001 From: niphlod Date: Tue, 14 Oct 2014 23:42:41 +0200 Subject: [PATCH] refactor main_hook to a function --- applications/admin/static/js/web2py.js | 20 +++++++++++--------- applications/examples/static/js/web2py.js | 20 +++++++++++--------- applications/welcome/static/js/web2py.js | 20 +++++++++++--------- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/applications/admin/static/js/web2py.js b/applications/admin/static/js/web2py.js index ffb6baa8..79d41094 100644 --- a/applications/admin/static/js/web2py.js +++ b/applications/admin/static/js/web2py.js @@ -684,19 +684,21 @@ } }); $.web2py.component_handler(target); + }, + main_hook : function() { + var flash = $('.flash'); + flash.hide(); + if(flash.html()) web2py.flash(flash.html()); + web2py.ajax_init(document); + web2py.event_handlers(); + web2py.a_handlers(); + web2py.form_handlers(); } } - /*end of functions */ /*main hook*/ - $(function() { - var flash = $('.flash'); - flash.hide(); - if(flash.html()) web2py.flash(flash.html()); - web2py.ajax_init(document); - web2py.event_handlers(); - web2py.a_handlers(); - web2py.form_handlers(); + $(function () { + web2py.main_hook(); }); })(jQuery); diff --git a/applications/examples/static/js/web2py.js b/applications/examples/static/js/web2py.js index ffb6baa8..79d41094 100644 --- a/applications/examples/static/js/web2py.js +++ b/applications/examples/static/js/web2py.js @@ -684,19 +684,21 @@ } }); $.web2py.component_handler(target); + }, + main_hook : function() { + var flash = $('.flash'); + flash.hide(); + if(flash.html()) web2py.flash(flash.html()); + web2py.ajax_init(document); + web2py.event_handlers(); + web2py.a_handlers(); + web2py.form_handlers(); } } - /*end of functions */ /*main hook*/ - $(function() { - var flash = $('.flash'); - flash.hide(); - if(flash.html()) web2py.flash(flash.html()); - web2py.ajax_init(document); - web2py.event_handlers(); - web2py.a_handlers(); - web2py.form_handlers(); + $(function () { + web2py.main_hook(); }); })(jQuery); diff --git a/applications/welcome/static/js/web2py.js b/applications/welcome/static/js/web2py.js index ffb6baa8..79d41094 100644 --- a/applications/welcome/static/js/web2py.js +++ b/applications/welcome/static/js/web2py.js @@ -684,19 +684,21 @@ } }); $.web2py.component_handler(target); + }, + main_hook : function() { + var flash = $('.flash'); + flash.hide(); + if(flash.html()) web2py.flash(flash.html()); + web2py.ajax_init(document); + web2py.event_handlers(); + web2py.a_handlers(); + web2py.form_handlers(); } } - /*end of functions */ /*main hook*/ - $(function() { - var flash = $('.flash'); - flash.hide(); - if(flash.html()) web2py.flash(flash.html()); - web2py.ajax_init(document); - web2py.event_handlers(); - web2py.a_handlers(); - web2py.form_handlers(); + $(function () { + web2py.main_hook(); }); })(jQuery);