Start Filter work

This commit is contained in:
Nicolas Stepien 2011-09-24 22:06:53 +02:00
parent fe45fcb4f0
commit 20656daa0b
2 changed files with 27 additions and 5 deletions

View File

@ -61,13 +61,12 @@
*/
(function() {
var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, QR, SECOND, Time, anonymize, conf, config, d, expandComment, expandThread, firstRun, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, nav, nodeInserted, options, pathname, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, temp, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher;
var $, $$, DAY, Favicon, HOUR, MINUTE, Main, NAMESPACE, QR, SECOND, Time, anonymize, conf, config, d, expandComment, expandThread, filter, firstRun, g, getTitle, imgExpand, imgGif, imgHover, imgPreloading, key, keybinds, log, nav, nodeInserted, options, pathname, quoteBacklink, quoteInline, quoteOP, quotePreview, redirect, replyHiding, reportButton, revealSpoilers, sauce, temp, threadHiding, threadStats, threading, titlePost, ui, unread, updater, val, watcher;
var __slice = Array.prototype.slice;
config = {
main: {
Enhancing: {
'404 Redirect': [true, 'Redirect dead threads'],
'Anonymize': [false, 'Make everybody anonymous'],
'Keybinds': [true, 'Binds actions to keys'],
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time'],
'Report Button': [true, 'Add report buttons'],
@ -76,7 +75,9 @@
'Index Navigation': [true, 'Navigate to previous / next thread'],
'Reply Navigation': [false, 'Navigate to top / bottom of thread']
},
Hiding: {
Filtering: {
'Anonymize': [false, 'Make everybody anonymous'],
'Filter': [false, 'Self-moderation placebo'],
'Reply Hiding': [true, 'Hide single replies'],
'Thread Hiding': [true, 'Hide entire threads'],
'Show Stubs': [true, 'Of hidden threads / replies']
@ -516,6 +517,15 @@
}
return Array.prototype.slice.call(root.querySelectorAll(selector));
};
filter = {
init: function() {
return HTMLBlockquoteElement.prototype.toString = function() {
return ($.el('span', {
innerHTML: this.innerHTML.replace(/<br>/g, '\n')
})).textContent;
};
}
};
expandComment = {
init: function() {
var a, _i, _len, _ref, _results;
@ -2846,6 +2856,9 @@
if (g.REPLY && (id = location.hash.slice(1)) && /\d/.test(id[0]) && !$.id(id)) {
scrollTo(0, d.body.scrollHeight);
}
if (conf['Filter']) {
filter.init();
}
if (conf['Image Expansion']) {
imgExpand.init();
}

View File

@ -2,7 +2,6 @@ config =
main:
Enhancing:
'404 Redirect': [true, 'Redirect dead threads']
'Anonymize': [false, 'Make everybody anonymous']
'Keybinds': [true, 'Binds actions to keys']
'Time Formatting': [true, 'Arbitrarily formatted timestamps, using your local time']
'Report Button': [true, 'Add report buttons']
@ -10,7 +9,9 @@ config =
'Thread Expansion': [true, 'View all replies']
'Index Navigation': [true, 'Navigate to previous / next thread']
'Reply Navigation': [false, 'Navigate to top / bottom of thread']
Hiding:
Filtering:
'Anonymize': [false, 'Make everybody anonymous']
'Filter': [false, 'Self-moderation placebo']
'Reply Hiding': [true, 'Hide single replies']
'Thread Hiding': [true, 'Hide entire threads']
'Show Stubs': [true, 'Of hidden threads / replies']
@ -374,6 +375,11 @@ else
$$ = (selector, root=d.body) ->
Array::slice.call root.querySelectorAll selector
filter =
init: ->
HTMLBlockquoteElement.prototype.toString = ->
return ($.el 'span', innerHTML: @innerHTML.replace /<br>/g, '\n').textContent
expandComment =
init: ->
for a in $$ 'span.abbr a'
@ -2183,6 +2189,9 @@ Main =
if g.REPLY and (id = location.hash[1..]) and /\d/.test(id[0]) and !$.id(id)
scrollTo 0, d.body.scrollHeight
if conf['Filter']
filter.init()
if conf['Image Expansion']
imgExpand.init()