-
Notifications
You must be signed in to change notification settings - Fork 0
/
contextMenu.html
141 lines (113 loc) · 4.2 KB
/
contextMenu.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://swisnl.github.io/jQuery-contextMenu/css/screen.css" type="text/css"/>
<link rel="stylesheet" href="https://swisnl.github.io/jQuery-contextMenu/css/theme.css" type="text/css"/>
</head>
<body>
<table width="100%" border="1">
<tbody>
<tr class="test">
<td >dasdasd</td>
<td>dsadsa</td>
</tr>
<tr class="test">
<td>dasdasd</td>
<td>gsdfd</td>
</tr>
</tbody>
</table>
<button class="contextMenu">hover over me</button>
<link href="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.js" type="text/javascript"></script>
<script src="https://swisnl.github.io/jQuery-contextMenu/js/main.js" type="text/javascript"></script>
<script>
$(function () {
// make button open the menu
$('#activate-menu').on('click', function (e) {
e.preventDefault();
$('.context-menu-one').contextMenu();
// or $('.context-menu-one').trigger("contextmenu");
// or $('.context-menu-one').contextMenu({x: 100, y: 100});
});
$.contextMenu({
selector: '.contextMenu',
trigger: 'left',
autohide: true,
callback: function (key, options) {
var m = "clicked: " + key;
var mainKey = key;
if (mainKey == "cut") {
console.log(m);
try {
ubot.runScript('test(m)');
} catch (ignore) {
console.log("ignored");
}
} else if (mainKey == "copy") {
console.log("clicked copy");
}
},
items: {
"edit": {
name: "Edit",
icon: "edit"
},
"cut": {
name: "Cut",
icon: "cut"
},
"copy": {
name: "Copy",
icon: "copy"
},
"paste": {
name: "Paste",
icon: "paste"
},
"delete": {
name: "Delete",
icon: "delete"
},
"sep1": "---------",
"quit": {
name: "Quit",
icon: function ($element, key, item) {
return 'context-menu-icon context-menu-icon-quit';
}
}
}
});
});
</script>
<!--
<script>
$(function(){
$.contextMenu({
selector: '.test',
trigger: 'right',
callback: function(key, options) {
var m = "clicked: " + key;
console.log(m) || alert(m);
},
items: {
"edit": {name: "Edit", icon: "edit"},
"cut": {name: "Cut", icon: "cut"},
"copy": {name: "Copy", icon: "copy"},
"paste": {name: "Paste", icon: "paste"},
"delete": {name: "Delete", icon: "delete"},
"sep1": "---------",
"quit": {name: "Quit", icon:
function($element, key, item){ return 'context-menu-icon context-menu-icon-quit'; }}
}
});
});
</script>
-->
</body>
</html>