This commit is contained in:
Nicolas Stepien 2011-12-11 00:33:02 +01:00
parent cfccab22b0
commit 19703e047d
3 changed files with 56 additions and 46 deletions

View File

@ -118,7 +118,8 @@
'Quote Inline': [true, 'Show quoted post inline on quote click'], 'Quote Inline': [true, 'Show quoted post inline on quote click'],
'Quote Preview': [true, 'Show quote content on hover'], 'Quote Preview': [true, 'Show quote content on hover'],
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'], 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'],
'Indicate Cross-thread Quotes': [true, 'Add \'(Cross-thread)\' to cross-threads quotes'] 'Indicate Cross-thread Quotes': [true, 'Add \'(Cross-thread)\' to cross-threads quotes'],
'Forward Hiding': [true, 'Hide original posts of inlined backlinks']
} }
}, },
filter: { filter: {
@ -2446,7 +2447,7 @@
e.preventDefault(); e.preventDefault();
id = this.hash.slice(1); id = this.hash.slice(1);
if (/\binlined\b/.test(this.className)) { if (/\binlined\b/.test(this.className)) {
$.rm($.x("following::*[@id='i" + id + "']", this)); quoteInline.rm(this, id);
} else { } else {
if ($.x("ancestor::*[@id='" + id + "']", this)) return; if ($.x("ancestor::*[@id='" + id + "']", this)) return;
quoteInline.add(this, id); quoteInline.add(this, id);
@ -2460,6 +2461,9 @@
inline = quoteInline.table(id, el.innerHTML); inline = quoteInline.table(id, el.innerHTML);
if (/\bbacklink\b/.test(q.className)) { if (/\bbacklink\b/.test(q.className)) {
$.after(q.parentNode, inline); $.after(q.parentNode, inline);
if (conf['Forward Hiding']) {
$.addClass($.x('ancestor::table', el), 'forwarded');
}
return; return;
} }
return $.after(root, inline); return $.after(root, inline);
@ -2477,6 +2481,20 @@
})); }));
} }
}, },
rm: function(q, id) {
var inlined, table, _i, _len, _ref;
table = $.x("following::*[@id='i" + id + "']", q);
$.rm(table);
if (!conf['Forward Hiding']) return;
_ref = $$('.backlink.inlined', table);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
inlined = _ref[_i];
$.removeClass($.x('ancestor::table', $.id(inlined.hash.slice(1))), 'forwarded');
}
if (/\bbacklink\b/.test(q.className)) {
return $.removeClass($.x('ancestor::table', $.id(id)), 'forwarded');
}
},
parse: function(req, pathname, id, threadID, inline) { parse: function(req, pathname, id, threadID, inline) {
var body, href, html, link, newInline, op, quote, reply, _i, _j, _len, _len2, _ref, _ref2; var body, href, html, link, newInline, op, quote, reply, _i, _j, _len, _len2, _ref, _ref2;
if (!inline.parentNode) return; if (!inline.parentNode) return;
@ -3166,9 +3184,6 @@
}, },
css: '\ css: '\
/* dialog styling */\ /* dialog styling */\
a[href="javascript:;"] {\
text-decoration: none;\
}\
div.dialog {\ div.dialog {\
border: 1px solid;\ border: 1px solid;\
}\ }\
@ -3178,6 +3193,17 @@
label, a, .favicon, #qr img {\ label, a, .favicon, #qr img {\
cursor: pointer;\ cursor: pointer;\
}\ }\
a[href="javascript:;"] {\
text-decoration: none;\
}\
\
[hidden], /* Firefox bug: hidden tables are not hidden. fixed in 9.0 */\
.thread.stub > :not(.block),\
#content > [name=tab]:not(:checked) + div,\
#updater:not(:hover) > :not(.move),\
#qp > input, #qp .inline, .forwarded {\
display: none;\
}\
\ \
.new {\ .new {\
background: lime;\ background: lime;\
@ -3194,10 +3220,6 @@
td.replyhider {\ td.replyhider {\
vertical-align: top;\ vertical-align: top;\
}\ }\
\
div.thread.stub > *:not(.block) {\
display: none;\
}\
\ \
.filesize + br + a {\ .filesize + br + a {\
float: left;\ float: left;\
@ -3261,9 +3283,6 @@
#options label {\ #options label {\
text-decoration: underline;\ text-decoration: underline;\
}\ }\
#options [name=tab]:not(:checked) + * {\
display: none;\
}\
#content > div {\ #content > div {\
height: 450px;\ height: 450px;\
overflow: auto;\ overflow: auto;\
@ -3330,9 +3349,6 @@
border: none;\ border: none;\
background: transparent;\ background: transparent;\
}\ }\
#updater:not(:hover) > div:not(.move) {\
display: none;\
}\
\ \
#stats {\ #stats {\
border: none;\ border: none;\
@ -3362,9 +3378,6 @@
border: 1px solid;\ border: 1px solid;\
padding-bottom: 5px;\ padding-bottom: 5px;\
}\ }\
#qp input, #qp .inline {\
display: none;\
}\
.qphl {\ .qphl {\
outline: 2px solid rgba(216, 94, 49, .7);\ outline: 2px solid rgba(216, 94, 49, .7);\
}\ }\
@ -3381,11 +3394,6 @@
.filtered {\ .filtered {\
text-decoration: line-through;\ text-decoration: line-through;\
}\ }\
\
/* Firefox bug: hidden tables are not hidden. fixed in 9.0 */\
[hidden] {\
display: none;\
}\
\ \
#files > input {\ #files > input {\
display: block;\ display: block;\

View File

@ -1,5 +1,6 @@
master master
- mayhem - mayhem
hide original posts from inlined backlinks - optional
enable autoposting when submitting a captcha while on cooldown enable autoposting when submitting a captcha while on cooldown
fix caret position when quoting on Opera fix caret position when quoting on Opera

View File

@ -46,6 +46,7 @@ config =
'Quote Preview': [true, 'Show quote content on hover'] 'Quote Preview': [true, 'Show quote content on hover']
'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes'] 'Indicate OP quote': [true, 'Add \'(OP)\' to OP quotes']
'Indicate Cross-thread Quotes': [true, 'Add \'(Cross-thread)\' to cross-threads quotes'] 'Indicate Cross-thread Quotes': [true, 'Add \'(Cross-thread)\' to cross-threads quotes']
'Forward Hiding': [true, 'Hide original posts of inlined backlinks']
filter: filter:
name: '' name: ''
tripcode: '' tripcode: ''
@ -1929,8 +1930,7 @@ quoteInline =
e.preventDefault() e.preventDefault()
id = @hash[1..] id = @hash[1..]
if /\binlined\b/.test @className if /\binlined\b/.test @className
# remove the corresponding table or loading td quoteInline.rm @, id
$.rm $.x "following::*[@id='i#{id}']", @
else else
return if $.x "ancestor::*[@id='#{id}']", @ return if $.x "ancestor::*[@id='#{id}']", @
quoteInline.add @, id quoteInline.add @, id
@ -1942,6 +1942,7 @@ quoteInline =
inline = quoteInline.table id, el.innerHTML inline = quoteInline.table id, el.innerHTML
if /\bbacklink\b/.test q.className if /\bbacklink\b/.test q.className
$.after q.parentNode, inline $.after q.parentNode, inline
$.addClass $.x('ancestor::table', el), 'forwarded' if conf['Forward Hiding']
return return
$.after root, inline $.after root, inline
else else
@ -1954,6 +1955,16 @@ quoteInline =
threadID = pathname.split('/').pop() threadID = pathname.split('/').pop()
$.cache pathname, (-> quoteInline.parse @, pathname, id, threadID, inline) $.cache pathname, (-> quoteInline.parse @, pathname, id, threadID, inline)
rm: (q, id) ->
#select the corresponding table or loading td
table = $.x "following::*[@id='i#{id}']", q
$.rm table
return unless conf['Forward Hiding']
for inlined in $$ '.backlink.inlined', table
$.removeClass $.x('ancestor::table', $.id inlined.hash[1..]), 'forwarded'
if /\bbacklink\b/.test q.className
$.removeClass $.x('ancestor::table', $.id id), 'forwarded'
parse: (req, pathname, id, threadID, inline) -> parse: (req, pathname, id, threadID, inline) ->
return unless inline.parentNode return unless inline.parentNode
@ -2526,9 +2537,6 @@ Main =
css: ' css: '
/* dialog styling */ /* dialog styling */
a[href="javascript:;"] {
text-decoration: none;
}
div.dialog { div.dialog {
border: 1px solid; border: 1px solid;
} }
@ -2538,6 +2546,17 @@ Main =
label, a, .favicon, #qr img { label, a, .favicon, #qr img {
cursor: pointer; cursor: pointer;
} }
a[href="javascript:;"] {
text-decoration: none;
}
[hidden], /* Firefox bug: hidden tables are not hidden. fixed in 9.0 */
.thread.stub > :not(.block),
#content > [name=tab]:not(:checked) + div,
#updater:not(:hover) > :not(.move),
#qp > input, #qp .inline, .forwarded {
display: none;
}
.new { .new {
background: lime; background: lime;
@ -2555,10 +2574,6 @@ Main =
vertical-align: top; vertical-align: top;
} }
div.thread.stub > *:not(.block) {
display: none;
}
.filesize + br + a { .filesize + br + a {
float: left; float: left;
pointer-events: none; pointer-events: none;
@ -2621,9 +2636,6 @@ Main =
#options label { #options label {
text-decoration: underline; text-decoration: underline;
} }
#options [name=tab]:not(:checked) + * {
display: none;
}
#content > div { #content > div {
height: 450px; height: 450px;
overflow: auto; overflow: auto;
@ -2690,9 +2702,6 @@ Main =
border: none; border: none;
background: transparent; background: transparent;
} }
#updater:not(:hover) > div:not(.move) {
display: none;
}
#stats { #stats {
border: none; border: none;
@ -2722,9 +2731,6 @@ Main =
border: 1px solid; border: 1px solid;
padding-bottom: 5px; padding-bottom: 5px;
} }
#qp input, #qp .inline {
display: none;
}
.qphl { .qphl {
outline: 2px solid rgba(216, 94, 49, .7); outline: 2px solid rgba(216, 94, 49, .7);
} }
@ -2742,11 +2748,6 @@ Main =
text-decoration: line-through; text-decoration: line-through;
} }
/* Firefox bug: hidden tables are not hidden. fixed in 9.0 */
[hidden] {
display: none;
}
#files > input { #files > input {
display: block; display: block;
} }