Changeset - 8b394bbd551c
[Not reviewed]
default
0 3 0
Mads Kiilerich - 11 years ago 2014-09-08 13:38:56
madski@unity3d.com
javascript: ypjax callback is optional and do not have any parameters

In files, read cache value from DOM.
3 files changed with 9 insertions and 12 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/base.js
Show inline comments
 
@@ -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();
 
            }
 
        }
 
    })()
kallithea/templates/admin/settings/settings_system.html
Show inline comments
 
@@ -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");
 
    })
 
</script>
kallithea/templates/files/files.html
Show inline comments
 
@@ -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()];
 
                });
 
        }
 
    });
 

	
0 comments (0 inline, 0 general)