diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html
index a77010b636..925d24f3a3 100644
--- a/phpBB/adm/style/acp_groups.html
+++ b/phpBB/adm/style/acp_groups.html
@@ -92,7 +92,12 @@
{L_GROUP_COLOR_EXPLAIN}
- - [ {L_COLOUR_SWATCH} ]
+ -
+
+
+ [ {L_COLOUR_SWATCH} ]
+
+
diff --git a/phpBB/adm/style/acp_users_signature.html b/phpBB/adm/style/acp_users_signature.html
index cfcab155bd..0a04c411d2 100644
--- a/phpBB/adm/style/acp_users_signature.html
+++ b/phpBB/adm/style/acp_users_signature.html
@@ -86,7 +86,7 @@
- -
+
-
-
diff --git a/phpBB/adm/style/colour_swatch.html b/phpBB/adm/style/colour_swatch.html
deleted file mode 100644
index e692a8bd91..0000000000
--- a/phpBB/adm/style/colour_swatch.html
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-{L_COLOUR_SWATCH}
-
-
-
-
-
-
-
-
-
-
diff --git a/phpBB/adm/swatch.php b/phpBB/adm/swatch.php
deleted file mode 100644
index e9d46d65b5..0000000000
--- a/phpBB/adm/swatch.php
+++ /dev/null
@@ -1,50 +0,0 @@
-session_begin(false);
-$auth->acl($user->data);
-$user->setup();
-
-// Set custom template for admin area
-$template->set_custom_style('adm', $phpbb_admin_path . 'style');
-
-$template->set_filenames(array(
- 'body' => 'colour_swatch.html')
-);
-
-$form = request_var('form', '');
-$name = request_var('name', '');
-
-// We validate form and name here, only id/class allowed
-$form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form;
-$name = (!preg_match('/^[a-z0-9_-]+$/i', $name)) ? '' : $name;
-
-$template->assign_vars(array(
- 'OPENER' => $form,
- 'NAME' => $name,
- 'T_IMAGES_PATH' => "{$phpbb_root_path}images/",
-
- 'S_USER_LANG' => $user->lang['USER_LANG'],
- 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'],
- 'S_CONTENT_ENCODING' => 'UTF-8',
-));
-
-$template->display('body');
-
-garbage_collection();
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index a3a6d75dd2..69a09427fe 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -962,6 +962,93 @@ phpbb.registerDropdown = function(toggle, dropdown, options)
toggle.click(phpbb.toggleDropdown);
};
+/**
+* Get the HTML for a color palette table.
+*
+* @param string dir Palette direction - either v or h
+* @param int width Palette cell width.
+* @param int height Palette cell height.
+*/
+phpbb.colorPalette = function(dir, width, height) {
+ var r = 0,
+ g = 0,
+ b = 0,
+ numberList = new Array(6),
+ color = '',
+ html = '';
+
+ numberList[0] = '00';
+ numberList[1] = '40';
+ numberList[2] = '80';
+ numberList[3] = 'BF';
+ numberList[4] = 'FF';
+
+ html += '
';
+
+ for (r = 0; r < 5; r++) {
+ if (dir == 'h') {
+ html += '';
+ }
+
+ for (g = 0; g < 5; g++) {
+ if (dir == 'v') {
+ html += '
';
+ }
+
+ for (b = 0; b < 5; b++) {
+ color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
+ html += '';
+ html += '';
+ html += ' | ';
+ }
+
+ if (dir == 'v') {
+ html += '
';
+ }
+ }
+
+ if (dir == 'h') {
+ html += '';
+ }
+ }
+ html += '
';
+ return html;
+}
+
+/**
+* Register a color palette.
+*
+* @param object el jQuery object for the palette container.
+*/
+phpbb.registerPalette = function(el) {
+ var orientation = el.attr('data-orientation'),
+ height = el.attr('data-height'),
+ width = el.attr('data-width'),
+ target = el.attr('data-target'),
+ bbcode = el.attr('data-bbcode');
+
+ // Insert the palette HTML into the container.
+ el.html(phpbb.colorPalette(orientation, width, height));
+
+ // Add toggle control.
+ $('#color_palette_toggle').click(function(e) {
+ el.toggle();
+ e.preventDefault();
+ });
+
+ // Attach event handler when a palette cell is clicked.
+ $(el).on('click', 'a', function(e) {
+ var color = $(this).attr('data-color');
+
+ if (bbcode) {
+ bbfontstyle('[color=#' + color + ']', '[/color]');
+ } else {
+ $(target).val(color);
+ }
+ e.preventDefault();
+ });
+}
+
/**
* Apply code editor to all textarea elements with data-bbcode attribute
*/
@@ -977,6 +1064,10 @@ $(document).ready(function() {
$(phpbb.dropdownHandles).each(phpbb.toggleDropdown);
}
});
+
+ $('#color_palette_placeholder').each(function() {
+ phpbb.registerPalette($(this));
+ });
});
})(jQuery); // Avoid conflicts with other libraries
diff --git a/phpBB/assets/javascript/editor.js b/phpBB/assets/javascript/editor.js
index 418dd163aa..5222de9fee 100644
--- a/phpBB/assets/javascript/editor.js
+++ b/phpBB/assets/javascript/editor.js
@@ -294,67 +294,6 @@ function storeCaret(textEl) {
}
}
-/**
-* Color pallette
-*/
-function colorPalette(dir, width, height) {
- var r = 0,
- g = 0,
- b = 0,
- numberList = new Array(6),
- color = '',
- html = '';
-
- numberList[0] = '00';
- numberList[1] = '40';
- numberList[2] = '80';
- numberList[3] = 'BF';
- numberList[4] = 'FF';
-
- html += '';
-
- for (r = 0; r < 5; r++) {
- if (dir == 'h') {
- html += '';
- }
-
- for (g = 0; g < 5; g++) {
- if (dir == 'v') {
- html += '
';
- }
-
- for (b = 0; b < 5; b++) {
- color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
- html += '';
- html += '';
- html += ' | ';
- }
-
- if (dir == 'v') {
- html += '
';
- }
- }
-
- if (dir == 'h') {
- html += '';
- }
- }
- html += '
';
- return html;
-}
-
-(function($) {
- $(document).ready(function() {
- $('#color_palette_placeholder').each(function() {
- var orientation = $(this).attr('data-orientation'),
- height = $(this).attr('data-height'),
- width = $(this).attr('data-width');
-
- $(this).html(colorPalette(orientation, width, height));
- });
- });
-})(jQuery);
-
/**
* Caret Position object
*/
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 8f417e753c..c170c67d49 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -657,7 +657,6 @@ class acp_groups
'GROUP_HIDDEN' => $type_hidden,
'U_BACK' => $u_back,
- 'U_SWATCH' => append_sid("{$phpbb_admin_path}swatch.$phpEx", 'form=settings&name=group_colour'),
'U_ACTION' => "{$this->u_action}&action=$action&g=$group_id",
'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(),
));
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 32b27b55b4..716289eded 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -699,7 +699,6 @@ class ucp_groups
'GROUP_CLOSED' => $type_closed,
'GROUP_HIDDEN' => $type_hidden,
- 'U_SWATCH' => append_sid("{$phpbb_admin_path}swatch.$phpEx", 'form=ucp&name=group_colour'),
'S_UCP_ACTION' => $this->u_action . "&action=$action&g=$group_id",
'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(),
));
diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html
index aa269058cc..c5cdfad156 100644
--- a/phpBB/styles/prosilver/template/posting_buttons.html
+++ b/phpBB/styles/prosilver/template/posting_buttons.html
@@ -55,7 +55,7 @@
-
+
diff --git a/phpBB/styles/prosilver/template/ucp_groups_manage.html b/phpBB/styles/prosilver/template/ucp_groups_manage.html
index 019b5aa3e1..eb431e9f3f 100644
--- a/phpBB/styles/prosilver/template/ucp_groups_manage.html
+++ b/phpBB/styles/prosilver/template/ucp_groups_manage.html
@@ -54,7 +54,12 @@