forked from LesignButure/StackoverflowCDN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
24 lines (24 loc) · 695 Bytes
/
background.js
File metadata and controls
24 lines (24 loc) · 695 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
chrome.webRequest.onBeforeRequest.addListener(
function(info) {
//console.log("Fucking URL: " + info.url);
//Redirect the cdn.sstatic.net request to local file
//if(info.url.indexOf("Js") == -1){
if(info.url.match(/Js/g) == null){
var cssUrl = chrome.extension.getURL("all.css");
return {redirectUrl: cssUrl};
} else{
var jsUrl = chrome.extension.getURL("stub.en.js");
return {redirectUrl: jsUrl};
}
},
//filters
{
urls: [
"http://cdn.sstatic.net/Js/stub.en.js?*",
"http://cdn.sstatic.net/Sites/stackoverflow/all.css?*",
"http://cdn.sstatic.net/ux/all.css?*"
]
},
//extraInfoSpec
["blocking"]
);