fix return values of $.ajax, $.cache

This commit is contained in:
ccd0 2014-10-11 21:18:43 -07:00
parent f124deb82f
commit ade9191eed
2 changed files with 6 additions and 8 deletions

View File

@ -61,7 +61,8 @@ $.ajax = do ->
r.open type, url, true
catch err
blockedError url
return options.onerror?()
options.onerror?()
return
if whenModified
r.setRequestHeader 'If-Modified-Since', lastModified[url] if url of lastModified
$.on r, 'load', -> lastModified[url] = r.getResponseHeader 'Last-Modified'
@ -77,13 +78,13 @@ do ->
$.cache = (url, cb, options) ->
if req = reqs[url]
if req.readyState is 4
cb.call req, req.evt
$.queueTask -> cb.call req, req.evt
else
req.callbacks.push cb
return
return req
rm = -> delete reqs[url]
try
req = $.ajax url, options
return unless req = $.ajax url, options
catch err
return
$.on req, 'load', (e) ->

View File

@ -171,11 +171,8 @@ Linkify =
title: (data) ->
[key, uid, options, link, post] = data
return unless service = Linkify.types[key].title
try
$.cache service.api(uid), (-> Linkify.cb.title @, data), responseType: 'json'
catch err
unless $.cache service.api(uid), (-> Linkify.cb.title @, data), {responseType: 'json'}
$.extend link, <%= html('[${key}] <span class="warning">Title Link Blocked</span> (are you using NoScript?)</a>') %>
return
cb:
toggle: (e) ->