From 0dcf24acc10e7ad52bf47c39faf14b118fd1566d Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Wed, 24 Jul 2013 12:41:40 +0200 Subject: [PATCH 1/2] [ticket/8228] Fix whitespaces before code in Firefox Based on the "[code] enhancements" modification by TerraFrost PHPBB3-8228 --- phpBB/styles/prosilver/template/bbcode.html | 4 ++-- phpBB/styles/prosilver/template/forum_fn.js | 5 +++-- phpBB/styles/prosilver/theme/colours.css | 2 +- phpBB/styles/prosilver/theme/content.css | 2 +- phpBB/styles/subsilver2/template/bbcode.html | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/phpBB/styles/prosilver/template/bbcode.html b/phpBB/styles/prosilver/template/bbcode.html index c0c0a2da46..460d102c28 100644 --- a/phpBB/styles/prosilver/template/bbcode.html +++ b/phpBB/styles/prosilver/template/bbcode.html @@ -12,8 +12,8 @@
-
{L_CODE}{L_COLON} {L_SELECT_ALL_CODE}
-
+
{L_CODE}{L_COLON} {L_SELECT_ALL_CODE}

+
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index eccb12e827..42a68a2ef5 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -187,7 +187,7 @@ function displayBlocks(c, e, t) { function selectCode(a) { // Get ID of code block - var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0]; + var e = a.parentNode.parentNode.getElementsByTagName('PRE')[0]; var s, r; // Not IE and IE9+ @@ -205,7 +205,8 @@ function selectCode(a) { } r = document.createRange(); - r.selectNodeContents(e); + r.setStart(e.firstChild, 0); + r.setEnd(e.lastChild, e.lastChild.textContent.length); s.removeAllRanges(); s.addRange(r); } diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 7d0462be1b..801d607d9c 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -479,7 +479,7 @@ dl.codebox dt { border-bottom-color: #CCCCCC; } -dl.codebox code { +dl.codebox pre { color: #2E8B57; } diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 4b8c972697..0cab12910b 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -491,7 +491,7 @@ blockquote dl.codebox { margin-left: 0; } -dl.codebox code { +dl.codebox pre { /* Also see tweaks.css */ overflow: auto; display: block; diff --git a/phpBB/styles/subsilver2/template/bbcode.html b/phpBB/styles/subsilver2/template/bbcode.html index efcf5e1acb..5558716cad 100644 --- a/phpBB/styles/subsilver2/template/bbcode.html +++ b/phpBB/styles/subsilver2/template/bbcode.html @@ -21,11 +21,11 @@ -
{L_CODE}{L_COLON}
+
{L_CODE}{L_COLON}
 
 
 
-
+ From 95c603d545ade8ab37e81fd99f2b62765a54bcb0 Mon Sep 17 00:00:00 2001 From: Oliver Schramm Date: Tue, 30 Jul 2013 18:00:47 +0200 Subject: [PATCH 2/2] [ticket/8228] Fix still existing problems with code in firefox A user of a board mentioned that there are still some problems in firefox if php-highlighting is on. So I used a snippet which they worked on for weeks. Link to the snippet (in german): http://www.ongray-design.de/forum/viewtopic.php?t=541 PHPBB3-8228 --- phpBB/styles/prosilver/template/bbcode.html | 4 ++-- phpBB/styles/prosilver/template/forum_fn.js | 5 ++--- phpBB/styles/prosilver/theme/bidi.css | 2 +- phpBB/styles/prosilver/theme/colours.css | 6 +++--- phpBB/styles/prosilver/theme/content.css | 8 ++++---- phpBB/styles/prosilver/theme/print.css | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/phpBB/styles/prosilver/template/bbcode.html b/phpBB/styles/prosilver/template/bbcode.html index 460d102c28..909c09df5a 100644 --- a/phpBB/styles/prosilver/template/bbcode.html +++ b/phpBB/styles/prosilver/template/bbcode.html @@ -12,8 +12,8 @@
-
{L_CODE}{L_COLON} {L_SELECT_ALL_CODE}

-
+

{L_CODE}{L_COLON} {L_SELECT_ALL_CODE}

+
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 42a68a2ef5..eccb12e827 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -187,7 +187,7 @@ function displayBlocks(c, e, t) { function selectCode(a) { // Get ID of code block - var e = a.parentNode.parentNode.getElementsByTagName('PRE')[0]; + var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0]; var s, r; // Not IE and IE9+ @@ -205,8 +205,7 @@ function selectCode(a) { } r = document.createRange(); - r.setStart(e.firstChild, 0); - r.setEnd(e.lastChild, e.lastChild.textContent.length); + r.selectNodeContents(e); s.removeAllRanges(); s.addRange(r); } diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index f617428565..a921805327 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -422,7 +422,7 @@ margin-left: 0; } -.rtl blockquote dl.codebox { +.rtl blockquote .codebox { margin-right: 0; } diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index 801d607d9c..5548905ede 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -470,16 +470,16 @@ blockquote blockquote blockquote { } /* Code block */ -dl.codebox { +.codebox { background-color: #FFFFFF; border-color: #C9D2D8; } -dl.codebox dt { +.codebox p { border-bottom-color: #CCCCCC; } -dl.codebox pre { +.codebox code { color: #2E8B57; } diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 0cab12910b..c56c7f9ef8 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -472,13 +472,13 @@ blockquote.uncited { } /* Code block */ -dl.codebox { +.codebox { padding: 3px; border: 1px solid transparent; font-size: 1em; } -dl.codebox dt { +.codebox p { text-transform: uppercase; border-bottom: 1px solid transparent; margin-bottom: 3px; @@ -487,11 +487,11 @@ dl.codebox dt { display: block; } -blockquote dl.codebox { +blockquote .codebox { margin-left: 0; } -dl.codebox pre { +.codebox code { /* Also see tweaks.css */ overflow: auto; display: block; diff --git a/phpBB/styles/prosilver/theme/print.css b/phpBB/styles/prosilver/theme/print.css index bc3ca80fdc..88de620493 100644 --- a/phpBB/styles/prosilver/theme/print.css +++ b/phpBB/styles/prosilver/theme/print.css @@ -136,4 +136,4 @@ div.spacer { clear: both; } /* Accessibility tweaks: Mozilla.org */ .skip_link { display: none; } -dl.codebox dt { display: none; } +.codebox p { display: none; }