cache, op
This commit is contained in:
parent
1f08f803dd
commit
fe0bbb842f
45
4chan_x.js
45
4chan_x.js
@ -1689,14 +1689,23 @@
|
|||||||
return _results;
|
return _results;
|
||||||
},
|
},
|
||||||
mouseover: function(e) {
|
mouseover: function(e) {
|
||||||
var el, id, qp;
|
var el, html, id, qp, threadID;
|
||||||
id = this.textContent.replace(">>", '');
|
id = this.textContent.replace(">>", '');
|
||||||
qp = $('#qp');
|
qp = $('#qp');
|
||||||
if (el = d.getElementById(id)) {
|
if (el = d.getElementById(id)) {
|
||||||
qp.innerHTML = el.innerHTML;
|
qp.innerHTML = el.innerHTML;
|
||||||
} else {
|
} else {
|
||||||
qp.innerHTML = 'Loading...';
|
threadID = this.pathname.split('/').pop();
|
||||||
quotePreview.get(this, id);
|
if (html = g.cache[threadID]) {
|
||||||
|
quotePreview.get(id, threadID, html);
|
||||||
|
} else {
|
||||||
|
qp.innerHTML = 'Loading...';
|
||||||
|
$.get(this.href, (function() {
|
||||||
|
html = this.responseText;
|
||||||
|
g.cache[threadID] = html;
|
||||||
|
return quotePreview.get(id, threadID, html);
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$.show(qp);
|
$.show(qp);
|
||||||
return ui.el = qp;
|
return ui.el = qp;
|
||||||
@ -1704,26 +1713,24 @@
|
|||||||
mouseout: function(e) {
|
mouseout: function(e) {
|
||||||
return $.hide(ui.el);
|
return $.hide(ui.el);
|
||||||
},
|
},
|
||||||
get: function(link, id) {
|
get: function(id, threadID, innerHTML) {
|
||||||
return $.get(link.href, (function() {
|
var body, html, reply, _i, _len, _ref;
|
||||||
return quotePreview.get2(link, id, this);
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
get2: function(link, id, xhr) {
|
|
||||||
var body, reply, _i, _len, _ref, _results;
|
|
||||||
body = $.el('body', {
|
body = $.el('body', {
|
||||||
innerHTML: xhr.responseText
|
innerHTML: innerHTML
|
||||||
});
|
});
|
||||||
_ref = $$('td.reply', body);
|
if (id === threadID) {
|
||||||
_results = [];
|
html = $('blockquote', body).innerHTML;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
} else {
|
||||||
reply = _ref[_i];
|
_ref = $$('td.reply', body);
|
||||||
if (reply.id === id) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
ui.el.innerHTML = reply.innerHTML;
|
reply = _ref[_i];
|
||||||
break;
|
if (reply.id === id) {
|
||||||
|
html = reply.innerHTML;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _results;
|
return ui.el.innerHTML = html;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
quickReport = {
|
quickReport = {
|
||||||
|
|||||||
@ -1352,22 +1352,32 @@ quotePreview =
|
|||||||
if el = d.getElementById id
|
if el = d.getElementById id
|
||||||
qp.innerHTML = el.innerHTML
|
qp.innerHTML = el.innerHTML
|
||||||
else
|
else
|
||||||
qp.innerHTML = 'Loading...'
|
threadID = @pathname.split('/').pop()
|
||||||
quotePreview.get this, id
|
if html = g.cache[threadID]
|
||||||
|
quotePreview.get id, threadID, html
|
||||||
|
else
|
||||||
|
qp.innerHTML = 'Loading...'
|
||||||
|
$.get @href, (->
|
||||||
|
html = @responseText
|
||||||
|
g.cache[threadID] = html
|
||||||
|
quotePreview.get id, threadID, html
|
||||||
|
)
|
||||||
$.show qp
|
$.show qp
|
||||||
ui.el = qp
|
ui.el = qp
|
||||||
mouseout: (e) ->
|
mouseout: (e) ->
|
||||||
$.hide ui.el
|
$.hide ui.el
|
||||||
get: (link, id) ->
|
get: (id, threadID, innerHTML) ->
|
||||||
$.get link.href, (-> quotePreview.get2 link, id, this)
|
body = $.el 'body', {innerHTML}
|
||||||
get2: (link, id, xhr) ->
|
|
||||||
body = $.el 'body',
|
|
||||||
innerHTML: xhr.responseText
|
|
||||||
|
|
||||||
for reply in $$ 'td.reply', body
|
if id == threadID #OP
|
||||||
if reply.id == id
|
html = $('blockquote', body).innerHTML
|
||||||
ui.el.innerHTML = reply.innerHTML
|
else
|
||||||
break
|
for reply in $$ 'td.reply', body
|
||||||
|
if reply.id == id
|
||||||
|
html = reply.innerHTML
|
||||||
|
break
|
||||||
|
|
||||||
|
ui.el.innerHTML = html
|
||||||
|
|
||||||
quickReport =
|
quickReport =
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user