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);
},
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);
}
};

View File

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

View File

@ -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: ->