Let the default responseType in $.ajax always be "json" regardless of URL.

This commit is contained in:
ccd0 2019-03-08 20:45:37 -08:00
parent 4801013380
commit a94d76d84b
3 changed files with 2 additions and 3 deletions

View File

@ -77,7 +77,6 @@ Report =
for [name, url] in urls
do (name, url) ->
$.ajax url,
responseType: 'json'
onloadend: ->
results.push [name, @response or {error: ''}]
if results.length is urls.length

View File

@ -52,7 +52,7 @@ $.ajax = do ->
(url, options={}, extra={}) ->
{type, whenModified, bypassCache, upCallbacks, form} = extra
options.responseType ?= 'json' if /\.json$/.test url
options.responseType ?= 'json'
# XXX https://forums.lanik.us/viewtopic.php?f=64&t=24173&p=78310
url = url.replace /^((?:https?:)?\/\/(?:\w+\.)?4c(?:ha|d)n\.org)\/adv\//, '$1//adv/'
if whenModified

View File

@ -90,7 +90,7 @@ CrossOrigin =
unless GM?.xmlHttpRequest? or GM_xmlhttpRequest?
if bypassCache
$.cleanCache (url2) -> url2 is url
if (req = $.cache url, cb, responseType: 'json')
if (req = $.cache url, cb)
$.on req, 'abort error', -> cb.call({})
else
cb.call {}