From 034648a5df2222c4cc09816b61893503ed366d2f Mon Sep 17 00:00:00 2001 From: James Campos Date: Thu, 2 Feb 2012 02:28:11 -0800 Subject: [PATCH] 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()