source: pro-bachkim-filespace/sourcecode/assets/js/vscontextmenu.js @ 13

Last change on this file since 13 was 13, checked in by dungnv, 11 years ago
  • Property svn:mime-type set to text/plain
File size: 1003 bytes
Line 
1if(jQuery) (function($){
2       
3        $.extend($.fn, {
4                violetcontextmenu: function (o) {
5                                if( !o ) var o = {};
6                                if( o.groups == undefined ) o.group = null;
7                                if( o.items == undefined ) o.items = null;
8                                if( o.container == undefined ) o.container = $(this);
9                               
10                                var buildMenu = function () {
11                                        //if (o.groups == null) return false;
12                                        var divElement = '<div class="contextmenu"></div>';
13                                        $(o.container).append(divElement);
14                                        var menu = $('.contextmenu');
15                                        var divSeparator = '<div class="contextmenu separator"></div>';
16                                        var divItem = '';
17                                        var count = 0;
18                                        for(var g in o.groups) {
19                                                if (count != 0) $(menu).append(divSeparator);
20                                               
21                                                divItem = '<div class="contextmenu item">item ' + g +'</div>';
22                                                $(menu).append(divItem);
23                                               
24                                                count++;
25                                        }
26                                       
27                                }
28                               
29                                buildMenu();
30                               
31                                this.initialize = function() {
32                                return this;
33                        };
34       
35                                return this.initialize();
36                        }
37        });
38
39})(jQuery);
Note: See TracBrowser for help on using the repository browser.