The branch, master has been updated via 783892518ce82c32374a6a643396244eff4c0ad3 (commit) from 719d6dd9f0c634fe49c121b4775f77a6953a954b (commit)
- Log ----------------------------------------------------------------- commit 783892518ce82c32374a6a643396244eff4c0ad3 Author: Marc Delisle marc@infomarc.info Date: Thu Mar 25 13:27:58 2010 -0400
Replace MooRainbow with a jQuery color picker
-----------------------------------------------------------------------
Summary of changes: js/mooRainbow/images/blank.gif | Bin 43 -> 0 bytes js/mooRainbow/images/moor_arrows.gif | Bin 94 -> 0 bytes js/mooRainbow/images/moor_boverlay.png | Bin 799 -> 0 bytes js/mooRainbow/images/moor_cursor.gif | Bin 80 -> 0 bytes js/mooRainbow/images/moor_slider.png | Bin 590 -> 0 bytes js/mooRainbow/images/moor_woverlay.png | Bin 768 -> 0 bytes js/mooRainbow/images/rainbow.png | Bin 794 -> 0 bytes js/mooRainbow/mooRainbow.css | 114 ------- js/mooRainbow/mooRainbow.js | 563 -------------------------------- js/mootools-domready-rainbow.js | 16 - libraries/common.inc.php | 2 - libraries/header_meta_style.inc.php | 11 +- main.php | 39 ++- 13 files changed, 38 insertions(+), 707 deletions(-) delete mode 100644 js/mooRainbow/images/blank.gif delete mode 100644 js/mooRainbow/images/moor_arrows.gif delete mode 100644 js/mooRainbow/images/moor_boverlay.png delete mode 100644 js/mooRainbow/images/moor_cursor.gif delete mode 100644 js/mooRainbow/images/moor_slider.png delete mode 100644 js/mooRainbow/images/moor_woverlay.png delete mode 100644 js/mooRainbow/images/rainbow.png delete mode 100644 js/mooRainbow/mooRainbow.css delete mode 100644 js/mooRainbow/mooRainbow.js delete mode 100644 js/mootools-domready-rainbow.js
diff --git a/js/mooRainbow/images/blank.gif b/js/mooRainbow/images/blank.gif deleted file mode 100644 index c9c195f..0000000 Binary files a/js/mooRainbow/images/blank.gif and /dev/null differ diff --git a/js/mooRainbow/images/moor_arrows.gif b/js/mooRainbow/images/moor_arrows.gif deleted file mode 100644 index c57addc..0000000 Binary files a/js/mooRainbow/images/moor_arrows.gif and /dev/null differ diff --git a/js/mooRainbow/images/moor_boverlay.png b/js/mooRainbow/images/moor_boverlay.png deleted file mode 100644 index 7ac228b..0000000 Binary files a/js/mooRainbow/images/moor_boverlay.png and /dev/null differ diff --git a/js/mooRainbow/images/moor_cursor.gif b/js/mooRainbow/images/moor_cursor.gif deleted file mode 100644 index 9515a38..0000000 Binary files a/js/mooRainbow/images/moor_cursor.gif and /dev/null differ diff --git a/js/mooRainbow/images/moor_slider.png b/js/mooRainbow/images/moor_slider.png deleted file mode 100644 index 9f4c47b..0000000 Binary files a/js/mooRainbow/images/moor_slider.png and /dev/null differ diff --git a/js/mooRainbow/images/moor_woverlay.png b/js/mooRainbow/images/moor_woverlay.png deleted file mode 100644 index c3f3e96..0000000 Binary files a/js/mooRainbow/images/moor_woverlay.png and /dev/null differ diff --git a/js/mooRainbow/images/rainbow.png b/js/mooRainbow/images/rainbow.png deleted file mode 100644 index a62ec90..0000000 Binary files a/js/mooRainbow/images/rainbow.png and /dev/null differ diff --git a/js/mooRainbow/mooRainbow.css b/js/mooRainbow/mooRainbow.css deleted file mode 100644 index 764664e..0000000 --- a/js/mooRainbow/mooRainbow.css +++ /dev/null @@ -1,114 +0,0 @@ -/***
- * - mooRainbow: defaultCSS
- * author: w00fz w00fzIT@gmail.com
- */
-
-#mooRainbow { font-size: 11px; color: #000; }
-
-.moor-box {
- width: 390px;
- height: 310px;
- border: 1px solid #636163;
- background-color: #f9f9f9;
-}
-.moor-overlayBox {
- width: 256px; /* Width and Height of the overlay must be setted here: default 256x256 */
- height: 256px;
- margin-top: 9px;
- margin-left: 9px;
- border: 1px solid #000;
-}
-.moor-slider {
- border: 1px solid #000;
- margin-top: 9px;
- margin-left: 280px;
- width: 19px; /* if you want a bigger or smaller slider... */
- height: 256px;
-}
-.moor-colorBox {
- border: 1px solid #000;
- width: 59px;
- height: 68px;
- margin-top: 20px;
- margin-left: 315px;
-}
-.moor-currentColor { /* Bottom Box Color, the backup one */
- margin-top: 55px;
- margin-left: 316px;
- width: 59px;
- height: 34px;
-}
-.moor-okButton {
- font-family: Tahoma;
- font-weight: bold;
- font-size: 11px;
- margin-top: 278px;
- margin-left: 8px;
- background: #e6e6e6;
- height: 23px;
- border: 1px solid #d6d6d6;
- border-left-color: #f5f5f5;
- border-top-color: #f5f5f5;
-}
-#mooRainbow label {
- font-family: mono;
-}
-/* Following are just <label> */
-.moor-rLabel {
- margin-top: 100px;
- margin-left: 315px;
-}
-.moor-gLabel {
- margin-top: 125px;
- margin-left: 315px;
-}
-.moor-bLabel {
- margin-top: 150px;
- margin-left: 315px;
-}
-.moor-HueLabel {
- margin-top: 190px;
- margin-left: 315px;
-}
-span.moor-ballino { /* Style hue � (degree) !! */
- margin-top: 190px;
- margin-left: 370px;
-}
-.moor-SatuLabel {
- margin-top: 215px;
- margin-left: 315px;
-}
-.moor-BrighLabel {
- margin-top: 240px;
- margin-left: 315px;
-}
-.moor-hexLabel {
- margin-top: 275px;
- margin-left: 280px;
-}
-
-/* <input> */
-.moor-rInput, .moor-gInput, .moor-bInput, .moor-HueInput, .moor-SatuInput, .moor-BrighInput {
- width: 30px;
-}
-.moor-hexInput {
- width: 55px;
-}
-.moor-cursor {
- background-image: url(images/moor_cursor.gif);
- width: 12px;
- height: 12px;
-}
-.moor-arrows {
- background-image: url(images/moor_arrows.gif);
- top: 9px;
- left: 270px;
- width: 41px;
- height: 9px;
-}
-.moor-chooseColor { /* Top Box Color, the choosen one */
- margin-top: 21px;
- margin-left: 316px;
- width: 59px;
- height: 34px;
-} \ No newline at end of file diff --git a/js/mooRainbow/mooRainbow.js b/js/mooRainbow/mooRainbow.js deleted file mode 100644 index c355a73..0000000 --- a/js/mooRainbow/mooRainbow.js +++ /dev/null @@ -1,563 +0,0 @@ -/*** - * MooRainbow - * - * @version 1.2b1 - * @license MIT-style license - * @author Djamil Legato (w00fz) - < w00fzIT [at] gmail.com > - * @infos http://moorainbow.woolly-sheep.net - * @copyright Author - * - * includes a fix for mootools 1.2 by Piotr Przybylski - */ - -var MooRainbow = new Class({ - Implements: [Options, Events], - options: { - id: 'mooRainbow', - prefix: 'moor-', - imgPath: 'images/', - startColor: [255, 0, 0], - wheel: false, - onComplete: Class.empty, - onChange: Class.empty, - selectText: 'Select' - }, - - initialize: function(el, options) { - this.element = $(el); if (!this.element) return; - this.setOptions(options); - - this.sliderPos = 0; - this.pickerPos = {x: 0, y: 0}; - this.backupColor = this.options.startColor; - this.currentColor = this.options.startColor; - this.sets = { - rgb: [], - hsb: [], - hex: [] - }; - this.pickerClick = this.sliderClick = false; - if (!this.layout) this.doLayout(); - this.OverlayEvents(); - this.sliderEvents(); - this.backupEvent(); - if (this.options.wheel) this.wheelEvents(); - this.element.addEvent('click', function(e) { this.toggle(e); }.bind(this)); - - this.layout.overlay.setStyle('background-color', this.options.startColor.rgbToHex()); - this.layout.backup.setStyle('background-color', this.backupColor.rgbToHex()); - - this.pickerPos.x = this.snippet('curPos').l + this.snippet('curSize', 'int').w; - this.pickerPos.y = this.snippet('curPos').t + this.snippet('curSize', 'int').h; - - this.manualSet(this.options.startColor); - - this.pickerPos.x = this.snippet('curPos').l + this.snippet('curSize', 'int').w; - this.pickerPos.y = this.snippet('curPos').t + this.snippet('curSize', 'int').h; - this.sliderPos = this.snippet('arrPos') - this.snippet('arrSize', 'int'); - - if (Browser.Engine.webkit) this.hide(); - }, - - toggle: function() { - this[this.visible ? 'hide' : 'show']() - }, - - show: function() { - this.rePosition(); - this.layout.setStyle('display', 'block'); - this.visible = true; - }, - - hide: function() { - this.layout.setStyles({'display': 'none'}); - this.visible = false; - }, - - manualSet: function(color, type) { - if (!type || (type != 'hsb' && type != 'hex')) type = 'rgb'; - var rgb, hsb, hex; - - if (type == 'rgb') { rgb = color; hsb = color.rgbToHsb(); hex = color.rgbToHex(); } - else if (type == 'hsb') { hsb = color; rgb = color.hsbToRgb(); hex = rgb.rgbToHex(); } - else { hex = color; rgb = color.hexToRgb(true); hsb = rgb.rgbToHsb(); } - - this.setMooRainbow(rgb); - this.autoSet(hsb); - }, - - autoSet: function(hsb) { - var curH = this.snippet('curSize', 'int').h; - var curW = this.snippet('curSize', 'int').w; - var oveH = this.layout.overlay.height; - var oveW = this.layout.overlay.width; - var sliH = this.layout.slider.height; - var arwH = this.snippet('arrSize', 'int'); - var hue; - - var posx = Math.round(((oveW * hsb[1]) / 100) - curW); - var posy = Math.round(- ((oveH * hsb[2]) / 100) + oveH - curH); - - var c = Math.round(((sliH * hsb[0]) / 360)); c = (c == 360) ? 0 : c; - var position = sliH - c + this.snippet('slider') - arwH; - hue = [this.sets.hsb[0], 100, 100].hsbToRgb().rgbToHex(); - - this.layout.cursor.setStyles({'top': posy, 'left': posx}); - this.layout.arrows.setStyle('top', position); - this.layout.overlay.setStyle('background-color', hue); - this.sliderPos = this.snippet('arrPos') - arwH; - this.pickerPos.x = this.snippet('curPos').l + curW; - this.pickerPos.y = this.snippet('curPos').t + curH; - }, - - setMooRainbow: function(color, type) { - if (!type || (type != 'hsb' && type != 'hex')) type = 'rgb'; - var rgb, hsb, hex; - - if (type == 'rgb') { rgb = color; hsb = color.rgbToHsb(); hex = color.rgbToHex(); } - else if (type == 'hsb') { hsb = color; rgb = color.hsbToRgb(); hex = rgb.rgbToHex(); } - else { hex = color; rgb = color.hexToRgb(); hsb = rgb.rgbToHsb(); } - - this.sets = { - rgb: rgb, - hsb: hsb, - hex: hex - }; - - if (!$chk(this.pickerPos.x)) - this.autoSet(hsb); - - this.RedInput.value = rgb[0]; - this.GreenInput.value = rgb[1]; - this.BlueInput.value = rgb[2]; - this.HueInput.value = hsb[0]; - this.SatuInput.value = hsb[1]; - this.BrighInput.value = hsb[2]; - this.hexInput.value = hex; - - this.currentColor = rgb; - - this.chooseColor.setStyle('background-color', rgb.rgbToHex()); - }, - - parseColors: function(x, y, z) { - var s = Math.round((x * 100) / this.layout.overlay.width); - var b = 100 - Math.round((y * 100) / this.layout.overlay.height); - var h = 360 - Math.round((z * 360) / this.layout.slider.height) + this.snippet('slider') - this.snippet('arrSize', 'int'); - h -= this.snippet('arrSize', 'int'); - h = (h >= 360) ? 0 : (h < 0) ? 0 : h; - s = (s > 100) ? 100 : (s < 0) ? 0 : s; - b = (b > 100) ? 100 : (b < 0) ? 0 : b; - - return [h, s, b]; - }, - - OverlayEvents: function() { - var lim, curH, curW, inputs; - curH = this.snippet('curSize', 'int').h; - curW = this.snippet('curSize', 'int').w; - inputs = $A(this.arrRGB).concat(this.arrHSB, this.hexInput); - - document.addEvent('click', function() { - if(this.visible) this.hide(this.layout); - }.bind(this)); - - inputs.each(function(el) { - if(el) { - el.addEvent('keydown', this.eventKeydown.bindWithEvent(this, el)); - el.addEvent('keyup', this.eventKeyup.bindWithEvent(this, el)); - } - }, this); - [this.element, this.layout].each(function(el) { - el.addEvents({ - 'click': function(e) { new Event(e).stop();}, - 'keyup': function(e) { - e = new Event(e); - if(e.key == 'esc' && this.visible) this.hide(this.layout); - }.bind(this) - }, this); - }, this); - - lim = { - x: [0 - curW, (this.layout.overlay.width - curW)], - y: [0 - curH, (this.layout.overlay.height - curH)] - }; - - this.layout.drag = new Drag(this.layout.cursor, { - limit: lim, - onStart: this.overlayDrag.bind(this), - onDrag: this.overlayDrag.bind(this), - snap: 0 - }); - - this.layout.overlay2.addEvent('mousedown', function(e){ - e = new Event(e); - this.layout.cursor.setStyles({ - 'top': e.page.y - this.layout.overlay.getPosition().y - curH, - 'left': e.page.x - this.layout.overlay.getPosition().x - curW - }); - this.overlayDrag(); - this.layout.drag.start(e); - }.bind(this)); - - this.okButton.addEvent('click', function() { - if(this.currentColor == this.options.startColor) { - this.hide(); - this.fireEvent('onComplete', [this.sets, this]); - } - else { - this.backupColor = this.currentColor; - this.layout.backup.setStyle('background-color', this.backupColor.rgbToHex()); - this.hide(); - this.fireEvent('onComplete', [this.sets, this]); - } - }.bind(this)); - }, - - overlayDrag: function() { - var curH = this.snippet('curSize', 'int').h; - var curW = this.snippet('curSize', 'int').w; - this.pickerPos.x = this.snippet('curPos').l + curW; - this.pickerPos.y = this.snippet('curPos').t + curH; - - this.setMooRainbow(this.parseColors(this.pickerPos.x, this.pickerPos.y, this.sliderPos), 'hsb'); - this.fireEvent('onChange', [this.sets, this]); - }, - - sliderEvents: function() { - var arwH = this.snippet('arrSize', 'int'), lim; - - lim = [0 + this.snippet('slider') - arwH, this.layout.slider.height - arwH + this.snippet('slider')]; - this.layout.sliderDrag = new Drag(this.layout.arrows, { - limit: {y: lim}, - modifiers: {x: false}, - onStart: this.sliderDrag.bind(this), - onDrag: this.sliderDrag.bind(this), - snap: 0 - }); - - this.layout.slider.addEvent('mousedown', function(e){ - e = new Event(e); - - this.layout.arrows.setStyle( - 'top', e.page.y - this.layout.slider.getPosition().y + this.snippet('slider') - arwH - ); - this.sliderDrag(); - this.layout.sliderDrag.start(e); - }.bind(this)); - }, - - sliderDrag: function() { - var arwH = this.snippet('arrSize', 'int'), hue; - - this.sliderPos = this.snippet('arrPos') - arwH; - this.setMooRainbow(this.parseColors(this.pickerPos.x, this.pickerPos.y, this.sliderPos), 'hsb'); - hue = [this.sets.hsb[0], 100, 100].hsbToRgb().rgbToHex(); - this.layout.overlay.setStyle('background-color', hue); - this.fireEvent('onChange', [this.sets, this]); - }, - - backupEvent: function() { - this.layout.backup.addEvent('click', function() { - this.manualSet(this.backupColor); - this.fireEvent('onChange', [this.sets, this]); - }.bind(this)); - }, - - wheelEvents: function() { - var arrColors = $A(this.arrRGB).extend(this.arrHSB); - - arrColors.each(function(el) { - el.addEvents({ - 'mousewheel': this.eventKeys.bindWithEvent(this, el), - 'keydown': this.eventKeys.bindWithEvent(this, el) - }); - }, this); - - [this.layout.arrows, this.layout.slider].each(function(el) { - el.addEvents({ - 'mousewheel': this.eventKeys.bindWithEvent(this, [this.arrHSB[0], 'slider']), - 'keydown': this.eventKeys.bindWithEvent(this, [this.arrHSB[0], 'slider']) - }); - }, this); - }, - - eventKeys: function(e, el, id) { - var wheel, type; - id = (!id) ? el.id : this.arrHSB[0]; - - if (e.type == 'keydown') { - if (e.key == 'up') wheel = 1; - else if (e.key == 'down') wheel = -1; - else return; - } else if (e.type == Element.Events.mousewheel.base) wheel = (e.wheel > 0) ? 1 : -1; - - if (this.arrRGB.contains(el)) type = 'rgb'; - else if (this.arrHSB.contains(el)) type = 'hsb'; - else type = 'hsb'; - - if (type == 'rgb') { - var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass; - var value = (el.value.toInt() || 0) + wheel; - value = (value > 255) ? 255 : (value < 0) ? 0 : value; - - switch(el.className) { - case prefix + 'rInput': pass = [value, rgb[1], rgb[2]]; break; - case prefix + 'gInput': pass = [rgb[0], value, rgb[2]]; break; - case prefix + 'bInput': pass = [rgb[0], rgb[1], value]; break; - default : pass = rgb; - } - this.manualSet(pass); - this.fireEvent('onChange', [this.sets, this]); - } else { - var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass; - var value = (el.value.toInt() || 0) + wheel; - - if (el.className.test(/(HueInput)/)) value = (value > 359) ? 0 : (value < 0) ? 0 : value; - else value = (value > 100) ? 100 : (value < 0) ? 0 : value; - - switch(el.className) { - case prefix + 'HueInput': pass = [value, hsb[1], hsb[2]]; break; - case prefix + 'SatuInput': pass = [hsb[0], value, hsb[2]]; break; - case prefix + 'BrighInput': pass = [hsb[0], hsb[1], value]; break; - default : pass = hsb; - } - - this.manualSet(pass, 'hsb'); - this.fireEvent('onChange', [this.sets, this]); - } - e.stop(); - }, - - eventKeydown: function(e, el) { - var n = e.code, k = e.key; - - if ((!el.className.test(/hexInput/) && !(n >= 48 && n <= 57)) && - (k!='backspace' && k!='tab' && k !='delete' && k!='left' && k!='right')) - e.stop(); - }, - - eventKeyup: function(e, el) { - var n = e.code, k = e.key, pass, prefix, chr = el.value.charAt(0); - - if (!$chk(el.value)) return; - if (el.className.test(/hexInput/)) { - if (chr != "#" && el.value.length != 6) return; - if (chr == '#' && el.value.length != 7) return; - } else { - if (!(n >= 48 && n <= 57) && (!['backspace', 'tab', 'delete', 'left', 'right'].contains(k)) && el.value.length > 3) return; - } - - prefix = this.options.prefix; - - if (el.className.test(/(rInput|gInput|bInput)/)) { - if (el.value < 0 || el.value > 255) return; - switch(el.className){ - case prefix + 'rInput': pass = [el.value, this.sets.rgb[1], this.sets.rgb[2]]; break; - case prefix + 'gInput': pass = [this.sets.rgb[0], el.value, this.sets.rgb[2]]; break; - case prefix + 'bInput': pass = [this.sets.rgb[0], this.sets.rgb[1], el.value]; break; - default : pass = this.sets.rgb; - } - this.manualSet(pass); - this.fireEvent('onChange', [this.sets, this]); - } - else if (!el.className.test(/hexInput/)) { - if (el.className.test(/HueInput/) && el.value < 0 || el.value > 360) return; - else if (el.className.test(/HueInput/) && el.value == 360) el.value = 0; - else if (el.className.test(/(SatuInput|BrighInput)/) && el.value < 0 || el.value > 100) return; - switch(el.className){ - case prefix + 'HueInput': pass = [el.value, this.sets.hsb[1], this.sets.hsb[2]]; break; - case prefix + 'SatuInput': pass = [this.sets.hsb[0], el.value, this.sets.hsb[2]]; break; - case prefix + 'BrighInput': pass = [this.sets.hsb[0], this.sets.hsb[1], el.value]; break; - default : pass = this.sets.hsb; - } - this.manualSet(pass, 'hsb'); - this.fireEvent('onChange', [this.sets, this]); - } else { - pass = el.value.hexToRgb(true); - if (isNaN(pass[0])||isNaN(pass[1])||isNaN(pass[2])) return; - - if ($chk(pass)) { - this.manualSet(pass); - this.fireEvent('onChange', [this.sets, this]); - } - } - - }, - - doLayout: function() { - var id = this.options.id, prefix = this.options.prefix; - var idPrefix = id + ' .' + prefix; - - this.layout = new Element('div', { - 'styles': {'display': 'block', 'position': 'absolute'}, - 'id': id - }).inject(document.body); - - var box = new Element('div', { - 'styles': {'position': 'relative'}, - 'class': prefix + 'box' - }).inject(this.layout); - - var div = new Element('div', { - 'styles': {'position': 'absolute', 'overflow': 'hidden'}, - 'class': prefix + 'overlayBox' - }).inject(box); - - var ar = new Element('div', { - 'styles': {'position': 'absolute', 'zIndex': 1}, - 'class': prefix + 'arrows' - }).inject(box); - ar.width = ar.getStyle('width').toInt(); - ar.height = ar.getStyle('height').toInt(); - - var ov = new Element('img', { - 'styles': {'background-color': '#fff', 'position': 'relative', 'zIndex': 2}, - 'src': this.options.imgPath + 'moor_woverlay.png', - 'class': prefix + 'overlay' - }).inject(div); - - var ov2 = new Element('img', { - 'styles': {'position': 'absolute', 'top': 0, 'left': 0, 'zIndex': 2}, - 'src': this.options.imgPath + 'moor_boverlay.png', - 'class': prefix + 'overlay' - }).inject(div); - - if (Browser.Engine.trident4) { - div.setStyle('overflow', ''); - var src = ov.src; - ov.src = this.options.imgPath + 'blank.gif'; - ov.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"; - src = ov2.src; - ov2.src = this.options.imgPath + 'blank.gif'; - ov2.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"; - } - ov.width = ov2.width = div.getStyle('width').toInt(); - ov.height = ov2.height = div.getStyle('height').toInt(); - - var cr = new Element('div', { - 'styles': {'overflow': 'hidden', 'position': 'absolute', 'zIndex': 2}, - 'class': prefix + 'cursor' - }).inject(div); - cr.width = cr.getStyle('width').toInt(); - cr.height = cr.getStyle('height').toInt(); - - var sl = new Element('img', { - 'styles': {'position': 'absolute', 'z-index': 2}, - 'src': this.options.imgPath + 'moor_slider.png', - 'class': prefix + 'slider' - }).inject(box); - this.layout.slider = sl; - sl.width = sl.getStyle('width').toInt(); - sl.height = sl.getStyle('height').toInt(); - - new Element('div', { - 'styles': {'position': 'absolute'}, - 'class': prefix + 'colorBox' - }).inject(box); - - new Element('div', { - 'styles': {'zIndex': 2, 'position': 'absolute'}, - 'class': prefix + 'chooseColor' - }).inject(box); - - this.layout.backup = new Element('div', { - 'styles': {'zIndex': 2, 'position': 'absolute', 'cursor': 'pointer'}, - 'class': prefix + 'currentColor' - }).inject(box); - - var R = new Element('label').inject(box).setStyle('position', 'absolute'); - var G = R.clone().inject(box).addClass(prefix + 'gLabel').set('html', 'G: '); - var B = R.clone().inject(box).addClass(prefix + 'bLabel').set('html', 'B: '); - R.set('html', 'R: ').addClass(prefix + 'rLabel'); - - var inputR = new Element('input'); - var inputG = inputR.clone().inject(G).addClass(prefix + 'gInput'); - var inputB = inputR.clone().inject(B).addClass(prefix + 'bInput'); - inputR.inject(R).addClass(prefix + 'rInput'); - - var HU = new Element('label').inject(box).setStyle('position', 'absolute'); - var SA = HU.clone().inject(box).addClass(prefix + 'SatuLabel').set('html', 'S: '); - var BR = HU.clone().inject(box).addClass(prefix + 'BrighLabel').set('html', 'B: '); - HU.set('html', 'H: ').addClass(prefix + 'HueLabel'); - - var inputHU = new Element('input'); - var inputSA = inputHU.clone().inject(SA).addClass(prefix + 'SatuInput'); - var inputBR = inputHU.clone().inject(BR).addClass(prefix + 'BrighInput'); - inputHU.inject(HU).addClass(prefix + 'HueInput'); - SA.innerHTML += " %"; BR.innerHTML += " %"; - SP = new Element('span', {'styles': {'position': 'absolute'}, 'class': prefix + 'ballino'}) - SP.innerHTML = " °" - SP.inject(HU,'after'); - - var hex = new Element('label').inject(box).setStyle('position', 'absolute').addClass(prefix + 'hexLabel').set('html', '#hex: ').adopt(new Element('input').addClass(prefix + 'hexInput')); - - var ok = new Element('input', { - 'styles': {'position': 'absolute'}, - 'type': 'button', - 'value': this.options.selectText, - 'class': prefix + 'okButton' - }).inject(box); - - this.rePosition(); - - var overlays = $$('#' + id + ' .' + prefix + 'overlay'); - this.layout.overlay = overlays[0]; - this.layout.overlay2 = overlays[1]; - this.layout.cursor = cr; - this.layout.arrows = ar; - this.chooseColor = this.layout.getElement('.' + prefix + 'chooseColor'); - this.RedInput = inputR; - this.GreenInput = inputG; - this.BlueInput = inputB; - this.HueInput = inputHU; - this.SatuInput = this.layout.getElement('.' + prefix + 'SatuInput'); - this.BrighInput = this.layout.getElement('.' + prefix + 'BrighInput'); - this.hexInput = this.layout.getElement('.' + prefix + 'hexInput');; - - this.arrRGB = [this.RedInput, this.GreenInput, this.BlueInput]; - this.arrHSB = [this.HueInput, this.SatuInput, this.BrighInput]; - this.okButton = ok; - - if (!Browser.Engine.webkit419) this.hide(); - }, - rePosition: function() { - var coords = this.element.getCoordinates(); - this.layout.setStyles({ - 'left': coords.left, - 'top': coords.top + coords.height + 1 - }); - }, - - snippet: function(mode, type) { - var size; type = (type) ? type : 'none'; - - switch(mode) { - case 'arrPos': - var t = this.layout.arrows.getStyle('top').toInt(); - size = t; - break; - case 'arrSize': - var h = this.layout.arrows.height; - h = (type == 'int') ? (h/2).toInt() : h; - size = h; - break; - case 'curPos': - var l = this.layout.cursor.getStyle('left').toInt(); - var t = this.layout.cursor.getStyle('top').toInt(); - size = {'l': l, 't': t}; - break; - case 'slider': - var t = this.layout.slider.getStyle('marginTop').toInt(); - size = t; - break; - default : - var h = this.layout.cursor.height; - var w = this.layout.cursor.width; - h = (type == 'int') ? (h/2).toInt() : h; - w = (type == 'int') ? (w/2).toInt() : w; - size = {w: w, h: h}; - }; - return size; - } -}); diff --git a/js/mootools-domready-rainbow.js b/js/mootools-domready-rainbow.js deleted file mode 100644 index 40041df..0000000 --- a/js/mootools-domready-rainbow.js +++ /dev/null @@ -1,16 +0,0 @@ -window.addEvent('domready', function() { - var r = new MooRainbow('myRainbow', { - 'startColor': [58, 142, 246], - 'imgPath': 'js/mooRainbow/images/', - 'onChange': function(color) { - top.frame_navigation.document.getElementById('body_leftFrame').style.backgroundColor = color.hex; - top.frame_navigation.document.getElementById('pmalogo').style.backgroundColor = color.hex; - top.frame_content.document.body.style.backgroundColor = color.hex; - }, - 'onComplete': function(color) { - top.frame_content.document.getElementById('rainbowform').custom_color.value = color.hex; - top.frame_content.document.getElementById('rainbowform').custom_color_rgb.value = color.rgb; - top.frame_content.document.getElementById('rainbowform').submit(); - } - }); -}); diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 11c5f8b..5a4afc4 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -666,10 +666,8 @@ unset($default_server);
if (isset($_REQUEST['custom_color_reset'])) { unset($_SESSION['tmp_user_values']['custom_color']); - unset($_SESSION['tmp_user_values']['custom_color_rgb']); } elseif (isset($_REQUEST['custom_color'])) { $_SESSION['tmp_user_values']['custom_color'] = $_REQUEST['custom_color']; - $_SESSION['tmp_user_values']['custom_color_rgb'] = $_REQUEST['custom_color_rgb']; } /** * @global PMA_Theme_Manager $_SESSION['PMA_Theme_Manager'] diff --git a/libraries/header_meta_style.inc.php b/libraries/header_meta_style.inc.php index 5413be6..c6c6f96 100644 --- a/libraries/header_meta_style.inc.php +++ b/libraries/header_meta_style.inc.php @@ -46,11 +46,14 @@ if ($GLOBALS['text_dir'] == 'ltr') { echo 'phpMyAdmin'; } ?></title> - <link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" /> -<?php if (defined('PMA_MOORAINBOW')) { ?> - <link rel="stylesheet" type="text/css" href="js/mooRainbow/mooRainbow.css" /> +<?php +// goes before our themed CSS + if (defined('PMA_COLORPICKER')) { ?> + <link rel="stylesheet" type="text/css" href="js/colorpicker/css/colorpicker.css" /> + <link rel="stylesheet" media="screen" type="text/css" href="js/colorpicker/css/layout.css" /> <?php - } + } ?> + <link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>phpmyadmin.css.php?<?php echo PMA_generate_common_url(); ?>&js_frame=<?php echo isset($print_view) ? 'print' : 'right'; ?>&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" /> <link rel="stylesheet" type="text/css" href="<?php echo defined('PMA_PATH_TO_BASEDIR') ? PMA_PATH_TO_BASEDIR : ''; ?>print.css" media="print" /> <meta name="robots" content="noindex,nofollow" /> diff --git a/main.php b/main.php index ef9c6b5..36a8125 100644 --- a/main.php +++ b/main.php @@ -9,11 +9,11 @@ /** * Gets some core libraries and displays a top message if required */ -define('PMA_MOORAINBOW', true); +define('PMA_COLORPICKER', true); require_once './libraries/common.inc.php'; -$GLOBALS['js_include'][] = 'mootools-more.js'; -$GLOBALS['js_include'][] = 'mooRainbow/mooRainbow.js'; -$GLOBALS['js_include'][] = 'mootools-domready-rainbow.js'; + +$GLOBALS['js_include'][] = 'jquery/jquery-1.4.2-min.js'; +$GLOBALS['js_include'][] = 'colorpicker/js/colorpicker.js';
// Handles some variables that may have been sent by the calling script $GLOBALS['db'] = ''; @@ -159,14 +159,37 @@ if ($GLOBALS['cfg']['ThemeManager']) { //<![CDATA[ document.write('<li id="li_custom_color">'); document.write('<?php echo PMA_escapeJsString($strCustomColor) . ': '; ?>'); - document.write('<img id="myRainbow" src="js/mooRainbow/images/rainbow.png" alt="[r]" width="16" height="16" />'); - document.write('<form name="rainbowform" id="rainbowform" method="post" action="index.php" target="_parent">'); + document.write('<form name="colorform" id="colorform" method="post" action="index.php" target="_parent">'); document.write('<?php echo PMA_generate_common_hidden_inputs(); ?>'); - document.write('<input type="hidden" name="custom_color" />'); - document.write('<input type="hidden" name="custom_color_rgb" />'); + document.write('<input type="hidden" id="custom_color" name="custom_color" value="" />'); document.write('<input type="submit" name="custom_color_reset" value="<?php echo $strReset; ?>" />'); document.write('</form>'); + document.write('<div id="colorSelector">'); + document.write('</div>'); document.write('</li>'); + + $(document).ready(function() { + // Choosing another id does not work! + $('#colorSelector').ColorPicker({ + color: '#0000ff', + onShow: function (colpkr) { + $(colpkr).fadeIn(500); + return false; + }, + onHide: function (colpkr) { + $(colpkr).fadeOut(500); + return false; + }, + onChange: function(hsb, hex, rgb) { + top.frame_content.document.body.style.backgroundColor = '#' + hex; + top.frame_navigation.document.body.style.backgroundColor = '#' + hex; + }, + onSubmit: function(hsb, hex, rgb) { + $('#custom_color').val('#' + hex); + $('#colorform').submit(); + } + }); + }); //]]> </script> <?php
hooks/post-receive