fix return values of $.ajax, $.cache
This commit is contained in:
parent
f124deb82f
commit
ade9191eed
@ -61,7 +61,8 @@ $.ajax = do ->
|
|||||||
r.open type, url, true
|
r.open type, url, true
|
||||||
catch err
|
catch err
|
||||||
blockedError url
|
blockedError url
|
||||||
return options.onerror?()
|
options.onerror?()
|
||||||
|
return
|
||||||
if whenModified
|
if whenModified
|
||||||
r.setRequestHeader 'If-Modified-Since', lastModified[url] if url of lastModified
|
r.setRequestHeader 'If-Modified-Since', lastModified[url] if url of lastModified
|
||||||
$.on r, 'load', -> lastModified[url] = r.getResponseHeader 'Last-Modified'
|
$.on r, 'load', -> lastModified[url] = r.getResponseHeader 'Last-Modified'
|
||||||
@ -77,13 +78,13 @@ do ->
|
|||||||
$.cache = (url, cb, options) ->
|
$.cache = (url, cb, options) ->
|
||||||
if req = reqs[url]
|
if req = reqs[url]
|
||||||
if req.readyState is 4
|
if req.readyState is 4
|
||||||
cb.call req, req.evt
|
$.queueTask -> cb.call req, req.evt
|
||||||
else
|
else
|
||||||
req.callbacks.push cb
|
req.callbacks.push cb
|
||||||
return
|
return req
|
||||||
rm = -> delete reqs[url]
|
rm = -> delete reqs[url]
|
||||||
try
|
try
|
||||||
req = $.ajax url, options
|
return unless req = $.ajax url, options
|
||||||
catch err
|
catch err
|
||||||
return
|
return
|
||||||
$.on req, 'load', (e) ->
|
$.on req, 'load', (e) ->
|
||||||
|
|||||||
@ -171,11 +171,8 @@ Linkify =
|
|||||||
title: (data) ->
|
title: (data) ->
|
||||||
[key, uid, options, link, post] = data
|
[key, uid, options, link, post] = data
|
||||||
return unless service = Linkify.types[key].title
|
return unless service = Linkify.types[key].title
|
||||||
try
|
unless $.cache service.api(uid), (-> Linkify.cb.title @, data), {responseType: 'json'}
|
||||||
$.cache service.api(uid), (-> Linkify.cb.title @, data), responseType: 'json'
|
|
||||||
catch err
|
|
||||||
$.extend link, <%= html('[${key}] <span class="warning">Title Link Blocked</span> (are you using NoScript?)</a>') %>
|
$.extend link, <%= html('[${key}] <span class="warning">Title Link Blocked</span> (are you using NoScript?)</a>') %>
|
||||||
return
|
|
||||||
|
|
||||||
cb:
|
cb:
|
||||||
toggle: (e) ->
|
toggle: (e) ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user