Skip to content

Commit 06fbf0b

Browse files
completely revamp settings and have them sync. Also update icons
1 parent 8e324dc commit 06fbf0b

12 files changed

+194
-97
lines changed

Merged/enhance.js

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
async function main() {
2-
// Use browser.* if available, otherwise fall back to chrome.*
3-
if (typeof browser === 'undefined') {
4-
var browser = chrome;
5-
}
1+
// Use browser.* if available, otherwise fall back to chrome.*
2+
if (typeof browser === 'undefined') {
3+
var browser = chrome;
4+
}
65

6+
async function main() {
77
const subPrefixes = {
88
anime: '#',
99
manga: '//#',
@@ -39,30 +39,12 @@ async function main() {
3939
// console.log(`Error: ${error}`);
4040
}
4141

42-
function onGot(result) {
43-
if (result.opcommentfaces !== undefined) {
44-
cf = result.opcommentfaces;
45-
} else {
46-
cf = true;
47-
}
48-
49-
if (result.opanisearch !== undefined) {
50-
as = result.opanisearch;
51-
} else {
52-
as = true;
53-
}
54-
55-
if (result.opspoiler !== undefined) {
56-
sp = result.opspoiler;
57-
} else {
58-
sp = false;
59-
}
60-
61-
if (result.nuspoiler !== undefined) {
62-
nsp = result.nuspoiler;
63-
} else {
64-
nsp = false;
65-
}
42+
function onGot(options) {
43+
options = options.options;
44+
const cf = options?.legacy?.enabled && options?.legacy?.subOptions?.commentFaces?.enabled;
45+
const as = options?.legacy?.enabled && options?.legacy?.subOptions?.aniSearch?.enabled;
46+
const sp = options?.legacy?.enabled && options?.legacy?.subOptions?.spoiler?.enabled;
47+
const nsp = options?.legacy?.enabled && options?.legacy?.subOptions?.nuSpoiler?.enabled;
6648

6749
if (nsp) {
6850
nuSpoilers();
@@ -73,7 +55,7 @@ async function main() {
7355

7456
// Get Option Data from Storage
7557

76-
const getting = browser.storage.local.get(['opcommentfaces', 'opanisearch', 'opspoiler', 'nuspoiler']);
58+
var getting = browser.storage.sync.get("options");
7759
getting.then(onGot, onError);
7860

7961
// Create Menu
@@ -773,13 +755,13 @@ async function main() {
773755
*/
774756

775757
function nuSpoilers(nsp) {
776-
const nuspoiler = document.getElementsByClassName('md-spoiler-text');
758+
const nuSpoiler = document.getElementsByClassName('md-spoiler-text');
777759

778-
for (let i = 0; i < nuspoiler.length; i++) {
779-
nuspoiler[i].addEventListener('mouseover', function () {
760+
for (let i = 0; i < nuSpoiler.length; i++) {
761+
nuSpoiler[i].addEventListener('mouseover', function () {
780762
this.classList.add('revealed');
781763
});
782-
nuspoiler[i].addEventListener('mouseout', function () {
764+
nuSpoiler[i].addEventListener('mouseout', function () {
783765
this.classList.remove('revealed');
784766
});
785767
}

Merged/icons/LICENSE

Lines changed: 0 additions & 1 deletion
This file was deleted.
15.6 KB
Loading
603 Bytes
Loading
1.74 KB
Loading
3.38 KB
Loading
5.62 KB
Loading

Merged/icons/border-48.png

-225 Bytes
Binary file not shown.

Merged/manifest.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"description": "Add functionalities to r/anime",
33
"manifest_version": 3,
4-
"name": "r/anime Enhanced",
5-
"version": "3.1.0",
4+
"name": "r/anime Enhanced 2.0",
5+
"version": "3.2.0",
66
"permissions": [
77
"storage"
88
],
@@ -11,7 +11,22 @@
1111
],
1212
"homepage_url": "https://github.com/r-anime/ranime-Extension",
1313
"icons": {
14-
"48": "icons/border-48.png"
14+
"16": "icons/Snoo_square_icon_16.png",
15+
"32": "icons/Snoo_square_icon_32.png",
16+
"48": "icons/Snoo_square_icon_48.png",
17+
"64": "icons/Snoo_square_icon_64.png",
18+
"128": "icons/Snoo_square_icon_128.png"
19+
},
20+
"action": {
21+
"default_icon": {
22+
"16": "icons/Snoo_square_icon_16.png",
23+
"32": "icons/Snoo_square_icon_32.png",
24+
"48": "icons/Snoo_square_icon_48.png",
25+
"64": "icons/Snoo_square_icon_64.png",
26+
"128": "icons/Snoo_square_icon_128.png"
27+
},
28+
"default_title": "r/anime Enhanced 2.0",
29+
"default_popup": "options.html"
1530
},
1631
"content_scripts": [
1732
{
@@ -26,12 +41,14 @@
2641
],
2742
"type": "module",
2843
"css": [
29-
"enhance.css"
44+
"enhance.css",
45+
"options.css"
3046
]
3147
}
3248
],
3349
"options_ui": {
34-
"page": "options.html"
50+
"page": "options.html",
51+
"open_in_tab": true
3552
},
3653
"browser_specific_settings": {
3754
"gecko": {

Merged/options.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.ranimeenhanced-options {
2+
--indent: 10px;
3+
/*width: 700px;*/
4+
display: inline-block;
5+
6+
.option-group {
7+
& > .option input {
8+
margin-right: var(--indent);
9+
}
10+
11+
.sub-options {
12+
margin-left: var(--indent);
13+
margin-bottom: 20px;
14+
}
15+
}
16+
17+
.option {
18+
display: flex;
19+
flex-direction: row;
20+
justify-content: space-between;
21+
gap: 5px;
22+
23+
&.disabled {
24+
opacity: 0.6;
25+
cursor: not-allowed;
26+
color: red;
27+
}
28+
&.disabled * {
29+
cursor: inherit;
30+
}
31+
32+
label {
33+
white-space: nowrap;
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)