diff options
| author | Phil Crosby | 2010-01-22 22:36:13 -0800 |
|---|---|---|
| committer | Phil Crosby | 2010-01-22 22:36:13 -0800 |
| commit | 893eaeb5c96ff5a324bc886f77c624aea4854947 (patch) | |
| tree | 097650f2bb1d9e03625c809ff2bacaa988b658e9 | |
| parent | 7ef4c24b20976560f0ed9aa981b197b1121f79a9 (diff) | |
| download | vimium-893eaeb5c96ff5a324bc886f77c624aea4854947.tar.bz2 | |
Make the enabling of the save button on the Options page based on textfield content, not keystrokes.
| -rw-r--r-- | options.html | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/options.html b/options.html index 3ddeb38d..d135799a 100644 --- a/options.html +++ b/options.html @@ -36,10 +36,12 @@ white-space:nowrap; } #buttonsPanel { - /* This should match the width of #excludedUrls */ - width:450px; + /* This should match the width of #excludedUrls + 5px of padding to move the buttons to the right. */ + width:455px; text-align:right; margin-top:18px; + + margin-right:-10px; } .help { position:absolute; @@ -62,12 +64,12 @@ function initializeOptions() { populateOptions(); for (var i = 0; i < editableFields.length; i++) - $(editableFields[i]).addEventListener("keydown", onOptionKeydown, false); + $(editableFields[i]).addEventListener("keyup", onOptionKeydown, false); $("advancedOptions").addEventListener("click", openAdvancedOptions, false); } function onOptionKeydown(event) { - if (event.keyCode > 31) // Ignore modifiers and TAB. + if (event.target.getAttribute("savedValue") != event.target.value) enableSaveButton(); } @@ -86,14 +88,18 @@ delete localStorage[fieldName]; else localStorage[fieldName] = fieldValue; + $(fieldName).value = fieldValue; + $(fieldName).setAttribute("savedValue", fieldValue); } $("saveOptions").disabled = true; } // Restores select box state to saved value from localStorage. function populateOptions() { - for (var i = 0; i < editableFields.length; i++) + for (var i = 0; i < editableFields.length; i++) { $(editableFields[i]).value = localStorage[editableFields[i]] || defaultSettings[editableFields[i]] || ""; + $(editableFields[i]).setAttribute("savedValue", $(editableFields[i]).value); + } } function restoreToDefaults() { |
