aboutsummaryrefslogtreecommitdiffstats
path: root/pages/popup
diff options
context:
space:
mode:
authorSimon Brazell <simon.brazell@gmail.com>2019-10-07 22:59:31 +1100
committerSimon Brazell <simon.brazell@gmail.com>2019-10-07 22:59:31 +1100
commit7249afb8ed86690f9ab7ce0b4bdd604f2c41c291 (patch)
treed495be3bdbe5d580253eecc1e4c4ebdeb876ddde /pages/popup
parentAdd popup & options pages (diff)
downloadlibredirect-7249afb8ed86690f9ab7ce0b4bdd604f2c41c291.zip
Complete options & popup menus
Diffstat (limited to '')
-rw-r--r--pages/popup/popup.html23
-rw-r--r--pages/popup/popup.js23
-rw-r--r--pages/styles.css (renamed from pages/popup/popup.css)10
3 files changed, 41 insertions, 15 deletions
diff --git a/pages/popup/popup.html b/pages/popup/popup.html
index 0e28a99a..889ffcde 100644
--- a/pages/popup/popup.html
+++ b/pages/popup/popup.html
@@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
- <link href="./popup.css" rel="stylesheet">
+ <link href="../styles.css" rel="stylesheet">
</head>
<body>
@@ -14,26 +14,24 @@
<img src="../../images/logo.png" alt="Privacy Redirect logo">
</div>
<small>
- <span>Version</span>: 1.0.2</span>
+ <span>Version</span>: 1.1.1</span>
</small>
</header>
- <section id="disableNitter" class="options settings_block">
+ <section class="options settings_block">
<div class="onoffswitch switch" aria-label="Toggle Nitter redirects">
- <h1 id="onoffswitch_label">Nitter Redirects</h1>
- <span class="slider round"></span>
- <input aria-hidden="true" id="onoffnitter" type="checkbox" checked> <label id="onoffnitter__label"
- for="onoffnitter">
+ <h1>Nitter Redirects</h1>
+ <input aria-hidden="true" id="disableNitter" type="checkbox" checked>&nbsp;
+ <label for="disableNitter" class="checkbox-label">
</label>
</div>
</section>
- <section id="disableInvidious" class="options settings_block">
+ <section class="options settings_block">
<div class="onoffswitch switch" aria-label="Toggle Invidious redirects">
- <h1 id="onoffinvidious_label">Invidious Redirects</h1>
- <span class="slider round"></span>
- <input aria-hidden="true" id="onoffinvidious" type="checkbox" checked> <label id="onoffinvidious_label"
- for="onoffinvidious">
+ <h1>Invidious Redirects</h1>
+ <input aria-hidden="true" id="disableInvidious" type="checkbox" checked>&nbsp;
+ <label for="disableInvidious" class="checkbox-label">
</label>
</div>
</section>
@@ -43,6 +41,7 @@
</footer>
<script src="./popup.js"></script>
+
</body>
</html> \ No newline at end of file
diff --git a/pages/popup/popup.js b/pages/popup/popup.js
index 0dddb49c..2837cdb2 100644
--- a/pages/popup/popup.js
+++ b/pages/popup/popup.js
@@ -1,4 +1,25 @@
-document.querySelector('#options').addEventListener('click', function () {
+'use strict';
+
+let disableNitter = document.querySelector('#disableNitter');
+let disableInvidious = document.querySelector('#disableInvidious');
+
+chrome.storage.sync.get(
+ ['disableNitter', 'disableInvidious'],
+ (result) => {
+ disableNitter.checked = !result.disableNitter;
+ disableInvidious.checked = !result.disableInvidious;
+ }
+);
+
+disableNitter.addEventListener('change', (event) => {
+ chrome.storage.sync.set({ disableNitter: !event.target.checked });
+});
+
+disableInvidious.addEventListener('change', (event) => {
+ chrome.storage.sync.set({ disableInvidious: !event.target.checked });
+});
+
+document.querySelector('#options').addEventListener('click', () => {
if (chrome.runtime.openOptionsPage) {
chrome.runtime.openOptionsPage();
} else {
diff --git a/pages/popup/popup.css b/pages/styles.css
index eebab8e3..5a233524 100644
--- a/pages/popup/popup.css
+++ b/pages/styles.css
@@ -73,11 +73,17 @@ footer a.button {
}
/* Elements */
+
+input[type=url] {
+ width: 100%;
+ margin-bottom: 5px;
+}
+
input[type=checkbox] {
opacity: 0;
}
-label {
+.checkbox-label {
background: grey;
border-radius: 25px;
color: var(--text-main);
@@ -91,7 +97,7 @@ label {
width: 50px;
}
-label:after {
+.checkbox-label:after {
background: #fff;
border-radius: 90px;
content: '';