guard clause

This commit is contained in:
James Campos 2011-05-07 20:55:30 -07:00
parent 6287bdc4dd
commit 6292a9dfea
2 changed files with 11 additions and 7 deletions

View File

@ -1702,7 +1702,7 @@
if (html = g.cache[threadID]) {
quotePreview.get(id, threadID, html);
} else {
qp.innerHTML = 'Loading...';
qp.innerHTML = "Loading " + id + "...";
$.get(this.href, (function() {
html = this.responseText;
g.cache[threadID] = html;
@ -1714,7 +1714,11 @@
return ui.el = qp;
},
get: function(id, threadID, innerHTML) {
var body, html, reply, _i, _len, _ref;
var body, html, qp, reply, _i, _len, _ref;
qp = $('#qp');
if (qp.innerHTML !== ("Loading " + id + "...")) {
return;
}
body = $.el('body', {
innerHTML: innerHTML
});
@ -1730,7 +1734,7 @@
}
}
}
return ui.el.innerHTML = html;
return qp.innerHTML = html;
}
};
quickReport = {

View File

@ -1358,7 +1358,7 @@ quotePreview =
if html = g.cache[threadID]
quotePreview.get id, threadID, html
else
qp.innerHTML = 'Loading...'
qp.innerHTML = "Loading #{id}..."
$.get @href, (->
html = @responseText
g.cache[threadID] = html
@ -1367,8 +1367,9 @@ quotePreview =
$.show qp
ui.el = qp
get: (id, threadID, innerHTML) ->
qp = $ '#qp'
return unless qp.innerHTML is "Loading #{id}..."
body = $.el 'body', {innerHTML}
if id == threadID #OP
html = $('blockquote', body).innerHTML
else
@ -1376,8 +1377,7 @@ quotePreview =
if reply.id == id
html = reply.innerHTML
break
ui.el.innerHTML = html
qp.innerHTML = html
quickReport =
init: ->