-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon.js
47 lines (39 loc) · 939 Bytes
/
common.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
export function getHostname(uri) {
uri = uri.replace(/(https?:\/\/)?(www.)?/i, "");
return uri.split("/")[0];
}
export const POPUP_MESSAGE = 1;
export const CONTENT_MESSAGE = 2;
export const FILTER_MESSAGE = 3;
export class RequestPacket {
constructor() {
this.type = 0;
this.request = 0;
this.value = 0;
}
}
export const SET_SITE_CONFIG = 1;
export const GET_SITE_CONFIG = 2;
export class SiteConfig {
constructor() {
this.isDisabled = false;
this.maxHeightPercent = 0;
this.maxWidthPercent = 0;
this.maxPercentOfScreenSpace = 0;
}
}
export class SiteConfigPacket {
constructor() {
this.hostname = "";
this.config = new SiteConfig();
}
}
export const GET_CONTENTSCRIPT_STATUS = 1;
export class ContentScriptStatus {
constructor() {
this.isActive = false;
this.config = new SiteConfig();
}
}
export const TOGGLE_STATUS = 4;
export const SET_CONTENTSCRIPT_CONFIG = 5;