⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpleeditor-debug.js

📁 这是YUI的源码及相关示例。里面有很多很炫的Javascript效果。
💻 JS
📖 第 1 页 / 共 5 页
字号:
        */        STR_SPIN_DOWN: 'Click to decrease the value of this input',        /**         * @property _titlebar        * @description Object reference to the titlebar        * @type HTMLElement        */        _titlebar: null,        /**         * @property browser        * @description Standard browser detection        * @type Object        */        browser: YAHOO.env.ua,        /**        * @protected        * @property _buttonList        * @description Internal property list of current buttons in the toolbar        * @type Array        */        _buttonList: null,        /**        * @protected        * @property _buttonGroupList        * @description Internal property list of current button groups in the toolbar        * @type Array        */        _buttonGroupList: null,        /**        * @protected        * @property _sep        * @description Internal reference to the separator HTML Element for cloning        * @type HTMLElement        */        _sep: null,        /**        * @protected        * @property _sepCount        * @description Internal refernce for counting separators, so we can give them a useful class name for styling        * @type Number        */        _sepCount: null,        /**        * @protected        * @property draghandle        * @type HTMLElement        */        _dragHandle: null,        /**        * @protected        * @property _toolbarConfigs        * @type Object        */        _toolbarConfigs: {            renderer: true        },        /**        * @protected        * @property CLASS_CONTAINER        * @description Default CSS class to apply to the toolbar container element        * @type String        */        CLASS_CONTAINER: 'yui-toolbar-container',        /**        * @protected        * @property CLASS_DRAGHANDLE        * @description Default CSS class to apply to the toolbar's drag handle element        * @type String        */        CLASS_DRAGHANDLE: 'yui-toolbar-draghandle',        /**        * @protected        * @property CLASS_SEPARATOR        * @description Default CSS class to apply to all separators in the toolbar        * @type String        */        CLASS_SEPARATOR: 'yui-toolbar-separator',        /**        * @protected        * @property CLASS_DISABLED        * @description Default CSS class to apply when the toolbar is disabled        * @type String        */        CLASS_DISABLED: 'yui-toolbar-disabled',        /**        * @protected        * @property CLASS_PREFIX        * @description Default prefix for dynamically created class names        * @type String        */        CLASS_PREFIX: 'yui-toolbar',        /**         * @method init        * @description The Toolbar class's initialization method        */        init: function(p_oElement, p_oAttributes) {            YAHOO.widget.Toolbar.superclass.init.call(this, p_oElement, p_oAttributes);        },        /**        * @method initAttributes        * @description Initializes all of the configuration attributes used to create         * the toolbar.        * @param {Object} attr Object literal specifying a set of         * configuration attributes used to create the toolbar.        */        initAttributes: function(attr) {            YAHOO.widget.Toolbar.superclass.initAttributes.call(this, attr);            this.addClass(this.CLASS_CONTAINER);            /**            * @attribute buttonType            * @description The buttonType to use (advanced or basic)            * @type String            */            this.setAttributeConfig('buttonType', {                value: attr.buttonType || 'basic',                writeOnce: true,                validator: function(type) {                    switch (type) {                        case 'advanced':                        case 'basic':                            return true;                    }                    return false;                },                method: function(type) {                    if (type == 'advanced') {                        if (YAHOO.widget.Button) {                            this.buttonType = YAHOO.widget.ToolbarButtonAdvanced;                        } else {                            YAHOO.log('Can not find YAHOO.widget.Button', 'error', 'Toolbar');                            this.buttonType = YAHOO.widget.ToolbarButton;                        }                    } else {                        this.buttonType = YAHOO.widget.ToolbarButton;                    }                }            });            /**            * @attribute buttons            * @description Object specifying the buttons to include in the toolbar            * Example:            * <code><pre>            * {            *   { id: 'b3', type: 'button', label: 'Underline', value: 'underline' },            *   { type: 'separator' },            *   { id: 'b4', type: 'menu', label: 'Align', value: 'align',            *       menu: [            *           { text: "Left", value: 'alignleft' },            *           { text: "Center", value: 'aligncenter' },            *           { text: "Right", value: 'alignright' }            *       ]            *   }            * }            * </pre></code>            * @type Array            */                        this.setAttributeConfig('buttons', {                value: [],                writeOnce: true,                method: function(data) {                    for (var i in data) {                        if (Lang.hasOwnProperty(data, i)) {                            if (data[i].type == 'separator') {                                this.addSeparator();                            } else if (data[i].group !== undefined) {                                this.addButtonGroup(data[i]);                            } else {                                this.addButton(data[i]);                            }                        }                    }                }            });            /**            * @attribute disabled            * @description Boolean indicating if the toolbar should be disabled. It will also disable the draggable attribute if it is on.            * @default false            * @type Boolean            */            this.setAttributeConfig('disabled', {                value: false,                method: function(disabled) {                    if (this.get('disabled') === disabled) {                        return false;                    }                    if (disabled) {                        this.addClass(this.CLASS_DISABLED);                        this.set('draggable', false);                        this.disableAllButtons();                    } else {                        this.removeClass(this.CLASS_DISABLED);                        if (this._configs.draggable._initialConfig.value) {                            //Draggable by default, set it back                            this.set('draggable', true);                        }                        this.resetAllButtons();                    }                }            });            /**            * @config cont            * @description The container for the toolbar.            * @type HTMLElement            */            this.setAttributeConfig('cont', {                value: attr.cont,                readOnly: true            });            /**            * @attribute grouplabels            * @description Boolean indicating if the toolbar should show the group label's text string.            * @default true            * @type Boolean            */            this.setAttributeConfig('grouplabels', {                value: ((attr.grouplabels === false) ? false : true),                method: function(grouplabels) {                    if (grouplabels) {                        Dom.removeClass(this.get('cont'), (this.CLASS_PREFIX + '-nogrouplabels'));                    } else {                        Dom.addClass(this.get('cont'), (this.CLASS_PREFIX + '-nogrouplabels'));                    }                }            });            /**            * @attribute titlebar            * @description Boolean indicating if the toolbar should have a titlebar. If            * passed a string, it will use that as the titlebar text            * @default false            * @type Boolean or String            */            this.setAttributeConfig('titlebar', {                value: false,                method: function(titlebar) {                    if (titlebar) {                        if (this._titlebar && this._titlebar.parentNode) {                            this._titlebar.parentNode.removeChild(this._titlebar);                        }                        this._titlebar = document.createElement('DIV');                        this._titlebar.tabIndex = '-1';                        Event.on(this._titlebar, 'focus', function() {                            this._handleFocus();                        }, this, true);                        Dom.addClass(this._titlebar, this.CLASS_PREFIX + '-titlebar');                        if (Lang.isString(titlebar)) {                            var h2 = document.createElement('h2');                            h2.tabIndex = '-1';                            h2.innerHTML = '<a href="#" tabIndex="0">' + titlebar + '</a>';                            this._titlebar.appendChild(h2);                            Event.on(h2.firstChild, 'click', function(ev) {                                Event.stopEvent(ev);                            });                            Event.on([h2, h2.firstChild], 'focus', function() {                                this._handleFocus();                            }, this, true);                        }                        if (this.get('firstChild')) {                            this.insertBefore(this._titlebar, this.get('firstChild'));                        } else {                            this.appendChild(this._titlebar);                        }                        if (this.get('collapse')) {                            this.set('collapse', true);                        }                    } else if (this._titlebar) {                        if (this._titlebar && this._titlebar.parentNode) {                            this._titlebar.parentNode.removeChild(this._titlebar);                        }                    }                }            });            /**            * @attribute collapse            * @description Boolean indicating if the the titlebar should have a collapse button.            * The collapse button will not remove the toolbar, it will minimize it to the titlebar            * @default false            * @type Boolean            */            this.setAttributeConfig('collapse', {                value: false,                method: function(collapse) {                    if (this._titlebar) {                        var collapseEl = null;                        var el = Dom.getElementsByClassName('collapse', 'span', this._titlebar);                        if (collapse) {                            if (el.length > 0) {                                //There is already a collapse button                                return true;                            }                            collapseEl = document.createElement('SPAN');                            collapseEl.innerHTML = 'X';                            collapseEl.title = this.STR_COLLAPSE;                            Dom.addClass(collapseEl, 'collapse');                            this._titlebar.appendChild(collapseEl);                            Event.addListener(collapseEl, 'click', function() {                                if (Dom.hasClass(this.get('cont').parentNode, 'yui-toolbar-container-collapsed')) {                                    this.collapse(false); //Expand Toolbar                                } else {                                    this.collapse(); //Collapse Toolbar                                }                            }, this, true);                        } else {                            collapseEl = Dom.getElementsByClassName('collapse', 'span', this._titlebar);                            if (collapseEl[0]) {                                if (Dom.hasClass(this.get('cont').parentNode, 'yui-toolbar-container-collapsed')) {                                    //We are closed, reopen the titlebar..                                    this.collapse(false); //Expand Toolbar                                }                                collapseEl[0].parentNode.removeChild(collapseEl[0]);                            }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -