Pārlūkot izejas kodu

store in local storage the state of checkboxes used to filter the rules

Gildas 7 gadi atpakaļ
vecāks
revīzija
b90c7788b3
1 mainītis faili ar 17 papildinājumiem un 1 dzēšanām
  1. 17 1
      extension/ui/bg/ui-options.js

+ 17 - 1
extension/ui/bg/ui-options.js

@@ -18,7 +18,7 @@
  *   along with SingleFile.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* global browser, window, document */
+/* global browser, window, document, localStorage */
 
 (async () => {
 
@@ -180,13 +180,29 @@
 			ruleEditButton.disabled = true;
 		}
 	};
+	if (localStorage.getItem("optionShowAutoSaveProfile")) {
+		showAutoSaveProfileInput.checked = true;
+		rulesContainerElement.classList.remove("compact");
+	}
 	showAutoSaveProfileInput.addEventListener("click", () => {
 		if (showAutoSaveProfileInput.checked) {
+			localStorage.setItem("optionShowAutoSaveProfile", 1);
 			rulesContainerElement.classList.remove("compact");
 		} else {
+			localStorage.setItem("optionShowAutoSaveProfile", 0);
 			rulesContainerElement.classList.add("compact");
 		}
 	}, false);
+	if (localStorage.getItem("optionShowAllProfiles")) {
+		showAllProfilesInput.checked = true;
+	}
+	showAllProfilesInput.addEventListener("click", () => {
+		if (showAllProfilesInput.checked) {
+			localStorage.setItem("optionShowAllProfiles", 1);
+		} else {
+			localStorage.setItem("optionShowAllProfiles", 0);
+		}
+	}, false);
 	addProfileButton.addEventListener("click", async () => {
 		const profileName = prompt(browser.i18n.getMessage("profileAddPrompt"));
 		if (profileName) {