From 034648a5df2222c4cc09816b61893503ed366d2f Mon Sep 17 00:00:00 2001 From: James Campos Date: Thu, 2 Feb 2012 02:28:11 -0800 Subject: [PATCH 1/3] fix #161 --- 4chan_x.user.js | 15 ++++++++++++--- changelog | 2 ++ script.coffee | 16 +++++++++++++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index cd8480063..72f457cf7 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1202,7 +1202,6 @@ init: function() { var h1, iframe; if (!$.id('recaptcha_challenge_field_holder')) return; - $('form[name=post]').hidden = true; h1 = $.el('h1', { innerHTML: 'Open the Quick Reply' }); @@ -3483,6 +3482,8 @@ if (conf['Quote Backlinks']) quoteBacklink.init(); if (conf['Indicate OP quote']) quoteOP.init(); if (conf['Indicate Cross-thread Quotes']) quoteDR.init(); + if (conf['Quick Reply']) Main.css += 'form[name=post] { display: none; }'; + Main.addStyle(); return $.ready(Main.ready); }, ready: function() { @@ -3493,7 +3494,6 @@ } if (!$.id('navtopr')) return; $.addClass(d.body, engine); - $.addStyle(Main.css); threading.init(); Favicon.init(); if (conf['Quick Reply']) qr.init(); @@ -3528,6 +3528,14 @@ } return $.on(form, 'DOMNodeInserted', Main.node); }, + addStyle: function() { + $.off(d, 'DOMNodeInserted', Main.addStyle); + if (d.head) { + return $.addStyle(Main.css); + } else { + return $.on(d, 'DOMNodeInserted', Main.addStyle); + } + }, message: function(e) { var data, version; data = e.data; @@ -3881,7 +3889,8 @@ img[md5], img[md5] + img {\ }\ .filtered {\ text-decoration: line-through;\ -}' +}\ +' }; Main.init(); diff --git a/changelog b/changelog index 462108b6a..a9fdab8ec 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ master +- aeosynth + prevent post form flicker 2.25.3 - Mayhem diff --git a/script.coffee b/script.coffee index 2e236083c..4b06573ef 100644 --- a/script.coffee +++ b/script.coffee @@ -862,7 +862,6 @@ nav = qr = init: -> return unless $.id 'recaptcha_challenge_field_holder' - $('form[name=post]').hidden = true h1 = $.el 'h1' innerHTML: 'Open the Quick Reply' $.on $('a', h1), 'click', qr.open @@ -2711,6 +2710,10 @@ Main = if conf['Indicate Cross-thread Quotes'] quoteDR.init() + if conf['Quick Reply'] + Main.css += 'form[name=post] { display: none; }' + + Main.addStyle() $.ready Main.ready @@ -2721,7 +2724,6 @@ Main = if not $.id 'navtopr' return $.addClass d.body, engine - $.addStyle Main.css threading.init() Favicon.init() @@ -2778,6 +2780,13 @@ Main = alert err $.on form, 'DOMNodeInserted', Main.node + addStyle: -> + $.off d, 'DOMNodeInserted', Main.addStyle + if d.head + $.addStyle Main.css + else # XXX fox + $.on d, 'DOMNodeInserted', Main.addStyle + message: (e) -> {data} = e {version} = data @@ -3122,6 +3131,7 @@ img[md5], img[md5] + img { } .filtered { text-decoration: line-through; -}' +} +' Main.init() From 5d3daaf72ea3113b3ba42979e43a016ee3b8c721 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 5 Feb 2012 01:49:28 -0800 Subject: [PATCH 2/3] work with new setting --- 4chan_x.user.js | 4 +++- script.coffee | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 8b9bd0056..ac68029b1 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3494,7 +3494,9 @@ if (conf['Quote Backlinks']) quoteBacklink.init(); if (conf['Indicate OP quote']) quoteOP.init(); if (conf['Indicate Cross-thread Quotes']) quoteDR.init(); - if (conf['Quick Reply']) Main.css += 'form[name=post] { display: none; }'; + if (conf['Quick Reply'] && conf['Hide Original Post Form']) { + Main.css += 'form[name=post] { display: none; }'; + } Main.addStyle(); return $.ready(Main.ready); }, diff --git a/script.coffee b/script.coffee index 45b5d1d82..a356822b3 100644 --- a/script.coffee +++ b/script.coffee @@ -2730,7 +2730,7 @@ Main = if conf['Indicate Cross-thread Quotes'] quoteDR.init() - if conf['Quick Reply'] + if conf['Quick Reply'] and conf['Hide Original Post Form'] Main.css += 'form[name=post] { display: none; }' Main.addStyle() From 11f6dcfd24c28c26cb59db0981962dafc8878ce8 Mon Sep 17 00:00:00 2001 From: James Campos Date: Sun, 5 Feb 2012 01:55:27 -0800 Subject: [PATCH 3/3] don't hide form twice --- 4chan_x.user.js | 1 - script.coffee | 1 - 2 files changed, 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index ac68029b1..8fca7d626 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1204,7 +1204,6 @@ }); $.on($('a', link), 'click', qr.open); form = d.forms[0]; - form.hidden = true; $.before(form, link); } g.callbacks.push(function(root) { diff --git a/script.coffee b/script.coffee index a356822b3..6d7a7f3ef 100644 --- a/script.coffee +++ b/script.coffee @@ -871,7 +871,6 @@ qr = link = $.el 'h1', innerHTML: "#{if g.REPLY then 'Open the Quick Reply' else 'Create a New Thread'}" $.on $('a', link), 'click', qr.open form = d.forms[0] - form.hidden = true $.before form, link g.callbacks.push (root) -> $.on $('.quotejs + .quotejs', root), 'click', qr.quote