-
Notifications
You must be signed in to change notification settings - Fork 0
/
origin_backgroud.js.exp
58 lines (58 loc) · 1.88 KB
/
origin_backgroud.js.exp
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
chrome.wml = {
version: "1"
}; (function() {
var c = chrome.webRequest != undefined ? chrome.webRequest.onHeadersReceived: null,
a = function() {
var d = function(f) {
var h = f.responseHeaders,
e = false,
g = false;
// comment: 替换text/vnd.wap.wml 为text/html
h.forEach(function(i) {
if (i && i.name.toLowerCase() == "content-type" && i.value.toLowerCase().substring(0, 16) == "text/vnd.wap.wml") {
i.value = "text/html";
g = true
}
});
if (g) {
h.forEach(function(i) {
// comment: 防止文件被当成下载
if (i.name.toLowerCase() == "content-disposition") {
i.value = "inline"
}
})
}
c.removeListener(a);
if (e) {
c.addListener(a(), {
urls: ["http://*/*", "https://*/*"]
},
["blocking", "responseHeaders"])
}
return {
responseHeaders: h
}
};
return d
};
if (c != null) {
c.addListener(a(), {
urls: ["http://*/*", "https://*/*"]
},
["blocking", "responseHeaders"])
}
if (chrome.tabs) {
var b = function(e, d, f) {
if (d.url) {
//comment: url更新后,发消息给contents script, contents script可以进行card间的切换
chrome.tabs.sendMessage(e, {
url: d.url
},
function(g) {})
}
};
if (!chrome.tabs.onUpdated.hasListener(b)) {
chrome.tabs.onUpdated.addListener(b)
}
}
} ());