forked from jae-jae/Userscript-Plus
-
-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathlogger.js
More file actions
54 lines (52 loc) · 1.07 KB
/
Copy pathlogger.js
File metadata and controls
54 lines (52 loc) · 1.07 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
51
52
53
54
'use strict';
//#region Console
const dbg = (...msg) => {
const dt = new Date();
console.debug(
'[%cUserJS%c] %cDBG',
'color: rgb(29, 155, 240);',
'',
'color: rgb(255, 212, 0);',
`[${dt.getHours()}:${('0' + dt.getMinutes()).slice(-2)}:${('0' + dt.getSeconds()).slice(-2)}]`,
...msg
);
};
const err = (...msg) => {
console.error(
'[%cUserJS%c] %cERROR',
'color: rgb(29, 155, 240);',
'',
'color: rgb(249, 24, 128);',
...msg
);
let alertBrowser = false;
for (const ex of msg) {
if (typeof ex === 'object' && 'cause' in ex) {
alertBrowser = true;
break;
}
}
if (/Mobile|Tablet/.test(navigator.userAgent) || alertBrowser) {
alert(...msg);
}
};
const info = (...msg) => {
console.info(
'[%cUserJS%c] %cINF',
'color: rgb(29, 155, 240);',
'',
'color: rgb(0, 186, 124);',
...msg
);
};
const log = (...msg) => {
console.log(
'[%cUserJS%c] %cLOG',
'color: rgb(29, 155, 240);',
'',
'color: rgb(219, 160, 73);',
...msg
);
};
//#endregion
export { dbg, err, info, log };