-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcapps.js
53 lines (47 loc) · 2.05 KB
/
capps.js
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
// ╭────────────────────────────────────────────────────────────╮
// │ capps.js -- Content Script Application code for .tridactyl │
// ╰────────────────────────────────────────────────────────────╯
var capps = {
sunriseSunset: function(lat, long) {
const times = SunCalc.getTimes(new Date(), lat, long);
return [times.sunrise, times.sunset].map(t=>t.toTimeString());
},
toggleCrosshair: function() {
if ($1(".spry-crosshair"))
rmall(".spry-crosshair");
else
tri.excmds.js("-r", "js/sprymedia/crosshair-loader.js");
document.dispatchEvent(new Event("input"));
document.dispatchEvent(new Event("change"));
},
/* http://slayeroffice.com/tools/modi/v2.0/modi_help.html */
modi: function() {
window.prefFile = "";
const script = document.createElement("script");
document.body.appendChild(script);
script.language = "javascript";
script.type = "text/javascript";
script.src = "http://slayeroffice.com/tools/modi/v2.0/modi_v2.0.js";
script.id = "modi";
},
/* https://github.com/benscabbia/x-ray */
toggleXray: function() {
const ghostCSS = `
* {
background: #000 !important;
color: #0f0! important;
outline: solid #f00 1px !important;
}
`;
const xray = document.createElement('style');
xray.innerHTML = ghostCSS;
const xraysInPage = [...document.body.getElementsByTagName("style")]
.filter(style => style.innerHTML === xray.innerHTML);
if(xraysInPage.length > 0) {
xraysInPage.forEach(style => document.body.removeChild(style));
} else {
document.body.appendChild(xray);
}
},
};
window.capps = capps;