cleanups
This commit is contained in:
parent
97336afc5f
commit
d13c1fc611
@ -96,7 +96,7 @@ class Dialog
|
|||||||
if left then el.style.left = left else el.style.right = '0px'
|
if left then el.style.left = left else el.style.right = '0px'
|
||||||
if top then el.style.top = top else el.style.bottom = '0px'
|
if top then el.style.top = top else el.style.bottom = '0px'
|
||||||
$('div.move', el).addEventListener 'mousedown', @move, true
|
$('div.move', el).addEventListener 'mousedown', @move, true
|
||||||
$('div.move a[name=close]', el)?.addEventListener 'click', (-> remove el), true
|
$('div.move a[name=close]', el)?.addEventListener 'click', (-> rm el), true
|
||||||
move: (e) =>
|
move: (e) =>
|
||||||
el = @el
|
el = @el
|
||||||
#distance from pointer to el edge is constant; calculate it here.
|
#distance from pointer to el edge is constant; calculate it here.
|
||||||
@ -134,11 +134,9 @@ d = document
|
|||||||
g = null #globals
|
g = null #globals
|
||||||
|
|
||||||
#utility
|
#utility
|
||||||
$ = (selector, root) ->
|
$ = (selector, root=d.body) ->
|
||||||
root or= d.body
|
|
||||||
root.querySelector selector
|
root.querySelector selector
|
||||||
$$ = (selector, root) ->
|
$$ = (selector, root=d.body) ->
|
||||||
root or= d.body
|
|
||||||
result = root.querySelectorAll selector
|
result = root.querySelectorAll selector
|
||||||
#magic that turns the results object into an array:
|
#magic that turns the results object into an array:
|
||||||
node for node in result
|
node for node in result
|
||||||
@ -166,7 +164,7 @@ n = (tag, props) -> #new
|
|||||||
el = d.createElement tag
|
el = d.createElement tag
|
||||||
if props then m el, props
|
if props then m el, props
|
||||||
el
|
el
|
||||||
remove = (el) ->
|
rm = (el) ->
|
||||||
el.parentNode.removeChild el
|
el.parentNode.removeChild el
|
||||||
replace = (root, el) ->
|
replace = (root, el) ->
|
||||||
root.parentNode.replaceChild el, root
|
root.parentNode.replaceChild el, root
|
||||||
@ -185,8 +183,7 @@ slice = (arr, id) ->
|
|||||||
i++
|
i++
|
||||||
tn = (s) ->
|
tn = (s) ->
|
||||||
d.createTextNode s
|
d.createTextNode s
|
||||||
x = (path, root) ->
|
x = (path, root=d.body) ->
|
||||||
root or= d.body
|
|
||||||
d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).
|
d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).
|
||||||
singleNodeValue
|
singleNodeValue
|
||||||
zeroPad = (n) ->
|
zeroPad = (n) ->
|
||||||
@ -209,7 +206,7 @@ autoWatch = ->
|
|||||||
|
|
||||||
closeQR = ->
|
closeQR = ->
|
||||||
div = @parentNode.parentNode
|
div = @parentNode.parentNode
|
||||||
remove div
|
rm div
|
||||||
|
|
||||||
clearHidden = ->
|
clearHidden = ->
|
||||||
#'hidden' might be misleading; it's the number of IDs we're *looking* for,
|
#'hidden' might be misleading; it's the number of IDs we're *looking* for,
|
||||||
@ -261,7 +258,7 @@ expandThread = ->
|
|||||||
num = if board is 'b' then 3 else 5
|
num = if board is 'b' then 3 else 5
|
||||||
table = x "following::br[@clear][1]/preceding::table[#{num}]", span
|
table = x "following::br[@clear][1]/preceding::table[#{num}]", span
|
||||||
while (prev = table.previousSibling) and (prev.nodeName is 'TABLE')
|
while (prev = table.previousSibling) and (prev.nodeName is 'TABLE')
|
||||||
remove prev
|
rm prev
|
||||||
span.textContent = span.textContent.replace '-', '+'
|
span.textContent = span.textContent.replace '-', '+'
|
||||||
return
|
return
|
||||||
span.textContent = span.textContent.replace '+', 'X Loading...'
|
span.textContent = span.textContent.replace '+', 'X Loading...'
|
||||||
@ -291,7 +288,7 @@ getThread = ->
|
|||||||
|
|
||||||
formSubmit = (e) ->
|
formSubmit = (e) ->
|
||||||
if span = @nextSibling
|
if span = @nextSibling
|
||||||
remove span
|
rm span
|
||||||
recaptcha = $('input[name=recaptcha_response_field]', this)
|
recaptcha = $('input[name=recaptcha_response_field]', this)
|
||||||
if recaptcha.value
|
if recaptcha.value
|
||||||
$('#qr input[title=autohide]:not(:checked)')?.click()
|
$('#qr input[title=autohide]:not(:checked)')?.click()
|
||||||
@ -372,7 +369,7 @@ iframeLoad = ->
|
|||||||
#unhide the qr so you know it's ready for the next item
|
#unhide the qr so you know it's ready for the next item
|
||||||
$('input[title=autohide]:checked', qr)?.click()
|
$('input[title=autohide]:checked', qr)?.click()
|
||||||
else
|
else
|
||||||
remove qr
|
rm qr
|
||||||
recaptchaReload()
|
recaptchaReload()
|
||||||
|
|
||||||
imageClick = (e) ->
|
imageClick = (e) ->
|
||||||
@ -413,7 +410,7 @@ imageFull = (thumb) ->
|
|||||||
imageThumb = (thumb) ->
|
imageThumb = (thumb) ->
|
||||||
#thumbify the image - show thumb, remove full sized image
|
#thumbify the image - show thumb, remove full sized image
|
||||||
thumb.className = ''
|
thumb.className = ''
|
||||||
remove thumb.nextSibling
|
rm thumb.nextSibling
|
||||||
|
|
||||||
keydown = (e) ->
|
keydown = (e) ->
|
||||||
kc = e.keyCode
|
kc = e.keyCode
|
||||||
@ -421,7 +418,7 @@ keydown = (e) ->
|
|||||||
g.char = String.fromCharCode kc
|
g.char = String.fromCharCode kc
|
||||||
|
|
||||||
keypress = (e) ->
|
keypress = (e) ->
|
||||||
if document.activeElement.nodeName in ['TEXTAREA', 'INPUT']
|
if d.activeElement.nodeName in ['TEXTAREA', 'INPUT']
|
||||||
keyModeInsert e
|
keyModeInsert e
|
||||||
else
|
else
|
||||||
keyModeNormal e
|
keyModeNormal e
|
||||||
@ -430,10 +427,10 @@ keyModeInsert = (e) ->
|
|||||||
kc = g.keyCode
|
kc = g.keyCode
|
||||||
char = g.char
|
char = g.char
|
||||||
if kc is 27 #escape
|
if kc is 27 #escape
|
||||||
remove $ '#qr'
|
rm $ '#qr'
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
else if e.ctrlKey and char is "S"
|
else if e.ctrlKey and char is "S"
|
||||||
ta = document.activeElement
|
ta = d.activeElement
|
||||||
return unless ta.nodeName is 'TEXTAREA'
|
return unless ta.nodeName is 'TEXTAREA'
|
||||||
|
|
||||||
value = ta.value
|
value = ta.value
|
||||||
@ -567,7 +564,7 @@ onloadThread = (responseText, span) ->
|
|||||||
#make sure all comments are fully expanded
|
#make sure all comments are fully expanded
|
||||||
span.previousSibling.innerHTML = opbq.innerHTML
|
span.previousSibling.innerHTML = opbq.innerHTML
|
||||||
while (next = span.nextSibling) and not next.clear#<br clear>
|
while (next = span.nextSibling) and not next.clear#<br clear>
|
||||||
remove next
|
rm next
|
||||||
if next
|
if next
|
||||||
for reply in replies
|
for reply in replies
|
||||||
inBefore next, x('ancestor::table', reply)
|
inBefore next, x('ancestor::table', reply)
|
||||||
@ -584,7 +581,7 @@ changeText = ->
|
|||||||
|
|
||||||
options = ->
|
options = ->
|
||||||
if div = $ '#options'
|
if div = $ '#options'
|
||||||
remove div
|
rm div
|
||||||
return
|
return
|
||||||
|
|
||||||
hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length
|
hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length
|
||||||
@ -639,7 +636,7 @@ quickReply = (link, text) ->
|
|||||||
clone = form.cloneNode true
|
clone = form.cloneNode true
|
||||||
#remove recaptcha scripts
|
#remove recaptcha scripts
|
||||||
for script in $$ 'script', clone
|
for script in $$ 'script', clone
|
||||||
remove script
|
rm script
|
||||||
m $('input[name=recaptcha_response_field]', clone),
|
m $('input[name=recaptcha_response_field]', clone),
|
||||||
listener: ['keydown', recaptchaListener]
|
listener: ['keydown', recaptchaListener]
|
||||||
m clone,
|
m clone,
|
||||||
@ -722,11 +719,11 @@ scrollThread = (count) ->
|
|||||||
showReply = ->
|
showReply = ->
|
||||||
div = @parentNode
|
div = @parentNode
|
||||||
table = div.nextSibling
|
table = div.nextSibling
|
||||||
show(table)
|
show table
|
||||||
remove(div)
|
rm div
|
||||||
id = $('td.reply, td.replyhl', table).id
|
id = $('td.reply, td.replyhl', table).id
|
||||||
slice(g.hiddenReplies, id)
|
slice g.hiddenReplies, id
|
||||||
GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies))
|
GM_setValue "hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies)
|
||||||
|
|
||||||
showThread = ->
|
showThread = ->
|
||||||
div = @nextSibling
|
div = @nextSibling
|
||||||
@ -784,7 +781,7 @@ updateCallback = ->
|
|||||||
s = ''
|
s = ''
|
||||||
if getConfig 'Unread Count' then s += "(#{g.replies.length}) "
|
if getConfig 'Unread Count' then s += "(#{g.replies.length}) "
|
||||||
s += "/#{g.BOARD}/ - 404"
|
s += "/#{g.BOARD}/ - 404"
|
||||||
document.title = s
|
d.title = s
|
||||||
g.dead = true
|
g.dead = true
|
||||||
updateFavicon()
|
updateFavicon()
|
||||||
return
|
return
|
||||||
@ -842,7 +839,7 @@ updateTime = ->
|
|||||||
|
|
||||||
updateTitle = ->
|
updateTitle = ->
|
||||||
len = g.replies.length
|
len = g.replies.length
|
||||||
document.title = document.title.replace /\d+/, len
|
d.title = d.title.replace /\d+/, len
|
||||||
updateFavicon()
|
updateFavicon()
|
||||||
|
|
||||||
updateAuto = ->
|
updateAuto = ->
|
||||||
@ -881,7 +878,7 @@ updaterMake = ->
|
|||||||
interval.value = GM_getValue 'Interval', 10
|
interval.value = GM_getValue 'Interval', 10
|
||||||
interval.addEventListener 'change', updateInterval, true
|
interval.addEventListener 'change', updateInterval, true
|
||||||
$('input[type=button]', div).addEventListener 'click', updateNow, true
|
$('input[type=button]', div).addEventListener 'click', updateNow, true
|
||||||
document.body.appendChild div
|
d.body.appendChild div
|
||||||
if getConfig 'Auto Update' then auto.click()
|
if getConfig 'Auto Update' then auto.click()
|
||||||
|
|
||||||
watch = ->
|
watch = ->
|
||||||
@ -1100,7 +1097,7 @@ recaptcha = $ '#recaptcha_response_field'
|
|||||||
recaptcha.addEventListener('keydown', recaptchaListener, true)
|
recaptcha.addEventListener('keydown', recaptchaListener, true)
|
||||||
|
|
||||||
scroll = ->
|
scroll = ->
|
||||||
height = document.body.clientHeight
|
height = d.body.clientHeight
|
||||||
for reply, i in g.replies
|
for reply, i in g.replies
|
||||||
bottom = reply.getBoundingClientRect().bottom
|
bottom = reply.getBoundingClientRect().bottom
|
||||||
if bottom > height #post is not completely read
|
if bottom > height #post is not completely read
|
||||||
@ -1246,9 +1243,9 @@ if getConfig 'Anonymize'
|
|||||||
trips = $$('span.postertrip', root)
|
trips = $$('span.postertrip', root)
|
||||||
for trip in trips
|
for trip in trips
|
||||||
if trip.parentNode.nodeName is 'A'
|
if trip.parentNode.nodeName is 'A'
|
||||||
remove(trip.parentNode)
|
rm trip.parentNode
|
||||||
else
|
else
|
||||||
remove(trip)
|
rm trip
|
||||||
|
|
||||||
if getConfig 'Reply Navigation'
|
if getConfig 'Reply Navigation'
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
@ -1267,8 +1264,8 @@ if getConfig 'Reply Navigation'
|
|||||||
inAfter el, span
|
inAfter el, span
|
||||||
|
|
||||||
if getConfig 'Keybinds'
|
if getConfig 'Keybinds'
|
||||||
document.addEventListener 'keydown', keydown, true
|
d.addEventListener 'keydown', keydown, true
|
||||||
document.addEventListener 'keypress', keypress, true
|
d.addEventListener 'keypress', keypress, true
|
||||||
|
|
||||||
if g.REPLY
|
if g.REPLY
|
||||||
if getConfig 'Thread Updater'
|
if getConfig 'Thread Updater'
|
||||||
@ -1283,8 +1280,8 @@ if g.REPLY
|
|||||||
d.title = "/#{g.BOARD}/ - #{text}"
|
d.title = "/#{g.BOARD}/ - #{text}"
|
||||||
if getConfig 'Unread Count'
|
if getConfig 'Unread Count'
|
||||||
g.replies = []
|
g.replies = []
|
||||||
document.title = '(0) ' + document.title
|
d.title = '(0) ' + d.title
|
||||||
document.addEventListener 'scroll', scroll, true
|
d.addEventListener 'scroll', scroll, true
|
||||||
g.callbacks.push (root) ->
|
g.callbacks.push (root) ->
|
||||||
g.replies = g.replies.concat $$ 'td.reply, td.replyhl', root
|
g.replies = g.replies.concat $$ 'td.reply, td.replyhl', root
|
||||||
updateTitle()
|
updateTitle()
|
||||||
|
|||||||
60
4chan_x.js
60
4chan_x.js
@ -1,5 +1,5 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var $, $$, DAY, Dialog, a, addTo, arr, as, autoWatch, autohide, b, board, callback, changeCheckbox, changeText, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, formSubmit, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, i, id, iframe, iframeLoad, imageClick, imageExpandClick, imageFull, imageThumb, imageToggle, img, inAfter, inBefore, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, m, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, options, parseResponse, pathname, qrListener, qrText, quickReply, recaptcha, recaptchaListener, recaptchaReload, redirect, remove, replace, replyNav, report, request, scroll, scrollThread, show, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, thread, threadF, threads, tn, tzOffset, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updaterMake, watch, watchX, watcher, watcherUpdate, x, zeroPad, _, _base, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _m, _ref, _ref2, _ref3, _ref4, _ref5;
|
var $, $$, DAY, Dialog, a, addTo, arr, as, autoWatch, autohide, b, board, callback, changeCheckbox, changeText, clearHidden, closeQR, config, cooldown, cutoff, d, delform, down, editSauce, el, expand, expandComment, expandThread, formSubmit, g, getConfig, getThread, getTime, hide, hideReply, hideThread, href, html, i, id, iframe, iframeLoad, imageClick, imageExpandClick, imageFull, imageThumb, imageToggle, img, inAfter, inBefore, input, inputs, keyModeInsert, keyModeNormal, keydown, keypress, l1, lastChecked, m, n, navbotr, navtopr, nodeInserted, now, omitted, onloadComment, onloadThread, options, parseResponse, pathname, qrListener, qrText, quickReply, recaptcha, recaptchaListener, recaptchaReload, redirect, replace, replyNav, report, request, rm, scroll, scrollThread, show, showReply, showThread, slice, span, src, start, stopPropagation, temp, text, textContent, thread, threadF, threads, tn, tzOffset, up, updateAuto, updateCallback, updateFavicon, updateInterval, updateNow, updateTime, updateTitle, updaterMake, watch, watchX, watcher, watcherUpdate, x, zeroPad, _, _base, _i, _j, _k, _l, _len, _len2, _len3, _len4, _len5, _len6, _m, _ref, _ref2, _ref3, _ref4, _ref5;
|
||||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __slice = Array.prototype.slice;
|
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __slice = Array.prototype.slice;
|
||||||
config = {
|
config = {
|
||||||
'404 Redirect': [true, 'Redirect dead threads'],
|
'404 Redirect': [true, 'Redirect dead threads'],
|
||||||
@ -114,7 +114,7 @@
|
|||||||
$('div.move', el).addEventListener('mousedown', this.move, true);
|
$('div.move', el).addEventListener('mousedown', this.move, true);
|
||||||
if ((_ref = $('div.move a[name=close]', el)) != null) {
|
if ((_ref = $('div.move a[name=close]', el)) != null) {
|
||||||
_ref.addEventListener('click', (function() {
|
_ref.addEventListener('click', (function() {
|
||||||
return remove(el);
|
return rm(el);
|
||||||
}), true);
|
}), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,12 +164,16 @@
|
|||||||
d = document;
|
d = document;
|
||||||
g = null;
|
g = null;
|
||||||
$ = function(selector, root) {
|
$ = function(selector, root) {
|
||||||
root || (root = d.body);
|
if (root == null) {
|
||||||
|
root = d.body;
|
||||||
|
}
|
||||||
return root.querySelector(selector);
|
return root.querySelector(selector);
|
||||||
};
|
};
|
||||||
$$ = function(selector, root) {
|
$$ = function(selector, root) {
|
||||||
var node, result, _i, _len, _results;
|
var node, result, _i, _len, _results;
|
||||||
root || (root = d.body);
|
if (root == null) {
|
||||||
|
root = d.body;
|
||||||
|
}
|
||||||
result = root.querySelectorAll(selector);
|
result = root.querySelectorAll(selector);
|
||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = result.length; _i < _len; _i++) {
|
for (_i = 0, _len = result.length; _i < _len; _i++) {
|
||||||
@ -224,7 +228,7 @@
|
|||||||
}
|
}
|
||||||
return el;
|
return el;
|
||||||
};
|
};
|
||||||
remove = function(el) {
|
rm = function(el) {
|
||||||
return el.parentNode.removeChild(el);
|
return el.parentNode.removeChild(el);
|
||||||
};
|
};
|
||||||
replace = function(root, el) {
|
replace = function(root, el) {
|
||||||
@ -251,7 +255,9 @@
|
|||||||
return d.createTextNode(s);
|
return d.createTextNode(s);
|
||||||
};
|
};
|
||||||
x = function(path, root) {
|
x = function(path, root) {
|
||||||
root || (root = d.body);
|
if (root == null) {
|
||||||
|
root = d.body;
|
||||||
|
}
|
||||||
return d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
|
return d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
|
||||||
};
|
};
|
||||||
zeroPad = function(n) {
|
zeroPad = function(n) {
|
||||||
@ -280,7 +286,7 @@
|
|||||||
closeQR = function() {
|
closeQR = function() {
|
||||||
var div;
|
var div;
|
||||||
div = this.parentNode.parentNode;
|
div = this.parentNode.parentNode;
|
||||||
return remove(div);
|
return rm(div);
|
||||||
};
|
};
|
||||||
clearHidden = function() {
|
clearHidden = function() {
|
||||||
GM_deleteValue("hiddenReplies/" + g.BOARD + "/");
|
GM_deleteValue("hiddenReplies/" + g.BOARD + "/");
|
||||||
@ -338,7 +344,7 @@
|
|||||||
num = board === 'b' ? 3 : 5;
|
num = board === 'b' ? 3 : 5;
|
||||||
table = x("following::br[@clear][1]/preceding::table[" + num + "]", span);
|
table = x("following::br[@clear][1]/preceding::table[" + num + "]", span);
|
||||||
while ((prev = table.previousSibling) && (prev.nodeName === 'TABLE')) {
|
while ((prev = table.previousSibling) && (prev.nodeName === 'TABLE')) {
|
||||||
remove(prev);
|
rm(prev);
|
||||||
}
|
}
|
||||||
span.textContent = span.textContent.replace('-', '+');
|
span.textContent = span.textContent.replace('-', '+');
|
||||||
return;
|
return;
|
||||||
@ -377,7 +383,7 @@
|
|||||||
formSubmit = function(e) {
|
formSubmit = function(e) {
|
||||||
var recaptcha, span, _ref;
|
var recaptcha, span, _ref;
|
||||||
if (span = this.nextSibling) {
|
if (span = this.nextSibling) {
|
||||||
remove(span);
|
rm(span);
|
||||||
}
|
}
|
||||||
recaptcha = $('input[name=recaptcha_response_field]', this);
|
recaptcha = $('input[name=recaptcha_response_field]', this);
|
||||||
if (recaptcha.value) {
|
if (recaptcha.value) {
|
||||||
@ -477,7 +483,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
remove(qr);
|
rm(qr);
|
||||||
}
|
}
|
||||||
return recaptchaReload();
|
return recaptchaReload();
|
||||||
};
|
};
|
||||||
@ -528,7 +534,7 @@
|
|||||||
};
|
};
|
||||||
imageThumb = function(thumb) {
|
imageThumb = function(thumb) {
|
||||||
thumb.className = '';
|
thumb.className = '';
|
||||||
return remove(thumb.nextSibling);
|
return rm(thumb.nextSibling);
|
||||||
};
|
};
|
||||||
keydown = function(e) {
|
keydown = function(e) {
|
||||||
var kc;
|
var kc;
|
||||||
@ -538,7 +544,7 @@
|
|||||||
};
|
};
|
||||||
keypress = function(e) {
|
keypress = function(e) {
|
||||||
var _ref;
|
var _ref;
|
||||||
if ((_ref = document.activeElement.nodeName) === 'TEXTAREA' || _ref === 'INPUT') {
|
if ((_ref = d.activeElement.nodeName) === 'TEXTAREA' || _ref === 'INPUT') {
|
||||||
return keyModeInsert(e);
|
return keyModeInsert(e);
|
||||||
} else {
|
} else {
|
||||||
return keyModeNormal(e);
|
return keyModeNormal(e);
|
||||||
@ -549,10 +555,10 @@
|
|||||||
kc = g.keyCode;
|
kc = g.keyCode;
|
||||||
char = g.char;
|
char = g.char;
|
||||||
if (kc === 27) {
|
if (kc === 27) {
|
||||||
remove($('#qr'));
|
rm($('#qr'));
|
||||||
return e.preventDefault();
|
return e.preventDefault();
|
||||||
} else if (e.ctrlKey && char === "S") {
|
} else if (e.ctrlKey && char === "S") {
|
||||||
ta = document.activeElement;
|
ta = d.activeElement;
|
||||||
if (ta.nodeName !== 'TEXTAREA') {
|
if (ta.nodeName !== 'TEXTAREA') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -728,7 +734,7 @@
|
|||||||
span.textContent = span.textContent.replace('X Loading...', '- ');
|
span.textContent = span.textContent.replace('X Loading...', '- ');
|
||||||
span.previousSibling.innerHTML = opbq.innerHTML;
|
span.previousSibling.innerHTML = opbq.innerHTML;
|
||||||
while ((next = span.nextSibling) && !next.clear) {
|
while ((next = span.nextSibling) && !next.clear) {
|
||||||
remove(next);
|
rm(next);
|
||||||
}
|
}
|
||||||
if (next) {
|
if (next) {
|
||||||
_results = [];
|
_results = [];
|
||||||
@ -756,7 +762,7 @@
|
|||||||
options = function() {
|
options = function() {
|
||||||
var checked, description, div, hiddenNum, html, input, option, value, _i, _len, _ref;
|
var checked, description, div, hiddenNum, html, input, option, value, _i, _len, _ref;
|
||||||
if (div = $('#options')) {
|
if (div = $('#options')) {
|
||||||
remove(div);
|
rm(div);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length;
|
hiddenNum = g.hiddenReplies.length + g.hiddenThreads.length;
|
||||||
@ -817,7 +823,7 @@
|
|||||||
_ref = $$('script', clone);
|
_ref = $$('script', clone);
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
script = _ref[_i];
|
script = _ref[_i];
|
||||||
remove(script);
|
rm(script);
|
||||||
}
|
}
|
||||||
m($('input[name=recaptcha_response_field]', clone), {
|
m($('input[name=recaptcha_response_field]', clone), {
|
||||||
listener: ['keydown', recaptchaListener]
|
listener: ['keydown', recaptchaListener]
|
||||||
@ -931,7 +937,7 @@
|
|||||||
div = this.parentNode;
|
div = this.parentNode;
|
||||||
table = div.nextSibling;
|
table = div.nextSibling;
|
||||||
show(table);
|
show(table);
|
||||||
remove(div);
|
rm(div);
|
||||||
id = $('td.reply, td.replyhl', table).id;
|
id = $('td.reply, td.replyhl', table).id;
|
||||||
slice(g.hiddenReplies, id);
|
slice(g.hiddenReplies, id);
|
||||||
return GM_setValue("hiddenReplies/" + g.BOARD + "/", JSON.stringify(g.hiddenReplies));
|
return GM_setValue("hiddenReplies/" + g.BOARD + "/", JSON.stringify(g.hiddenReplies));
|
||||||
@ -1008,7 +1014,7 @@
|
|||||||
s += "(" + g.replies.length + ") ";
|
s += "(" + g.replies.length + ") ";
|
||||||
}
|
}
|
||||||
s += "/" + g.BOARD + "/ - 404";
|
s += "/" + g.BOARD + "/ - 404";
|
||||||
document.title = s;
|
d.title = s;
|
||||||
g.dead = true;
|
g.dead = true;
|
||||||
updateFavicon();
|
updateFavicon();
|
||||||
return;
|
return;
|
||||||
@ -1073,7 +1079,7 @@
|
|||||||
updateTitle = function() {
|
updateTitle = function() {
|
||||||
var len;
|
var len;
|
||||||
len = g.replies.length;
|
len = g.replies.length;
|
||||||
document.title = document.title.replace(/\d+/, len);
|
d.title = d.title.replace(/\d+/, len);
|
||||||
return updateFavicon();
|
return updateFavicon();
|
||||||
};
|
};
|
||||||
updateAuto = function() {
|
updateAuto = function() {
|
||||||
@ -1117,7 +1123,7 @@
|
|||||||
interval.value = GM_getValue('Interval', 10);
|
interval.value = GM_getValue('Interval', 10);
|
||||||
interval.addEventListener('change', updateInterval, true);
|
interval.addEventListener('change', updateInterval, true);
|
||||||
$('input[type=button]', div).addEventListener('click', updateNow, true);
|
$('input[type=button]', div).addEventListener('click', updateNow, true);
|
||||||
document.body.appendChild(div);
|
d.body.appendChild(div);
|
||||||
if (getConfig('Auto Update')) {
|
if (getConfig('Auto Update')) {
|
||||||
return auto.click();
|
return auto.click();
|
||||||
}
|
}
|
||||||
@ -1351,7 +1357,7 @@
|
|||||||
recaptcha.addEventListener('keydown', recaptchaListener, true);
|
recaptcha.addEventListener('keydown', recaptchaListener, true);
|
||||||
scroll = function() {
|
scroll = function() {
|
||||||
var bottom, height, i, reply, _len, _ref;
|
var bottom, height, i, reply, _len, _ref;
|
||||||
height = document.body.clientHeight;
|
height = d.body.clientHeight;
|
||||||
_ref = g.replies;
|
_ref = g.replies;
|
||||||
for (i = 0, _len = _ref.length; i < _len; i++) {
|
for (i = 0, _len = _ref.length; i < _len; i++) {
|
||||||
reply = _ref[i];
|
reply = _ref[i];
|
||||||
@ -1563,7 +1569,7 @@
|
|||||||
_results = [];
|
_results = [];
|
||||||
for (_j = 0, _len2 = trips.length; _j < _len2; _j++) {
|
for (_j = 0, _len2 = trips.length; _j < _len2; _j++) {
|
||||||
trip = trips[_j];
|
trip = trips[_j];
|
||||||
_results.push(trip.parentNode.nodeName === 'A' ? remove(trip.parentNode) : remove(trip));
|
_results.push(trip.parentNode.nodeName === 'A' ? rm(trip.parentNode) : rm(trip));
|
||||||
}
|
}
|
||||||
return _results;
|
return _results;
|
||||||
});
|
});
|
||||||
@ -1593,8 +1599,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (getConfig('Keybinds')) {
|
if (getConfig('Keybinds')) {
|
||||||
document.addEventListener('keydown', keydown, true);
|
d.addEventListener('keydown', keydown, true);
|
||||||
document.addEventListener('keypress', keypress, true);
|
d.addEventListener('keypress', keypress, true);
|
||||||
}
|
}
|
||||||
if (g.REPLY) {
|
if (g.REPLY) {
|
||||||
if (getConfig('Thread Updater')) {
|
if (getConfig('Thread Updater')) {
|
||||||
@ -1614,8 +1620,8 @@
|
|||||||
}
|
}
|
||||||
if (getConfig('Unread Count')) {
|
if (getConfig('Unread Count')) {
|
||||||
g.replies = [];
|
g.replies = [];
|
||||||
document.title = '(0) ' + document.title;
|
d.title = '(0) ' + d.title;
|
||||||
document.addEventListener('scroll', scroll, true);
|
d.addEventListener('scroll', scroll, true);
|
||||||
g.callbacks.push(function(root) {
|
g.callbacks.push(function(root) {
|
||||||
g.replies = g.replies.concat($$('td.reply, td.replyhl', root));
|
g.replies = g.replies.concat($$('td.reply, td.replyhl', root));
|
||||||
return updateTitle();
|
return updateTitle();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user