fix settings

master
Aevann 2023-01-01 04:50:06 +02:00
parent e2bd765b62
commit 21c88c7d9e
2 changed files with 9 additions and 9 deletions

View File

@ -93,7 +93,7 @@ const setting_switchs = document.getElementsByClassName('setting_switch');
for (const element of setting_switchs) {
if (element.dataset.nonce != nonce) continue
element.onchange = () => {
postToastSwitch(this,`/settings/${element.name}?poor=${element.checked}`);
postToastSwitch(element,`/settings/personal?${element.name}=${element.checked}`);
};
}
@ -101,7 +101,7 @@ const setting_reloads = document.getElementsByClassName('setting_reload');
for (const element of setting_reloads) {
if (element.dataset.nonce != nonce) continue
element.onchange = () => {
postToastReload(this,`/settings/${element.name}?poor=${element.checked}`);
postToastReload(element,`/settings/personal?${element.name}=${element.value}`);
};
}

View File

@ -14,7 +14,7 @@
</div>
<div class="body w-lg-100">
<div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input setting_switch" id="poor" name="poor"{% if v.poor %} checked{% endif %}>
<input autocomplete="off" type="checkbox" class="custom-control-input setting_switch" data-nonce="{{g.nonce}}" id="poor" name="poor"{% if v.poor %} checked{% endif %}>
<label class="custom-control-label" for="poor"></label>
</div>
<span class="text-small text-muted">Makes the site faster for low-end devices:</span>
@ -23,7 +23,7 @@
<li><small>Hides signatures.</small></li>
<li><small>Makes emoji search only start when you press Enter.</small></li>
<li><small>Disables UI animations.</small></li>
{% if HOLIDAY_EVENT %}
{% if HOLIDAY_EVENT() %}
<li><small>Disables event music.</small></li>
{% endif %}
</ul>
@ -41,7 +41,7 @@
<div class="body w-lg-100">
<p>Change how many posts appear on every page.</p>
<div class="input-group mb2">
<select autocomplete="off" id='frontsize' class="form-control setting_switch" form="profile-settings" name="frontsize">
<select autocomplete="off" id='frontsize' class="form-control setting_switch" data-nonce="{{g.nonce}}" form="profile-settings" name="frontsize">
{% for entry in PAGE_SIZES %}
<option value="{{entry}}"{{' selected' if v.frontsize==entry}}>{{entry}}</option>
{% endfor %}
@ -56,7 +56,7 @@
<div class="body w-lg-100">
<p>Change the default sorting for comments.</p>
<div class="input-group mb2">
<select autocomplete="off" id='defaultsortingcomments' class="form-control setting_switch" form="profile-settings" name="defaultsortingcomments">
<select autocomplete="off" id='defaultsortingcomments' class="form-control setting_switch" data-nonce="{{g.nonce}}" form="profile-settings" name="defaultsortingcomments">
{% for entry in COMMENT_SORTS %}
<option value="{{entry}}"{{' selected' if v.defaultsortingcomments==entry}}>{{entry}}</option>
{% endfor %}
@ -71,7 +71,7 @@
<div class="body w-lg-100">
<p>Change the default sorting for posts.</p>
<div class="input-group mb2">
<select autocomplete="off" id='defaultsorting' class="form-control setting_switch" form="profile-settings" name="defaultsorting">
<select autocomplete="off" id='defaultsorting' class="form-control setting_switch" data-nonce="{{g.nonce}}" form="profile-settings" name="defaultsorting">
{% for entry in SORTS %}
<option value="{{entry}}"{{' selected' if v.defaultsorting==entry}}>{{entry}}</option>
{% endfor %}
@ -86,7 +86,7 @@
<div class="body w-lg-100">
<p>Change the default time filter for posts.</p>
<div class="input-group mb2">
<select autocomplete="off" id='defaulttime' class="form-control setting_switch" form="profile-settings" name="defaulttime">
<select autocomplete="off" id='defaulttime' class="form-control setting_switch" data-nonce="{{g.nonce}}" form="profile-settings" name="defaulttime">
{% for entry in TIME_FILTERS %}
<option value="{{entry}}"{{' selected' if v.defaulttime==entry}}>{{entry}}</option>
{% endfor %}
@ -115,7 +115,7 @@
<div class="body w-lg-100">
<p>Change the domain you would like to view reddit posts in.</p>
<div class="input-group mb2">
<select autocomplete="off" id='reddit' class="form-control setting_switch" form="profile-settings" name="reddit">
<select autocomplete="off" id='reddit' class="form-control setting_switch" data-nonce="{{g.nonce}}" form="profile-settings" name="reddit">
{% for entry in ['old.reddit.com', 'reddit.com', 'i.reddit.com', 'unddit.com', 'teddit.net', 'libredd.it'] %}
<option value="{{entry}}"{{' selected' if v.reddit==entry}}>{{entry}}</option>
{% endfor %}