diff options
author | Hygna <hygna@proton.me> | 2022-09-30 14:54:56 +0100 |
---|---|---|
committer | Hygna <hygna@proton.me> | 2022-09-30 14:54:56 +0100 |
commit | 18facf37a2f058b1314f5fd3a1f9d36c70ba27f5 (patch) | |
tree | 5042ecbc2172c95a7a505ae71a7f3e263dfaa1d8 /src/pages | |
parent | Changes: (diff) | |
download | libredirect-18facf37a2f058b1314f5fd3a1f9d36c70ba27f5.zip |
Squashed a few bugs
Diffstat (limited to 'src/pages')
-rw-r--r-- | src/pages/background/background.js | 30 | ||||
-rw-r--r-- | src/pages/options/index.html | 14 | ||||
-rw-r--r-- | src/pages/options/widgets/general.js | 2 | ||||
-rw-r--r-- | src/pages/options/widgets/services.js | 2 | ||||
-rw-r--r-- | src/pages/popup/popup.html | 20 |
5 files changed, 34 insertions, 34 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js index e9bf691f..3a900609 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -6,20 +6,7 @@ import servicesHelper from "../../assets/javascripts/services.js" window.browser = window.browser || window.chrome -browser.runtime.onInstalled.addListener(details => { - function initDefaults() { - fetch("/instances/blacklist.json") - .then(response => response.text()) - .then(async data => { - browser.storage.local.clear(() => { - browser.storage.local.set({ blacklists: JSON.parse(data) }, () => { - generalHelper.initDefaults() - servicesHelper.initDefaults() - }) - }) - }) - } - +browser.runtime.onInstalled.addListener(async details => { // if (details.reason == 'install' || (details.reason == "update" && details.previousVersion != browser.runtime.getManifest().version)) { // if (details.reason == "update") // browser.storage.local.get(null, r => { @@ -38,12 +25,25 @@ browser.runtime.onInstalled.addListener(details => { case "update": switch (details.previousVersion) { case "2.2.1": - //do stuff + initDefaults() break } } }) +function initDefaults() { + browser.storage.local.clear(() => { + fetch("/instances/blacklist.json") + .then(response => response.text()) + .then(async data => { + browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { + await generalHelper.initDefaults() + await servicesHelper.initDefaults() + }) + }) + }) +} + let BYPASSTABs = [] browser.webRequest.onBeforeRequest.addListener( details => { diff --git a/src/pages/options/index.html b/src/pages/options/index.html index 6ef33723..71d04fd0 100644 --- a/src/pages/options/index.html +++ b/src/pages/options/index.html @@ -84,7 +84,7 @@ <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> </svg> - <a href="#sendTargets" data-localise="__MSG_sendTargets__">Send Files</a></div> + <a href="#uploadFiles" data-localise="__MSG_uploadFiles__">Send Files</a></div> <div class="title"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="currentColor"> <path d="M11 17h2v-6h-2Zm1-8q.425 0 .713-.288Q13 8.425 13 8t-.287-.713Q12.425 7 12 7t-.712.287Q11 7.575 11 8t.288.712Q11.575 9 12 9Zm0 13q-2.075 0-3.9-.788-1.825-.787-3.175-2.137-1.35-1.35-2.137-3.175Q2 14.075 2 12t.788-3.9q.787-1.825 2.137-3.175 1.35-1.35 3.175-2.138Q9.925 2 12 2t3.9.787q1.825.788 3.175 2.138 1.35 1.35 2.137 3.175Q22 9.925 22 12t-.788 3.9q-.787 1.825-2.137 3.175-1.35 1.35-3.175 2.137Q14.075 22 12 22Zm0-2q3.35 0 5.675-2.325Q20 15.35 20 12q0-3.35-2.325-5.675Q15.35 4 12 4 8.65 4 6.325 6.325 4 8.65 4 12q0 3a.35 2.325 5.675Q8.65 20 12 20Zm0-8Z"></path> </svg> @@ -318,9 +318,9 @@ <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> </svg> - <x data-localise="__MSG_sendTargets__">Send Files</x> + <x data-localise="__MSG_uploadFiles__">Send Files</x> </div> - <input id="sendTargets" type="checkbox"> + <input id="uploadFiles" type="checkbox"> </div> </div> @@ -2818,7 +2818,7 @@ <h4 data-localise="__MSG_frontend__">Frontend</h4> <select id="translate-frontend"> <option value="simplyTranslate">SimplyTranslate</option> - <option value="lingva">Lingva</option> + <option value="lingva">Lingva Translate</option> </select> </div> @@ -3134,14 +3134,14 @@ </div> </section> -<section class="option-block" id="sendTargets_page"> +<section class="option-block" id="uploadFiles_page"> <div class="some-block option-block"> - <h1 data-localise="__MSG_sendTargets__">Send Files</h1> + <h1 data-localise="__MSG_uploadFiles__">Send Files</h1> </div> <hr> <div class="some-block option-block"> <h4 data-localise="__MSG_enable__">Enable</h4> - <input id="sendTargets-enabled" type="checkbox"> + <input id="uploadFiles-enabled" type="checkbox"> </div> <hr> <div id="send"> diff --git a/src/pages/options/widgets/general.js b/src/pages/options/widgets/general.js index 23ed73ee..cd5cfb47 100644 --- a/src/pages/options/widgets/general.js +++ b/src/pages/options/widgets/general.js @@ -37,7 +37,6 @@ function setOption(option, multiChoice, event) { browser.storage.local.get("options", r => { let options = r.options if (multiChoice) { - console.log(event.target.options) options[option] = event.target.options[event.target.options.selectedIndex].value } else { options[option] = event.target.checked @@ -95,6 +94,7 @@ resetSettings.addEventListener("click", async () => { .then(response => response.text()) .then(async data => { browser.storage.local.set({ blacklists: JSON.parse(data) }, async () => { + await generalHelper.initDefaults() await servicesHelper.initDefaults() location.reload() }) diff --git a/src/pages/options/widgets/services.js b/src/pages/options/widgets/services.js index 873950f3..98e068a1 100644 --- a/src/pages/options/widgets/services.js +++ b/src/pages/options/widgets/services.js @@ -77,7 +77,7 @@ function changeNetworkSettings() { changeNetworkSettings() for (const service in config.services) { divs[service] = {} - divs[service][service] = document.getElementById(`${service}_page`) + //divs[service].page = document.getElementById(`${service}_page`) for (const option in config.services[service].options) { divs[service][option] = document.getElementById(`${service}-${option}`) diff --git a/src/pages/popup/popup.html b/src/pages/popup/popup.html index d52a34b6..56e4ca14 100644 --- a/src/pages/popup/popup.html +++ b/src/pages/popup/popup.html @@ -91,7 +91,7 @@ <h4 data-localise="__MSG_search__">Search</h4></a> <input class="search-enabled" type="checkbox"/> </div> -<div class="translate some-block"><a class="title" href="https://translate.google.com"> +<div class="translate some-block"><a class="title" href="https://translate.libredirect.invalid"> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> </svg> @@ -99,7 +99,7 @@ <h4 data-localise="__MSG_translate__">Translate</h4></a> <input class="translate-enabled" type="checkbox"/> </div> -<div class="maps some-block"><a class="title" href="https://maps.google.com"> +<div class="maps some-block"><a class="title" href="https://maps.libredirect.invalid"> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> <path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z"></path> </svg> @@ -107,13 +107,13 @@ <h4 data-localise="__MSG_maps__">Maps</h4></a> <input class="maps-enabled" type="checkbox"/> </div> -<div class="sendTargets some-block"><a class="title" href="https://send.libredirect.invalid"> +<div class="uploadFiles some-block"><a class="title" href="https://send.libredirect.invalid"> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> </svg> - <h4 data-localise="__MSG_sendTargets__">Send Files</h4></a> - <input class="sendTargets-enabled" type="checkbox"/> + <h4 data-localise="__MSG_uploadFiles__">Send Files</h4></a> + <input class="uploadFiles-enabled" type="checkbox"/> </div> <div id="current_site_divider"> @@ -204,7 +204,7 @@ <h4 data-localise="__MSG_search__">Search</h4></a> <input class="search-enabled" type="checkbox"/> </div> -<div class="translate some-block"><a class="title" href="https://translate.google.com"> +<div class="translate some-block"><a class="title" href="https://translate.libredirect.invalid"> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> <path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path> </svg> @@ -212,7 +212,7 @@ <h4 data-localise="__MSG_translate__">Translate</h4></a> <input class="translate-enabled" type="checkbox"/> </div> -<div class="maps some-block"><a class="title" href="https://maps.google.com"> +<div class="maps some-block"><a class="title" href="https://maps.libredirect.invalid"> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> <path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z"></path> </svg> @@ -220,13 +220,13 @@ <h4 data-localise="__MSG_maps__">Maps</h4></a> <input class="maps-enabled" type="checkbox"/> </div> -<div class="sendTargets some-block"><a class="title" href="https://send.libredirect.invalid"> +<div class="uploadFiles some-block"><a class="title" href="https://send.libredirect.invalid"> <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"> <path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path> </svg> - <h4 data-localise="__MSG_sendTargets__">Send Files</h4></a> - <input class="sendTargets-enabled" type="checkbox"/> + <h4 data-localise="__MSG_uploadFiles__">Send Files</h4></a> + <input class="uploadFiles-enabled" type="checkbox"/> </div> </div> |