From c6df27e8187be8ebf540be2e4f0f268c181d35ed Mon Sep 17 00:00:00 2001
From: kaffem <29717789+kaffem@users.noreply.github.com>
Date: Wed, 5 Aug 2020 07:12:04 +0200
Subject: [PATCH] #32 added basic settings for #11
---
settings/settings.html | 22 ++++++++++++++++++++++
settings/settings.js | 25 +++++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/settings/settings.html b/settings/settings.html
index e69de29..3d3b2ec 100644
--- a/settings/settings.html
+++ b/settings/settings.html
@@ -0,0 +1,22 @@
+
+
+
+ Enhanced Aniwatch Settings
+
+
+
+
+
+
+
+
diff --git a/settings/settings.js b/settings/settings.js
index e69de29..7e10f2b 100644
--- a/settings/settings.js
+++ b/settings/settings.js
@@ -0,0 +1,25 @@
+// Saves settings to chrome.storage
+function save_settings() {
+ let items = {
+ maxPlayerWidth: document.getElementById('maxPlayerWidth').value,
+ actualPlayerWidth: document.getElementById('actualPlayerWidth').value
+ };
+
+ chrome.storage.local.set(items, function() {
+ alert('Settings saved.');
+ });
+}
+
+// Restores the settings using stored in chrome.storage
+function restore_settings() {
+ chrome.storage.local.get([
+ 'maxPlayerWidth',
+ 'actualPlayerWidth'
+ ], function(r) {
+ document.getElementById('maxPlayerWidth').value = r.maxPlayerWidth;
+ document.getElementById('actualPlayerWidth').value = r.actualPlayerWidth;
+ });
+}
+
+document.getElementById('save').addEventListener('click', save_settings);
+document.addEventListener('DOMContentLoaded', restore_settings);