Change site preferences table layout

This commit is contained in:
AKORA 2024-10-07 14:31:34 +02:00
parent bd44d20ee1
commit 0ea0745d19
2 changed files with 83 additions and 43 deletions

View file

@ -737,14 +737,6 @@
<thead>
<tr>
<th scope="col"><span data-i18n="optionsColumnPageURL"></span></th>
<th scope="col"><span data-i18n="optionsColumnIgnore"></span></th>
<th scope="col"><span data-i18n="optionsColumnUsernameOnly"></span></th>
<th scope="col"><span data-i18n="optionsColumnImprovedInputFieldDetection"></span></th>
<th scope="col"><span data-i18n="optionsColumnAllowIframes"></span></th>
<th scope="col"><span data-i18n="optionsCheckboxAutoSubmit"></span></th>
<th scope="col"><span data-i18n="optionsCheckboxAutoFillSingleEntry"></span></th>
<th scope="col"><span data-i18n="optionsCheckboxAutoFillSingleTotp"></span></th>
<th scope="col"><span data-i18n="optionsColumnDelete"></span></th>
</tr>
</thead>
<tbody>
@ -752,26 +744,72 @@
<td colspan="5"><span data-i18n="optionsSitePreferencesNotFound"></span></td>
</tr>
<tr class="clone d-none">
<td class="text-nowrap"></td>
<td>
<select class="form-select form-select-sm" name="ignore" data-i18n="[title]optionsSitePreferencesSelect">
<option value="ignoreNothing" data-i18n="optionsSelectionNothing"></option>
<option value="ignoreNormal" data-i18n="optionsSelectionNormal"></option>
<option value="ignoreAutoSubmit" data-i18n="optionsSelectionAutoSubmit"></option>
<option value="ignoreFull" data-i18n="optionsSelectionFull"></option>
</select>
</td>
<td><input class="form-check-input" type="checkbox" name="usernameOnly" value="false" data-i18n="[title]optionsColumnUsernameOnly"></td>
<td><input class="form-check-input" type="checkbox" name="improvedFieldDetection" value="false" data-i18n="[title]optionsColumnImprovedInputFieldDetection"></td>
<td><input class="form-check-input" type="checkbox" name="allowIframes" value="false" data-i18n="[title]optionsColumnAllowIframes"></td>
<td><input class="form-check-input" type="checkbox" name="autoSubmit" value="false" data-i18n="[title]optionsColumnAutoSubmit"></td>
<td><input class="form-check-input" type="checkbox" name="autoFillCredentials" value="false" data-i18n="[title]optionsColumnAutoFillCredentials"></td>
<td><input class="form-check-input" type="checkbox" name="autoFillTOTP" value="false" data-i18n="[title]optionsColumnAutoFillTOTP"></td>
<td class="text-nowrap">
<button class="btn btn-sm delete btn-danger btn" data-i18n="[title]removeSitePreferencesButtonTitle">
<i class="fa fa-remove" aria-hidden="true"></i>
<span data-i18n="optionsButtonRemove"></span>
</button>
<details>
<summary>
<span></span>
</summary>
<div class="form-group col-sm-3 pb-2">
<label for="ignore" data-i18n="optionsColumnIgnore"></label>
<select class="form-select form-select-sm" id="ignore" name="ignore" data-i18n="[title]optionsSitePreferencesSelect">
<option value="ignoreNothing" data-i18n="optionsSelectionNothing"></option>
<option value="ignoreNormal" data-i18n="optionsSelectionNormal"></option>
<option value="ignoreAutoSubmit" data-i18n="optionsSelectionAutoSubmit"></option>
<option value="ignoreFull" data-i18n="optionsSelectionFull"></option>
</select>
</div>
<div class="form-group">
<div class="form-check">
<label for="usernameOnly" data-i18n="optionsColumnUsernameOnly"></label>
<input class="form-check-input" type="checkbox" id="usernameOnly" name="usernameOnly" value="false" data-i18n="[title]optionsColumnUsernameOnly">
</div>
</div>
<div class="form-group">
<div class="form-check">
<label for="improvedFieldDetection" data-i18n="optionsColumnImprovedInputFieldDetection"></label>
<input class="form-check-input" type="checkbox" id="improvedFieldDetection" name="improvedFieldDetection" value="false" data-i18n="[title]optionsColumnImprovedInputFieldDetection">
</div>
</div>
<div class="form-group">
<div class="form-check">
<label for="allowIframes" data-i18n="optionsColumnAllowIframes"></label>
<input class="form-check-input" type="checkbox" id="allowIframes" name="allowIframes" value="false" data-i18n="[title]optionsColumnAllowIframes">
</div>
</div>
<div class="form-group">
<div class="form-check">
<label for="autoSubmit" data-i18n="optionsCheckboxAutoSubmit"></label>
<input class="form-check-input" type="checkbox" id="autoSubmit" name="autoSubmit" value="false" data-i18n="[title]optionsColumnAutoSubmit">
<div class="form-text" data-i18n="optionsAutoSubmitHelpText"></div>
</div>
</div>
<div class="form-group">
<div class="form-check">
<label for="autoFillCredentials" data-i18n="optionsCheckboxAutoFillSingleEntry"></label>
<input class="form-check-input" type="checkbox" id="autoFillCredentials" name="autoFillCredentials" value="false" data-i18n="[title]optionsColumnAutoFillCredentials">
<div class="form-text" data-i18n="optionsAutoFillSingleEntryHelpText"></div>
</div>
</div>
<div class="form-group">
<div class="form-check">
<label for="autoFillTOTP" data-i18n="optionsCheckboxAutoFillSingleTotp"></label>
<input class="form-check-input" type="checkbox" id="autoFillTOTP" name="autoFillTOTP" value="false" data-i18n="[title]optionsColumnAutoFillTOTP">
<div class="form-text" data-i18n="optionsAutoFillSingleTotpHelpText"></div>
</div>
</div>
<button class="btn btn-sm delete btn-danger btn" data-i18n="[title]removeSitePreferencesButtonTitle">
<i class="fa fa-remove" aria-hidden="true"></i>
<span data-i18n="optionsButtonRemove"></span>
</button>
</details>
</td>
</tr>
</tbody>

