auto watch
This commit is contained in:
parent
a5c49f95be
commit
0ad8064e72
34
4chan_x.js
34
4chan_x.js
@ -59,7 +59,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, NAMESPACE, anonymize, autoWatch, callback, config, d, el, expandComment, expandThread, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, nav, navtopr, nodeInserted, options, pathname, qr, quickReport, recaptcha, redirect, replyHiding, sauce, temp, threadHiding, titlePost, tzOffset, ui, unread, updater, watcher, _config, _i, _j, _len, _len2, _ref, _ref2, _ref3;
|
var $, $$, NAMESPACE, anonymize, callback, config, d, el, expandComment, expandThread, g, imageHover, imgExpand, imgGif, imgPreloading, keybinds, localize, log, nav, navtopr, nodeInserted, options, pathname, qr, quickReport, recaptcha, redirect, replyHiding, sauce, temp, threadHiding, titlePost, tzOffset, ui, unread, updater, watcher, _config, _i, _j, _len, _len2, _ref, _ref2, _ref3;
|
||||||
var __slice = Array.prototype.slice;
|
var __slice = Array.prototype.slice;
|
||||||
if (typeof console != "undefined" && console !== null) {
|
if (typeof console != "undefined" && console !== null) {
|
||||||
log = function(arg) {
|
log = function(arg) {
|
||||||
@ -1146,23 +1146,17 @@
|
|||||||
return qr.autohide.set();
|
return qr.autohide.set();
|
||||||
},
|
},
|
||||||
sys: function() {
|
sys: function() {
|
||||||
var board, html, id, recaptcha, thread, _, _base, _ref, _ref2;
|
var board, html, id, recaptcha, thread, _, _ref, _ref2;
|
||||||
$.bind(window, 'message', qr.cb.messageIframe);
|
|
||||||
if (recaptcha = $('#recaptcha_response_field')) {
|
if (recaptcha = $('#recaptcha_response_field')) {
|
||||||
$.bind(recaptcha, 'keydown', recaptcha.listener);
|
$.bind(recaptcha, 'keydown', recaptcha.listener);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if ($.config('Auto Watch')) {
|
$.bind(window, 'message', qr.cb.messageIframe);
|
||||||
html = $('b').innerHTML;
|
html = $('b').innerHTML;
|
||||||
_ref = html.match(/<!-- thread:(\d+),no:(\d+) -->/), _ = _ref[0], thread = _ref[1], id = _ref[2];
|
_ref = html.match(/<!-- thread:(\d+),no:(\d+) -->/), _ = _ref[0], thread = _ref[1], id = _ref[2];
|
||||||
if (thread === '0') {
|
if (thread === '0') {
|
||||||
_ref2 = $('meta', d).content.match(/4chan.org\/(\w+)\//), _ = _ref2[0], board = _ref2[1];
|
_ref2 = $('meta', d).content.match(/4chan.org\/(\w+)\//), _ = _ref2[0], board = _ref2[1];
|
||||||
(_base = g.watched)[board] || (_base[board] = []);
|
return window.location = "http://boards.4chan.org/" + board + "/res/" + thread + "#watch";
|
||||||
g.watched[board].push({
|
|
||||||
id: id,
|
|
||||||
text: GM_getValue('autoText')
|
|
||||||
});
|
|
||||||
return GM_setValue('watched', JSON.stringify(g.watched));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1985,12 +1979,6 @@
|
|||||||
return $.prepend(delform, controls);
|
return $.prepend(delform, controls);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
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.';
|
NAMESPACE = 'AEOS.4chan_x.';
|
||||||
g = {
|
g = {
|
||||||
cache: {},
|
cache: {},
|
||||||
@ -2211,8 +2199,8 @@
|
|||||||
if ($.config('Thread Navigation')) {
|
if ($.config('Thread Navigation')) {
|
||||||
nav.init();
|
nav.init();
|
||||||
}
|
}
|
||||||
if ($.config('Auto Watch')) {
|
if ($.config('Auto Watch') && location.hash === '#watch') {
|
||||||
$.bind($('form[name=post]'), 'submit', autoWatch);
|
watcher.watch();
|
||||||
}
|
}
|
||||||
if ($.config('Thread Expansion')) {
|
if ($.config('Thread Expansion')) {
|
||||||
expandThread.init();
|
expandThread.init();
|
||||||
|
|||||||
@ -880,21 +880,17 @@ qr =
|
|||||||
qr.autohide.set()
|
qr.autohide.set()
|
||||||
|
|
||||||
sys: ->
|
sys: ->
|
||||||
$.bind window, 'message', qr.cb.messageIframe
|
if recaptcha = $ '#recaptcha_response_field' #post reporting
|
||||||
if recaptcha = $ '#recaptcha_response_field'
|
|
||||||
# post reporting
|
|
||||||
$.bind recaptcha, 'keydown', recaptcha.listener
|
$.bind recaptcha, 'keydown', recaptcha.listener
|
||||||
if $.config 'Auto Watch'
|
return
|
||||||
html = $('b').innerHTML
|
|
||||||
[_, thread, id] = html.match(/<!-- thread:(\d+),no:(\d+) -->/)
|
$.bind window, 'message', qr.cb.messageIframe
|
||||||
if thread is '0'
|
|
||||||
[_, board] = $('meta', d).content.match(/4chan.org\/(\w+)\//)
|
html = $('b').innerHTML
|
||||||
g.watched[board] or= []
|
[_, thread, id] = html.match(/<!-- thread:(\d+),no:(\d+) -->/)
|
||||||
g.watched[board].push {
|
if thread is '0'
|
||||||
id: id,
|
[_, board] = $('meta', d).content.match(/4chan.org\/(\w+)\//)
|
||||||
text: GM_getValue 'autoText'
|
window.location = "http://boards.4chan.org/#{board}/res/#{thread}#watch"
|
||||||
}
|
|
||||||
GM_setValue 'watched', JSON.stringify g.watched
|
|
||||||
|
|
||||||
threadHiding =
|
threadHiding =
|
||||||
init: ->
|
init: ->
|
||||||
@ -1508,16 +1504,6 @@ imgExpand =
|
|||||||
delform = $ 'form[name=delform]'
|
delform = $ 'form[name=delform]'
|
||||||
$.prepend delform, controls
|
$.prepend delform, controls
|
||||||
|
|
||||||
|
|
||||||
# TODO rewrite these **************************************************************************
|
|
||||||
|
|
||||||
autoWatch = (e) ->
|
|
||||||
form = e.target
|
|
||||||
tc = $('input[name=sub]', form).value or $('textarea', form).value
|
|
||||||
GM_setValue('autoText', "/#{g.BOARD}/ - #{tc[...25]}")
|
|
||||||
|
|
||||||
# /TODO ***************************************************************
|
|
||||||
|
|
||||||
#main
|
#main
|
||||||
NAMESPACE = 'AEOS.4chan_x.'
|
NAMESPACE = 'AEOS.4chan_x.'
|
||||||
g =
|
g =
|
||||||
@ -1743,8 +1729,8 @@ else #not reply
|
|||||||
if $.config 'Thread Navigation'
|
if $.config 'Thread Navigation'
|
||||||
nav.init()
|
nav.init()
|
||||||
|
|
||||||
if $.config 'Auto Watch'
|
if $.config('Auto Watch') and location.hash is '#watch'
|
||||||
$.bind $('form[name=post]'), 'submit', autoWatch
|
watcher.watch()
|
||||||
|
|
||||||
if $.config 'Thread Expansion'
|
if $.config 'Thread Expansion'
|
||||||
expandThread.init()
|
expandThread.init()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user