Fix longstanding bug where aborting a thread expension would just not work; fix abortion of cached
requests. Blame @aeosynth. Also replace Xs with × while I'm at it.
This commit is contained in:
parent
f1742941e6
commit
7f3620948e
@ -362,7 +362,7 @@
|
||||
}
|
||||
} else {
|
||||
req = $.ajax(url, {
|
||||
onload: (function() {
|
||||
onload: function() {
|
||||
var cb, _i, _len, _ref, _results;
|
||||
_ref = this.callbacks;
|
||||
_results = [];
|
||||
@ -371,7 +371,10 @@
|
||||
_results.push(cb.call(this));
|
||||
}
|
||||
return _results;
|
||||
})
|
||||
},
|
||||
onabort: function() {
|
||||
return delete $.cache.requests[url];
|
||||
}
|
||||
});
|
||||
req.callbacks = [cb];
|
||||
return $.cache.requests[url] = req;
|
||||
@ -811,13 +814,13 @@
|
||||
switch (a.textContent[0]) {
|
||||
case '+':
|
||||
if ((_ref = $('.op .container', thread)) != null) _ref.textContent = '';
|
||||
a.textContent = a.textContent.replace('+', 'X Loading...');
|
||||
a.textContent = a.textContent.replace('+', '\u00d7 Loading...');
|
||||
return $.cache(pathname, (function() {
|
||||
return expandThread.parse(this, pathname, thread, a);
|
||||
}));
|
||||
case 'X':
|
||||
a.textContent = a.textContent.replace('X Loading...', '+');
|
||||
return $.cache[pathname].abort();
|
||||
case '\u00d7':
|
||||
a.textContent = a.textContent.replace('\u00d7 Loading...', '+');
|
||||
return $.cache.requests[pathname].abort();
|
||||
case '-':
|
||||
a.textContent = a.textContent.replace('-', '+');
|
||||
num = (function() {
|
||||
@ -855,7 +858,7 @@
|
||||
$.off(a, 'click', expandThread.cb.toggle);
|
||||
return;
|
||||
}
|
||||
a.textContent = a.textContent.replace('X Loading...', '-');
|
||||
a.textContent = a.textContent.replace('\u00d7 Loading...', '-');
|
||||
body = $.el('body', {
|
||||
innerHTML: req.responseText
|
||||
});
|
||||
|
||||
@ -297,7 +297,9 @@ $.extend $,
|
||||
else
|
||||
req.callbacks.push cb
|
||||
else
|
||||
req = $.ajax url, onload: (-> cb.call @ for cb in @callbacks)
|
||||
req = $.ajax url,
|
||||
onload: -> cb.call @ for cb in @callbacks
|
||||
onabort: -> delete $.cache.requests[url]
|
||||
req.callbacks = [cb]
|
||||
$.cache.requests[url] = req
|
||||
cb:
|
||||
@ -681,16 +683,17 @@ expandThread =
|
||||
pathname = "/#{g.BOARD}/res/#{threadID}"
|
||||
a = $ '.omittedposts', thread
|
||||
|
||||
# \u00d7 is ×
|
||||
|
||||
switch a.textContent[0]
|
||||
when '+'
|
||||
$('.op .container', thread)?.textContent = ''
|
||||
a.textContent = a.textContent.replace '+', 'X Loading...'
|
||||
a.textContent = a.textContent.replace '+', '\u00d7 Loading...'
|
||||
$.cache pathname, (-> expandThread.parse @, pathname, thread, a)
|
||||
|
||||
when 'X'
|
||||
a.textContent = a.textContent.replace 'X Loading...', '+'
|
||||
#FIXME this will kill all callbacks
|
||||
$.cache[pathname].abort()
|
||||
when '\u00d7'
|
||||
a.textContent = a.textContent.replace '\u00d7 Loading...', '+'
|
||||
$.cache.requests[pathname].abort()
|
||||
|
||||
when '-'
|
||||
a.textContent = a.textContent.replace '-', '+'
|
||||
@ -712,7 +715,7 @@ expandThread =
|
||||
$.off a, 'click', expandThread.cb.toggle
|
||||
return
|
||||
|
||||
a.textContent = a.textContent.replace 'X Loading...', '-'
|
||||
a.textContent = a.textContent.replace '\u00d7 Loading...', '-'
|
||||
|
||||
body = $.el 'body',
|
||||
innerHTML: req.responseText
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user