-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.js
More file actions
24 lines (22 loc) · 827 Bytes
/
options.js
File metadata and controls
24 lines (22 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* eslint-disable no-loop-func */
/* eslint-disable no-undef */
/* eslint-disable no-restricted-syntax */
/* eslint-disable no-console */
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const page = document.getElementById('buttonDiv');
const kButtonColors = ['#3aa757', '#e8453c', '#f9bb2d', '#4688f1'];
function constructOptions(kButtonColors) {
for (const item of kButtonColors) {
const button = document.createElement('button');
button.style.backgroundColor = item;
button.addEventListener('click', () => {
chrome.storage.sync.set({ color: item }, () => {
console.log(`color is ${item}`);
});
});
page.appendChild(button);
}
}
constructOptions(kButtonColors);