-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathcube_clean_cache.js
More file actions
43 lines (42 loc) · 1.06 KB
/
cube_clean_cache.js
File metadata and controls
43 lines (42 loc) · 1.06 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
(function () {
let a = document.createElement('a');
a.innerHTML = ' ';
a.style.backgroundColor = 'yellow';
a.style.position = 'absolute';
a.style.zIndex = 10000000;
a.style.bottom = '2px';
a.style.left = '2px';
a.style.width = '16px';
a.style.height = '16px';
a.style.cursor = 'pointer';
a.style.opacity = '0.2';
a.style.borderRadius = '8px';
let base = document.currentScript;
if (base) {
base = base.src.replace(/[^/]+\.js/, '__clean_cache__');
}
document.addEventListener('DOMContentLoaded', function () {
document.body.appendChild(a);
a.onmouseover = function () {
this.style.opacity = '0.8';
};
a.onmouseout = function () {
this.style.opacity = '0.2';
};
a.onclick = function () {
if (!base) {
return;
}
let img = document.createElement('img');
img.src = base;
img.onerror = function () {
delete img.onerror;
location.reload();
};
img.onload = function () {
delete img.onerror;
location.reload();
};
};
});
})();