Don't depend on prototype.toString()

This commit is contained in:
Nicolas Stepien 2011-09-26 22:03:56 +02:00
parent baf5a4ec13
commit 5dcff904a8
2 changed files with 4 additions and 14 deletions

View File

@ -532,11 +532,6 @@
callbacks: [], callbacks: [],
init: function() { init: function() {
var filter, key, m, regx, _i, _len; var filter, key, m, regx, _i, _len;
HTMLBlockquoteElement.prototype.toString = function() {
return ($.el('a', {
innerHTML: this.innerHTML.replace(/<br>/g, '\n')
})).textContent;
};
for (key in config.filter) { for (key in config.filter) {
if (!(m = conf[key].match(/(.+)/g))) { if (!(m = conf[key].match(/(.+)/g))) {
continue; continue;
@ -616,7 +611,9 @@
}, },
com: function(root) { com: function(root) {
var com; var com;
if (com = $('blockquote', root).toString()) { if (com = ($.el('a', {
innerHTML: $('blockquote', root).innerHTML.replace(/<br>/g, '\n')
})).textContent) {
return filter.test('com', com); return filter.test('com', com);
} }
}, },

View File

@ -388,13 +388,6 @@ filter =
regexps: {} regexps: {}
callbacks: [] callbacks: []
init: -> init: ->
HTMLQuoteElement.prototype.toString = ->
return ($.el 'a', innerHTML: @innerHTML.replace /<br>/g, '\n').textContent
#to remove when both chrom, ff and oprah will define blockquotes as HTMLQuoteElement
if HTMLBlockquoteElement
HTMLBlockquoteElement.prototype.toString = ->
return ($.el 'a', innerHTML: @innerHTML.replace /<br>/g, '\n').textContent
for key of config.filter for key of config.filter
unless m = conf[key].match /(.+)/g unless m = conf[key].match /(.+)/g
continue continue
@ -436,7 +429,7 @@ filter =
if (sub = if root.className is 'op' then $('.filetitle', root).textContent else $('.replytitle', root).textContent) if (sub = if root.className is 'op' then $('.filetitle', root).textContent else $('.replytitle', root).textContent)
filter.test 'sub', sub filter.test 'sub', sub
com: (root) -> com: (root) ->
if com = $('blockquote', root).toString() if com = ($.el 'a', innerHTML: $('blockquote', root).innerHTML.replace /<br>/g, '\n').textContent
filter.test 'com', com filter.test 'com', com
file: (root) -> file: (root) ->
if file = $ '.filesize span', root if file = $ '.filesize span', root