Add options page with sort mode setting
This commit is contained in:
parent
f0f3a7e4ea
commit
5cf4471c78
2 changed files with 27 additions and 0 deletions
15
src/options.html
Normal file
15
src/options.html
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head><meta charset="UTF-8"><title>Tab Tidy — Options</title></head>
|
||||||
|
<body>
|
||||||
|
<h2>Tab Tidy Settings</h2>
|
||||||
|
<label>Sort groups by:
|
||||||
|
<select id="sortMode">
|
||||||
|
<option value="alpha">Alphabetical</option>
|
||||||
|
<option value="count">Tab count</option>
|
||||||
|
<option value="lastUsed">Last used</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<script src="src/options.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
12
src/options.js
Normal file
12
src/options.js
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Options page — sort mode persistence
|
||||||
|
const SORT_KEY = 'tabTidy_sortMode';
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const select = document.getElementById('sortMode');
|
||||||
|
chrome.storage.local.get(SORT_KEY, (result) => {
|
||||||
|
select.value = result[SORT_KEY] || 'alpha';
|
||||||
|
});
|
||||||
|
select.addEventListener('change', () => {
|
||||||
|
chrome.storage.local.set({ [SORT_KEY]: select.value });
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue