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);
unxify.node(root);
return;
}
quote = $('.quotejs + .quotejs', root); quote = $('.quotejs + .quotejs', root);
return quote.textContent = quote.previousElementSibling.hash.slice(1); 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);
}
} }
}; };

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
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 = $ '.quotejs + .quotejs', root
quote.textContent = quote.previousElementSibling.hash[1..] 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 = qr =
init: -> init: ->