src/components/vendors/contextMenu.js
function (menu, cmenu) {
            var className = cmenu.className;
            $.each(cmenu.theme.split(","), function (i, n) {
                className += ' ' + cmenu.themePrefix + n;
            });
//			var $t = $('<div style="background-color:#ffff00; xwidth:200px; height:200px"><table style="" cellspacing=0 cellpadding=0></table></div>').click(function(){cmenu.hide(); return false;}); // We wrap a table around it so width can be flexible
            var $t = $('<table style="" cellspacing="0" cellpadding="0"></table>').click(function () {
                cmenu.hide();
                return false;
            }); // We wrap a table around it so width can be flexible
            var $tr = $('<tr></tr>');
            var $td = $('<td></td>');
            var $div = cmenu._div = $('<div class="' + className + '"></div>');

            cmenu._div.hover(
                function () {
                    if (cmenu.closeTimer) {
                        clearTimeout(cmenu.closeTimer);
                        cmenu.closeTimer = null;
                    }
                },
                function () {
                    var myClass = cmenu;

                    function timerRelay() {
                        myClass.hide();
                    }

                    myClass.closeTimer = setTimeout(timerRelay, 500);
                }
            );

            // Each menu item is specified as either:
            //     title:function
            // or  title: { property:value ... }
            /*
             for (var i=0; i<menu.length; i++) {
             var m = menu[i];
             if (m==$.contextMenu.separator) {
             $div.append(cmenu.createSeparator());
             }
             else {
             for (var opt in menu[i]) {
             $div.append(cmenu.createMenuItem(opt,menu[i][opt])); // Extracted to method for extensibility
             }
             }
             }
             */
            for (var i = 0; i < menu.length; i++) {
                var m = menu[i];
                if (m === $.contextMenu.separator) {
                    $div.append(cmenu.createSeparator());
                }
                else {
                    $div.append(cmenu.createMenuItem(m)); // Extracted to method for extensibility
                }
            }
            if (cmenu.useIframe) {
                $td.append(cmenu.createIframe());
            }
            $t.append($tr.append($td.append($div)));
            return $t;
        }
function (menu, cmenu) {
            var className = cmenu.className;
            $.each(cmenu.theme.split(","), function (i, n) {
                className += ' ' + cmenu.themePrefix + n;
            });
//			var $t = $('<div style="background-color:#ffff00; xwidth:200px; height:200px"><table style="" cellspacing=0 cellpadding=0></table></div>').click(function(){cmenu.hide(); return false;}); // We wrap a table around it so width can be flexible
            var $t = $('<table style="" cellspacing="0" cellpadding="0"></table>').click(function () {
                cmenu.hide();
                return false;
            }); // We wrap a table around it so width can be flexible
            var $tr = $('<tr></tr>');
            var $td = $('<td></td>');
            var $div = cmenu._div = $('<div class="' + className + '"></div>');

            cmenu._div.hover(
                function () {
                    if (cmenu.closeTimer) {
                        clearTimeout(cmenu.closeTimer);
                        cmenu.closeTimer = null;
                    }
                },
                function () {
                    var myClass = cmenu;

                    function timerRelay() {
                        myClass.hide();
                    }

                    myClass.closeTimer = setTimeout(timerRelay, 500);
                }
            );

            // Each menu item is specified as either:
            //     title:function
            // or  title: { property:value ... }
            /*
             for (var i=0; i<menu.length; i++) {
             var m = menu[i];
             if (m==$.contextMenu.separator) {
             $div.append(cmenu.createSeparator());
             }
             else {
             for (var opt in menu[i]) {
             $div.append(cmenu.createMenuItem(opt,menu[i][opt])); // Extracted to method for extensibility
             }
             }
             }
             */
            for (var i = 0; i < menu.length; i++) {
                var m = menu[i];
                if (m === $.contextMenu.separator) {
                    $div.append(cmenu.createSeparator());
                }
                else {
                    $div.append(cmenu.createMenuItem(m)); // Extracted to method for extensibility
                }
            }
            if (cmenu.useIframe) {
                $td.append(cmenu.createIframe());
            }
            $t.append($tr.append($td.append($div)));
            return $t;
        }
function ( menu , cmenu ) { var className = cmenu . className ; $ . each ( cmenu . theme . split ( "," ) , function ( i , n ) { className += ' ' + cmenu . themePrefix + n ; } ) ; //			var $t = $('<div style="background-color:#ffff00; xwidth:200px; height:200px"><table style="" cellspacing=0 cellpadding=0></table></div>').click(function(){cmenu.hide(); return false;}); // We wrap a table around it so width can be flexible var $t = $ ( '<table style="" cellspacing="0" cellpadding="0"></table>' ) . click ( function ( ) { cmenu . hide ( ) ; return false ; } ) ; // We wrap a table around it so width can be flexible var $tr = $ ( '<tr></tr>' ) ; var $td = $ ( '<td></td>' ) ; var $div = cmenu . _div = $ ( '<div class="' + className + '"></div>' ) ; cmenu . _div . hover ( function ( ) { if ( cmenu . closeTimer ) { clearTimeout ( cmenu . closeTimer ) ; cmenu . closeTimer = null ; } } , function ( ) { var myClass = cmenu ; function timerRelay ( ) { myClass . hide ( ) ; } myClass . closeTimer = setTimeout ( timerRelay , 500 ) ; } ) ; // Each menu item is specified as either: //     title:function // or  title: { property:value ... } /*
             for (var i=0; i<menu.length; i++) {
             var m = menu[i];
             if (m==$.contextMenu.separator) {
             $div.append(cmenu.createSeparator());
             }
             else {
             for (var opt in menu[i]) {
             $div.append(cmenu.createMenuItem(opt,menu[i][opt])); // Extracted to method for extensibility
             }
             }
             }
             */ for ( var i = 0 ; i < menu . length ; i ++ ) { var m = menu [ i ] ; if ( m === $ . contextMenu . separator ) { $div . append ( cmenu . createSeparator ( ) ) ; } else { $div . append ( cmenu . createMenuItem ( m ) ) ; // Extracted to method for extensibility } } if ( cmenu . useIframe ) { $td . append ( cmenu . createIframe ( ) ) ; } $t . append ( $tr . append ( $td . append ( $div ) ) ) ; return $t ; }
Accept an Array representing a menu structure and turn it into HTML
Accept an Array representing a menu structure and turn it into HTML