look for subject in (auto)watch

This commit is contained in:
James Campos 2011-04-17 12:20:47 -07:00
parent b40b19d2b2
commit 3c12aee02d
2 changed files with 18 additions and 17 deletions

View File

@ -1532,7 +1532,7 @@
favicon = $('img.favicon', thread);
id = favicon.nextSibling.name;
if (favicon.src === g.favEmpty) {
return watcher.watch(id, favicon);
return watcher.watch(id, favicon, thread);
} else {
return watcher.unwatch(g.BOARD, id);
}
@ -1550,11 +1550,12 @@
delete watched[board][id];
return $.setValue('watched', watched);
},
watch: function(id, favicon) {
var props, watched, _name;
watch: function(id, favicon, thread) {
var props, tc, watched, _name;
favicon.src = g.favDefault;
tc = $('span.filetitle', thread).textContent || $('blockquote', thread).textContent;
props = {
textContent: ("/" + g.BOARD + "/ - ") + $.x('following-sibling::blockquote', favicon).textContent.slice(0, 25),
textContent: "/" + g.BOARD + "/ - " + tc.slice(0, 25),
href: "/" + g.BOARD + "/res/" + id
};
watched = $.getValue('watched', {});
@ -1985,10 +1986,11 @@
thumb.className = '';
return $.remove(thumb.nextSibling);
};
autoWatch = function() {
var autoText;
autoText = $('textarea', this).value.slice(0, 25);
return GM_setValue('autoText', "/" + g.BOARD + "/ - " + autoText);
autoWatch = function(e) {
var form, tc;
form = e.target;
tc = $('input[name=sub]', form).value || $('textarea', form).value;
return GM_setValue('autoText', "/" + g.BOARD + "/ - " + tc.slice(0, 25));
};
NAMESPACE = 'AEOS.4chan_x.';
g = {

View File

@ -1208,7 +1208,7 @@ watcher =
favicon = $ 'img.favicon', thread
id = favicon.nextSibling.name
if favicon.src == g.favEmpty
watcher.watch id, favicon
watcher.watch id, favicon, thread
else # favicon.src == g.favDefault
watcher.unwatch g.BOARD, id
@ -1225,12 +1225,11 @@ watcher =
delete watched[board][id]
$.setValue 'watched', watched
watch: (id, favicon) ->
watch: (id, favicon, thread) ->
favicon.src = g.favDefault
tc = $('span.filetitle', thread).textContent or $('blockquote', thread).textContent
props =
textContent: "/#{g.BOARD}/ - " +
$.x('following-sibling::blockquote', favicon)
.textContent.slice(0,25)
textContent: "/#{g.BOARD}/ - #{tc[...25]}"
href: "/#{g.BOARD}/res/#{id}"
watched = $.getValue 'watched', {}
@ -1519,10 +1518,10 @@ imageThumb = (thumb) ->
thumb.className = ''
$.remove thumb.nextSibling
autoWatch = ->
#TODO look for subject
autoText = $('textarea', this).value.slice(0, 25)
GM_setValue('autoText', "/#{g.BOARD}/ - #{autoText}")
autoWatch = (e) ->
form = e.target
tc = $('input[name=sub]', form).value or $('textarea', form).value
GM_setValue('autoText', "/#{g.BOARD}/ - #{tc[...25]}")
# /TODO ***************************************************************