diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-03-02 22:08:34 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 22:08:34 -0500 |
commit | b0bc7dc08fd05fbfc45679fbad9aee82a9f2248e (patch) | |
tree | 5838c4fbb2b8d7c49726c915f1359b30daac8e31 /ext | |
parent | 4208595293a18c2cd95064caf77db786c2902ac8 (diff) |
Add a toggle for the persistent storage option on the permissions page (#1479)
Diffstat (limited to 'ext')
-rw-r--r-- | ext/js/pages/permissions-main.js | 4 | ||||
-rw-r--r-- | ext/permissions.html | 23 |
2 files changed, 27 insertions, 0 deletions
diff --git a/ext/js/pages/permissions-main.js b/ext/js/pages/permissions-main.js index 782ea9ec..66fa1d42 100644 --- a/ext/js/pages/permissions-main.js +++ b/ext/js/pages/permissions-main.js @@ -18,6 +18,7 @@ /* global * DocumentFocusController * PermissionsToggleController + * PersistentStorageController * SettingsController */ @@ -92,6 +93,9 @@ function setupPermissionsToggles() { const permissionsToggleController = new PermissionsToggleController(settingsController); permissionsToggleController.prepare(); + const persistentStorageController = new PersistentStorageController(); + persistentStorageController.prepare(); + await promiseTimeout(100); document.documentElement.dataset.loaded = 'true'; diff --git a/ext/permissions.html b/ext/permissions.html index 5bd6987f..699aca4f 100644 --- a/ext/permissions.html +++ b/ext/permissions.html @@ -153,6 +153,28 @@ <label class="toggle"><input type="checkbox" id="permission-checkbox-allow-file-url-access" disabled><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> </div> </div></div> + <div class="settings-item"><div class="settings-item-inner"> + <div class="settings-item-left"> + <div class="settings-item-label">Persistent storage</div> + <div class="settings-item-description"> + <p> + Web browsers will sometimes clear stored data if the device is running low on storage space, + which can result in the imported dictionaries being deleted unexpectedly. + The persistent storage permission tells the browser that the data should not be deleted in those circumstances. + </p> + <p data-show-for-browser="firefox-mobile"> + It may not be possible to enable this permission on Firefox for Android. + </p> + <p data-show-for-browser="chrome edge"> + Chromium-based browsers should not need to enable this setting since the Yomichan extension has + the <code>unlimitedStorage</code> permission, which should prevent data deletion.<sup><a href="https://bugs.chromium.org/p/chromium/issues/detail?id=680392#c15" target="_blank" rel="noopener">[1]</a></sup> + </p> + </div> + </div> + <div class="settings-item-right"> + <label class="toggle"><input type="checkbox" id="storage-persistent-checkbox"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label> + </div> + </div></div> </div> <div class="footer-padding"></div> @@ -172,6 +194,7 @@ <script src="/js/dom/document-focus-controller.js"></script> <script src="/js/dom/html-template-collection.js"></script> <script src="/js/pages/settings/permissions-toggle-controller.js"></script> +<script src="/js/pages/settings/persistent-storage-controller.js"></script> <script src="/js/pages/settings/settings-controller.js"></script> <script src="/js/pages/permissions-main.js"></script> |