Only need progress event for upload monitoring.
This commit is contained in:
parent
4af0e0b962
commit
5bd4a2859e
@ -722,16 +722,15 @@ QR =
|
||||
extra =
|
||||
form: $.formData formData
|
||||
if Conf['Show Upload Progress']
|
||||
extra.upCallbacks =
|
||||
onload: ->
|
||||
extra.onprogress = (e) ->
|
||||
if e.loaded < e.total
|
||||
# Uploading...
|
||||
QR.req.progress = "#{Math.round e.loaded / e.total * 100}%"
|
||||
else
|
||||
# Upload done, waiting for server response.
|
||||
QR.req.isUploadFinished = true
|
||||
QR.req.progress = '...'
|
||||
QR.status()
|
||||
onprogress: (e) ->
|
||||
# Uploading...
|
||||
QR.req.progress = "#{Math.round e.loaded / e.total * 100}%"
|
||||
QR.status()
|
||||
QR.status()
|
||||
|
||||
cb = (response) ->
|
||||
if response?
|
||||
|
||||
@ -47,7 +47,7 @@ $.ajax = do ->
|
||||
pageXHR = XMLHttpRequest
|
||||
|
||||
(url, options={}, extra={}) ->
|
||||
{type, upCallbacks, form, headers} = extra
|
||||
{type, onprogress, form, headers} = extra
|
||||
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/'
|
||||
@ -58,7 +58,7 @@ $.ajax = do ->
|
||||
for key, value of (headers or {})
|
||||
r.setRequestHeader key, value
|
||||
$.extend r, options
|
||||
$.extend r.upload, upCallbacks
|
||||
$.extend r.upload, {onprogress}
|
||||
# connection error or content blocker
|
||||
$.on r, 'error', -> (c.warn "4chan X failed to load: #{url}" unless r.status)
|
||||
<% if (type === 'crx') { %>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user