Merge branch 'ticket/jellydoughnut/9499' into develop-olympus

* ticket/jellydoughnut/9499:
  [ticket/9499] Unify definition of dE() and other javascript functions
This commit is contained in:
Andreas Fischer 2010-07-31 02:10:00 +02:00
commit f179987f64
3 changed files with 22 additions and 11 deletions

View file

@ -46,7 +46,11 @@ function initInsertions()
{ {
textarea.focus(); textarea.focus();
baseHeight = doc.selection.createRange().duplicate().boundingHeight; 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(/&lt\;/ig, '<'); theSelection = theSelection.replace(/&lt\;/ig, '<');
theSelection = theSelection.replace(/&gt\;/ig, '>'); theSelection = theSelection.replace(/&gt\;/ig, '>');
theSelection = theSelection.replace(/&amp\;/ig, '&'); theSelection = theSelection.replace(/&amp\;/ig, '&');
theSelection = theSelection.replace(/&nbsp\;/ig, ' ');
} }
else if (document.all) else if (document.all)
{ {
@ -273,8 +278,8 @@ function mozWrap(txtarea, open, close)
var s3 = (txtarea.value).substring(selEnd, selLength); var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3; txtarea.value = s1 + open + s2 + close + s3;
txtarea.selectionStart = selEnd + open.length + close.length; txtarea.selectionStart = selStart + open.length;
txtarea.selectionEnd = txtarea.selectionStart; txtarea.selectionEnd = selEnd + open.length;
txtarea.focus(); txtarea.focus();
txtarea.scrollTop = scrollTop; txtarea.scrollTop = scrollTop;
@ -327,8 +332,8 @@ function colorPalette(dir, width, height)
for (b = 0; b < 5; b++) for (b = 0; b < 5; b++)
{ {
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
document.write('<td bgcolor="#' + color + '">'); document.write('<td bgcolor="#' + color + '" style="width: ' + width + 'px; height: ' + height + 'px;">');
document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;" onmouseover="helpline(\'s\');" onmouseout="helpline(\'tip\');"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>'); document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
document.writeln('</td>'); document.writeln('</td>');
} }

View file

@ -98,16 +98,21 @@ function viewableArea(e, itself)
/** /**
* Set display of page element * Set display of page element
* s[-1,0,1] = hide,toggle display,show * 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) 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';
} }
/** /**

View file

@ -240,6 +240,7 @@ function addquote(post_id, username, l_wrote)
theSelection = theSelection.replace(/&lt\;/ig, '<'); theSelection = theSelection.replace(/&lt\;/ig, '<');
theSelection = theSelection.replace(/&gt\;/ig, '>'); theSelection = theSelection.replace(/&gt\;/ig, '>');
theSelection = theSelection.replace(/&amp\;/ig, '&'); theSelection = theSelection.replace(/&amp\;/ig, '&');
theSelection = theSelection.replace(/&nbsp\;/ig, ' ');
} }
else if (document.all) else if (document.all)
{ {
@ -387,8 +388,8 @@ function colorPalette(dir, width, height)
for (b = 0; b < 5; b++) for (b = 0; b < 5; b++)
{ {
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
document.write('<td bgcolor="#' + color + '">'); document.write('<td bgcolor="#' + color + '" style="width: ' + width + 'px; height: ' + height + 'px;">');
document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;" onmouseover="helpline(\'s\');" onmouseout="helpline(\'tip\');"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>'); document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
document.writeln('</td>'); document.writeln('</td>');
} }