Skip to content

Commit 06995e4

Browse files
committed
Stable Update
Signed-off-by: magicoflolis <magicoflolis@gmail.com>
1 parent 63e2ea5 commit 06995e4

50 files changed

Lines changed: 2019 additions & 1090 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dist/extension/css/options.css

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
body,
2+
html {
3+
padding: 0;
4+
margin: 0;
5+
}
6+
7+
form {
8+
font-size: 1.25em;
9+
}
10+
11+
section:not(:first-child) {
12+
border-top: 1px solid #b6b6b6;
13+
}
14+
15+
section.checkbox>label,
16+
section.checkboxlist>label,
17+
section.select {
18+
display: flex;
19+
justify-content: space-between;
20+
padding: .825em;
21+
}
22+
23+
section.checkbox>label,
24+
section.checkboxlist>label {
25+
cursor: pointer;
26+
}
27+
28+
section.checkboxlist {
29+
padding-left: .825em;
30+
padding-bottom: .5em;
31+
}
32+
33+
section.checkboxlist>label {
34+
padding-top: .5em;
35+
padding-bottom: .5em;
36+
}
37+
38+
section.checkboxlist p {
39+
margin-bottom: .5em;
40+
}
41+
42+
.switch {
43+
position: relative;
44+
width: 38px;
45+
-webkit-user-select: none;
46+
-moz-user-select: none;
47+
-ms-user-select: none;
48+
user-select: none;
49+
}
50+
51+
.switch>input {
52+
display: none;
53+
}
54+
55+
.switch>label {
56+
display: block;
57+
overflow: hidden;
58+
cursor: pointer;
59+
height: 16px;
60+
padding: 0;
61+
line-height: 16px;
62+
border: 0px solid #FFFFFF;
63+
border-radius: 20px;
64+
background-color: #9AA0A6;
65+
}
66+
67+
.switch>label:before {
68+
content: "";
69+
display: block;
70+
width: 20px;
71+
height: 20px;
72+
margin: -2px;
73+
background: #DADCE0;
74+
position: absolute;
75+
top: 0;
76+
right: 20px;
77+
border-radius: 20px;
78+
}
79+
80+
.switch>input:checked+label {
81+
background-color: #5A6F93;
82+
}
83+
84+
.switch>input:checked+label {
85+
margin-left: 0;
86+
}
87+
88+
.switch>input:checked+label:before {
89+
right: 0px;
90+
background-color: #8AB4F8;
91+
}
92+
93+
@media (prefers-color-scheme: dark) {
94+
:root {
95+
background-color: #202023;
96+
color: #e8eaed;
97+
}
98+
99+
section:not(:first-child) {
100+
border-top: 1px solid #4c4c4e;
101+
}
102+
}

dist/extension/css/options.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/extension/js/background.js

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
const countApi = "https://greasyfork.org/scripts/by-site.json",
22
adultAPI = "https://sleazyfork.org/scripts/by-site.json",
33
brws = typeof browser === "undefined" ? chrome : browser,
4-
getCurrentTabUrl = (callback) => {
4+
getCurrentTabUrl = async (callback) => {
55
try {
6-
let queryInfo = {
7-
active: true,
8-
currentWindow: true,
9-
};
10-
brws.tabs.query(queryInfo, (tabs) => {
6+
let queryInfo = {
7+
active: true,
8+
currentWindow: true,
9+
};
10+
brws.tabs.query(queryInfo, (tabs) => {
1111
let tab = tabs[0],
1212
url = tab.url;
1313
console.assert(typeof url == "string", "tab.url should be a string");
1414
callback(url);
15-
});
16-
} catch (e) {
17-
console.log(e);
18-
brws.browserAction.setBadgeText({
19-
text: "err",
20-
});
21-
return callback(url);
22-
}
15+
});
16+
} catch (e) {
17+
console.log(e);
18+
brws.browserAction.setBadgeText({
19+
text: "err",
20+
});
21+
return callback(url);
22+
}
2323
},
2424
getUrlHost = (url) => {
2525
let a = document.createElement("a");
@@ -41,25 +41,24 @@ const countApi = "https://greasyfork.org/scripts/by-site.json",
4141
text: "",
4242
});
4343
});
44+
},
45+
countBadge = async (api) => {
46+
await new Promise((reject) => {
47+
try {
48+
fetch(api).then((r) => {
49+
r.json().then((data) => {
50+
brws.tabs.onUpdated.addListener(() => {
51+
changeBadge(data);
52+
});
53+
brws.tabs.onActivated.addListener(() => {
54+
changeBadge(data);
55+
});
56+
});
57+
});
58+
} catch (error) {
59+
reject(error);
60+
}
61+
})
4462
};
45-
46-
fetch(countApi).then((r) => {
47-
r.json().then((data) => {
48-
brws.tabs.onUpdated.addListener(() => {
49-
changeBadge(data);
50-
});
51-
brws.tabs.onActivated.addListener(() => {
52-
changeBadge(data);
53-
});
54-
});
55-
});
56-
fetch(adultAPI).then((r) => {
57-
r.json().then((data) => {
58-
brws.tabs.onUpdated.addListener(() => {
59-
changeBadge(data);
60-
});
61-
brws.tabs.onActivated.addListener(() => {
62-
changeBadge(data);
63-
});
64-
});
65-
});
63+
countBadge(countApi);
64+
countBadge(adultAPI);

dist/extension/js/options.js

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/extension/js/options.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)