diff --git a/kallithea/public/js/base.js b/kallithea/public/js/base.js --- a/kallithea/public/js/base.js +++ b/kallithea/public/js/base.js @@ -384,8 +384,8 @@ function ypjax(url,container,s_call,args $container.html(o.responseText); $container.css('opacity','1.0'); //execute the given original callback - if (s_call !== undefined){ - s_call(o); + if (s_call !== undefined && s_call){ + s_call(); } } })() diff --git a/kallithea/templates/admin/settings/settings_system.html b/kallithea/templates/admin/settings/settings_system.html --- a/kallithea/templates/admin/settings/settings_system.html +++ b/kallithea/templates/admin/settings/settings_system.html @@ -38,6 +38,6 @@ $('#check_for_update').click(function(e){ $('#update_notice').show(); ypjax("${h.url('admin_settings_system_update')}", - "update_notice", function(){}); + "update_notice"); }) diff --git a/kallithea/templates/files/files.html b/kallithea/templates/files/files.html --- a/kallithea/templates/files/files.html +++ b/kallithea/templates/files/files.html @@ -199,6 +199,7 @@ var callbacks = function(State){ $(document).ready(function(){ ypjax_links(); var container = 'files_data'; + var $files_data = $('#files_data'); //Bind to StateChange Event History.Adapter.bind(window,'statechange',function(){ var State = History.getState(); @@ -215,15 +216,11 @@ $(document).ready(function(){ callbacks(State); } else{ - ypjax(State.url,container,function(o){ - //callbacks after ypjax call - callbacks(State); - if (o !== undefined){ - //store our request in cache - var _expire_on = new Date().getTime()+CACHE_EXPIRE; - CACHE[cache_key] = [_expire_on, o.responseText]; - } - }); + ypjax(State.url, container, function(){ + callbacks(State); + var expire_on = new Date().getTime() + CACHE_EXPIRE; + CACHE[cache_key] = [expire_on, $files_data.html()]; + }); } });