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

📄 simpleeditor-debug.js

📁 这是YUI的源码及相关示例。里面有很多很炫的Javascript效果。
💻 JS
📖 第 1 页 / 共 5 页
字号:
        }            });})();/** * @description <p>Creates a rich Toolbar widget based on Button. Primarily used with the Rich Text Editor</p> * @namespace YAHOO.widget * @requires yahoo, dom, element, event, toolbarbutton * @optional container_core, dragdrop * @beta */(function() {    /**    * @private    **/var Dom = YAHOO.util.Dom,    Event = YAHOO.util.Event,    Lang = YAHOO.lang;        var getButton = function(id) {        var button = id;        if (Lang.isString(id)) {            button = this.getButtonById(id);        }        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) {        YAHOO.log('Toolbar Initalizing', 'info', 'Toolbar');        YAHOO.log(arguments.length + ' arguments passed to constructor', 'info', 'Toolbar');                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) {            YAHOO.log('No element defined, creating toolbar container', 'warn', 'Toolbar');            oConfig.element = document.createElement('DIV');            oConfig.element.id = Dom.generateId();                        if (local_attrs.container && Dom.get(local_attrs.container)) {                YAHOO.log('Container found in config appending to it (' + Dom.get(local_attrs.container).id + ')', 'info', 'Toolbar');                Dom.get(local_attrs.container).appendChild(oConfig.element);            }        }                if (!oConfig.element.id) {            oConfig.element.id = ((Lang.isString(el)) ? el : Dom.generateId());            YAHOO.log('No element ID defined for toolbar container, creating..', 'warn', 'Toolbar');        }        YAHOO.log('Initing toolbar with id: ' + oConfig.element.id, 'info', 'Toolbar');                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',    '#434343': 'Shale',    '#5B5B5B': 'Flint',    '#737373': 'Gray',    '#8B8B8B': 'Concrete',    '#A2A2A2': 'Gray',    '#B9B9B9': 'Titanium',    '#000000': 'Black',    '#D0D0D0': 'Light Gray',    '#E6E6E6': 'Silver',    '#FFFFFF': 'White',    '#BFBF00': 'Pumpkin',    '#FFFF00': 'Yellow',    '#FFFF40': 'Banana',    '#FFFF80': 'Pale Yellow',    '#FFFFBF': 'Butter',    '#525330': 'Raw Siena',    '#898A49': 'Mildew',    '#AEA945': 'Olive',    '#7F7F00': 'Paprika',    '#C3BE71': 'Earth',    '#E0DCAA': 'Khaki',    '#FCFAE1': 'Cream',    '#60BF00': 'Cactus',    '#80FF00': 'Chartreuse',    '#A0FF40': 'Green',    '#C0FF80': 'Pale Lime',    '#DFFFBF': 'Light Mint',    '#3B5738': 'Green',    '#668F5A': 'Lime Gray',    '#7F9757': 'Yellow',    '#407F00': 'Clover',    '#8A9B55': 'Pistachio',    '#B7C296': 'Light Jade',    '#E6EBD5': 'Breakwater',    '#00BF00': 'Spring Frost',    '#00FF80': 'Pastel Green',    '#40FFA0': 'Light Emerald',    '#80FFC0': 'Sea Foam',    '#BFFFDF': 'Sea Mist',    '#033D21': 'Dark Forrest',    '#438059': 'Moss',    '#7FA37C': 'Medium Green',    '#007F40': 'Pine',    '#8DAE94': 'Yellow Gray Green',    '#ACC6B5': 'Aqua Lung',    '#DDEBE2': 'Sea Vapor',    '#00BFBF': 'Fog',    '#00FFFF': 'Cyan',    '#40FFFF': 'Turquoise Blue',    '#80FFFF': 'Light Aqua',    '#BFFFFF': 'Pale Cyan',    '#033D3D': 'Dark Teal',    '#347D7E': 'Gray Turquoise',    '#609A9F': 'Green Blue',    '#007F7F': 'Seaweed',    '#96BDC4': 'Green Gray',    '#B5D1D7': 'Soapstone',    '#E2F1F4': 'Light Turquoise',    '#0060BF': 'Summer Sky',    '#0080FF': 'Sky Blue',    '#40A0FF': 'Electric Blue',    '#80C0FF': 'Light Azure',    '#BFDFFF': 'Ice Blue',    '#1B2C48': 'Navy',    '#385376': 'Biscay',    '#57708F': 'Dusty Blue',    '#00407F': 'Sea Blue',    '#7792AC': 'Sky Blue Gray',    '#A8BED1': 'Morning Sky',    '#DEEBF6': 'Vapor',    '#0000BF': 'Deep Blue',    '#0000FF': 'Blue',    '#4040FF': 'Cerulean Blue',    '#8080FF': 'Evening Blue',    '#BFBFFF': 'Light Blue',    '#212143': 'Deep Indigo',    '#373E68': 'Sea Blue',    '#444F75': 'Night Blue',    '#00007F': 'Indigo Blue',    '#585E82': 'Dockside',    '#8687A4': 'Blue Gray',    '#D2D1E1': 'Light Blue Gray',    '#6000BF': 'Neon Violet',    '#8000FF': 'Blue Violet',    '#A040FF': 'Violet Purple',    '#C080FF': 'Violet Dusk',    '#DFBFFF': 'Pale Lavender',    '#302449': 'Cool Shale',    '#54466F': 'Dark Indigo',    '#655A7F': 'Dark Violet',    '#40007F': 'Violet',    '#726284': 'Smoky Violet',    '#9E8FA9': 'Slate Gray',    '#DCD1DF': 'Violet White',    '#BF00BF': 'Royal Violet',    '#FF00FF': 'Fuchsia',    '#FF40FF': 'Magenta',    '#FF80FF': 'Orchid',    '#FFBFFF': 'Pale Magenta',    '#4A234A': 'Dark Purple',    '#794A72': 'Medium Purple',    '#936386': 'Cool Granite',    '#7F007F': 'Purple',    '#9D7292': 'Purple Moon',    '#C0A0B6': 'Pale Purple',    '#ECDAE5': 'Pink Cloud',    '#BF005F': 'Hot Pink',    '#FF007F': 'Deep Pink',    '#FF409F': 'Grape',    '#FF80BF': 'Electric Pink',    '#FFBFDF': 'Pink',    '#451528': 'Purple Red',    '#823857': 'Purple Dino',    '#A94A76': 'Purple Gray',    '#7F003F': 'Rose',    '#BC6F95': 'Antique Mauve',    '#D8A5BB': 'Cool Marble',    '#F7DDE9': 'Pink Granite',    '#C00000': 'Apple',    '#FF0000': 'Fire Truck',    '#FF4040': 'Pale Red',    '#FF8080': 'Salmon',    '#FFC0C0': 'Warm Pink',    '#441415': 'Sepia',    '#82393C': 'Rust',    '#AA4D4E': 'Brick',    '#800000': 'Brick Red',    '#BC6E6E': 'Mauve',    '#D8A3A4': 'Shrimp Pink',    '#F8DDDD': 'Shell Pink',    '#BF5F00': 'Dark Orange',    '#FF7F00': 'Orange',    '#FF9F40': 'Grapefruit',    '#FFBF80': 'Canteloupe',    '#FFDFBF': 'Wax',    '#482C1B': 'Dark Brick',    '#855A40': 'Dirt',    '#B27C51': 'Tan',    '#7F3F00': 'Nutmeg',    '#C49B71': 'Mustard',    '#E1C4A8': 'Pale Tan',    '#FDEEE0': 'Marble'/* }}} */        },        /**         * @property _colorPicker        * @description The HTML Element containing the colorPicker        * @type HTMLElement        */        _colorPicker: null,        /**         * @property STR_COLLAPSE        * @description String for Toolbar Collapse Button        * @type String        */        STR_COLLAPSE: 'Collapse Toolbar',        /**         * @property STR_SPIN_LABEL        * @description String for spinbutton dynamic label. Note the {VALUE} will be replaced with YAHOO.lang.substitute        * @type String        */        STR_SPIN_LABEL: 'Spin Button with value {VALUE}. Use Control Shift Up Arrow and Control Shift Down arrow keys to increase or decrease the value.',        /**         * @property STR_SPIN_UP        * @description String for spinbutton up        * @type String        */        STR_SPIN_UP: 'Click to increase the value of this input',        /**         * @property STR_SPIN_DOWN        * @description String for spinbutton down        * @type String

⌨️ 快捷键说明

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