Don't return watcher.watch() if there's no text.

This commit is contained in:
Nicolas Stepien 2011-08-23 05:16:08 +02:00
parent e19cbc8fc5
commit 026903528a
2 changed files with 15 additions and 12 deletions

View File

@ -1875,18 +1875,19 @@
return watcher.refresh(); return watcher.refresh();
}, },
watch: function(thread, id) { watch: function(thread, id) {
var el, props, watched, _name; var el, watched, _name;
el = $('span.filetitle', thread); el = $('span.filetitle', thread);
props.href = "/" + g.BOARD + "/res/" + id;
if (!el.textContent) { if (!el.textContent) {
el = $('blockquote', thread); el = $('blockquote', thread);
if (!el.textContent) { if (el.textContent) {
return; props.textContent = "/" + g.BOARD + "/ - " + ($.innerText(el).slice(0, 25));
} else {
props.textContent = d.title;
} }
} else {
props.textContent = "/" + g.BOARD + "/ - " + ($.innerText(el).slice(0, 25));
} }
props = {
textContent: "/" + g.BOARD + "/ - " + ($.innerText(el).slice(0, 25)),
href: "/" + g.BOARD + "/res/" + id
};
watched = $.get('watched', {}); watched = $.get('watched', {});
watched[_name = g.BOARD] || (watched[_name] = {}); watched[_name = g.BOARD] || (watched[_name] = {});
watched[g.BOARD][id] = props; watched[g.BOARD][id] = props;

View File

@ -1539,13 +1539,15 @@ watcher =
watch: (thread, id) -> watch: (thread, id) ->
el = $ 'span.filetitle', thread el = $ 'span.filetitle', thread
props.href = "/#{g.BOARD}/res/#{id}"
if not el.textContent if not el.textContent
el = $ 'blockquote', thread el = $ 'blockquote', thread
if not el.textContent if el.textContent
return props.textContent = "/#{g.BOARD}/ - #{$.innerText(el)[...25]}"
props = else
textContent: "/#{g.BOARD}/ - #{$.innerText(el)[...25]}" props.textContent = d.title
href: "/#{g.BOARD}/res/#{id}" else
props.textContent = "/#{g.BOARD}/ - #{$.innerText(el)[...25]}"
watched = $.get 'watched', {} watched = $.get 'watched', {}
watched[g.BOARD] or= {} watched[g.BOARD] or= {}