look for subject in (auto)watch
This commit is contained in:
parent
b40b19d2b2
commit
3c12aee02d
18
4chan_x.js
18
4chan_x.js
@ -1532,7 +1532,7 @@
|
|||||||
favicon = $('img.favicon', thread);
|
favicon = $('img.favicon', thread);
|
||||||
id = favicon.nextSibling.name;
|
id = favicon.nextSibling.name;
|
||||||
if (favicon.src === g.favEmpty) {
|
if (favicon.src === g.favEmpty) {
|
||||||
return watcher.watch(id, favicon);
|
return watcher.watch(id, favicon, thread);
|
||||||
} else {
|
} else {
|
||||||
return watcher.unwatch(g.BOARD, id);
|
return watcher.unwatch(g.BOARD, id);
|
||||||
}
|
}
|
||||||
@ -1550,11 +1550,12 @@
|
|||||||
delete watched[board][id];
|
delete watched[board][id];
|
||||||
return $.setValue('watched', watched);
|
return $.setValue('watched', watched);
|
||||||
},
|
},
|
||||||
watch: function(id, favicon) {
|
watch: function(id, favicon, thread) {
|
||||||
var props, watched, _name;
|
var props, tc, watched, _name;
|
||||||
favicon.src = g.favDefault;
|
favicon.src = g.favDefault;
|
||||||
|
tc = $('span.filetitle', thread).textContent || $('blockquote', thread).textContent;
|
||||||
props = {
|
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
|
href: "/" + g.BOARD + "/res/" + id
|
||||||
};
|
};
|
||||||
watched = $.getValue('watched', {});
|
watched = $.getValue('watched', {});
|
||||||
@ -1985,10 +1986,11 @@
|
|||||||
thumb.className = '';
|
thumb.className = '';
|
||||||
return $.remove(thumb.nextSibling);
|
return $.remove(thumb.nextSibling);
|
||||||
};
|
};
|
||||||
autoWatch = function() {
|
autoWatch = function(e) {
|
||||||
var autoText;
|
var form, tc;
|
||||||
autoText = $('textarea', this).value.slice(0, 25);
|
form = e.target;
|
||||||
return GM_setValue('autoText', "/" + g.BOARD + "/ - " + autoText);
|
tc = $('input[name=sub]', form).value || $('textarea', form).value;
|
||||||
|
return GM_setValue('autoText', "/" + g.BOARD + "/ - " + tc.slice(0, 25));
|
||||||
};
|
};
|
||||||
NAMESPACE = 'AEOS.4chan_x.';
|
NAMESPACE = 'AEOS.4chan_x.';
|
||||||
g = {
|
g = {
|
||||||
|
|||||||
@ -1208,7 +1208,7 @@ watcher =
|
|||||||
favicon = $ 'img.favicon', thread
|
favicon = $ 'img.favicon', thread
|
||||||
id = favicon.nextSibling.name
|
id = favicon.nextSibling.name
|
||||||
if favicon.src == g.favEmpty
|
if favicon.src == g.favEmpty
|
||||||
watcher.watch id, favicon
|
watcher.watch id, favicon, thread
|
||||||
else # favicon.src == g.favDefault
|
else # favicon.src == g.favDefault
|
||||||
watcher.unwatch g.BOARD, id
|
watcher.unwatch g.BOARD, id
|
||||||
|
|
||||||
@ -1225,12 +1225,11 @@ watcher =
|
|||||||
delete watched[board][id]
|
delete watched[board][id]
|
||||||
$.setValue 'watched', watched
|
$.setValue 'watched', watched
|
||||||
|
|
||||||
watch: (id, favicon) ->
|
watch: (id, favicon, thread) ->
|
||||||
favicon.src = g.favDefault
|
favicon.src = g.favDefault
|
||||||
|
tc = $('span.filetitle', thread).textContent or $('blockquote', thread).textContent
|
||||||
props =
|
props =
|
||||||
textContent: "/#{g.BOARD}/ - " +
|
textContent: "/#{g.BOARD}/ - #{tc[...25]}"
|
||||||
$.x('following-sibling::blockquote', favicon)
|
|
||||||
.textContent.slice(0,25)
|
|
||||||
href: "/#{g.BOARD}/res/#{id}"
|
href: "/#{g.BOARD}/res/#{id}"
|
||||||
|
|
||||||
watched = $.getValue 'watched', {}
|
watched = $.getValue 'watched', {}
|
||||||
@ -1519,10 +1518,10 @@ imageThumb = (thumb) ->
|
|||||||
thumb.className = ''
|
thumb.className = ''
|
||||||
$.remove thumb.nextSibling
|
$.remove thumb.nextSibling
|
||||||
|
|
||||||
autoWatch = ->
|
autoWatch = (e) ->
|
||||||
#TODO look for subject
|
form = e.target
|
||||||
autoText = $('textarea', this).value.slice(0, 25)
|
tc = $('input[name=sub]', form).value or $('textarea', form).value
|
||||||
GM_setValue('autoText', "/#{g.BOARD}/ - #{autoText}")
|
GM_setValue('autoText', "/#{g.BOARD}/ - #{tc[...25]}")
|
||||||
|
|
||||||
# /TODO ***************************************************************
|
# /TODO ***************************************************************
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user