Make our AJAX requests work in Maxthon. #593

This commit is contained in:
ccd0 2015-11-15 19:56:58 -08:00
parent abb688b0df
commit 8aa780cc33

View File

@ -67,8 +67,14 @@ $.ajax = do ->
r.setRequestHeader 'If-Modified-Since', lastModified[whenModified][url] if lastModified[whenModified]?[url]?
$.on r, 'load', -> (lastModified[whenModified] or= {})[url] = r.getResponseHeader 'Last-Modified'
if /\.json$/.test url
r.responseType = 'json'
options.responseType ?= 'json'
$.extend r, options
# XXX https://code.google.com/p/chromium/issues/detail?id=119256 (Maxthon is still on Chromium 30)
if options.responseType is 'json' and r.responseType isnt 'json' and delete r.response
Object.defineProperty r, 'response',
configurable: true
enumerable: true
get: -> return JSON.parse r.responseText
$.extend r.upload, upCallbacks
r.send form
r