removed unused variables, cleanup, added icons (#907)
This commit is contained in:
Родитель
8e1afb6f03
Коммит
ba108bff6f
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 6.6 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.6 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 28 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 3.6 KiB |
|
@ -21,10 +21,9 @@ function debounce(timeout, callback) {
|
||||||
// .enable / .disable
|
// .enable / .disable
|
||||||
// ------------------
|
// ------------------
|
||||||
|
|
||||||
const showToggleState = document.getElementById('show-toggle-state');
|
|
||||||
document
|
document
|
||||||
.getElementById('toggle-state-button')
|
.getElementById('toggle-state-button')
|
||||||
.addEventListener('click', async (_event) => {
|
.addEventListener('click', async () => {
|
||||||
// Use the isEnabled method to read the action's current state.
|
// Use the isEnabled method to read the action's current state.
|
||||||
let actionEnabled = await chrome.action.isEnabled();
|
let actionEnabled = await chrome.action.isEnabled();
|
||||||
// when the button is clicked negate the state
|
// when the button is clicked negate the state
|
||||||
|
@ -63,7 +62,7 @@ async function showCurrentPage() {
|
||||||
option.selected = true;
|
option.selected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate popup inputs on on page load
|
// Populate popup inputs on page load
|
||||||
showCurrentPage();
|
showCurrentPage();
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
|
@ -73,7 +72,7 @@ showCurrentPage();
|
||||||
// If a popup is specified, our on click handler won't be called. We declare it here rather than in
|
// If a popup is specified, our on click handler won't be called. We declare it here rather than in
|
||||||
// the `onclicked-button` handler to prevent the user from accidentally registering multiple
|
// the `onclicked-button` handler to prevent the user from accidentally registering multiple
|
||||||
// onClicked listeners.
|
// onClicked listeners.
|
||||||
chrome.action.onClicked.addListener((tab) => {
|
chrome.action.onClicked.addListener(() => {
|
||||||
chrome.tabs.create({ url: 'https://html5zombo.com/' });
|
chrome.tabs.create({ url: 'https://html5zombo.com/' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -101,7 +100,7 @@ async function showBadgeText() {
|
||||||
document.getElementById('current-badge-text').value = text;
|
document.getElementById('current-badge-text').value = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate badge text inputs on on page load
|
// Populate badge text inputs on page load
|
||||||
showBadgeText();
|
showBadgeText();
|
||||||
|
|
||||||
document
|
document
|
||||||
|
@ -183,7 +182,7 @@ async function showBadgeColor() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate badge background color inputs on on page load
|
// Populate badge background color inputs on page load
|
||||||
showBadgeColor();
|
showBadgeColor();
|
||||||
|
|
||||||
document
|
document
|
||||||
|
@ -267,7 +266,6 @@ document.getElementById('reset-icon-button').addEventListener('click', () => {
|
||||||
// -------------
|
// -------------
|
||||||
|
|
||||||
const titleInput = document.getElementById('title-input');
|
const titleInput = document.getElementById('title-input');
|
||||||
const titleInputDebounce = Number.parseInt(titleInput.dataset.debounce || 100);
|
|
||||||
titleInput.addEventListener(
|
titleInput.addEventListener(
|
||||||
'input',
|
'input',
|
||||||
debounce(200, async (event) => {
|
debounce(200, async (event) => {
|
||||||
|
@ -280,7 +278,7 @@ titleInput.addEventListener(
|
||||||
|
|
||||||
document
|
document
|
||||||
.getElementById('reset-title-button')
|
.getElementById('reset-title-button')
|
||||||
.addEventListener('click', async (event) => {
|
.addEventListener('click', async () => {
|
||||||
const manifest = chrome.runtime.getManifest();
|
const manifest = chrome.runtime.getManifest();
|
||||||
let title = manifest.action.default_title;
|
let title = manifest.action.default_title;
|
||||||
|
|
||||||
|
@ -302,5 +300,5 @@ async function showActionTitle() {
|
||||||
document.getElementById('current-title').value = title;
|
document.getElementById('current-title').value = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate action title inputs on on page load
|
// Populate action title inputs on page load
|
||||||
showActionTitle();
|
showActionTitle();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче