# HG changeset patch # User Mads Kiilerich # Date 1410176336 -7200 # Node ID 8b394bbd551c9890e0d74c28b32fd8101f874228 # Parent a40994692ddbd7e49e89be76b0e4dce26d8077d9 javascript: ypjax callback is optional and do not have any parameters In files, read cache value from DOM. diff -r a40994692ddb -r 8b394bbd551c kallithea/public/js/base.js --- a/kallithea/public/js/base.js Mon Sep 08 13:38:56 2014 +0200 +++ b/kallithea/public/js/base.js Mon Sep 08 13:38:56 2014 +0200 @@ -384,8 +384,8 @@ $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 -r a40994692ddb -r 8b394bbd551c kallithea/templates/admin/settings/settings_system.html --- a/kallithea/templates/admin/settings/settings_system.html Mon Sep 08 13:38:56 2014 +0200 +++ b/kallithea/templates/admin/settings/settings_system.html Mon Sep 08 13:38:56 2014 +0200 @@ -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 -r a40994692ddb -r 8b394bbd551c kallithea/templates/files/files.html --- a/kallithea/templates/files/files.html Mon Sep 08 13:38:56 2014 +0200 +++ b/kallithea/templates/files/files.html Mon Sep 08 13:38:56 2014 +0200 @@ -199,6 +199,7 @@ $(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 @@ 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()]; + }); } });