Skip to content

Commit 6c1d8ff

Browse files
authored
Merge pull request #9 from Charlie-XIAO/main
fix "click on white area resets the color" problem, edit documentation, change a little bit of css
2 parents 6f3c063 + 416a695 commit 6c1d8ff

File tree

5 files changed

+15
-33
lines changed

5 files changed

+15
-33
lines changed

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# CODE_OF_CONDUCT
1+
# Code of Conduct
22

33
## Our Pledge
44
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

CONTRIBUTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
# CONTRIBUTING
22

3-
We sincerely welcome contributions, both in codes and in other forms. This file describes general guidline for contributing.
3+
We sincerely welcome contributions, both in codes and in other forms. This file describes general guideline for contributing.
44

55
## Types of Contribution
66

7-
There isn't a strict standard on contribution types, here are some directions to consider
7+
There isn't a strict standard on contribution types, here are some directions to consider:
88

9-
- **Fix a bug** If you find a bug yourself or find some bug listed under Issues solvable, you are welcome to fix it
10-
- **Add new functions according to requirements** If you notice users' requirements for some interesting functions and you want to contribute, feel free to communicate with us and we are happy to update our web-extension to include more features
11-
- **translation and documentation** You are welcomed to create new branches to translate existed version for other languages. You are also welcomed to help accomplishing documentation for this web-extension
9+
- **Fix a bug**: If you find a bug yourself or find some bug listed under Issues solvable, you are welcome to fix it.
10+
- **Add new functions according to requirements**: If you notice users' requirements for some interesting functions and you want to contribute, feel free to communicate with us and we are happy to update our web-extension to include more features.
11+
- **Translation and documentation**: You are welcomed to create new branches to translate existed version for other languages. You are also welcomed to help accomplishing documentation for this web-extension.
1212

1313
## Guideline for adding new functions
1414

15-
If you aim at helping us adding new functions, you should make sure that the new functions are consistent with the goal and values of this addon and our community. When adding a new function, you should create a new branch. Please do not change the main branch. We also welcome you to discuss with the leadership and you can find the discord channel [here](https://discord.gg/aKUQRYZrFB)
15+
If you aim at helping us adding new functions, you should make sure that the new functions are consistent with the goal and values of this addon and our community. When adding a new function, you should create a new branch. Please do not change the main branch. We also welcome you to discuss with the leadership and you can find the discord channel [here](https://discord.gg/aKUQRYZrFB).
1616

1717
## Code style
1818

19-
If you are aditing an existing file or adding new code files, code style should be consistent with the rest of the code in the file and other existing files. Please comment when necessary. At the same time, if there are references, please include them as comment at the beginning of the code file. For more general standard, follow the guideline [here](https://wiki.mozilla.org/WebExtensions/Hacking#Code_Style)
19+
If you are aditing an existing file or adding new code files, code style should be consistent with the rest of the code in the file and other existing files. Please comment when necessary. At the same time, if there are references, please include them as comment at the beginning of the code file. For more general standard, follow the guideline [here](https://wiki.mozilla.org/WebExtensions/Hacking#Code_Style).
2020

2121
## Documentation style
2222

2323
If you would like to contribute to our documentation. You should check the grammar first. You should write in a clear way and avoid complicated long sentences. Using graphs and examples as complimentary explanation is recommended. At the same time, if there are references, please state them clearly.
2424

2525
## Licensing
2626

27-
Please note that the examples are all made available under the [Mozilla Public License 2](https://github.com/ossd-s23/TitleBarColoring/blob/main/LICENSE).0, so any contributions must be compatible with that license. Ask the leadership if you have any questions.
27+
Please note that the examples are all made available under the [Mozilla Public License 2.0](LICENSE), so any contributions must be compatible with that license. Ask the leadership if you have any questions.
2828

29-
Template for this CONTRIBUTING document is adapted from [mdn web-extensions](https://github.com/mdn/webextensions-examples/blob/main/CONTRIBUTING.md)
29+
Template for this document is adapted from [MDN Web Extensions](CONTRIBUTING.md).

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The screenshot below shows two different title bar colors for different windows.
1616

1717
## Getting Started
1818
1. Fork this repo to your Github account and run it locally on your machine by cloning it. For a quick review on Github commands, check out this [link](https://education.github.com/git-cheat-sheet-education.pdf).
19-
2. Search "about:debugging" in Firefox browser. Click 'This Firefox' on the left side and then click the 'Load Temporary Add-on' button and select the manifest.json file for this project. The extension will appear on the page and should be ready to use!
19+
2. Search "`about:debugging`" in Firefox browser. Click 'This Firefox' on the left side and then click the 'Load Temporary Add-on' button and select the `manifest.json` file for this project. The extension will appear on the page and should be ready to use!
2020

2121
## Licensing
2222
- TabColor is a Free and Open Source (FOSS) project under the [Mozilla Public License 2.0](https://github.com/ossd-s23/TitleBarColoring/blob/main/LICENSE).

popup.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ body {
2020
font-size: 12px;
2121
cursor: pointer;
2222
margin-bottom: 5%;
23+
height: 20px;
2324
}
2425

2526
.button1 {

popup.js

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
function Choose_color(color) {
2-
switch (color) {
3-
case "Red":
4-
return "Red";
5-
case "Orange":
6-
return "Orange";
7-
case "Yellow":
8-
return "Yellow";
9-
case "Green":
10-
return "Green";
11-
case "Blue":
12-
return "Blue";
13-
case "Purple":
14-
return "Purple";
15-
case "Pink":
16-
return "Pink";
17-
}
18-
}
19-
20-
211
function handleResponse(message) {
222
console.log(`Message from the background script: ${message.response}`);
233
}
@@ -27,12 +7,13 @@ function handleError(error) {
277
}
288

299
function notifyBackgroundPage(e) {
30-
let chosen_color = Choose_color(e.target.textContent);
10+
if (e.target.nodeName !== "BUTTON") return;
11+
let chosen_color = e.target.textContent;
3112
const sending = browser.runtime.sendMessage({
3213
greeting: chosen_color,
3314
});
3415

3516
sending.then(handleResponse, handleError);
3617
}
3718

38-
window.addEventListener("click", notifyBackgroundPage);
19+
window.addEventListener("click", notifyBackgroundPage);

0 commit comments

Comments
 (0)