src/components/vendors/contextMenu.js
function (obj) {
            var cmenu = this;
            var label = obj.label;
            if (typeof obj === "function") {
                obj = {onclick: obj};
            } // If passed a simple function, turn it into a property of an object
            // Default properties, extended in case properties are passed
            var o = $.extend({
                onclick: function () {
                },
                className: '',
                hoverClassName: cmenu.itemHoverClassName,
                icon: '',
                disabled: false,
                title: '',
                hoverItem: cmenu.hoverItem,
                hoverItemOut: cmenu.hoverItemOut
            }, obj);
            // If an icon is specified, hard-code the background-image style. Themes that don't show images should take this into account in their CSS
            var iconStyle = (o.icon) ? 'background-image:url(' + o.icon + ');' : '';
            var $div = $('<div class="' + cmenu.itemClassName + ' ' + o.className + ((o.disabled) ? ' ' + cmenu.disabledItemClassName : '') + '" title="' + o.title + '"></div>')
            // If the item is disabled, don't do anything when it is clicked
                .click(
                    function (e) {
                        if (cmenu.isItemDisabled(this)) {
                            return false;
                        }
                        else {
                            return o.onclick.call(cmenu.target, this, cmenu, e, label);
                        }
                    }
                )
                // Change the class of the item when hovered over
                .hover(
                    function () {
                        o.hoverItem.call(this, (cmenu.isItemDisabled(this)) ? cmenu.disabledItemHoverClassName : o.hoverClassName);
                    }
                    , function () {
                        o.hoverItemOut.call(this, (cmenu.isItemDisabled(this)) ? cmenu.disabledItemHoverClassName : o.hoverClassName);
                    }
                );
            var $idiv = $('<div class="' + cmenu.innerDivClassName + '" style="' + iconStyle + '">' + label + '</div>');
            $div.append($idiv);
            return $div;
        }
function (obj) {
            var cmenu = this;
            var label = obj.label;
            if (typeof obj === "function") {
                obj = {onclick: obj};
            } // If passed a simple function, turn it into a property of an object
            // Default properties, extended in case properties are passed
            var o = $.extend({
                onclick: function () {
                },
                className: '',
                hoverClassName: cmenu.itemHoverClassName,
                icon: '',
                disabled: false,
                title: '',
                hoverItem: cmenu.hoverItem,
                hoverItemOut: cmenu.hoverItemOut
            }, obj);
            // If an icon is specified, hard-code the background-image style. Themes that don't show images should take this into account in their CSS
            var iconStyle = (o.icon) ? 'background-image:url(' + o.icon + ');' : '';
            var $div = $('<div class="' + cmenu.itemClassName + ' ' + o.className + ((o.disabled) ? ' ' + cmenu.disabledItemClassName : '') + '" title="' + o.title + '"></div>')
            // If the item is disabled, don't do anything when it is clicked
                .click(
                    function (e) {
                        if (cmenu.isItemDisabled(this)) {
                            return false;
                        }
                        else {
                            return o.onclick.call(cmenu.target, this, cmenu, e, label);
                        }
                    }
                )
                // Change the class of the item when hovered over
                .hover(
                    function () {
                        o.hoverItem.call(this, (cmenu.isItemDisabled(this)) ? cmenu.disabledItemHoverClassName : o.hoverClassName);
                    }
                    , function () {
                        o.hoverItemOut.call(this, (cmenu.isItemDisabled(this)) ? cmenu.disabledItemHoverClassName : o.hoverClassName);
                    }
                );
            var $idiv = $('<div class="' + cmenu.innerDivClassName + '" style="' + iconStyle + '">' + label + '</div>');
            $div.append($idiv);
            return $div;
        }
function ( obj ) { var cmenu = this ; var label = obj . label ; if ( typeof obj === "function" ) { obj = { onclick : obj } ; } // If passed a simple function, turn it into a property of an object // Default properties, extended in case properties are passed var o = $ . extend ( { onclick : function ( ) { } , className : '' , hoverClassName : cmenu . itemHoverClassName , icon : '' , disabled : false , title : '' , hoverItem : cmenu . hoverItem , hoverItemOut : cmenu . hoverItemOut } , obj ) ; // If an icon is specified, hard-code the background-image style. Themes that don't show images should take this into account in their CSS var iconStyle = ( o . icon ) ? 'background-image:url(' + o . icon + ');' : '' ; var $div = $ ( '<div class="' + cmenu . itemClassName + ' ' + o . className + ( ( o . disabled ) ? ' ' + cmenu . disabledItemClassName : '' ) + '" title="' + o . title + '"></div>' ) // If the item is disabled, don't do anything when it is clicked . click ( function ( e ) { if ( cmenu . isItemDisabled ( this ) ) { return false ; } else { return o . onclick . call ( cmenu . target , this , cmenu , e , label ) ; } } ) // Change the class of the item when hovered over . hover ( function ( ) { o . hoverItem . call ( this , ( cmenu . isItemDisabled ( this ) ) ? cmenu . disabledItemHoverClassName : o . hoverClassName ) ; } , function ( ) { o . hoverItemOut . call ( this , ( cmenu . isItemDisabled ( this ) ) ? cmenu . disabledItemHoverClassName : o . hoverClassName ) ; } ) ; var $idiv = $ ( '<div class="' + cmenu . innerDivClassName + '" style="' + iconStyle + '">' + label + '</div>' ) ; $div . append ( $idiv ) ; return $div ; }
Create an individual menu item
Create an individual menu item