Skip to content

Commit

Permalink
Rename primary profile to default profile (#1198)
Browse files Browse the repository at this point in the history
  • Loading branch information
khaitruong922 authored Jul 11, 2024
1 parent 1006c5d commit 533750a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions ext/action-popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
</div>
</label>
<div class="nav-button-container">
<button type="button" class="nav-button action-select-profile" title="Change primary profile" hidden>
<button type="button" class="nav-button action-select-profile" title="Change default profile" hidden>
<span class="icon" data-icon="profile"></span>
<span class="profile-select-container"><select class="profile-select">
<optgroup label="Primary Profile" class="profile-select-option-group"></optgroup>
<optgroup label="Default Profile" class="profile-select-option-group"></optgroup>
</select></span>
</button>
<a tabindex="0" class="nav-button action-open-settings" title="Settings" data-hotkey='["global:openSettingsPage","title","Settings ({0})"]'>
Expand Down Expand Up @@ -74,7 +74,7 @@ <h3 id="extension-info">Yomitan</h3>
<span class="link-group-icon" data-icon="profile"></span>
<span class="link-group-label">Profile</span>
<span class="profile-select-container"><select class="profile-select">
<optgroup label="Primary Profile" class="profile-select-option-group"></optgroup>
<optgroup label="Default Profile" class="profile-select-option-group"></optgroup>
</select></span>
</a>
<a tabindex="0" class="link-group action-open-settings">
Expand Down
4 changes: 2 additions & 2 deletions ext/js/display/search-display-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,14 @@ export class SearchDisplayController {
const value = Number.parseInt(node.value, 10);
const optionsFull = await this._display.application.api.optionsGetFull();
if (typeof value === 'number' && Number.isFinite(value) && value >= 0 && value <= optionsFull.profiles.length) {
await this._setPrimaryProfileIndex(value);
await this._setDefaultProfileIndex(value);
}
}

/**
* @param {number} value
*/
async _setPrimaryProfileIndex(value) {
async _setDefaultProfileIndex(value) {
/** @type {import('settings-modifications').ScopedModificationSet} */
const modification = {
action: 'set',
Expand Down
16 changes: 8 additions & 8 deletions ext/js/pages/action-popup-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class DisplayController {
this._setupButtonEvents('.action-open-permissions', null, chrome.runtime.getURL('/permissions.html'));

const {profiles, profileCurrent} = optionsFull;
const primaryProfile = (profileCurrent >= 0 && profileCurrent < profiles.length) ? profiles[profileCurrent] : null;
if (primaryProfile !== null) {
this._setupOptions(primaryProfile);
const defaultProfile = (profileCurrent >= 0 && profileCurrent < profiles.length) ? profiles[profileCurrent] : null;
if (defaultProfile !== null) {
this._setupOptions(defaultProfile);
}

/** @type {NodeListOf<HTMLElement>} */
Expand Down Expand Up @@ -219,9 +219,9 @@ class DisplayController {
await hotkeyHelpController.prepare(this._api);

const {profiles, profileCurrent} = /** @type {import('settings').Options} */ (this._optionsFull);
const primaryProfile = (profileCurrent >= 0 && profileCurrent < profiles.length) ? profiles[profileCurrent] : null;
if (primaryProfile !== null) {
hotkeyHelpController.setOptions(primaryProfile.options);
const defaultProfile = (profileCurrent >= 0 && profileCurrent < profiles.length) ? profiles[profileCurrent] : null;
if (defaultProfile !== null) {
hotkeyHelpController.setOptions(defaultProfile.options);
}

hotkeyHelpController.setupNode(document.documentElement);
Expand Down Expand Up @@ -260,14 +260,14 @@ class DisplayController {
const node = /** @type {HTMLInputElement} */ (event.currentTarget);
const value = Number.parseInt(node.value, 10);
if (typeof value === 'number' && Number.isFinite(value) && value >= 0 && value <= /** @type {import('settings').Options} */ (this._optionsFull).profiles.length) {
void this._setPrimaryProfileIndex(value);
void this._setDefaultProfileIndex(value);
}
}

/**
* @param {number} value
*/
async _setPrimaryProfileIndex(value) {
async _setDefaultProfileIndex(value) {
/** @type {import('settings-modifications').ScopedModificationSet} */
const modification = {
action: 'set',
Expand Down
6 changes: 3 additions & 3 deletions ext/js/pages/generic-page-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ await Application.main(true, async (application) => {
themeController.prepare();
const optionsFull = await application.api.optionsGetFull();
const {profiles, profileCurrent} = optionsFull;
const primaryProfile = (profileCurrent >= 0 && profileCurrent < profiles.length) ? profiles[profileCurrent] : null;
if (primaryProfile !== null) {
themeController.theme = primaryProfile.options.general.popupTheme;
const defaultProfile = (profileCurrent >= 0 && profileCurrent < profiles.length) ? profiles[profileCurrent] : null;
if (defaultProfile !== null) {
themeController.theme = defaultProfile.options.general.popupTheme;
themeController.siteOverride = true;
themeController.updateTheme();
}
Expand Down
6 changes: 3 additions & 3 deletions ext/js/pages/info-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ await Application.main(true, async (application) => {
themeController.prepare();
const optionsFull = await application.api.optionsGetFull();
const {profiles, profileCurrent} = optionsFull;
const primaryProfile = (profileCurrent >= 0 && profileCurrent < profiles.length) ? profiles[profileCurrent] : null;
if (primaryProfile !== null) {
themeController.theme = primaryProfile.options.general.popupTheme;
const defaultProfile = (profileCurrent >= 0 && profileCurrent < profiles.length) ? profiles[profileCurrent] : null;
if (defaultProfile !== null) {
themeController.theme = defaultProfile.options.general.popupTheme;
themeController.siteOverride = true;
themeController.updateTheme();
}
Expand Down
2 changes: 1 addition & 1 deletion ext/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1>Yomitan Search</h1>
<div class="search-options-left">
<div class="search-option" id="search-option-profile-select">
<span class="profile-select-container"><select class="profile-select" id="profile-select">
<optgroup label="Primary Profile" id="profile-select-option-group"></optgroup>
<optgroup label="Default Profile" id="profile-select-option-group"></optgroup>
</select></span>
</div>
<label class="search-option" id="search-option-clipboard-monitor-container">
Expand Down
2 changes: 1 addition & 1 deletion ext/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ <h1>Yomitan Settings</h1>
<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 primary profile that is used for scanning.</div>
<div class="settings-item-description">Switch the default profile that is used for scanning.</div>
</div>
<div class="settings-item-right">
<select id="profile-active-select"></select>
Expand Down

0 comments on commit 533750a

Please sign in to comment.