View file

@ -575,22 +575,24 @@ options.initSitePreferences = function() {
const row = rowClone.cloneNode(true);
row.setAttribute('url', url);
row.setAttribute('id', 'tr-scf' + newIndex);
row.children[0].textContent = url;
row.children[1].children[0].value = ignore;
row.children[1].children[0].addEventListener('change', selectionChanged);
row.children[2].children['usernameOnly'].checked = usernameOnly;
row.children[2].children['usernameOnly'].addEventListener('change', checkboxClicked);
row.children[3].children['improvedFieldDetection'].checked = improvedFieldDetection;
row.children[3].children['improvedFieldDetection'].addEventListener('change', checkboxClicked);
row.children[4].children['allowIframes'].checked = allowIframes;
row.children[4].children['allowIframes'].addEventListener('change', checkboxClicked);
row.children[5].children['autoSubmit'].checked = autoSubmit;
row.children[5].children['autoSubmit'].addEventListener('change', checkboxClicked);
row.children[6].children['autoFillCredentials'].checked = autoFillCredentials;
row.children[6].children['autoFillCredentials'].addEventListener('change', checkboxClicked);
row.children[7].children['autoFillTOTP'].checked = autoFillTOTP;
row.children[7].children['autoFillTOTP'].addEventListener('change', checkboxClicked);
row.children[8].addEventListener('click', removeButtonClicked);
const details = row.children[0].children[0];
details.children[0].children[0].textContent = url;
details.children[2].children[0].value = ignore;
details.children[2].children[0].addEventListener('change', selectionChanged);
details.querySelector('#usernameOnly').checked = usernameOnly;
details.querySelector('#usernameOnly').addEventListener('change', checkboxClicked);
details.querySelector('#improvedFieldDetection').checked = improvedFieldDetection;
details.querySelector('#improvedFieldDetection').addEventListener('change', checkboxClicked);
details.querySelector('#allowIframes').checked = allowIframes;
details.querySelector('#allowIframes').addEventListener('change', checkboxClicked);
details.querySelector('#autoSubmit').checked = autoSubmit;
details.querySelector('#autoSubmit').addEventListener('change', checkboxClicked);
details.querySelector('#autoFillCredentials').checked = autoFillCredentials;
details.querySelector('#autoFillCredentials').addEventListener('change', checkboxClicked);
details.querySelector('#autoFillTOTP').checked = autoFillTOTP;
details.querySelector('#autoFillTOTP').addEventListener('change', checkboxClicked);
details.children[8].addEventListener('click', removeButtonClicked);
$('#tab-site-preferences table tbody').append(row);
};