-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.js
More file actions
41 lines (36 loc) · 1001 Bytes
/
Copy pathmenu.js
File metadata and controls
41 lines (36 loc) · 1001 Bytes
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
var contexts = ["page"];
var parent = chrome.contextMenus.create({
'title': 'Quan tam'
});
$.getJSON(config.server_url + '/user/topic', function (toipcs) {
$.each(toipcs, function (i, topic) {
chrome.contextMenus.create({
'title': topic.name,
'parentId': parent,
'onclick': function (info, tab) {
onMenuItemClick(info, tab, topic)
}
});
});
//create and post into a new topic
chrome.contextMenus.create({
'title': 'New Group',
'parentId': parent,
'onclick': function (info, tab) {
var answer = prompt("Topic name?");
}
});
});
function onMenuItemClick(info, tab, topic) {
$.ajax({
'url': config.server_url + "/post/link",
'method': 'post',
'data': {
'url': info.pageUrl,
'topicId': topic.id
},
'success': function (data) {
alert("Them thanh Cong!")
}
});
}