-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Add Chinese (Hong Kong) translation 2. Add a popup to disable/enable the automatic injection
- Loading branch information
1 parent
dcb3266
commit e2a592a
Showing
11 changed files
with
158 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"langCode": { | ||
"message": "zh-HK" | ||
}, | ||
"extensionName": { | ||
"message": "注入粵拼" | ||
}, | ||
"extensionDescription": { | ||
"message": "為漢字標註粵語發音(粵拼)。" | ||
}, | ||
"contextMenuItemDoInjectJyutping": { | ||
"message": "注入粵拼" | ||
}, | ||
"popupCheckboxText": { | ||
"message": "自動注入" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#!/bin/sh | ||
zip -r inject-jyutping.zip _locales background_scripts content_scripts icons lib manifest.json | ||
zip -r inject-jyutping.zip _locales background_scripts content_scripts icons lib popup manifest.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.middle { | ||
vertical-align: middle; | ||
} | ||
|
||
.large { | ||
font-size: 120%; | ||
} | ||
|
||
/* Create a "toggle switch" (on/off button) with CSS. | ||
* Taken from https://www.w3schools.com/howto/howto_css_switch.asp | ||
*/ | ||
|
||
/* The switch - the box around the slider */ | ||
.switch { | ||
position: relative; | ||
display: inline-block; | ||
width: 60px; | ||
height: 34px; | ||
} | ||
|
||
/* Hide default HTML checkbox */ | ||
.switch input { | ||
opacity: 0; | ||
width: 0; | ||
height: 0; | ||
} | ||
|
||
/* The slider */ | ||
.slider { | ||
position: absolute; | ||
cursor: pointer; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background-color: #ccc; | ||
} | ||
|
||
.slider:before { | ||
position: absolute; | ||
content: ""; | ||
height: 26px; | ||
width: 26px; | ||
left: 4px; | ||
bottom: 4px; | ||
background-color: white; | ||
} | ||
|
||
input:checked + .slider { | ||
background-color: #2196F3; | ||
} | ||
|
||
input:focus + .slider { | ||
box-shadow: 0 0 1px #2196F3; | ||
} | ||
|
||
input:checked + .slider:before { | ||
-webkit-transform: translateX(26px); | ||
-ms-transform: translateX(26px); | ||
transform: translateX(26px); | ||
} | ||
|
||
/* Rounded sliders */ | ||
.slider.round { | ||
border-radius: 34px; | ||
} | ||
|
||
.slider.round:before { | ||
border-radius: 50%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<link rel="stylesheet" href="index.css"> | ||
<script src="../lib/browser-polyfill.js" defer></script> | ||
<script src="index.js" defer></script> | ||
</head> | ||
<body> | ||
<p> | ||
<b id="checkboxText" class="middle large"></b> | ||
<label class="middle switch"> | ||
<input id="extensionEnabled" type="checkbox"> | ||
<span class="slider round"></span> | ||
</label> | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* Initialize state */ | ||
(async () => { | ||
document.documentElement.lang = browser.i18n.getMessage('langCode'); | ||
document.getElementById('checkboxText').innerText = browser.i18n.getMessage('popupCheckboxText'); | ||
document.getElementById('extensionEnabled').checked = ((await browser.storage.local.get('enabled'))['enabled'] !== false) ? true : false; | ||
})(); | ||
|
||
/* Handle state change */ | ||
document.getElementById('extensionEnabled').addEventListener('click', () => { | ||
browser.storage.local.set({enabled: document.getElementById('extensionEnabled').checked}); | ||
}); |