-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhide.js
More file actions
50 lines (38 loc) · 1.22 KB
/
Copy pathhide.js
File metadata and controls
50 lines (38 loc) · 1.22 KB
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
(() => {
const hide = async () => {
chrome.storage.sync.get('extensions', (data) => {
const extensions = data.extensions;
const filterExt = (element, name) => {
for(let extension of extensions)
if(name.endsWith(extension)) element.remove();
};
const files = document.querySelector('[aria-labelledby="files"]');
if(files) {
let children = Array.from(files.children);
let len = children.length;
for(let i=1; i<len; i++) {
let name = children[i].querySelector('[title]').innerText;
filterExt(children[i], name);
}
}
chrome.storage.sync.get('octotree', (data) => {
if(!data.octotree) return;
const octotree = document.querySelector('.octotree-view-body');
if(!octotree) return;
children = Array.from(octotree.querySelectorAll('[title]'));
len = children.length;
if(len == 0) return;
for(let i=1; i<len; i++) {
let name = children[i].getAttribute('title');
filterExt(children[i], name);
}
});
});
};
const loop = async () => {
hide();
await new Promise(resolve => setTimeout(resolve, 1000));
loop();
};
loop();
})();