Skip to content

Commit

Permalink
Merge pull request #23 from dmlls/v0.9.28
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlls authored Sep 7, 2024
2 parents 2d510d6 + 2d183c1 commit 7aec562
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 72 deletions.
6 changes: 6 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ if (typeof browser === "undefined") {
await fetchSettings(false);
})();

browser.runtime.onStartup.addListener(
async () => {
await fetchSettings(false);
}
);

browser.webRequest.onBeforeRequest.addListener(
async (details) => {
const url = new URL(details.url);
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Yang! - Yet Another Bangs anywhere extension",
"description": "An open-source, lightweight Firefox extension that allows using DuckDuckGo Bangs anywhere.",
"homepage_url": "https://github.com/dmlls/yang",
"version": "0.9.26",
"version": "0.9.28",

"browser_specific_settings": {
"gecko": {
Expand Down
30 changes: 16 additions & 14 deletions options/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ body {
}

.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
max-width: 60%;
min-height: 80vh;
margin: 50px auto;
text-align: center;
background-color: #fff;
box-shadow: 0 0 10px rgba(0 0 0 0.1);
box-shadow: 0 0 10px #ebebeb;
border-radius: 8px;
padding: 2em;
overflow-x: hidden;
Expand All @@ -28,7 +33,7 @@ body {
h1 {
color: #333;
margin-top: 5px;
margin-bottom: 4vw;
margin-bottom: 40px;
font-weight: normal;
}

Expand Down Expand Up @@ -103,7 +108,7 @@ h1 {
font-size: 0.9em;
font-family: sans-serif;
text-align: left;
box-shadow: 0 0 20px rgba(0 0 0 0.15);
box-shadow: 0 0 20px #ebebeb;
overflow: hidden;
}

Expand Down Expand Up @@ -179,14 +184,15 @@ h1 {
}

#no-bangs {
visibility: hidden;
color: #585858;
font-size: 0.9em;
margin: 10px 0;
margin: 15px 0;
}

.footer {
display: flex;
width: 100%;
margin-top: 20px;
justify-content: space-between;
font-size: small;
}
Expand Down Expand Up @@ -230,25 +236,21 @@ h1 {

@media screen and (width < 1000px) {
h1 {
margin-bottom: 5vw;
margin-bottom: 35px;
}

.container {
max-width: 100%;
height: 100dvh;
display: flex;
flex-direction: column;
margin: 0;
padding: 0;
}

.footer {
width: 100%;
bottom: 0;
margin: 0;
}

.footer * {
margin: 0 25px 35px 15px;
width: 95%;
margin-bottom: 30px;
}

.toast-container {
Expand All @@ -257,7 +259,7 @@ h1 {

#yang-logo {
width: 25%;
margin: 30px auto 10px;
margin-top: 30px;
}

.table-container {
Expand Down
100 changes: 51 additions & 49 deletions options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,67 +10,69 @@
</head>
<body>
<div class="container">
<img id="yang-logo" src="../icons/icon.svg" />
<h1>Custom Bangs</h1>
<div class="table-container">
<div class="button-container">
<a href="settings.html">
<button type="button" id="settings">
<div class="inner-container">
<img id="yang-logo" src="../icons/icon.svg" />
<h1>Custom Bangs</h1>
<div class="table-container">
<div class="button-container">
<a href="settings.html">
<button type="button" id="settings">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="24"
height="24"
>
<path
d="m12 8.25c-2.0711 0-3.75 1.6789-3.75 3.75 0 2.0711 1.6789 3.75 3.75 3.75 2.0711 0 3.75-1.6789 3.75-3.75 0-2.0711-1.6789-3.75-3.75-3.75zm-2.25 3.75c0-1.2426 1.0074-2.25 2.25-2.25s2.25 1.0074 2.25 2.25-1.0074 2.25-2.25 2.25-2.25-1.0074-2.25-2.25z"
clip-rule="evenodd"
fill-rule="evenodd"
/>
<path
d="m11.975 1.25c-0.4444-1e-5 -0.8155-1e-5 -1.1201 0.02077-0.3171 0.02164-0.6166 0.06828-0.90699 0.18856-0.67382 0.27911-1.2092 0.81446-1.4883 1.4883-0.1453 0.3508-0.18465 0.7205-0.19968 1.1223-0.01208 0.32303-0.1751 0.59255-0.41569 0.73145-0.24058 0.1389-0.5555 0.14532-0.84129-0.00573-0.35552-0.18791-0.69537-0.33869-1.0718-0.38825-0.7231-0.0952-1.4544 0.10076-2.033 0.54476-0.24936 0.19134-0.43952 0.42741-0.6168 0.69121-0.17031 0.25341-0.35582 0.57475-0.57805 0.95967l-0.02525 0.04374c-0.22224 0.38491-0.40776 0.70623-0.54207 0.98042-0.13981 0.28544-0.24918 0.56816-0.29021 0.87978-0.0952 0.72311 0.10076 1.4544 0.54475 2.0331 0.23112 0.3011 0.53157 0.5201 0.87201 0.734 0.27378 0.172 0.42571 0.448 0.42569 0.7259-1e-5 0.2778-0.15194 0.5538-0.42569 0.7258-0.34048 0.2139-0.64096 0.4329-0.8721 0.7341-0.444 0.5786-0.63995 1.3099-0.54476 2.033 0.04103 0.3116 0.1504 0.5944 0.29021 0.8798 0.13431 0.2742 0.31983 0.5955 0.54206 0.9804l0.02526 0.0438c0.22223 0.3849 0.40774 0.7062 0.57805 0.9596 0.17728 0.2638 0.36744 0.4999 0.6168 0.6912 0.57863 0.444 1.3099 0.64 2.033 0.5448 0.37644-0.0496 0.71627-0.2003 1.0718-0.3882 0.28583-0.1511 0.60079-0.1447 0.8414-0.0057 0.24062 0.1389 0.40366 0.4084 0.41574 0.7315 0.01503 0.4018 0.05439 0.7715 0.19968 1.1223 0.27911 0.6738 0.81447 1.2092 1.4883 1.4883 0.29039 0.1203 0.58989 0.1669 0.90699 0.1885 0.3046 0.0208 0.6757 0.0208 1.1201 0.0208h0.0505c0.4445 0 0.8155 0 1.1202-0.0208 0.3171-0.0216 0.6166-0.0682 0.907-0.1885 0.6738-0.2791 1.2092-0.8145 1.4883-1.4883 0.1453-0.3508 0.1846-0.7205 0.1996-1.1224 0.0121-0.323 0.1751-0.5925 0.4157-0.7315 0.2406-0.1389 0.5556-0.1453 0.8414 0.0057 0.3555 0.1879 0.6953 0.3387 1.0718 0.3882 0.7231 0.0952 1.4544-0.1007 2.033-0.5447 0.2494-0.1914 0.4395-0.4274 0.6168-0.6912 0.1703-0.2534 0.3558-0.5747 0.578-0.9596l0.0253-0.0438c0.2222-0.3849 0.4078-0.7063 0.5421-0.9805 0.1398-0.2854 0.2491-0.5681 0.2902-0.8797 0.0952-0.7232-0.1008-1.4545-0.5448-2.0331-0.2311-0.3012-0.5316-0.5201-0.872-0.734-0.2738-0.172-0.4257-0.448-0.4257-0.7259 0-0.2778 0.1519-0.5537 0.4256-0.7257 0.3406-0.2139 0.6411-0.4328 0.8722-0.7341 0.444-0.57861 0.64-1.3099 0.5448-2.033-0.0411-0.31162-0.1504-0.59434-0.2902-0.87978-0.1343-0.27417-0.3198-0.59547-0.5421-0.98035l-0.0252-0.04377c-0.2223-0.38493-0.4078-0.7063-0.5781-0.95971-0.1773-0.2638-0.3674-0.49987-0.6168-0.69122-0.5786-0.44399-1.3099-0.63995-2.0331-0.54475-0.3764 0.04956-0.7162 0.20032-1.0717 0.38822-0.2858 0.15107-0.6008 0.14464-0.8414 0.00572-0.2406-0.13891-0.4037-0.40847-0.4158-0.73153-0.015-0.40183-0.0543-0.77151-0.1996-1.1223-0.2791-0.67383-0.8145-1.2092-1.4883-1.4883-0.2904-0.12028-0.5899-0.16692-0.907-0.18856-0.3047-0.02078-0.6757-0.02078-1.1202-0.02077h-0.0505zm-1.4531 1.5952c0.0772-0.03196 0.1944-0.06143 0.4351-0.07786 0.2475-0.01688 0.5671-0.01729 1.0433-0.01729s0.7958 4.1e-4 1.0432 0.01729c0.2408 0.01643 0.358 0.0459 0.4351 0.07786 0.3063 0.12687 0.5497 0.37021 0.6765 0.6765 0.0401 0.09661 0.0732 0.24722 0.0866 0.60432 0.0296 0.79238 0.4386 1.5553 1.1647 1.9745 0.726 0.4192 1.5913 0.39192 2.2923 0.0214 0.3159-0.16698 0.463-0.21356 0.5666-0.22721 0.3287-0.04327 0.6611 0.0458 0.9241 0.24761 0.0663 0.05084 0.1504 0.13761 0.285 0.33788 0.1384 0.20587 0.2985 0.48244 0.5366 0.89484 0.2381 0.41241 0.3976 0.68938 0.5067 0.91213 0.1061 0.21669 0.1392 0.33294 0.1501 0.41574 0.0433 0.32868-0.0458 0.6611-0.2476 0.92411-0.0637 0.08297-0.1775 0.18701-0.4802 0.37712-0.6713 0.4219-1.1275 1.1575-1.1276 1.9958 0 0.8384 0.4562 1.5741 1.1276 1.996 0.3026 0.1901 0.4164 0.2941 0.4801 0.3771 0.2018 0.263 0.2909 0.5954 0.2476 0.9241-0.0109 0.0828-0.044 0.199-0.1501 0.4157-0.1091 0.2227-0.2686 0.4997-0.5067 0.9121s-0.3982 0.689-0.5366 0.8949c-0.1346 0.2002-0.2187 0.287-0.285 0.3378-0.263 0.2019-0.5954 0.2909-0.9241 0.2477-0.1036-0.0137-0.2507-0.0603-0.5666-0.2272-0.701-0.3706-1.5663-0.3978-2.2924 0.0214-0.7259 0.4192-1.1349 1.1821-1.1645 1.9745-0.0134 0.3571-0.0465 0.5077-0.0866 0.6044-0.1268 0.3062-0.3702 0.5496-0.6765 0.6765-0.0771 0.0319-0.1943 0.0614-0.4351 0.0778-0.2474 0.0169-0.567 0.0173-1.0432 0.0173s-0.7958-4e-4 -1.0433-0.0173c-0.2407-0.0164-0.3579-0.0459-0.4351-0.0778-0.3062-0.1269-0.54959-0.3703-0.67646-0.6765-0.04002-0.0967-0.07319-0.2473-0.08655-0.6044-0.02963-0.7923-0.43862-1.5553-1.1647-1.9745-0.72606-0.4192-1.5913-0.3919-2.2923-0.0214-0.31593 0.167-0.46295 0.2136-0.56663 0.2272-0.32869 0.0433-0.6611-0.0458-0.92411-0.2476-0.06626-0.0508-0.15039-0.1376-0.28498-0.3379-0.13835-0.2058-0.2985-0.4824-0.5366-0.8948-0.23811-0.4124-0.39755-0.6894-0.50666-0.9121-0.10614-0.2167-0.13922-0.333-0.15012-0.4158-0.04327-0.3287 0.0458-0.6611 0.24762-0.9241 0.06366-0.0829 0.17751-0.187 0.4801-0.3771 0.67138-0.4218 1.1276-1.1575 1.1277-1.9958 5e-5 -0.8385-0.45621-1.5742-1.1276-1.9961-0.30252-0.19011-0.41636-0.29413-0.48002-0.37709-0.20181-0.26301-0.29088-0.59542-0.24761-0.92411 0.0109-0.08279 0.04398-0.19905 0.15012-0.41573 0.10911-0.22276 0.26855-0.49973 0.50665-0.91214 0.23811-0.4124 0.39825-0.68897 0.53661-0.89484 0.13459-0.20026 0.21872-0.28704 0.28497-0.33787 0.26302-0.20182 0.59543-0.29089 0.92411-0.24762 0.10369 0.01365 0.25072 0.06023 0.56669 0.22724 0.701 0.37051 1.5662 0.39778 2.2922-0.02139 0.72604-0.41917 1.135-1.1821 1.1646-1.9744 0.01336-0.35713 0.04653-0.50775 0.08655-0.60437 0.12687-0.30629 0.37026-0.54963 0.67646-0.6765z"
clip-rule="evenodd"
fill-rule="evenodd"
/>
</svg>
Settings
</button>
</a>
<button type="button" id="add-bang">
<svg
class="icon"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="24"
height="24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path
d="m12 8.25c-2.0711 0-3.75 1.6789-3.75 3.75 0 2.0711 1.6789 3.75 3.75 3.75 2.0711 0 3.75-1.6789 3.75-3.75 0-2.0711-1.6789-3.75-3.75-3.75zm-2.25 3.75c0-1.2426 1.0074-2.25 2.25-2.25s2.25 1.0074 2.25 2.25-1.0074 2.25-2.25 2.25-2.25-1.0074-2.25-2.25z"
clip-rule="evenodd"
fill-rule="evenodd"
/>
<path
d="m11.975 1.25c-0.4444-1e-5 -0.8155-1e-5 -1.1201 0.02077-0.3171 0.02164-0.6166 0.06828-0.90699 0.18856-0.67382 0.27911-1.2092 0.81446-1.4883 1.4883-0.1453 0.3508-0.18465 0.7205-0.19968 1.1223-0.01208 0.32303-0.1751 0.59255-0.41569 0.73145-0.24058 0.1389-0.5555 0.14532-0.84129-0.00573-0.35552-0.18791-0.69537-0.33869-1.0718-0.38825-0.7231-0.0952-1.4544 0.10076-2.033 0.54476-0.24936 0.19134-0.43952 0.42741-0.6168 0.69121-0.17031 0.25341-0.35582 0.57475-0.57805 0.95967l-0.02525 0.04374c-0.22224 0.38491-0.40776 0.70623-0.54207 0.98042-0.13981 0.28544-0.24918 0.56816-0.29021 0.87978-0.0952 0.72311 0.10076 1.4544 0.54475 2.0331 0.23112 0.3011 0.53157 0.5201 0.87201 0.734 0.27378 0.172 0.42571 0.448 0.42569 0.7259-1e-5 0.2778-0.15194 0.5538-0.42569 0.7258-0.34048 0.2139-0.64096 0.4329-0.8721 0.7341-0.444 0.5786-0.63995 1.3099-0.54476 2.033 0.04103 0.3116 0.1504 0.5944 0.29021 0.8798 0.13431 0.2742 0.31983 0.5955 0.54206 0.9804l0.02526 0.0438c0.22223 0.3849 0.40774 0.7062 0.57805 0.9596 0.17728 0.2638 0.36744 0.4999 0.6168 0.6912 0.57863 0.444 1.3099 0.64 2.033 0.5448 0.37644-0.0496 0.71627-0.2003 1.0718-0.3882 0.28583-0.1511 0.60079-0.1447 0.8414-0.0057 0.24062 0.1389 0.40366 0.4084 0.41574 0.7315 0.01503 0.4018 0.05439 0.7715 0.19968 1.1223 0.27911 0.6738 0.81447 1.2092 1.4883 1.4883 0.29039 0.1203 0.58989 0.1669 0.90699 0.1885 0.3046 0.0208 0.6757 0.0208 1.1201 0.0208h0.0505c0.4445 0 0.8155 0 1.1202-0.0208 0.3171-0.0216 0.6166-0.0682 0.907-0.1885 0.6738-0.2791 1.2092-0.8145 1.4883-1.4883 0.1453-0.3508 0.1846-0.7205 0.1996-1.1224 0.0121-0.323 0.1751-0.5925 0.4157-0.7315 0.2406-0.1389 0.5556-0.1453 0.8414 0.0057 0.3555 0.1879 0.6953 0.3387 1.0718 0.3882 0.7231 0.0952 1.4544-0.1007 2.033-0.5447 0.2494-0.1914 0.4395-0.4274 0.6168-0.6912 0.1703-0.2534 0.3558-0.5747 0.578-0.9596l0.0253-0.0438c0.2222-0.3849 0.4078-0.7063 0.5421-0.9805 0.1398-0.2854 0.2491-0.5681 0.2902-0.8797 0.0952-0.7232-0.1008-1.4545-0.5448-2.0331-0.2311-0.3012-0.5316-0.5201-0.872-0.734-0.2738-0.172-0.4257-0.448-0.4257-0.7259 0-0.2778 0.1519-0.5537 0.4256-0.7257 0.3406-0.2139 0.6411-0.4328 0.8722-0.7341 0.444-0.57861 0.64-1.3099 0.5448-2.033-0.0411-0.31162-0.1504-0.59434-0.2902-0.87978-0.1343-0.27417-0.3198-0.59547-0.5421-0.98035l-0.0252-0.04377c-0.2223-0.38493-0.4078-0.7063-0.5781-0.95971-0.1773-0.2638-0.3674-0.49987-0.6168-0.69122-0.5786-0.44399-1.3099-0.63995-2.0331-0.54475-0.3764 0.04956-0.7162 0.20032-1.0717 0.38822-0.2858 0.15107-0.6008 0.14464-0.8414 0.00572-0.2406-0.13891-0.4037-0.40847-0.4158-0.73153-0.015-0.40183-0.0543-0.77151-0.1996-1.1223-0.2791-0.67383-0.8145-1.2092-1.4883-1.4883-0.2904-0.12028-0.5899-0.16692-0.907-0.18856-0.3047-0.02078-0.6757-0.02078-1.1202-0.02077h-0.0505zm-1.4531 1.5952c0.0772-0.03196 0.1944-0.06143 0.4351-0.07786 0.2475-0.01688 0.5671-0.01729 1.0433-0.01729s0.7958 4.1e-4 1.0432 0.01729c0.2408 0.01643 0.358 0.0459 0.4351 0.07786 0.3063 0.12687 0.5497 0.37021 0.6765 0.6765 0.0401 0.09661 0.0732 0.24722 0.0866 0.60432 0.0296 0.79238 0.4386 1.5553 1.1647 1.9745 0.726 0.4192 1.5913 0.39192 2.2923 0.0214 0.3159-0.16698 0.463-0.21356 0.5666-0.22721 0.3287-0.04327 0.6611 0.0458 0.9241 0.24761 0.0663 0.05084 0.1504 0.13761 0.285 0.33788 0.1384 0.20587 0.2985 0.48244 0.5366 0.89484 0.2381 0.41241 0.3976 0.68938 0.5067 0.91213 0.1061 0.21669 0.1392 0.33294 0.1501 0.41574 0.0433 0.32868-0.0458 0.6611-0.2476 0.92411-0.0637 0.08297-0.1775 0.18701-0.4802 0.37712-0.6713 0.4219-1.1275 1.1575-1.1276 1.9958 0 0.8384 0.4562 1.5741 1.1276 1.996 0.3026 0.1901 0.4164 0.2941 0.4801 0.3771 0.2018 0.263 0.2909 0.5954 0.2476 0.9241-0.0109 0.0828-0.044 0.199-0.1501 0.4157-0.1091 0.2227-0.2686 0.4997-0.5067 0.9121s-0.3982 0.689-0.5366 0.8949c-0.1346 0.2002-0.2187 0.287-0.285 0.3378-0.263 0.2019-0.5954 0.2909-0.9241 0.2477-0.1036-0.0137-0.2507-0.0603-0.5666-0.2272-0.701-0.3706-1.5663-0.3978-2.2924 0.0214-0.7259 0.4192-1.1349 1.1821-1.1645 1.9745-0.0134 0.3571-0.0465 0.5077-0.0866 0.6044-0.1268 0.3062-0.3702 0.5496-0.6765 0.6765-0.0771 0.0319-0.1943 0.0614-0.4351 0.0778-0.2474 0.0169-0.567 0.0173-1.0432 0.0173s-0.7958-4e-4 -1.0433-0.0173c-0.2407-0.0164-0.3579-0.0459-0.4351-0.0778-0.3062-0.1269-0.54959-0.3703-0.67646-0.6765-0.04002-0.0967-0.07319-0.2473-0.08655-0.6044-0.02963-0.7923-0.43862-1.5553-1.1647-1.9745-0.72606-0.4192-1.5913-0.3919-2.2923-0.0214-0.31593 0.167-0.46295 0.2136-0.56663 0.2272-0.32869 0.0433-0.6611-0.0458-0.92411-0.2476-0.06626-0.0508-0.15039-0.1376-0.28498-0.3379-0.13835-0.2058-0.2985-0.4824-0.5366-0.8948-0.23811-0.4124-0.39755-0.6894-0.50666-0.9121-0.10614-0.2167-0.13922-0.333-0.15012-0.4158-0.04327-0.3287 0.0458-0.6611 0.24762-0.9241 0.06366-0.0829 0.17751-0.187 0.4801-0.3771 0.67138-0.4218 1.1276-1.1575 1.1277-1.9958 5e-5 -0.8385-0.45621-1.5742-1.1276-1.9961-0.30252-0.19011-0.41636-0.29413-0.48002-0.37709-0.20181-0.26301-0.29088-0.59542-0.24761-0.92411 0.0109-0.08279 0.04398-0.19905 0.15012-0.41573 0.10911-0.22276 0.26855-0.49973 0.50665-0.91214 0.23811-0.4124 0.39825-0.68897 0.53661-0.89484 0.13459-0.20026 0.21872-0.28704 0.28497-0.33787 0.26302-0.20182 0.59543-0.29089 0.92411-0.24762 0.10369 0.01365 0.25072 0.06023 0.56669 0.22724 0.701 0.37051 1.5662 0.39778 2.2922-0.02139 0.72604-0.41917 1.135-1.1821 1.1646-1.9744 0.01336-0.35713 0.04653-0.50775 0.08655-0.60437 0.12687-0.30629 0.37026-0.54963 0.67646-0.6765z"
clip-rule="evenodd"
fill-rule="evenodd"
/>
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
Settings
Add Bang
</button>
</a>
<button type="button" id="add-bang">
<svg
class="icon"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="24"
height="24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
Add Bang
</button>
</div>
<table id="bangs-table">
<thead>
<tr>
<th>Name</th>
<th>Bang</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
<div id="no-bangs">Click on + Add Bang to get started.</div>
</div>
<table id="bangs-table">
<thead>
<tr>
<th>Name</th>
<th>Bang</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
<div id="no-bangs">Click on + Add Bang to get started.</div>
</div>
<div class="footer">
<code id="version"
><a href="https://github.com/dmlls/yang/releases/tag/v0.9.26"
>v0.9.26</a
><a href="https://github.com/dmlls/yang/releases/tag/v0.9.28"
>v0.9.28</a
></code
>
<a
Expand Down
9 changes: 3 additions & 6 deletions options/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ function onGot(allBangs) {
.filter((entry) => entry[0].startsWith(PreferencePrefix.BANG))
.sort((a, b) => a[1].order - b[1].order)
.map((entry) => entry[0]);
if (sortedBangs.length === 0) {
const noBangsLabel = document.getElementById("no-bangs");
noBangsLabel.style.visibility = "visible";
} else {
if (sortedBangs.length > 0) {
document.getElementById("no-bangs").style.display = "none";
for (const b of sortedBangs) {
const tableBody = document.querySelector("#bangs-table tbody");
const row = tableBody.insertRow();
Expand Down Expand Up @@ -104,8 +102,7 @@ function deleteBang(e) {
const table = document.getElementById("bangs-table");
if (table.rows.length === 1) {
// Empty table.
const noBangsLabel = document.getElementById("no-bangs");
noBangsLabel.style.visibility = "visible";
document.getElementById("no-bangs").style.removeProperty("display");
}
displayToast(
bangKey,
Expand Down
2 changes: 1 addition & 1 deletion options/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function saveOnCtrlEnter(e) {
browser.storage.sync.get(Array.from(storedSettings.keys())).then(
function onGot(items) {
for (const [settingName, settingValue] of storedSettings) {
if (Object.hasOwn(items, settingName)) {
if (Object.hasOwn(items, settingName) && items[settingName] != null) {
settingValue.element.setAttribute("value", items[settingName]);
} else {
settingValue.element.setAttribute("value", settingValue.default);
Expand Down
2 changes: 1 addition & 1 deletion utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async function fetchSettings(update = false) {
}
settings[bangKey] = bangInfo;
}
if (!Object.hasOwn(settings, PreferencePrefix.BANG_SYMBOL)) {
if (!Object.hasOwn(settings, PreferencePrefix.BANG_SYMBOL) || !settings[PreferencePrefix.BANG_SYMBOL]) {
settings[PreferencePrefix.BANG_SYMBOL] = Defaults.BANG_SYMBOL;
}
browser.storage.session.clear().then(
Expand Down

0 comments on commit 7aec562

Please sign in to comment.