Skip to content

Commit

Permalink
Add a reset button
Browse files Browse the repository at this point in the history
Signed-off-by: supechicken <me@supechicken666.dev>
  • Loading branch information
supechicken committed Sep 16, 2024
1 parent 702a14a commit c12ef28
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions css/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,7 @@ input[type="file"] { width: 100px; }
font-size: 0.9rem;
margin-right: 10px;
}

#bottomBtnList > button {
width: 150px;
}
5 changes: 4 additions & 1 deletion html/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@
</tr>
</table>
</fieldset>
<button id="saveBtn">Save settings</button>
<div id="bottomBtnList" class="horizontal-center">
<button id="resetBtn">Reset options</button>
<button id="saveBtn">Save settings</button>
</div>
</body>

</html>
19 changes: 19 additions & 0 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const chromeURLs = chrome.runtime.getManifest().optional_host_per
movingBackground = document.getElementById('movingBackground'),
backgroundPicker = document.getElementById('backgroundPicker'),
chromeUIBgPicker = document.getElementById('chromeUIBgPicker'),
resetBtn = document.getElementById('resetBtn'),
saveBtn = document.getElementById('saveBtn');

function printLog(message) {
Expand Down Expand Up @@ -111,6 +112,24 @@ chromeUIBgPicker.onchange = async () => {
chromeUIBgName.innerText = chromeUIBgFile.name;
};

// reset options
resetBtn.onclick = () => {
chromeUI.checked = false;
movingBackground.checked = true;
blurRadiusSlider.value = 0;
blurRadiusPercent.innerText = `${blurRadiusSlider.value}px`;
chromeUIBlurRadiusSlider.value = 0;
chromeUIBlurRadiusPercent.innerText = `${chromeUIBlurRadiusSlider.value}px`;
menuBlurRadiusSlider.value = 5;
menuBlurRadiusPercent.innerText = `${menuBlurRadiusSlider.value}px`;
UIOpacitySlider.value = 50;
UIOpacityPercent.innerText = `${UIOpacitySlider.value}%`
chromeUIOpacitySlider.value = 50;
chromeUIOpacityPercent.innerText = `${chromeUIOpacitySlider.value}%`
menuOpacitySlider.value = 50;
menuOpacityPercent.innerText = `${menuOpacitySlider.value}%`;
}

// save changes
saveBtn.onclick = async () => {
saveBtn.disabled = true;
Expand Down

0 comments on commit c12ef28

Please sign in to comment.