diff --git a/4chan_x.user.js b/4chan_x.user.js index 3400e1927..23e429b34 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1195,15 +1195,19 @@ return g.callbacks.push(this.node); }, node: function(root) { - var quote; - if (unxify.censor === false) return; - if (unxify.censor === void 0) { - unxify.censor = /\D/.test($('.quotejs + .quotejs', root).textContent); - unxify.node(root); - return; + var number, quote; + switch (unxify.censor) { + case true: + quote = $('.quotejs + .quotejs', root); + return quote.textContent = quote.previousElementSibling.hash.slice(1); + case false: + break; + default: + number = $('.quotejs + .quotejs', root).textContent; + if (number.length < 4) return; + unxify.censor = /\D/.test($('.quotejs + .quotejs', root).textContent); + return unxify.node(root); } - quote = $('.quotejs + .quotejs', root); - return quote.textContent = quote.previousElementSibling.hash.slice(1); } }; diff --git a/changelog b/changelog index 48ea583d4..88e3556ea 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- Mayhem + Fix unXXXifier on pages starting with not XXXed numbers. 2.26.2 - Mayhem diff --git a/script.coffee b/script.coffee index 6969b54d1..5888d2e47 100644 --- a/script.coffee +++ b/script.coffee @@ -873,16 +873,19 @@ unxify = init: -> g.callbacks.push @node node: (root) -> - if unxify.censor is false - # Don't execute on safe boards - return - if unxify.censor is undefined - # Test if the board's censored - unxify.censor = /\D/.test $('.quotejs + .quotejs', root).textContent - unxify.node root - return - quote = $ '.quotejs + .quotejs', root - quote.textContent = quote.previousElementSibling.hash[1..] + switch unxify.censor + when true + quote = $ '.quotejs + .quotejs', root + quote.textContent = quote.previousElementSibling.hash[1..] + when false + # Don't execute on safe boards. + else + number = $('.quotejs + .quotejs', root).textContent + # 3 digits long post numbers are not censored. + return if number.length < 4 + # Test if the board's censored. + unxify.censor = /\D/.test $('.quotejs + .quotejs', root).textContent + unxify.node root qr = init: ->