Let the default responseType in $.ajax always be "json" regardless of URL.
This commit is contained in:
parent
4801013380
commit
a94d76d84b
@ -77,7 +77,6 @@ Report =
|
|||||||
for [name, url] in urls
|
for [name, url] in urls
|
||||||
do (name, url) ->
|
do (name, url) ->
|
||||||
$.ajax url,
|
$.ajax url,
|
||||||
responseType: 'json'
|
|
||||||
onloadend: ->
|
onloadend: ->
|
||||||
results.push [name, @response or {error: ''}]
|
results.push [name, @response or {error: ''}]
|
||||||
if results.length is urls.length
|
if results.length is urls.length
|
||||||
|
|||||||
@ -52,7 +52,7 @@ $.ajax = do ->
|
|||||||
|
|
||||||
(url, options={}, extra={}) ->
|
(url, options={}, extra={}) ->
|
||||||
{type, whenModified, bypassCache, upCallbacks, form} = 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
|
# 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/'
|
url = url.replace /^((?:https?:)?\/\/(?:\w+\.)?4c(?:ha|d)n\.org)\/adv\//, '$1//adv/'
|
||||||
if whenModified
|
if whenModified
|
||||||
|
|||||||
@ -90,7 +90,7 @@ CrossOrigin =
|
|||||||
unless GM?.xmlHttpRequest? or GM_xmlhttpRequest?
|
unless GM?.xmlHttpRequest? or GM_xmlhttpRequest?
|
||||||
if bypassCache
|
if bypassCache
|
||||||
$.cleanCache (url2) -> url2 is url
|
$.cleanCache (url2) -> url2 is url
|
||||||
if (req = $.cache url, cb, responseType: 'json')
|
if (req = $.cache url, cb)
|
||||||
$.on req, 'abort error', -> cb.call({})
|
$.on req, 'abort error', -> cb.call({})
|
||||||
else
|
else
|
||||||
cb.call {}
|
cb.call {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user