1
+ <!DOCTYPE html>
2
+ < html xmlns ="http://www.w3.org/1999/xhtml " xml:lang ="de " lang ="de ">
3
+ < head >
4
+ < meta charset ="utf-8 " />
5
+ < meta http-equiv ="content-type " content ="text/html; charset=utf-8 " />
6
+ < title > Custom Command Types Demo - jQuery contextMenu Plugin</ title >
7
+ < meta name ="description " content ="simple contextMenu generator for interactive web applications based on jQuery " />
8
+
9
+ < script src ="../jquery-1.8.2.min.js " type ="text/javascript "> </ script >
10
+ < script src ="../src/jquery.ui.position.js " type ="text/javascript "> </ script >
11
+ < script src ="../src/jquery.contextMenu.js " type ="text/javascript "> </ script >
12
+ < script src ="../prettify/prettify.js " type ="text/javascript "> </ script >
13
+ < script src ="../screen.js " type ="text/javascript "> </ script >
14
+
15
+ < link href ="../src/jquery.contextMenu.css " rel ="stylesheet " type ="text/css " />
16
+ < link href ="../screen.css " rel ="stylesheet " type ="text/css " />
17
+ < link href ="../prettify/prettify.sunburst.css " rel ="stylesheet " type ="text/css " />
18
+
19
+ < script type ="text/javascript ">
20
+
21
+ var _gaq = _gaq || [ ] ;
22
+ _gaq . push ( [ '_setAccount' , 'UA-8922143-3' ] ) ;
23
+ _gaq . push ( [ '_trackPageview' ] ) ;
24
+
25
+ ( function ( ) {
26
+ var ga = document . createElement ( 'script' ) ; ga . type = 'text/javascript' ; ga . async = true ;
27
+ ga . src = ( 'https:' == document . location . protocol ? 'https://ssl' : 'http://www' ) + '.google-analytics.com/ga.js' ;
28
+ var s = document . getElementsByTagName ( 'script' ) [ 0 ] ; s . parentNode . insertBefore ( ga , s ) ;
29
+ } ) ( ) ;
30
+
31
+ </ script >
32
+ </ head >
33
+ < body >
34
+ < a id ="github-forkme " href ="https://github.com/medialize/jQuery-contextMenu "> < img src ="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png " alt ="Fork me on GitHub " /> </ a >
35
+ < div id ="container ">
36
+ < h1 > < a href ="https://github.com/medialize/jQuery-contextMenu "> jQuery contextMenu</ a > </ h1 >
37
+
38
+ < ul class ="menu ">
39
+ < li > < a href ="../index.html "> About</ a > </ li >
40
+ < li class ="active "> < a href ="../demo.html "> Demo</ a > </ li >
41
+ < li > < a href ="../docs.html "> Documentation</ a > </ li >
42
+ < li > < a href ="http://rodneyrehm.de/en/ "> Author</ a > </ li >
43
+ </ ul >
44
+
45
+ < h2 id ="demo "> Demo: Custom Command Types</ h2 >
46
+ < p > < code > jQuery.contextMenu</ code > allows you to create your own <comand>s and leverage the simple UI handling.</ p >
47
+ < div class ="inline-spaces ">
48
+ < div class ="context-menu-custom box menu-1 ">
49
+ < strong > right click me</ strong >
50
+ </ div >
51
+ </ div >
52
+
53
+ < h3 id ="code "> Example code: Custom Command Types</ h3 >
54
+ < script type ="text/javascript " class ="showcase ">
55
+ $ ( function ( ) {
56
+ /**************************************************
57
+ * Custom Command Handler
58
+ **************************************************/
59
+ $ . contextMenu . types . label = function ( item , opt , root ) {
60
+ // this === item.$node
61
+
62
+ $ ( '<span>Label</span><ul>'
63
+ + '<li class="label1" title="label 1">label 1</li>'
64
+ + '<li class="label2" title="label 2">label 2</li>'
65
+ + '<li class="label3" title="label 3">label 3</li>'
66
+ + '<li class="label4" title="label 4">label 4</li></ul>' )
67
+ . appendTo ( this )
68
+ . on ( 'click' , 'li' , function ( ) {
69
+ // do some funky stuff
70
+ var message = "text: " + $ ( this ) . text ( ) ;
71
+ $ ( '#msg' ) . text ( $ ( '#msg' ) . text ( ) + ' | ' + message ) ;
72
+ // hide the menu
73
+ root . $menu . trigger ( 'contextmenu:hide' ) ;
74
+ } ) ;
75
+
76
+ this . addClass ( 'labels' ) . on ( 'contextmenu:focus' , function ( e ) {
77
+ // setup some awesome stuff
78
+ } ) . on ( 'contextmenu:blur' , function ( e ) {
79
+ // tear down whatever you did
80
+ } ) . on ( 'keydown' , function ( e ) {
81
+ // some funky key handling, maybe?
82
+ } ) ;
83
+ } ;
84
+
85
+ /**************************************************
86
+ * Context-Menu with custom command "label"
87
+ **************************************************/
88
+ $ . contextMenu ( {
89
+ selector : '.context-menu-custom' ,
90
+ callback : function ( key , options ) {
91
+ var message = "clicked: " + key ;
92
+ $ ( '#msg' ) . text ( message ) ;
93
+ } ,
94
+ items : {
95
+ open : { name : "Open" , callback : $ . noop } ,
96
+ label : { type : "label" , customName : "Label" } ,
97
+ edit : { name : "Edit" , callback : $ . noop }
98
+ }
99
+ } ) ;
100
+ } ) ;
101
+ </ script >
102
+
103
+ < h3 id ="css "> Example CSS: Custom Command Types</ h3 >
104
+ < style type ="text/css " class ="showcase ">
105
+ .labels > ul {
106
+ margin : 0 ;
107
+ padding : 0 ;
108
+ list-style : none;
109
+ display : block;
110
+ float : none;
111
+ }
112
+ .labels > ul > li {
113
+ display : inline-block;
114
+ width : 20px ;
115
+ height : 20px ;
116
+ border : 1px solid # CCC ;
117
+ overflow : hidden;
118
+ text-indent : -2000px ;
119
+ }
120
+ .labels > ul > li .selected ,
121
+ .labels > ul > li : hover { border : 1px solid # 000 ; }
122
+ .labels > ul > li + li { margin-left : 5px ; }
123
+ .labels > ul > li .label1 { background : red; }
124
+ .labels > ul > li .label2 { background : green; }
125
+ .labels > ul > li .label3 { background : blue; }
126
+ .labels > ul > li .label4 { background : yellow; }
127
+ </ style >
128
+
129
+ < h3 id ="html "> Example HTML: Custom Command Types</ h3 >
130
+ < div style ="display:none " class ="showcase " data-showcase-import =".menu-1 "> </ div >
131
+
132
+ < h2 > jQuery Context Menu Demo Gallery</ h2 >
133
+ < ul id ="demo-list ">
134
+ < li > < a href ="../demo.html "> Simple Context Menu</ a > </ li >
135
+ < li > < a href ="on-dom-element.html "> Context Menu on DOM Element</ a > </ li >
136
+ < li > < a href ="dynamic.html "> Adding new Context Menu Triggers</ a > </ li >
137
+ < li > < a href ="dynamic-create.html "> Create Context Menu on demand</ a > </ li >
138
+ < li > < a href ="async-create.html "> Create Context Menu (asynchronous)</ a > </ li >
139
+
140
+ < li > < a href ="keeping-contextmenu-open.html "> Keeping the context menu open</ a > </ li >
141
+ < li > < a href ="callback.html "> Command's action (callbacks)</ a > </ li >
142
+
143
+ < li > < a href ="trigger-left-click.html "> Left-Click Trigger</ a > </ li >
144
+ < li > < a href ="trigger-swipe.html "> Swipe Trigger</ a > </ li >
145
+ < li > < a href ="trigger-hover.html "> Hover Activated Context Menu</ a > </ li >
146
+ < li > < a href ="trigger-hover-autohide.html "> Hover Activated Context Menu With Autohide</ a > </ li >
147
+ < li > < a href ="trigger-custom.html "> Custom Activated Context Menu</ a > </ li >
148
+
149
+ < li > < a href ="disabled-menu.html "> Disabled Menu</ a > </ li >
150
+ < li > < a href ="disabled.html "> Disabled Command</ a > </ li >
151
+ < li > < a href ="disabled-callback.html "> Disabled Callback Command</ a > </ li >
152
+ < li > < a href ="disabled-changing.html "> Changing Command's disabled status</ a > </ li >
153
+
154
+ < li > < a href ="accesskeys.html "> Accesskeys</ a > </ li >
155
+ < li > < a href ="sub-menus.html "> Submenus</ a > </ li >
156
+
157
+ < li > < a href ="input.html "> Input Commands</ a > </ li >
158
+ < li class ="current "> < a href ="custom-command.html "> Custom Command Types</ a > </ li >
159
+
160
+ < li > < a href ="menu-title.html "> Menus with titles</ a > </ li >
161
+
162
+ < li > < a href ="html5-import.html "> Importing HTML5 <menu type="context"></ a > </ li >
163
+ < li > < a href ="html5-polyfill.html "> HTML5 Polyfill</ a > </ li >
164
+ < li > < a href ="html5-polyfill-firefox8.html "> HTML5 Polyfill (Firefox 8)</ a > </ li >
165
+ </ ul >
166
+ </ div >
167
+ < div id ="msg "> </ div >
168
+ </ body >
169
+ </ html >
0 commit comments