upgrade to mootools 1.2; temporarily deactivate the color picker that does not work with this mootools version

This commit is contained in:
Marc Delisle
2008-07-14 19:52:16 +00:00
parent 29d7c3e2f8
commit 2ac75d4591
9 changed files with 1063 additions and 7683 deletions

View File

@@ -12,7 +12,6 @@ require_once './libraries/common.inc.php';
require_once './libraries/Table.class.php'; require_once './libraries/Table.class.php';
$GLOBALS['js_include'][] = 'mootools.js'; $GLOBALS['js_include'][] = 'mootools.js';
$GLOBALS['js_include'][] = 'mootools-domready.js';
/** /**
* Prepares the tables list if the user where not redirected to this script * Prepares the tables list if the user where not redirected to this script

View File

@@ -1,9 +1,9 @@
/*** /***
* MooRainbow * MooRainbow
* *
* @version 1.11 * @version 1.2b1
* @license MIT-style license * @license MIT-style license
* @author w00fz - < w00fzIT [at] gmail.com > * @author Djamil Legato (w00fz) - < w00fzIT [at] gmail.com >
* @infos http://moorainbow.woolly-sheep.net * @infos http://moorainbow.woolly-sheep.net
* @copyright Author * @copyright Author
* *
@@ -11,6 +11,7 @@
*/ */
var MooRainbow = new Class({ var MooRainbow = new Class({
Implements: [Options, Events],
options: { options: {
id: 'mooRainbow', id: 'mooRainbow',
prefix: 'moor-', prefix: 'moor-',
@@ -18,7 +19,8 @@ var MooRainbow = new Class({
startColor: [255, 0, 0], startColor: [255, 0, 0],
wheel: false, wheel: false,
onComplete: Class.empty, onComplete: Class.empty,
onChange: Class.empty onChange: Class.empty,
selectText: 'Select'
}, },
initialize: function(el, options) { initialize: function(el, options) {
@@ -54,7 +56,7 @@ var MooRainbow = new Class({
this.pickerPos.y = this.snippet('curPos').t + this.snippet('curSize', 'int').h; this.pickerPos.y = this.snippet('curPos').t + this.snippet('curSize', 'int').h;
this.sliderPos = this.snippet('arrPos') - this.snippet('arrSize', 'int'); this.sliderPos = this.snippet('arrPos') - this.snippet('arrSize', 'int');
if (window.khtml) this.hide(); if (Browser.Engine.webkit) this.hide();
}, },
toggle: function() { toggle: function() {
@@ -154,15 +156,17 @@ var MooRainbow = new Class({
var lim, curH, curW, inputs; var lim, curH, curW, inputs;
curH = this.snippet('curSize', 'int').h; curH = this.snippet('curSize', 'int').h;
curW = this.snippet('curSize', 'int').w; curW = this.snippet('curSize', 'int').w;
inputs = this.arrRGB.copy().concat(this.arrHSB, this.hexInput); inputs = $A(this.arrRGB).concat(this.arrHSB, this.hexInput);
document.addEvent('click', function() { document.addEvent('click', function() {
if(this.visible) this.hide(this.layout); if(this.visible) this.hide(this.layout);
}.bind(this)); }.bind(this));
inputs.each(function(el) { inputs.each(function(el) {
if(el) {
el.addEvent('keydown', this.eventKeydown.bindWithEvent(this, el)); el.addEvent('keydown', this.eventKeydown.bindWithEvent(this, el));
el.addEvent('keyup', this.eventKeyup.bindWithEvent(this, el)); el.addEvent('keyup', this.eventKeyup.bindWithEvent(this, el));
}
}, this); }, this);
[this.element, this.layout].each(function(el) { [this.element, this.layout].each(function(el) {
el.addEvents({ el.addEvents({
@@ -179,7 +183,7 @@ var MooRainbow = new Class({
y: [0 - curH, (this.layout.overlay.height - curH)] y: [0 - curH, (this.layout.overlay.height - curH)]
}; };
this.layout.drag = new Drag.Base(this.layout.cursor, { this.layout.drag = new Drag(this.layout.cursor, {
limit: lim, limit: lim,
onStart: this.overlayDrag.bind(this), onStart: this.overlayDrag.bind(this),
onDrag: this.overlayDrag.bind(this), onDrag: this.overlayDrag.bind(this),
@@ -189,9 +193,10 @@ var MooRainbow = new Class({
this.layout.overlay2.addEvent('mousedown', function(e){ this.layout.overlay2.addEvent('mousedown', function(e){
e = new Event(e); e = new Event(e);
this.layout.cursor.setStyles({ this.layout.cursor.setStyles({
'top': e.page.y - this.layout.overlay.getTop() - curH, 'top': e.page.y - this.layout.overlay.getPosition().y - curH,
'left': e.page.x - this.layout.overlay.getLeft() - curW 'left': e.page.x - this.layout.overlay.getPosition().x - curW
}); });
this.overlayDrag();
this.layout.drag.start(e); this.layout.drag.start(e);
}.bind(this)); }.bind(this));
@@ -223,7 +228,7 @@ var MooRainbow = new Class({
var arwH = this.snippet('arrSize', 'int'), lim; var arwH = this.snippet('arrSize', 'int'), lim;
lim = [0 + this.snippet('slider') - arwH, this.layout.slider.height - arwH + this.snippet('slider')]; lim = [0 + this.snippet('slider') - arwH, this.layout.slider.height - arwH + this.snippet('slider')];
this.layout.sliderDrag = new Drag.Base(this.layout.arrows, { this.layout.sliderDrag = new Drag(this.layout.arrows, {
limit: {y: lim}, limit: {y: lim},
modifiers: {x: false}, modifiers: {x: false},
onStart: this.sliderDrag.bind(this), onStart: this.sliderDrag.bind(this),
@@ -235,8 +240,9 @@ var MooRainbow = new Class({
e = new Event(e); e = new Event(e);
this.layout.arrows.setStyle( this.layout.arrows.setStyle(
'top', e.page.y - this.layout.slider.getTop() + this.snippet('slider') - arwH 'top', e.page.y - this.layout.slider.getPosition().y + this.snippet('slider') - arwH
); );
this.sliderDrag();
this.layout.sliderDrag.start(e); this.layout.sliderDrag.start(e);
}.bind(this)); }.bind(this));
}, },
@@ -259,7 +265,7 @@ var MooRainbow = new Class({
}, },
wheelEvents: function() { wheelEvents: function() {
var arrColors = this.arrRGB.copy().extend(this.arrHSB); var arrColors = $A(this.arrRGB).extend(this.arrHSB);
arrColors.each(function(el) { arrColors.each(function(el) {
el.addEvents({ el.addEvents({
@@ -284,15 +290,15 @@ var MooRainbow = new Class({
if (e.key == 'up') wheel = 1; if (e.key == 'up') wheel = 1;
else if (e.key == 'down') wheel = -1; else if (e.key == 'down') wheel = -1;
else return; else return;
} else if (e.type == Element.Events.mousewheel.type) wheel = (e.wheel > 0) ? 1 : -1; } else if (e.type == Element.Events.mousewheel.base) wheel = (e.wheel > 0) ? 1 : -1;
if (this.arrRGB.test(el)) type = 'rgb'; if (this.arrRGB.contains(el)) type = 'rgb';
else if (this.arrHSB.test(el)) type = 'hsb'; else if (this.arrHSB.contains(el)) type = 'hsb';
else type = 'hsb'; else type = 'hsb';
if (type == 'rgb') { if (type == 'rgb') {
var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass; var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass;
var value = el.value.toInt() + wheel; var value = (el.value.toInt() || 0) + wheel;
value = (value > 255) ? 255 : (value < 0) ? 0 : value; value = (value > 255) ? 255 : (value < 0) ? 0 : value;
switch(el.className) { switch(el.className) {
@@ -305,7 +311,7 @@ var MooRainbow = new Class({
this.fireEvent('onChange', [this.sets, this]); this.fireEvent('onChange', [this.sets, this]);
} else { } else {
var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass; var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass;
var value = el.value.toInt() + wheel; var value = (el.value.toInt() || 0) + wheel;
if (el.className.test(/(HueInput)/)) value = (value > 359) ? 0 : (value < 0) ? 0 : value; if (el.className.test(/(HueInput)/)) value = (value > 359) ? 0 : (value < 0) ? 0 : value;
else value = (value > 100) ? 100 : (value < 0) ? 0 : value; else value = (value > 100) ? 100 : (value < 0) ? 0 : value;
@@ -316,6 +322,7 @@ var MooRainbow = new Class({
case prefix + 'BrighInput': pass = [hsb[0], hsb[1], value]; break; case prefix + 'BrighInput': pass = [hsb[0], hsb[1], value]; break;
default : pass = hsb; default : pass = hsb;
} }
this.manualSet(pass, 'hsb'); this.manualSet(pass, 'hsb');
this.fireEvent('onChange', [this.sets, this]); this.fireEvent('onChange', [this.sets, this]);
} }
@@ -338,7 +345,7 @@ var MooRainbow = new Class({
if (chr != "#" && el.value.length != 6) return; if (chr != "#" && el.value.length != 6) return;
if (chr == '#' && el.value.length != 7) return; if (chr == '#' && el.value.length != 7) return;
} else { } else {
if (!(n >= 48 && n <= 57) && (!['backspace', 'tab', 'delete', 'left', 'right'].test(k)) && el.value.length > 3) return; if (!(n >= 48 && n <= 57) && (!['backspace', 'tab', 'delete', 'left', 'right'].contains(k)) && el.value.length > 3) return;
} }
prefix = this.options.prefix; prefix = this.options.prefix;
@@ -416,7 +423,7 @@ var MooRainbow = new Class({
'class': prefix + 'overlay' 'class': prefix + 'overlay'
}).inject(div); }).inject(div);
if (window.ie6) { if (Browser.Engine.trident4) {
div.setStyle('overflow', ''); div.setStyle('overflow', '');
var src = ov.src; var src = ov.src;
ov.src = this.options.imgPath + 'blank.gif'; ov.src = this.options.imgPath + 'blank.gif';
@@ -460,9 +467,9 @@ var MooRainbow = new Class({
}).inject(box); }).inject(box);
var R = new Element('label').inject(box).setStyle('position', 'absolute'); var R = new Element('label').inject(box).setStyle('position', 'absolute');
var G = R.clone().inject(box).addClass(prefix + 'gLabel').appendText('G: '); var G = R.clone().inject(box).addClass(prefix + 'gLabel').set('html', 'G: ');
var B = R.clone().inject(box).addClass(prefix + 'bLabel').appendText('B: '); var B = R.clone().inject(box).addClass(prefix + 'bLabel').set('html', 'B: ');
R.appendText('R: ').addClass(prefix + 'rLabel'); R.set('html', 'R: ').addClass(prefix + 'rLabel');
var inputR = new Element('input'); var inputR = new Element('input');
var inputG = inputR.clone().inject(G).addClass(prefix + 'gInput'); var inputG = inputR.clone().inject(G).addClass(prefix + 'gInput');
@@ -470,23 +477,25 @@ var MooRainbow = new Class({
inputR.inject(R).addClass(prefix + 'rInput'); inputR.inject(R).addClass(prefix + 'rInput');
var HU = new Element('label').inject(box).setStyle('position', 'absolute'); var HU = new Element('label').inject(box).setStyle('position', 'absolute');
var SA = HU.clone().inject(box).addClass(prefix + 'SatuLabel').appendText('S: '); var SA = HU.clone().inject(box).addClass(prefix + 'SatuLabel').set('html', 'S: ');
var BR = HU.clone().inject(box).addClass(prefix + 'BrighLabel').appendText('B: '); var BR = HU.clone().inject(box).addClass(prefix + 'BrighLabel').set('html', 'B: ');
HU.appendText('H: ').addClass(prefix + 'HueLabel'); HU.set('html', 'H: ').addClass(prefix + 'HueLabel');
var inputHU = new Element('input'); var inputHU = new Element('input');
var inputSA = inputHU.clone().inject(SA).addClass(prefix + 'SatuInput'); var inputSA = inputHU.clone().inject(SA).addClass(prefix + 'SatuInput');
var inputBR = inputHU.clone().inject(BR).addClass(prefix + 'BrighInput'); var inputBR = inputHU.clone().inject(BR).addClass(prefix + 'BrighInput');
inputHU.inject(HU).addClass(prefix + 'HueInput'); inputHU.inject(HU).addClass(prefix + 'HueInput');
SA.appendText(' %'); BR.appendText(' %'); SA.innerHTML += " %"; BR.innerHTML += " %";
new Element('span', {'styles': {'position': 'absolute'}, 'class': prefix + 'ballino'}).setHTML(" &deg;").injectAfter(HU); SP = new Element('span', {'styles': {'position': 'absolute'}, 'class': prefix + 'ballino'})
SP.innerHTML = " &deg;"
SP.inject(HU,'after');
var hex = new Element('label').inject(box).setStyle('position', 'absolute').addClass(prefix + 'hexLabel').appendText('#hex: ').adopt(new Element('input').addClass(prefix + 'hexInput')); 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', { var ok = new Element('input', {
'styles': {'position': 'absolute'}, 'styles': {'position': 'absolute'},
'type': 'button', 'type': 'button',
'value': 'Select', 'value': this.options.selectText,
'class': prefix + 'okButton' 'class': prefix + 'okButton'
}).inject(box); }).inject(box);
@@ -511,7 +520,7 @@ var MooRainbow = new Class({
this.arrHSB = [this.HueInput, this.SatuInput, this.BrighInput]; this.arrHSB = [this.HueInput, this.SatuInput, this.BrighInput];
this.okButton = $E('#' + idPrefix + 'okButton'); this.okButton = $E('#' + idPrefix + 'okButton');
if (!window.khtml) this.hide(); if (!Browser.Engine.webkit419) this.hide();
}, },
rePosition: function() { rePosition: function() {
var coords = this.element.getCoordinates(); var coords = this.element.getCoordinates();
@@ -553,6 +562,3 @@ var MooRainbow = new Class({
return size; return size;
} }
}); });
MooRainbow.implement(new Options);
MooRainbow.implement(new Events);

View File

@@ -1,15 +0,0 @@
window.addEvent('domready', function(){
var divs = $$(['docs', 'js', 'html', 'css']);
divs.each(function(div){
var link = $(div.id + 'code');
div.setStyle('display', 'none');
link.addEvent('click', function(e){
e = new Event(e);
divs.each(function(other){
if (other != div) other.setStyle('display', 'none');
});
div.setStyle('display', (div.getStyle('display') == 'block') ? 'none' : 'block');
e.stop();
});
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -147,13 +147,13 @@ if (empty($cfg['Lang'])) {
if ($GLOBALS['cfg']['ThemeManager']) { if ($GLOBALS['cfg']['ThemeManager']) {
echo '<li id="li_select_theme">'; echo '<li id="li_select_theme">';
echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox(); echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
echo '<img id="myRainbow" src="js/mooRainbow/images/rainbow.png" alt="[r]" /*
width="16" height="16" />'; echo '<img id="myRainbow" src="js/mooRainbow/images/rainbow.png" alt="[r]" width="16" height="16" />';
echo '<form name="rainbowform" id="rainbowform" method="post" action="index.php" target="_parent">'; echo '<form name="rainbowform" id="rainbowform" method="post" action="index.php" target="_parent">';
echo PMA_generate_common_hidden_inputs(); echo PMA_generate_common_hidden_inputs();
echo '<input type="hidden" name="custom_color" />'; echo '<input type="hidden" name="custom_color" />';
echo '<input type="hidden" name="custom_color_rgb" />'; echo '<input type="hidden" name="custom_color_rgb" />';
echo '</form>'; echo '</form>';*/
echo '</li>'; echo '</li>';
} }
echo '<li id="li_select_fontsize">'; echo '<li id="li_select_fontsize">';

View File

@@ -15,7 +15,6 @@ require_once './libraries/check_user_privileges.lib.php';
require_once './libraries/bookmark.lib.php'; require_once './libraries/bookmark.lib.php';
$GLOBALS['js_include'][] = 'mootools.js'; $GLOBALS['js_include'][] = 'mootools.js';
$GLOBALS['js_include'][] = 'mootools-domready.js';
/** /**
* Defines the url to return to in case of error in a sql statement * Defines the url to return to in case of error in a sql statement

View File

@@ -363,7 +363,6 @@ $GLOBALS['js_include'][] = 'tbl_change.js';
$GLOBALS['js_include'][] = 'functions.js'; $GLOBALS['js_include'][] = 'functions.js';
// in case we call sql.php which needs those: // in case we call sql.php which needs those:
$GLOBALS['js_include'][] = 'mootools.js'; $GLOBALS['js_include'][] = 'mootools.js';
$GLOBALS['js_include'][] = 'mootools-domready.js';
$active_page = $goto_include; $active_page = $goto_include;
require_once './libraries/header.inc.php'; require_once './libraries/header.inc.php';

View File

@@ -18,7 +18,6 @@ require_once './libraries/relation.lib.php'; // foreign keys
require_once './libraries/mysql_charsets.lib.php'; require_once './libraries/mysql_charsets.lib.php';
$GLOBALS['js_include'][] = 'mootools.js'; $GLOBALS['js_include'][] = 'mootools.js';
$GLOBALS['js_include'][] = 'mootools-domready.js';
if ($GLOBALS['cfg']['PropertiesIconic'] == true) { if ($GLOBALS['cfg']['PropertiesIconic'] == true) {
$titles['Browse'] = $titles['Browse'] =

View File

@@ -14,7 +14,6 @@ require_once './libraries/mysql_charsets.lib.php';
require_once './libraries/relation.lib.php'; require_once './libraries/relation.lib.php';
$GLOBALS['js_include'][] = 'mootools.js'; $GLOBALS['js_include'][] = 'mootools.js';
$GLOBALS['js_include'][] = 'mootools-domready.js';
/** /**
* handle multiple field commands if required * handle multiple field commands if required