8000 Combine `Default profile` and `Editing profile` options into `Active profile` by Kuuuube · Pull Request #1983 · yomidevs/yomitan · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Combine Default profile and Editing profile options into Active profile #1983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions ext/js/pages/settings/profile-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export class ProfileController {
/** @type {HTMLSelectElement} */
this._profileActiveSelect = querySelectorNotNull(document, '#profile-active-select');
/** @type {HTMLSelectElement} */
this._profileTargetSelect = querySelectorNotNull(document, '#profile-target-select');
/** @type {HTMLSelectElement} */
this._profileCopySourceSelect = querySelectorNotNull(document, '#profile-copy-source-select');
/** @type {HTMLElement} */
this._resetProfileNameElement = querySelectorNotNull(document, '#profile-reset-name');
Expand Down Expand Up @@ -96,7 +94,6 @@ export class ProfileController {
this._profileEntriesSupported = (this._profileEntryListContainer !== null);

if (this._profileActiveSelect !== null) { this._profileActiveSelect.addEventListener('change', this._onProfileActiveChange.bind(this), false); }
if (this._profileTargetSelect !== null) { this._profileTargetSelect.addEventListener('change', this._onProfileTargetChange.bind(this), false); }
if (this._profileAddButton !== null) { this._profileAddButton.addEventListener('click', this._onAdd.bind(this), false); }
if (this._profileResetConfirmButton !== null) { this._profileResetConfirmButton.addEventListener('click', this._onResetConfirm.bind(this), false); }
if (this._profileRemoveConfirmButton !== null) { this._profileRemoveConfirmButton.addEventListener('click', this._onDeleteConfirm.bind(this), false); }
Expand Down Expand Up @@ -150,6 +147,7 @@ export class ProfileController {
const profileEntry = this._getProfileEntry(profileIndex);
if (profileEntry !== null) { profileEntry.setIsDefault(true); }

this._settingsController.profileIndex = profileIndex;
await this._settingsController.setGlobalSetting('profileCurrent', profileIndex);
}

Expand Down Expand Up @@ -242,7 +240,7 @@ export class ProfileController {

// Get indices
let profileCurrentNew = this._profileCurrent;
const settingsProfileIndex = this._settingsController.profileIndex;
const settingsProfileIndex = this._profileCurrent;

// Construct settings modifications
/** @type {import('settings-modifications').Modification[]} */
Expand Down Expand Up @@ -438,7 +436,6 @@ export class ProfileController {
this._updateProfileSelectOptions();

/** @type {HTMLSelectElement} */ (this._profileActiveSelect).value = `${profileCurrent}`;
/** @type {HTMLSelectElement} */ (this._profileTargetSelect).value = `${settingsProfileIndex}`;

// Update profile conditions
this._profileConditionsUI.cleanup();
Expand Down Expand Up @@ -469,16 +466,6 @@ export class ProfileController {
void this.setDefaultProfile(value);
}

/**
* @param {Event} e
*/
_onProfileTargetChange(e) {
const element = /** @type {HTMLSelectElement} */ (e.currentTarget);
const value = this._tryGetValidProfileIndex(element.value);
if (value === null) { return; }
this._settingsController.profileIndex = value;
}

/** */
_onAdd() {
void this.duplicateProfile(this._settingsController.profileIndex);
Expand Down Expand Up @@ -588,7 +575,6 @@ export class ProfileController {
_getAllProfileSelects() {
return [
/** @type {HTMLSelectElement} */ (this._profileActiveSelect),
/** @type {HTMLSelectElement} */ (this._profileTargetSelect),
/** @type {HTMLSelectElement} */ (this._profileCopySourceSelect),
];
}
Expand Down
13 changes: 2 additions & 11 deletions ext/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,13 @@ <h1>Yomitan Settings</h1>
<div class="settings-group">
<div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable">
<div class="settings-item-left">
<div class="settings-item-label">Default profile</div>
<div class="settings-item-description">Switch the default profile that is used for scanning.</div>
<div class="settings-item-label">Active profile</div>
<div class="settings-item-description">Switch the active profile that is used for scanning.</div>
</div>
<div class="settings-item-right">
<select id="profile-active-select"></select>
</div>
</div></div>
<div class="settings-item"><div class="settings-item-inner settings-item-inner-wrappable">
<div class="settings-item-left">
<div class="settings-item-label">Editing profile</div>
<div class="settings-item-description">Change which profile is being modified on this page.</div>
</div>
<div class="settings-item-right">
<select id="profile-target-select"></select>
</div>
</div></div>
<div class="settings-item settings-item-button" data-modal-action="show,profiles"><div class="settings-item-inner">
<div class="settings-item-left">
<div class="settings-item-label">Configure profiles&hellip;</div>
Expand Down
0