aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/styles/prosilver
diff options
context:
space:
mode:
authorVjacheslav Trushkin <cyberalien@gmail.com>2013-04-12 16:40:32 +0300
committerVjacheslav Trushkin <cyberalien@gmail.com>2013-04-12 16:40:32 +0300
commitfafbce8124e27448164a0a68ef5a8420114309ad (patch)
tree45d60411c177f79dff728f22a00d960bc2726fb3 /phpBB/styles/prosilver
parentc25dfef770e440dec9f1d1eeb71e5ef8c3ffbb66 (diff)
downloadforums-fafbce8124e27448164a0a68ef5a8420114309ad.tar
forums-fafbce8124e27448164a0a68ef5a8420114309ad.tar.gz
forums-fafbce8124e27448164a0a68ef5a8420114309ad.tar.bz2
forums-fafbce8124e27448164a0a68ef5a8420114309ad.tar.xz
forums-fafbce8124e27448164a0a68ef5a8420114309ad.zip
[ticket/11275] Do not use document.write() for color palette
Replace document.write() for color palette function PHPBB3-11275
Diffstat (limited to 'phpBB/styles/prosilver')
-rw-r--r--phpBB/styles/prosilver/template/editor.js44
-rw-r--r--phpBB/styles/prosilver/template/posting_buttons.html39
2 files changed, 44 insertions, 39 deletions
diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js
index 93506b8d4a..9e5665de99 100644
--- a/phpBB/styles/prosilver/template/editor.js
+++ b/phpBB/styles/prosilver/template/editor.js
@@ -298,9 +298,12 @@ function storeCaret(textEl) {
* Color pallette
*/
function colorPalette(dir, width, height) {
- var r = 0, g = 0, b = 0;
- var numberList = new Array(6);
- var color = '';
+ var r = 0,
+ g = 0,
+ b = 0,
+ numberList = new Array(6);
+ color = '',
+ html = '';
numberList[0] = '00';
numberList[1] = '40';
@@ -308,37 +311,46 @@ function colorPalette(dir, width, height) {
numberList[3] = 'BF';
numberList[4] = 'FF';
- document.writeln('<table cellspacing="1" cellpadding="0" border="0">');
+ html += '<table cellspacing="1" cellpadding="0" border="0">';
for (r = 0; r < 5; r++) {
- if (dir === 'h') {
- document.writeln('<tr>');
+ if (dir == 'h') {
+ html += '<tr>';
}
for (g = 0; g < 5; g++) {
- if (dir === 'v') {
- document.writeln('<tr>');
+ if (dir == 'v') {
+ html += '<tr>';
}
for (b = 0; b < 5; b++) {
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
- document.write('<td bgcolor="#' + color + '" style="width: ' + width + 'px; height: ' + height + 'px;">');
- 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>');
+ html += '<td bgcolor="#' + color + '" style="width: ' + width + 'px; height: ' + height + 'px;">';
+ html += '<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>';
+ html += '</td>';
}
- if (dir === 'v') {
- document.writeln('</tr>');
+ if (dir == 'v') {
+ html += '</tr>';
}
}
- if (dir === 'h') {
- document.writeln('</tr>');
+ if (dir == 'h') {
+ html += '</tr>';
}
}
- document.writeln('</table>');
+ html += '</table>';
+ return html;
}
+(function($) {
+ $(document).ready(function() {
+ $('#color_palette_placeholder').each(function() {
+ $(this).html(colorPalette('h', 15, 10));
+ });
+ });
+})(jQuery);
+
/**
* Caret Position object
*/
diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html
index 8e87407757..fadbc9b3ca 100644
--- a/phpBB/styles/prosilver/template/posting_buttons.html
+++ b/phpBB/styles/prosilver/template/posting_buttons.html
@@ -35,37 +35,30 @@
var panels = new Array('options-panel', 'attach-panel', 'poll-panel');
var show_panel = 'options-panel';
+ function change_palette()
+ {
+ dE('colour_palette');
+ e = document.getElementById('colour_palette');
+
+ if (e.style.display == 'block')
+ {
+ document.getElementById('bbpalette').value = '{LA_FONT_COLOR_HIDE}';
+ }
+ else
+ {
+ document.getElementById('bbpalette').value = '{LA_FONT_COLOR}';
+ }
+ }
// ]]>
</script>
-<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/editor.js"></script>
+<!-- INCLUDEJS template/editor.js -->
<!-- IF S_BBCODE_ALLOWED -->
<div id="colour_palette" style="display: none;">
<dl style="clear: left;">
<dt><label>{L_FONT_COLOR}{L_COLON}</label></dt>
- <dd>
- <script type="text/javascript">
- // <![CDATA[
- function change_palette()
- {
- dE('colour_palette');
- e = document.getElementById('colour_palette');
-
- if (e.style.display == 'block')
- {
- document.getElementById('bbpalette').value = '{LA_FONT_COLOR_HIDE}';
- }
- else
- {
- document.getElementById('bbpalette').value = '{LA_FONT_COLOR}';
- }
- }
-
- colorPalette('h', 15, 10);
- // ]]>
- </script>
- </dd>
+ <dd id="color_palette_placeholder"></dd>
</dl>
</div>