Parley
view release on metacpan or search on metacpan
root/static/yui/editor/editor-debug.js view on Meta::CPAN
var em = picker.getElementsByTagName('em')[0];
var strong = picker.getElementsByTagName('strong')[0];
var tar = Event.getTarget(ev);
if (tar.tagName.toLowerCase() == 'a') {
em.style.backgroundColor = tar.style.backgroundColor;
strong.innerHTML = this._colorData['#' + tar.innerHTML] + '<br>' + tar.innerHTML;
}
}, this, true);
Event.on(picker, 'focus', function(ev) {
Event.stopEvent(ev);
});
Event.on(picker, 'click', function(ev) {
Event.stopEvent(ev);
});
Event.on(picker, 'mousedown', function(ev) {
Event.stopEvent(ev);
var tar = Event.getTarget(ev);
if (tar.tagName.toLowerCase() == 'a') {
var retVal = this.fireEvent('colorPickerClicked', { type: 'colorPickerClicked', target: this, button: this._colorPicker._button, color: tar.innerHTML, colorName: this._colorData['#' + tar.innerHTML] } );
if (retVal !== false) {
var info = {
color: tar.innerHTML,
colorName: this._colorData['#' + tar.innerHTML],
value: this._colorPicker._button
};
this.fireEvent('buttonClick', { type: 'buttonClick', target: this.get('element'), button: info });
}
this.getButtonByValue(this._colorPicker._button).getMenu().hide();
}
}, this, true);
},
/**
* @method _resetColorPicker
* @private
* @description Clears the currently selected color or mouseover color in the color picker.
*/
_resetColorPicker: function() {
var em = this._colorPicker.getElementsByTagName('em')[0];
var strong = this._colorPicker.getElementsByTagName('strong')[0];
em.style.backgroundColor = 'transparent';
strong.innerHTML = '';
},
/**
* @method _makeColorButton
* @private
* @description Called to turn a "color" button into a menu button with an Overlay for the menu.
* @param {Object} _oButton <a href="YAHOO.widget.ToolbarButton.html">YAHOO.widget.ToolbarButton</a> reference
*/
_makeColorButton: function(_oButton) {
if (!this._colorPicker) {
this._createColorPicker(this.get('id'));
}
_oButton.type = 'color';
_oButton.menu = new YAHOO.widget.Overlay(this.get('id') + '_' + _oButton.value + '_menu', { visible: false, position: 'absolute', iframe: true });
_oButton.menu.setBody('');
_oButton.menu.render(this.get('cont'));
Dom.addClass(_oButton.menu.element, 'yui-button-menu');
Dom.addClass(_oButton.menu.element, 'yui-color-button-menu');
_oButton.menu.beforeShowEvent.subscribe(function() {
_oButton.menu.cfg.setProperty('zindex', 5); //Re Adjust the overlays zIndex.. not sure why.
_oButton.menu.cfg.setProperty('context', [this.getButtonById(_oButton.id).get('element'), 'tl', 'bl']); //Re Adjust the overlay.. not sure why.
//Move the DOM reference of the color picker to the Overlay that we are about to show.
this._resetColorPicker();
var _p = this._colorPicker;
if (_p.parentNode) {
_p.parentNode.removeChild(_p);
}
_oButton.menu.setBody('');
_oButton.menu.appendToBody(_p);
this._colorPicker.style.display = 'block';
}, this, true);
return _oButton;
},
/**
* @private
* @method _makeSpinButton
* @description Create a button similar to an OS Spin button.. It has an up/down arrow combo to scroll through a range of int values.
* @param {Object} _button <a href="YAHOO.widget.ToolbarButton.html">YAHOO.widget.ToolbarButton</a> reference
* @param {Object} oButton Object literal containing the buttons initial config
*/
_makeSpinButton: function(_button, oButton) {
_button.addClass(this.CLASS_PREFIX + '-spinbutton');
var self = this,
_par = _button._button.parentNode.parentNode, //parentNode of Button Element for appending child
range = oButton.range,
_b1 = document.createElement('a'),
_b2 = document.createElement('a');
_b1.href = '#';
_b2.href = '#';
_b1.tabIndex = '-1';
_b2.tabIndex = '-1';
//Setup the up and down arrows
_b1.className = 'up';
_b1.title = this.STR_SPIN_UP;
_b1.innerHTML = this.STR_SPIN_UP;
_b2.className = 'down';
_b2.title = this.STR_SPIN_DOWN;
_b2.innerHTML = this.STR_SPIN_DOWN;
//Append them to the container
_par.appendChild(_b1);
_par.appendChild(_b2);
var label = YAHOO.lang.substitute(this.STR_SPIN_LABEL, { VALUE: _button.get('label') });
_button.set('title', label);
var cleanVal = function(value) {
value = ((value < range[0]) ? range[0] : value);
value = ((value > range[1]) ? range[1] : value);
return value;
};
var br = this.browser;
var tbar = false;
var strLabel = this.STR_SPIN_LABEL;
if (this._titlebar && this._titlebar.firstChild) {
tbar = this._titlebar.firstChild;
}
var _intUp = function(ev) {
( run in 0.957 second using v1.01-cache-2.11-cpan-39bf76dae61 )