-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.js
More file actions
32 lines (25 loc) · 752 Bytes
/
content.js
File metadata and controls
32 lines (25 loc) · 752 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
function disableForceDownload() {
const links = document.querySelectorAll("a[href*=forcedownload]");
for (const link of links) {
let href = new URL(link.href);
href.searchParams.delete("forcedownload");
link.href = href.toString();
}
}
function openInNewTab() {
const allLinks = document.querySelectorAll("a[href*=pluginfile], a[href*=resource]");
for (const link of allLinks) {
link.target = "_blank";
}
}
chrome.storage.local.get("disableForceDownload", (result) => {
if (result.disableForceDownload === true) {
disableForceDownload();
}
});
chrome.storage.local.get("openInNewTab", (result) => {
if (result.openInNewTab === true) {
openInNewTab();
}
}
)