forked from harshayburadkar/clut-chrome-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1577b7d
commit 17c197e
Showing
4 changed files
with
125 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>CLUT Options</title> | ||
</head> | ||
<body> | ||
<label> | ||
<input type="checkbox" id="only-same-window" /> | ||
Only switch to tabs in the same window | ||
</label> | ||
|
||
<div id="status"></div> | ||
<button id="save">Save</button> | ||
|
||
<script src="options.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// https://github.com/harshayburadkar/clut-chrome-extension/pull/9/files | ||
|
||
// Saves options to chrome.storage | ||
function save_options() { | ||
var onlySameWindow = document.getElementById("only-same-window").checked; | ||
chrome.storage.sync.set( | ||
{ | ||
onlySameWindow | ||
}, | ||
function () { | ||
// Update status to let user know options were saved. | ||
var status = document.getElementById("status"); | ||
status.textContent = "Options saved."; | ||
setTimeout(function () { | ||
status.textContent = ""; | ||
}, 750); | ||
} | ||
); | ||
} | ||
|
||
// Restores select box and checkbox state using the preferences | ||
// stored in chrome.storage. | ||
function restore_options() { | ||
// Use default value color = 'red' and likesColor = true. | ||
chrome.storage.sync.get( | ||
{ | ||
onlySameWindow: false | ||
}, | ||
function (items) { | ||
document.getElementById("only-same-window").checked = items.onlySameWindow; | ||
} | ||
); | ||
} | ||
document.addEventListener("DOMContentLoaded", restore_options); | ||
document.getElementById("save").addEventListener("click", save_options); |