quick report
This commit is contained in:
parent
e7ea8ec816
commit
b78c23684a
173
4chan_x.js
173
4chan_x.js
@ -59,7 +59,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, NAMESPACE, autoWatch, callback, config, d, delform, el, expand, expandComment, expandThread, g, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, keybinds, log, nav, navtopr, nodeInserted, option, options, pathname, qr, recaptcha, recaptchaListener, recaptchaReload, redirect, replyHiding, report, scroll, temp, text, threadHiding, tzOffset, ui, updateFavicon, updateTitle, updater, watcher, _config, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4;
|
var $, $$, NAMESPACE, autoWatch, callback, config, d, delform, el, expand, expandComment, expandThread, g, imageClick, imageExpand, imageExpandClick, imageHover, imageResize, imageThumb, imageToggle, imageType, imageTypeChange, keybinds, log, nav, navtopr, nodeInserted, option, options, pathname, qr, quickReport, recaptcha, recaptchaListener, recaptchaReload, redirect, replyHiding, scroll, temp, text, threadHiding, tzOffset, ui, updateFavicon, updateTitle, updater, watcher, _config, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4;
|
||||||
var __slice = Array.prototype.slice;
|
var __slice = Array.prototype.slice;
|
||||||
if (typeof console != "undefined" && console !== null) {
|
if (typeof console != "undefined" && console !== null) {
|
||||||
log = console.log;
|
log = console.log;
|
||||||
@ -1560,44 +1560,6 @@
|
|||||||
return watcher.addLink(props);
|
return watcher.addLink(props);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
nodeInserted = function(e) {
|
|
||||||
var callback, dialog, target, _i, _len, _ref, _results;
|
|
||||||
target = e.target;
|
|
||||||
if (target.nodeName === 'TABLE') {
|
|
||||||
_ref = g.callbacks;
|
|
||||||
_results = [];
|
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
||||||
callback = _ref[_i];
|
|
||||||
_results.push(callback(target));
|
|
||||||
}
|
|
||||||
return _results;
|
|
||||||
} else if (target.id === 'recaptcha_challenge_field' && (dialog = $('#qr'))) {
|
|
||||||
$('#recaptcha_image img', dialog).src = "http://www.google.com/recaptcha/api/image?c=" + target.value;
|
|
||||||
return $('#recaptcha_challenge_field', dialog).value = target.value;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
scroll = function() {
|
|
||||||
var bottom, height, i, reply, _len, _ref;
|
|
||||||
height = d.body.clientHeight;
|
|
||||||
_ref = g.replies;
|
|
||||||
for (i = 0, _len = _ref.length; i < _len; i++) {
|
|
||||||
reply = _ref[i];
|
|
||||||
bottom = reply.getBoundingClientRect().bottom;
|
|
||||||
if (bottom > height) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g.replies = g.replies.slice(i);
|
|
||||||
return updateTitle();
|
|
||||||
};
|
|
||||||
autoWatch = function() {
|
|
||||||
var autoText;
|
|
||||||
autoText = $('textarea', this).value.slice(0, 25);
|
|
||||||
return GM_setValue('autoText', "/" + g.BOARD + "/ - " + autoText);
|
|
||||||
};
|
|
||||||
imageClick = function(e) {
|
imageClick = function(e) {
|
||||||
if (e.shiftKey || e.altKey || e.ctrlKey) {
|
if (e.shiftKey || e.altKey || e.ctrlKey) {
|
||||||
return;
|
return;
|
||||||
@ -1690,6 +1652,44 @@
|
|||||||
thumb.className = '';
|
thumb.className = '';
|
||||||
return $.remove(thumb.nextSibling);
|
return $.remove(thumb.nextSibling);
|
||||||
};
|
};
|
||||||
|
nodeInserted = function(e) {
|
||||||
|
var callback, dialog, target, _i, _len, _ref, _results;
|
||||||
|
target = e.target;
|
||||||
|
if (target.nodeName === 'TABLE') {
|
||||||
|
_ref = g.callbacks;
|
||||||
|
_results = [];
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
callback = _ref[_i];
|
||||||
|
_results.push(callback(target));
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
} else if (target.id === 'recaptcha_challenge_field' && (dialog = $('#qr'))) {
|
||||||
|
$('#recaptcha_image img', dialog).src = "http://www.google.com/recaptcha/api/image?c=" + target.value;
|
||||||
|
return $('#recaptcha_challenge_field', dialog).value = target.value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
scroll = function() {
|
||||||
|
var bottom, height, i, reply, _len, _ref;
|
||||||
|
height = d.body.clientHeight;
|
||||||
|
_ref = g.replies;
|
||||||
|
for (i = 0, _len = _ref.length; i < _len; i++) {
|
||||||
|
reply = _ref[i];
|
||||||
|
bottom = reply.getBoundingClientRect().bottom;
|
||||||
|
if (bottom > height) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
g.replies = g.replies.slice(i);
|
||||||
|
return updateTitle();
|
||||||
|
};
|
||||||
|
autoWatch = function() {
|
||||||
|
var autoText;
|
||||||
|
autoText = $('textarea', this).value.slice(0, 25);
|
||||||
|
return GM_setValue('autoText', "/" + g.BOARD + "/ - " + autoText);
|
||||||
|
};
|
||||||
recaptchaListener = function(e) {
|
recaptchaListener = function(e) {
|
||||||
if (e.keyCode === 8 && this.value === '') {
|
if (e.keyCode === 8 && this.value === '') {
|
||||||
return recaptchaReload();
|
return recaptchaReload();
|
||||||
@ -1743,12 +1743,39 @@
|
|||||||
}
|
}
|
||||||
return location.href = url;
|
return location.href = url;
|
||||||
};
|
};
|
||||||
report = function() {
|
quickReport = {
|
||||||
var input;
|
init: function() {
|
||||||
input = $.x('preceding-sibling::input[1]', this);
|
return g.callbacks.push(quickReport.cb.node);
|
||||||
input.click();
|
},
|
||||||
$('input[value="Report"]').click();
|
cb: {
|
||||||
return input.click();
|
node: function(root) {
|
||||||
|
var a, arr, el, _i, _len, _results;
|
||||||
|
arr = $$('span[id^=no]', root);
|
||||||
|
_results = [];
|
||||||
|
for (_i = 0, _len = arr.length; _i < _len; _i++) {
|
||||||
|
el = arr[_i];
|
||||||
|
a = $.el('a', {
|
||||||
|
textContent: '[ ! ]'
|
||||||
|
});
|
||||||
|
$.bind(a, 'click', quickReport.cb.report);
|
||||||
|
$.after(el, a);
|
||||||
|
_results.push($.after(el, $.tn(' ')));
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
},
|
||||||
|
report: function(e) {
|
||||||
|
var target;
|
||||||
|
target = e.target;
|
||||||
|
return quickReport.report(target);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
report: function(target) {
|
||||||
|
var input;
|
||||||
|
input = $.x('preceding-sibling::input[1]', target);
|
||||||
|
input.click();
|
||||||
|
$('input[value="Report"]').click();
|
||||||
|
return input.click();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
updateFavicon = function() {
|
updateFavicon = function() {
|
||||||
var clone, favicon, href, len;
|
var clone, favicon, href, len;
|
||||||
@ -1941,6 +1968,23 @@
|
|||||||
recaptcha = $('#recaptcha_response_field');
|
recaptcha = $('#recaptcha_response_field');
|
||||||
$.bind(recaptcha, 'keydown', recaptchaListener);
|
$.bind(recaptcha, 'keydown', recaptchaListener);
|
||||||
$.bind($('form[name=post]'), 'submit', qr.cb.submit);
|
$.bind($('form[name=post]'), 'submit', qr.cb.submit);
|
||||||
|
if ($.config('Anonymize')) {
|
||||||
|
g.callbacks.push(function(root) {
|
||||||
|
var name, names, trip, trips, _i, _j, _len, _len2, _results;
|
||||||
|
names = $$('span.postername, span.commentpostername', root);
|
||||||
|
for (_i = 0, _len = names.length; _i < _len; _i++) {
|
||||||
|
name = names[_i];
|
||||||
|
name.innerHTML = 'Anonymous';
|
||||||
|
}
|
||||||
|
trips = $$('span.postertrip', root);
|
||||||
|
_results = [];
|
||||||
|
for (_j = 0, _len2 = trips.length; _j < _len2; _j++) {
|
||||||
|
trip = trips[_j];
|
||||||
|
_results.push(trip.parentNode.nodeName === 'A' ? $.remove(trip.parentNode) : $.remove(trip));
|
||||||
|
}
|
||||||
|
return _results;
|
||||||
|
});
|
||||||
|
}
|
||||||
if ($.config('Image Expansion')) {
|
if ($.config('Image Expansion')) {
|
||||||
delform = $('form[name=delform]');
|
delform = $('form[name=delform]');
|
||||||
expand = $.el('div', {
|
expand = $.el('div', {
|
||||||
@ -1971,9 +2015,6 @@
|
|||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ($.config('Image Hover')) {
|
|
||||||
imageHover.init();
|
|
||||||
}
|
|
||||||
if ($.config('Image Auto-Gif')) {
|
if ($.config('Image Auto-Gif')) {
|
||||||
g.callbacks.push(function(root) {
|
g.callbacks.push(function(root) {
|
||||||
var src, thumb, thumbs, _i, _len, _results;
|
var src, thumb, thumbs, _i, _len, _results;
|
||||||
@ -2047,6 +2088,9 @@
|
|||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if ($.config('Image Hover')) {
|
||||||
|
imageHover.init();
|
||||||
|
}
|
||||||
if ($.config('Reply Hiding')) {
|
if ($.config('Reply Hiding')) {
|
||||||
replyHiding.init();
|
replyHiding.init();
|
||||||
}
|
}
|
||||||
@ -2054,42 +2098,11 @@
|
|||||||
qr.init();
|
qr.init();
|
||||||
}
|
}
|
||||||
if ($.config('Quick Report')) {
|
if ($.config('Quick Report')) {
|
||||||
g.callbacks.push(function(root) {
|
quickReport.init();
|
||||||
var a, arr, el, _i, _len, _results;
|
|
||||||
arr = $$('span[id^=no]', root);
|
|
||||||
_results = [];
|
|
||||||
for (_i = 0, _len = arr.length; _i < _len; _i++) {
|
|
||||||
el = arr[_i];
|
|
||||||
a = $.el('a', {
|
|
||||||
textContent: '[ ! ]'
|
|
||||||
});
|
|
||||||
$.bind(a, 'click', report);
|
|
||||||
$.after(el, a);
|
|
||||||
_results.push($.after(el, $.tn(' ')));
|
|
||||||
}
|
|
||||||
return _results;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if ($.config('Thread Watcher')) {
|
if ($.config('Thread Watcher')) {
|
||||||
watcher.init();
|
watcher.init();
|
||||||
}
|
}
|
||||||
if ($.config('Anonymize')) {
|
|
||||||
g.callbacks.push(function(root) {
|
|
||||||
var name, names, trip, trips, _i, _j, _len, _len2, _results;
|
|
||||||
names = $$('span.postername, span.commentpostername', root);
|
|
||||||
for (_i = 0, _len = names.length; _i < _len; _i++) {
|
|
||||||
name = names[_i];
|
|
||||||
name.innerHTML = 'Anonymous';
|
|
||||||
}
|
|
||||||
trips = $$('span.postertrip', root);
|
|
||||||
_results = [];
|
|
||||||
for (_j = 0, _len2 = trips.length; _j < _len2; _j++) {
|
|
||||||
trip = trips[_j];
|
|
||||||
_results.push(trip.parentNode.nodeName === 'A' ? $.remove(trip.parentNode) : $.remove(trip));
|
|
||||||
}
|
|
||||||
return _results;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if ($.config('Keybinds')) {
|
if ($.config('Keybinds')) {
|
||||||
keybinds.init();
|
keybinds.init();
|
||||||
}
|
}
|
||||||
|
|||||||
112
script.coffee
112
script.coffee
@ -1238,30 +1238,6 @@ watcher =
|
|||||||
|
|
||||||
# TODO rewrite these **************************************************************************
|
# TODO rewrite these **************************************************************************
|
||||||
|
|
||||||
nodeInserted = (e) ->
|
|
||||||
target = e.target
|
|
||||||
if target.nodeName is 'TABLE'
|
|
||||||
for callback in g.callbacks
|
|
||||||
callback target
|
|
||||||
else if target.id is 'recaptcha_challenge_field' and dialog = $ '#qr'
|
|
||||||
$('#recaptcha_image img', dialog).src = "http://www.google.com/recaptcha/api/image?c=" + target.value
|
|
||||||
$('#recaptcha_challenge_field', dialog).value = target.value
|
|
||||||
|
|
||||||
scroll = ->
|
|
||||||
height = d.body.clientHeight
|
|
||||||
for reply, i in g.replies
|
|
||||||
bottom = reply.getBoundingClientRect().bottom
|
|
||||||
if bottom > height #post is not completely read
|
|
||||||
break
|
|
||||||
if i is 0 then return
|
|
||||||
g.replies = g.replies[i..]
|
|
||||||
updateTitle()
|
|
||||||
|
|
||||||
autoWatch = ->
|
|
||||||
#TODO look for subject
|
|
||||||
autoText = $('textarea', this).value.slice(0, 25)
|
|
||||||
GM_setValue('autoText', "/#{g.BOARD}/ - #{autoText}")
|
|
||||||
|
|
||||||
imageClick = (e) ->
|
imageClick = (e) ->
|
||||||
return if e.shiftKey or e.altKey or e.ctrlKey
|
return if e.shiftKey or e.altKey or e.ctrlKey
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@ -1338,6 +1314,30 @@ imageThumb = (thumb) ->
|
|||||||
thumb.className = ''
|
thumb.className = ''
|
||||||
$.remove thumb.nextSibling
|
$.remove thumb.nextSibling
|
||||||
|
|
||||||
|
nodeInserted = (e) ->
|
||||||
|
target = e.target
|
||||||
|
if target.nodeName is 'TABLE'
|
||||||
|
for callback in g.callbacks
|
||||||
|
callback target
|
||||||
|
else if target.id is 'recaptcha_challenge_field' and dialog = $ '#qr'
|
||||||
|
$('#recaptcha_image img', dialog).src = "http://www.google.com/recaptcha/api/image?c=" + target.value
|
||||||
|
$('#recaptcha_challenge_field', dialog).value = target.value
|
||||||
|
|
||||||
|
scroll = ->
|
||||||
|
height = d.body.clientHeight
|
||||||
|
for reply, i in g.replies
|
||||||
|
bottom = reply.getBoundingClientRect().bottom
|
||||||
|
if bottom > height #post is not completely read
|
||||||
|
break
|
||||||
|
if i is 0 then return
|
||||||
|
g.replies = g.replies[i..]
|
||||||
|
updateTitle()
|
||||||
|
|
||||||
|
autoWatch = ->
|
||||||
|
#TODO look for subject
|
||||||
|
autoText = $('textarea', this).value.slice(0, 25)
|
||||||
|
GM_setValue('autoText', "/#{g.BOARD}/ - #{autoText}")
|
||||||
|
|
||||||
recaptchaListener = (e) ->
|
recaptchaListener = (e) ->
|
||||||
if e.keyCode is 8 and @value is ''
|
if e.keyCode is 8 and @value is ''
|
||||||
recaptchaReload()
|
recaptchaReload()
|
||||||
@ -1357,11 +1357,26 @@ redirect = ->
|
|||||||
url = "http://boards.4chan.org/#{g.BOARD}"
|
url = "http://boards.4chan.org/#{g.BOARD}"
|
||||||
location.href = url
|
location.href = url
|
||||||
|
|
||||||
report = ->
|
quickReport =
|
||||||
input = $.x('preceding-sibling::input[1]', this)
|
init: ->
|
||||||
input.click()
|
g.callbacks.push quickReport.cb.node
|
||||||
$('input[value="Report"]').click()
|
cb:
|
||||||
input.click()
|
node: (root) ->
|
||||||
|
arr = $$ 'span[id^=no]', root
|
||||||
|
for el in arr
|
||||||
|
a = $.el 'a',
|
||||||
|
textContent: '[ ! ]'
|
||||||
|
$.bind a, 'click', quickReport.cb.report
|
||||||
|
$.after el, a
|
||||||
|
$.after el, $.tn(' ')
|
||||||
|
report: (e) ->
|
||||||
|
{target} = e
|
||||||
|
quickReport.report target
|
||||||
|
report: (target) ->
|
||||||
|
input = $.x('preceding-sibling::input[1]', target)
|
||||||
|
input.click()
|
||||||
|
$('input[value="Report"]').click()
|
||||||
|
input.click()
|
||||||
|
|
||||||
updateFavicon = ->
|
updateFavicon = ->
|
||||||
len = g.replies.length
|
len = g.replies.length
|
||||||
@ -1554,6 +1569,18 @@ $.bind recaptcha, 'keydown', recaptchaListener
|
|||||||
$.bind $('form[name=post]'), 'submit', qr.cb.submit
|
$.bind $('form[name=post]'), 'submit', qr.cb.submit
|
||||||
|
|
||||||
#major features
|
#major features
|
||||||
|
if $.config 'Anonymize'
|
||||||
|
g.callbacks.push (root) ->
|
||||||
|
names = $$('span.postername, span.commentpostername', root)
|
||||||
|
for name in names
|
||||||
|
name.innerHTML = 'Anonymous'
|
||||||
|
trips = $$('span.postertrip', root)
|
||||||
|
for trip in trips
|
||||||
|
if trip.parentNode.nodeName is 'A'
|
||||||
|
$.remove trip.parentNode
|
||||||
|
else
|
||||||
|
$.remove trip
|
||||||
|
|
||||||
if $.config 'Image Expansion'
|
if $.config 'Image Expansion'
|
||||||
delform = $ 'form[name=delform]'
|
delform = $ 'form[name=delform]'
|
||||||
expand = $.el 'div',
|
expand = $.el 'div',
|
||||||
@ -1576,9 +1603,6 @@ if $.config 'Image Expansion'
|
|||||||
$.bind thumb.parentNode, 'click', imageClick
|
$.bind thumb.parentNode, 'click', imageClick
|
||||||
if g.expand then imageToggle thumb.parentNode
|
if g.expand then imageToggle thumb.parentNode
|
||||||
|
|
||||||
if $.config 'Image Hover'
|
|
||||||
imageHover.init()
|
|
||||||
|
|
||||||
if $.config 'Image Auto-Gif'
|
if $.config 'Image Auto-Gif'
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
thumbs = $$ 'img[md5]', root
|
thumbs = $$ 'img[md5]', root
|
||||||
@ -1628,6 +1652,9 @@ if $.config 'Sauce'
|
|||||||
$.append span, $.tn(' '), link
|
$.append span, $.tn(' '), link
|
||||||
i++
|
i++
|
||||||
|
|
||||||
|
if $.config 'Image Hover'
|
||||||
|
imageHover.init()
|
||||||
|
|
||||||
if $.config 'Reply Hiding'
|
if $.config 'Reply Hiding'
|
||||||
replyHiding.init()
|
replyHiding.init()
|
||||||
|
|
||||||
@ -1635,30 +1662,11 @@ if $.config 'Quick Reply'
|
|||||||
qr.init()
|
qr.init()
|
||||||
|
|
||||||
if $.config 'Quick Report'
|
if $.config 'Quick Report'
|
||||||
g.callbacks.push (root) ->
|
quickReport.init()
|
||||||
arr = $$('span[id^=no]', root)
|
|
||||||
for el in arr
|
|
||||||
a = $.el 'a',
|
|
||||||
textContent: '[ ! ]'
|
|
||||||
$.bind a, 'click', report
|
|
||||||
$.after el, a
|
|
||||||
$.after el, $.tn(' ')
|
|
||||||
|
|
||||||
if $.config 'Thread Watcher'
|
if $.config 'Thread Watcher'
|
||||||
watcher.init()
|
watcher.init()
|
||||||
|
|
||||||
if $.config 'Anonymize'
|
|
||||||
g.callbacks.push (root) ->
|
|
||||||
names = $$('span.postername, span.commentpostername', root)
|
|
||||||
for name in names
|
|
||||||
name.innerHTML = 'Anonymous'
|
|
||||||
trips = $$('span.postertrip', root)
|
|
||||||
for trip in trips
|
|
||||||
if trip.parentNode.nodeName is 'A'
|
|
||||||
$.remove trip.parentNode
|
|
||||||
else
|
|
||||||
$.remove trip
|
|
||||||
|
|
||||||
if $.config 'Keybinds'
|
if $.config 'Keybinds'
|
||||||
keybinds.init()
|
keybinds.init()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user