diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2006-10-29 15:13:01 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2006-10-29 15:13:01 +0000 |
commit | 49f6f3bf71daf78f75c731db626a40f2284838b2 (patch) | |
tree | e0b0bc296e48cd530449c151daade3c9bb833f60 | |
parent | 7992505881073aff0bbdce49301eca2c5dd3fc1b (diff) | |
download | brdo-49f6f3bf71daf78f75c731db626a40f2284838b2.tar.gz brdo-49f6f3bf71daf78f75c731db626a40f2284838b2.tar.bz2 |
Color.module tweaks:
- Remove tab characters
- Make sure GD2 is present before doing magic.
- Add requirement check for GD2
- Fix broken .png file
-rw-r--r-- | misc/farbtastic/farbtastic.js | 44 | ||||
-rw-r--r-- | modules/color/color.module | 16 | ||||
-rw-r--r-- | modules/system/system.install | 5 | ||||
-rw-r--r-- | modules/system/system.module | 8 | ||||
-rw-r--r-- | themes/garland/minnelli/color/base.png | bin | 31169 -> 30077 bytes | |||
-rw-r--r-- | themes/garland/minnelli/color/preview.png | bin | 199434 -> 23895 bytes |
6 files changed, 41 insertions, 32 deletions
diff --git a/misc/farbtastic/farbtastic.js b/misc/farbtastic/farbtastic.js index 361179b75..999230d91 100644 --- a/misc/farbtastic/farbtastic.js +++ b/misc/farbtastic/farbtastic.js @@ -174,16 +174,16 @@ jQuery._farbtastic = function (container, callback) { // Get coordinates relative to color picker center var pos = fb.widgetCoords(event); - // Set new HSL parameters + // Set new HSL parameters if (fb.circleDrag) { - var hue = Math.atan2(pos.x, -pos.y) / 6.28; - if (hue < 0) hue += 1; - fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]); + var hue = Math.atan2(pos.x, -pos.y) / 6.28; + if (hue < 0) hue += 1; + fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]); } else { - var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5)); - var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5)); - fb.setHSL([fb.hsl[0], sat, lum]); + var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5)); + var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5)); + fb.setHSL([fb.hsl[0], sat, lum]); } return false; } @@ -257,20 +257,20 @@ jQuery._farbtastic = function (container, callback) { var g = Math.round(rgb[1] * 255); var b = Math.round(rgb[2] * 255); return '#' + (r < 16 ? '0' : '') + r.toString(16) + - (g < 16 ? '0' : '') + g.toString(16) + - (b < 16 ? '0' : '') + b.toString(16); + (g < 16 ? '0' : '') + g.toString(16) + + (b < 16 ? '0' : '') + b.toString(16); } fb.unpack = function (color) { if (color.length == 7) { - return [parseInt('0x' + color.substring(1, 3)) / 255, - parseInt('0x' + color.substring(3, 5)) / 255, - parseInt('0x' + color.substring(5, 7)) / 255]; + return [parseInt('0x' + color.substring(1, 3)) / 255, + parseInt('0x' + color.substring(3, 5)) / 255, + parseInt('0x' + color.substring(5, 7)) / 255]; } else if (color.length == 4) { - return [parseInt('0x' + color.substring(1, 2)) / 15, - parseInt('0x' + color.substring(2, 3)) / 15, - parseInt('0x' + color.substring(3, 4)) / 15]; + return [parseInt('0x' + color.substring(1, 2)) / 15, + parseInt('0x' + color.substring(2, 3)) / 15, + parseInt('0x' + color.substring(3, 4)) / 15]; } } @@ -280,8 +280,8 @@ jQuery._farbtastic = function (container, callback) { m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s; m1 = l * 2 - m2; return [this.hueToRGB(m1, m2, h+0.33333), - this.hueToRGB(m1, m2, h), - this.hueToRGB(m1, m2, h-0.33333)]; + this.hueToRGB(m1, m2, h), + this.hueToRGB(m1, m2, h-0.33333)]; } fb.hueToRGB = function (m1, m2, h) { @@ -301,14 +301,14 @@ jQuery._farbtastic = function (container, callback) { l = (min + max) / 2; s = 0; if (l > 0 && l < 1) { - s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l)); + s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l)); } h = 0; if (delta > 0) { - if (max == r && max != g) h += (g - b) / delta; - if (max == g && max != b) h += (2 + (b - r) / delta); - if (max == b && max != r) h += (4 + (r - g) / delta); - h /= 6; + if (max == r && max != g) h += (g - b) / delta; + if (max == g && max != b) h += (2 + (b - r) / delta); + if (max == b && max != r) h += (4 + (r - g) / delta); + h /= 6; } return [h, s, l]; } diff --git a/modules/color/color.module b/modules/color/color.module index 5b3b3ce71..e0253e74c 100644 --- a/modules/color/color.module +++ b/modules/color/color.module @@ -6,7 +6,7 @@ */ function color_form_alter($form_id, &$form) { // Insert the color changer into the theme settings page. - if ($form_id == 'system_theme_settings' && color_get_info(arg(4))) { + if ($form_id == 'system_theme_settings' && color_get_info(arg(4)) && function_exists('gd_info')) { $form['color'] = array( '#type' => 'fieldset', '#title' => t('Color scheme'), @@ -502,8 +502,8 @@ function _color_hsl2rgb($hsl) { $m2 = ($l <= 0.5) ? $l * ($s + 1) : $l + $s - $l*$s; $m1 = $l * 2 - $m2; return array(_color_hue2rgb($m1, $m2, $h + 0.33333), - _color_hue2rgb($m1, $m2, $h), - _color_hue2rgb($m1, $m2, $h - 0.33333)); + _color_hue2rgb($m1, $m2, $h), + _color_hue2rgb($m1, $m2, $h - 0.33333)); } /** @@ -530,14 +530,14 @@ function _color_rgb2hsl($rgb) { $l = ($min + $max) / 2; $s = 0; if ($l > 0 && $l < 1) { - $s = $delta / ($l < 0.5 ? (2 * $l) : (2 - 2 * $l)); + $s = $delta / ($l < 0.5 ? (2 * $l) : (2 - 2 * $l)); } $h = 0; if ($delta > 0) { - if ($max == $r && $max != $g) $h += ($g - $b) / $delta; - if ($max == $g && $max != $b) $h += (2 + ($b - $r) / $delta); - if ($max == $b && $max != $r) $h += (4 + ($r - $g) / $delta); - $h /= 6; + if ($max == $r && $max != $g) $h += ($g - $b) / $delta; + if ($max == $g && $max != $b) $h += (2 + ($b - $r) / $delta); + if ($max == $b && $max != $r) $h += (4 + ($r - $g) / $delta); + $h /= 6; } return array($h, $s, $l); }
\ No newline at end of file diff --git a/modules/system/system.install b/modules/system/system.install index c94a05234..7980c1272 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -19,7 +19,8 @@ function system_requirements($phase) { $requirements['drupal'] = array( 'title' => $t('Drupal'), 'value' => VERSION, - 'severity' => REQUIREMENT_INFO + 'severity' => REQUIREMENT_INFO, + 'weight' => -10, ); } @@ -27,7 +28,7 @@ function system_requirements($phase) { $software = $_SERVER['SERVER_SOFTWARE']; $requirements['webserver'] = array( 'title' => $t('Web server'), - 'value' => $software + 'value' => $software, ); // Use server info string, if present. if ($software && preg_match('![0-9]!', $software)) { diff --git a/modules/system/system.module b/modules/system/system.module index 0789d8841..ac3e743b1 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -1793,6 +1793,7 @@ function system_status($check = FALSE) { // Check run-time requirements and status information $requirements = module_invoke_all('requirements', 'runtime'); + usort($requirements, '_system_sort_requirements'); if ($check) { return drupal_requirements_severity($requirements) == REQUIREMENT_ERROR; @@ -1802,6 +1803,13 @@ function system_status($check = FALSE) { } /** + * Helper function to sort requirements. + */ +function _system_sort_requirements($a, $b) { + return (isset($a['weight']) || isset($b['weight'])) ? $a['weight'] - $b['weight'] : strcmp($a['title'], $b['title']); +} + +/** * Theme status report */ function theme_status_report(&$requirements) { diff --git a/themes/garland/minnelli/color/base.png b/themes/garland/minnelli/color/base.png Binary files differindex 17974b8f7..ef1df365e 100644 --- a/themes/garland/minnelli/color/base.png +++ b/themes/garland/minnelli/color/base.png diff --git a/themes/garland/minnelli/color/preview.png b/themes/garland/minnelli/color/preview.png Binary files differindex 51012b3de..b7e9a1ac5 100644 --- a/themes/garland/minnelli/color/preview.png +++ b/themes/garland/minnelli/color/preview.png |