Skip to content

Commit

Permalink
merge pull request #29 from waymondrang/side-panel-fix
Browse files Browse the repository at this point in the history
merge update branch and close dictionary panel issue
  • Loading branch information
waymondrang authored Mar 12, 2023
2 parents 0bd0162 + 3914b8e commit af5acb8
Show file tree
Hide file tree
Showing 15 changed files with 1,701 additions and 348 deletions.
2 changes: 1 addition & 1 deletion src/chrome/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
padding: 2px 8px;
z-index: 2500000000;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}
}
509 changes: 466 additions & 43 deletions src/chrome/docs.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "DocsAfterDark",
"version": "0.5.3",
"version": "0.6.0",
"description": "Modern, dark mode for Google Docs",
"author": "Raymond Wang",
"manifest_version": 3,
Expand Down
153 changes: 83 additions & 70 deletions src/chrome/popup.html
Original file line number Diff line number Diff line change
@@ -1,77 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="popup.css" />
<link rel="stylesheet" href="special.css" />
<title>DocsAfterDark Settings</title>
</head>

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="popup.css">
<link rel="stylesheet" href="special.css">
<title>DocsAfterDark Settings</title>
</head>

<body>
<div id="main">
<p>DocsAfterDark Options</p>
<p class="menu_bar_label">Global Toggle</p>
<div id="on_off" class="menu_bar">
<button id="on">On</button>
<button id="off">Off</button>
</div>
<p class="menu_bar_label">Invert Options</p>
<div id="invert_container">
<div class="input">
<input type="checkbox" id="invert" name="invert"><label for="invert">Invert</label>
<body>
<div id="main">
<p>DocsAfterDark Options</p>
<p class="menu_bar_label">Global Toggle</p>
<div id="on_off" class="menu_bar">
<button id="on">On</button>
<button id="off">Off</button>
</div>
<div class="input">
<input type="checkbox" id="grayscale" name="grayscale"><label for="grayscale">Grayscale</label>
</div>
</div>
<p class="menu_bar_label">Document Background<span class="__firefox-exclude">&nbsp;(May Be Unstable)</span></p>
<div id="document_bg" class="menu_bar">
<button id="default">
<div>
Default
</div>
</button>
<button id="shade">
<div>
Shade
</div>
</button>
<button id="dark">
<div>
Dark
</div>
</button>
<button id="black">
<div>
Black
<p class="menu_bar_label">Invert Options</p>
<div id="invert_container">
<div class="input">
<input type="checkbox" id="invert" name="invert" /><label
for="invert"
>Invert</label
>
</div>
</button>
<button id="custom">
<div>
Custom
<div class="input">
<input
type="checkbox"
id="grayscale"
name="grayscale" /><label for="grayscale"
>Grayscale</label
>
</div>
</button>
</div>
<input id="custom_input" class="hidden" placeholder="Custom Color/CSS">
<button id="save_custom" class="hidden">Save</button>
<p id="description"></p>
<div id="document_border_container">
<p class="menu_bar_label">Document Border</p>
<input type="checkbox" id="show_border" name="show_border"><label for="show_border">Show Border</label>
</div>
<div id="toggle_button_container">
<p class="menu_bar_label">Toggle Button Options</p>
<input type="checkbox" id="raise_button" name="raise_button"><label for="raise_button">Raise Button</label>
</div>
<p class="menu_bar_label">
Document Background<span class="__firefox-exclude"
>&nbsp;(May Be Unstable)</span
>
</p>
<div id="document_bg" class="menu_bar">
<button id="default">
<div>Default</div>
</button>
<button id="shade">
<div>Shade</div>
</button>
<button id="dark">
<div>Dark</div>
</button>
<button id="black">
<div>Black</div>
</button>
<button id="custom">
<div>Custom</div>
</button>
</div>
<input
id="custom_input"
class="hidden"
placeholder="Custom Color/CSS" />
<button id="save_custom" class="hidden">Save</button>
<p id="description"></p>
<div id="document_border_container">
<p class="menu_bar_label">Document Border</p>
<input
type="checkbox"
id="show_border"
name="show_border" /><label for="show_border"
>Show Border</label
>
</div>
<div id="toggle_button_container">
<p class="menu_bar_label">Toggle Button Options</p>
<input
type="checkbox"
id="raise_button"
name="raise_button" /><label for="raise_button"
>Raise Button</label
>
</div>
<footer>
<p id="version"></p>
<a id="donate">Donate</a>
</footer>
</div>
<footer>
<p id="version"></p>
<a id="donate">Donate</a>
</footer>
</div>
<script src="popup.js"></script>
</body>

</html>
<script src="popup.js"></script>
</body>
</html>
17 changes: 16 additions & 1 deletion src/chrome/word.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const link_color = "#90caf9";
const invert_value = "invert(1)";
const grayscale_value = "contrast(79%) grayscale(100%)";
const page_border = "0 0 0 1px";
const gm3_page_border = "1px solid #404040";
const backgrounds = {
default: "#ffffff",
shade: "#999999",
Expand All @@ -18,7 +19,7 @@ const backgrounds = {
};
const default_background = "default";
const update_text_style =
"border: 1px solid #4d4d4d; background-color: #212121; padding: 8px 12px; border-radius: 6px; box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); font-size: 12px;"; // use fixed font size
"border: 1px solid #4d4d4d; background-color: #212121; padding: 8px 12px; border-radius: 6px; box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); font-size: 12px; font-family: Google Sans,Roboto,sans-serif;"; // use fixed font size
const close_button_style =
"background-color: #4d4d4d; border-radius: 2px; color: #64b5f6; border: none; cursor: pointer; margin-left: 12px; font-size: inherit;";
const update_notification_style =
Expand Down Expand Up @@ -196,11 +197,17 @@ function set_up() {
? (grayscale ? grayscale_value + " " : "") + invert_value
: "none"
);

document.documentElement.style.setProperty(
"--document_border",
show_border ? page_border : "none"
);

document.documentElement.style.setProperty(
"--gm3_document_border",
show_border ? gm3_page_border : "none"
);

// Do not create notification if not needed

// Show update notification if data.updates is not set or if it is
Expand Down Expand Up @@ -325,6 +332,14 @@ function set_up() {
changes.show_border.newValue ? page_border : "none"
);
}

// Handle show border option change
if (Object.keys(changes).includes("show_border")) {
document.documentElement.style.setProperty(
"--gm3_document_border",
changes.show_border.newValue ? gm3_page_border : "none"
);
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/firefox/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
padding: 2px 8px;
z-index: 2500000000;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}
}
Loading

0 comments on commit af5acb8

Please sign in to comment.