-
Notifications
You must be signed in to change notification settings - Fork 4
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
Showing
6 changed files
with
172 additions
and
52 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
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 |
---|---|---|
@@ -1,4 +1,49 @@ | ||
"use strict"; | ||
// Enable chromereload by uncommenting this line: | ||
// import 'chromereload/devonly' | ||
if(process.env.NODE_ENV === 'development'){ | ||
require('chromereload/devonly') | ||
} | ||
|
||
console.log(`'Allo 'Allo! Options`) | ||
// Saves options to chrome.storage | ||
function save_options() { | ||
var updateFrequency = document.getElementById('updateFrequency').value; | ||
var showBest = document.getElementById('maxComparisons').value; | ||
var minpercentage = document.getElementById('minpercentage').value; | ||
var maxLengthDifference = document.getElementById('maxDifference').value; | ||
var maxworkers = document.getElementById('maxWorkers').value; | ||
|
||
var options = { | ||
updateFrequency: updateFrequency, | ||
showBest: showBest, | ||
minpercentage: minpercentage, | ||
maxLengthDifference: maxLengthDifference, | ||
maxworkers: maxworkers | ||
}; | ||
chrome.storage.sync.set({options:options}, 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 values using the preferences | ||
// stored in chrome.storage. | ||
function restore_options() { | ||
chrome.storage.sync.get(['options'], function(result) { | ||
document.getElementById('updateFrequency').value = result.options.updateFrequency; | ||
document.getElementById('maxComparisons').value = result.options.showBest; | ||
document.getElementById('minpercentage').value = result.options.minpercentage; | ||
document.getElementById('maxDifference').value = result.options.maxLengthDifference; | ||
document.getElementById('maxWorkers').value = result.options.maxworkers; | ||
}); | ||
} | ||
function reset() { | ||
var form = document.getElementById('options'); | ||
form.reset(); | ||
} | ||
document.addEventListener('DOMContentLoaded', restore_options); | ||
document.getElementById('reset').addEventListener('click',reset); | ||
document.getElementById('save').addEventListener('click',save_options); |
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,15 @@ | ||
div { | ||
margin-bottom: 10px; | ||
} | ||
|
||
input:invalid+span:after { | ||
color: red; | ||
content: '✖'; | ||
padding-left: 5px; | ||
} | ||
|
||
input:valid+span:after { | ||
color: green; | ||
content: '✓'; | ||
padding-left: 5px; | ||
} |