Changeset - 4a57462b5101
[Not reviewed]
default
0 2 0
Takumi IINO - 11 years ago 2014-11-29 08:04:42
trot.thunder@gmail.com
javascripts: jQuery version of ajaxGET
2 files changed with 10 insertions and 19 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/base.js
Show inline comments
 
@@ -379,27 +379,20 @@ function asynchtml(url, $target, success
 
                $target.css('opacity','1.0');
 
            })
 
        ;
 
};
 

	
 
var ajaxGET = function(url,success) {
 
    // Set special header for ajax == HTTP_X_PARTIAL_XHR
 
    YUC.initHeader('X-PARTIAL-XHR',true);
 

	
 
    var sUrl = url;
 
    var callback = {
 
        success: success,
 
        failure: function (o) {
 
            if (o.status != 0) {
 
                alert("Ajax GET error: " + o.statusText);
 
            };
 
        }
 
    };
 

	
 
    var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
 
    return request;
 
    return $.ajax({url: url, headers: {'X-PARTIAL-XHR': '1'}, cache: false})
 
        .done(success)
 
        .fail(function(jqXHR, textStatus, errorThrown) {
 
                if (textStatus == "abort")
 
                    return;
 
                alert("Ajax GET error: " + textStatus);
 
        })
 
        ;
 
};
 

	
 
var ajaxPOST = function(url,postData,success) {
 
    var postData = _toQueryString(postData);
 
    return $.ajax({url: url, data: postData, type: 'POST', headers: {'X-PARTIAL-XHR': '1'}, cache: false})
 
        .done(success)
 
@@ -433,14 +426,13 @@ var show_changeset_tooltip = function(){
 
        var $target = $(e.currentTarget);
 
        var rid = $target.attr('raw_id');
 
        var repo_name = $target.attr('repo_name');
 
        if(rid && !$target.hasClass('tooltip')){
 
            _show_tooltip(e, _TM['loading ...']);
 
            var url = pyroutes.url('changeset_info', {"repo_name": repo_name, "revision": rid});
 
            ajaxGET(url, function(o){
 
                    var json = JSON.parse(o.responseText);
 
            ajaxGET(url, function(json){
 
                    $target.addClass('tooltip')
 
                    _show_tooltip(e, json['message']);
 
                    _activate_tooltip($target);
 
                });
 
        }
 
    });
kallithea/templates/pullrequests/pullrequest.html
Show inline comments
 
@@ -153,15 +153,14 @@ ${self.repo_context_bar('showpullrequest
 
      var repo_name = $('#other_repo').val();
 
      if (pendingajax) {
 
          pendingajax.abort();
 
          pendingajax = undefined;
 
      }
 
      pendingajax = ajaxGET(pyroutes.url('pullrequest_repo_info', {"repo_name": repo_name}),
 
          function(o){
 
          function(data){
 
              pendingajax = undefined;
 
              var data = JSON.parse(o.responseText);
 
              $('#other_repo_desc').html(data.description);
 

	
 
              // replace options of other_ref with the ones for the current other_repo
 
              $other_ref.empty();
 
              for(var i = 0; i < data.refs.length; i++)
 
              {
0 comments (0 inline, 0 general)