/
content_script.js
53 lines (34 loc) · 1.48 KB
/
content_script.js
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
/**
Submits current page URL into OC queue
**/
function convert_video(info, tab) {
var pageUrl = info.pageUrl;
// console.log(info);
// console.log(tab)
// window.open(url);
// submit URL to OC queue
ocapi.submitVideo(pageUrl, function(hashCode) {
// alert("Hashcode:" + hashCode)
// Create a simple text notification:
var notification = webkitNotifications.createNotification(
'logo.png', // icon url - can be relative
'Hello!', // notification title
'Lorem ipsum...' // notification body text
);
// // Or create an HTML notification:
// var notification = webkitNotifications.createHTMLNotification(
// 'notification.html' // html url - can be relative
// );
// Then show the notification.
notification.show();
});
}
/* inject "Download" link into page/link context menus */
var video_menu = chrome.contextMenus.create({"title": chrome.i18n.getMessage("download_video"),
"contexts": ["page", "link"],
"onclick": convert_video
// "documentUrlPatterns": ['*://*.youtube.com/watch*',
// '*://vimeo.com/*',
// '*://5min.com/*',
// ]
});