Fix and improve unXXXifier.

This commit is contained in:
Nicolas Stepien 2012-02-16 15:22:11 +01:00
parent 3d8f62abd0
commit e52b2f75fa
3 changed files with 27 additions and 18 deletions

View File

@ -1195,15 +1195,19 @@
return g.callbacks.push(this.node); return g.callbacks.push(this.node);
}, },
node: function(root) { node: function(root) {
var quote; var number, quote;
if (unxify.censor === false) return; switch (unxify.censor) {
if (unxify.censor === void 0) { case true:
unxify.censor = /\D/.test($('.quotejs + .quotejs', root).textContent); quote = $('.quotejs + .quotejs', root);
unxify.node(root); return quote.textContent = quote.previousElementSibling.hash.slice(1);
return; 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);
} }
}; };

View File

@ -1,4 +1,6 @@
master master
- Mayhem
Fix unXXXifier on pages starting with not XXXed numbers.
2.26.2 2.26.2
- Mayhem - Mayhem

View File

@ -873,16 +873,19 @@ unxify =
init: -> init: ->
g.callbacks.push @node g.callbacks.push @node
node: (root) -> node: (root) ->
if unxify.censor is false switch unxify.censor
# Don't execute on safe boards when true
return quote = $ '.quotejs + .quotejs', root
if unxify.censor is undefined quote.textContent = quote.previousElementSibling.hash[1..]
# Test if the board's censored when false
unxify.censor = /\D/.test $('.quotejs + .quotejs', root).textContent # Don't execute on safe boards.
unxify.node root else
return number = $('.quotejs + .quotejs', root).textContent
quote = $ '.quotejs + .quotejs', root # 3 digits long post numbers are not censored.
quote.textContent = quote.previousElementSibling.hash[1..] return if number.length < 4
# Test if the board's censored.
unxify.censor = /\D/.test $('.quotejs + .quotejs', root).textContent
unxify.node root
qr = qr =
init: -> init: ->