Skip to content

Commit

Permalink
Merge pull request #7 from JordanAMeyer/master
Browse files Browse the repository at this point in the history
change "Clear Data" to be a button instead of a checkbox
  • Loading branch information
Dan Kang committed Feb 26, 2014
2 parents 914dcf3 + 6db652a commit 79521fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
5 changes: 1 addition & 4 deletions options.html
Expand Up @@ -40,10 +40,7 @@ <h1>Web Timer Options</h1>
</tr>
<tr>
<th>Storage</th>
<td>
<input id="clear-data" type="checkbox" />
<label for="clear-data">Clear All Data</label>
</td>
<td><button id="clear-data">Clear Data</button></td>
<td id="storage-description" class="description">There is no way to recover your data once you delete it.</td>
</tbody>
</table>
Expand Down
9 changes: 2 additions & 7 deletions options.js
Expand Up @@ -39,13 +39,6 @@ function save_options() {
limit_data.value = localStorage["chart_limit"];
}

// Check checkboxes for erasing data
var clear_data = document.getElementById("clear-data");
if (clear_data.checked) {
clearData();
clear_data.checked = false;
}

// Update status to let user know options were saved.
var status = document.getElementById("status");
status.innerHTML = "Options Saved.";
Expand All @@ -72,6 +65,7 @@ function clearData() {
localStorage.clear();
localStorage["blacklist"] = blacklist;
bg.setDefaults();
location.reload();
}

document.addEventListener('DOMContentLoaded', function () {
Expand All @@ -80,6 +74,7 @@ document.addEventListener('DOMContentLoaded', function () {

// Set handlers for option descriptions
document.querySelector('#save-button').addEventListener('click', save_options);
document.querySelector('#clear-data').addEventListener('click', clearData);
var rows = document.querySelectorAll('tr');
var mouseoverHandler = function() { this.querySelector('.description').style.visibility = "visible"; };
var mouseoutHandler = function() { this.querySelector('.description').style.visibility = "hidden"; };
Expand Down

0 comments on commit 79521fe

Please sign in to comment.