Hopkins-Plugin-HMI
view release on metacpan or search on metacpan
share/root/static/yui/build/editor/simpleeditor.js view on Meta::CPAN
}
if (Lang.isNumber(id)) {
button = this.getButtonByIndex(id);
}
if ((!(button instanceof YAHOO.widget.ToolbarButton)) && (!(button instanceof YAHOO.widget.ToolbarButtonAdvanced))) {
button = this.getButtonByValue(id);
}
if ((button instanceof YAHOO.widget.ToolbarButton) || (button instanceof YAHOO.widget.ToolbarButtonAdvanced)) {
return button;
}
return false;
};
/**
* Provides a rich toolbar widget based on the button and menu widgets
* @constructor
* @class Toolbar
* @extends YAHOO.util.Element
* @param {String/HTMLElement} el The element to turn into a toolbar.
* @param {Object} attrs Object liternal containing configuration parameters.
*/
YAHOO.widget.Toolbar = function(el, attrs) {
if (Lang.isObject(arguments[0]) && !Dom.get(el).nodeType) {
attrs = el;
}
var local_attrs = {};
if (attrs) {
Lang.augmentObject(local_attrs, attrs); //Break the config reference
}
var oConfig = {
element: null,
attributes: local_attrs
};
if (Lang.isString(el) && Dom.get(el)) {
oConfig.element = Dom.get(el);
} else if (Lang.isObject(el) && Dom.get(el) && Dom.get(el).nodeType) {
oConfig.element = Dom.get(el);
}
if (!oConfig.element) {
oConfig.element = document.createElement('DIV');
oConfig.element.id = Dom.generateId();
if (local_attrs.container && Dom.get(local_attrs.container)) {
Dom.get(local_attrs.container).appendChild(oConfig.element);
}
}
if (!oConfig.element.id) {
oConfig.element.id = ((Lang.isString(el)) ? el : Dom.generateId());
}
var fs = document.createElement('fieldset');
var lg = document.createElement('legend');
lg.innerHTML = 'Toolbar';
fs.appendChild(lg);
var cont = document.createElement('DIV');
oConfig.attributes.cont = cont;
Dom.addClass(cont, 'yui-toolbar-subcont');
fs.appendChild(cont);
oConfig.element.appendChild(fs);
oConfig.element.tabIndex = -1;
oConfig.attributes.element = oConfig.element;
oConfig.attributes.id = oConfig.element.id;
YAHOO.widget.Toolbar.superclass.constructor.call(this, oConfig.element, oConfig.attributes);
};
YAHOO.extend(YAHOO.widget.Toolbar, YAHOO.util.Element, {
/**
* @method _addMenuClasses
* @private
* @description This method is called from Menu's renderEvent to add a few more classes to the menu items
* @param {String} ev The event that fired.
* @param {Array} na Array of event information.
* @param {Object} o Button config object.
*/
_addMenuClasses: function(ev, na, o) {
Dom.addClass(this.element, 'yui-toolbar-' + o.get('value') + '-menu');
if (Dom.hasClass(o._button.parentNode.parentNode, 'yui-toolbar-select')) {
Dom.addClass(this.element, 'yui-toolbar-select-menu');
}
var items = this.getItems();
for (var i = 0; i < items.length; i++) {
Dom.addClass(items[i].element, 'yui-toolbar-' + o.get('value') + '-' + ((items[i].value) ? items[i].value.replace(/ /g, '-').toLowerCase() : items[i]._oText.nodeValue.replace(/ /g, '-').toLowerCase()));
Dom.addClass(items[i].element, 'yui-toolbar-' + o.get('value') + '-' + ((items[i].value) ? items[i].value.replace(/ /g, '-') : items[i]._oText.nodeValue.replace(/ /g, '-')));
}
},
/**
* @property buttonType
* @description The default button to use
* @type Object
*/
buttonType: YAHOO.widget.ToolbarButton,
/**
* @property dd
* @description The DragDrop instance associated with the Toolbar
* @type Object
*/
dd: null,
/**
* @property _colorData
* @description Object reference containing colors hex and text values.
* @type Object
*/
_colorData: {
/* {{{ _colorData */
'#111111': 'Obsidian',
'#2D2D2D': 'Dark Gray',
( run in 2.484 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )