forked from whizzzkid/csc309-crext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snippets
42 lines (36 loc) · 828 Bytes
/
snippets
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
// Param extractor
function (param, string) {
var results = new RegExp('[\\?&]' + param + '=([^&#$]*)').exec(string);
return results[1] || 0;
};
// Some HTML
style="float:left; padding-right:10px; width=48px; height: 48px;"
// background manifest
"background": {
"scripts": [""]
},
// browser action manifest
"browser_action": {
"default_icon": {
"16": "assets/icon16.png"
},
"default_title": "",
"default_popup": ""
},
// Permissions:
"storage",
"webRequest",
"webRequestBlocking",
// Blocking code
chrome.webRequest.onBeforeRequest.addListener(
callback,
// Applies to following url patterns
{urls: ['*://*.youtube.com/*']},
// In request blocking mode
['blocking']
);
// blocking callback
function(details) {
var redirectUrl = details.url;
return {redirectUrl: redirectTo};
}