From 488030543607b23940cd97ecc44fba047174173d Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Mon, 26 Jul 2010 13:25:13 -0500 Subject: [PATCH] [ticket/9499] Unify definition of dE() and other javascript functions dE() was defined differently in the ACP and in prosilver. Other javascript in editor.js files has also been unified (taking the prosilver implementation as cannonical) PHPBB3-9499 --- phpBB/adm/style/editor.js | 15 ++++++++++----- phpBB/styles/prosilver/template/forum_fn.js | 13 +++++++++---- phpBB/styles/subsilver2/template/editor.js | 5 +++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/phpBB/adm/style/editor.js b/phpBB/adm/style/editor.js index 7e3ce1c708..217aa699e2 100644 --- a/phpBB/adm/style/editor.js +++ b/phpBB/adm/style/editor.js @@ -46,7 +46,11 @@ function initInsertions() { textarea.focus(); baseHeight = doc.selection.createRange().duplicate().boundingHeight; - // document.body.focus(); + + if (!document.forms[form_name]) + { + document.body.focus(); + } } } @@ -230,6 +234,7 @@ function addquote(post_id, username) theSelection = theSelection.replace(/<\;/ig, '<'); theSelection = theSelection.replace(/>\;/ig, '>'); theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/ \;/ig, ' '); } else if (document.all) { @@ -273,8 +278,8 @@ function mozWrap(txtarea, open, close) var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + open + s2 + close + s3; - txtarea.selectionStart = selEnd + open.length + close.length; - txtarea.selectionEnd = txtarea.selectionStart; + txtarea.selectionStart = selStart + open.length; + txtarea.selectionEnd = selEnd + open.length; txtarea.focus(); txtarea.scrollTop = scrollTop; @@ -327,8 +332,8 @@ function colorPalette(dir, width, height) for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); - document.write(''); - document.write('#' + color + ''); + document.write(''); + document.write('#' + color + ''); document.writeln(''); } diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 6fb3778952..4a85858df5 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -98,16 +98,21 @@ function viewableArea(e, itself) /** * Set display of page element * s[-1,0,1] = hide,toggle display,show +* type = string: inline, block, inline-block or other CSS "display" type */ -function dE(n, s) +function dE(n, s, type) { - var e = document.getElementById(n); + if (!type) + { + type = 'block'; + } + var e = document.getElementById(n); if (!s) { - s = (e.style.display == '' || e.style.display == 'block') ? -1 : 1; + s = (e.style.display == '' || e.style.display == type) ? -1 : 1; } - e.style.display = (s == 1) ? 'block' : 'none'; + e.style.display = (s == 1) ? type : 'none'; } /** diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index e340bc74b5..cd22812bab 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -240,6 +240,7 @@ function addquote(post_id, username, l_wrote) theSelection = theSelection.replace(/<\;/ig, '<'); theSelection = theSelection.replace(/>\;/ig, '>'); theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/ \;/ig, ' '); } else if (document.all) { @@ -387,8 +388,8 @@ function colorPalette(dir, width, height) for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); - document.write(''); - document.write('#' + color + ''); + document.write(''); + document.write('#' + color + ''); document.writeln(''); }