Skip to content

Commit

Permalink
fix: ui
Browse files Browse the repository at this point in the history
  • Loading branch information
makinzm committed Dec 21, 2024
1 parent b5adeaf commit 1bc6f7d
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 27 deletions.
31 changes: 18 additions & 13 deletions dist/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,33 @@ <h2>ドメインフィルターモード</h2>
<div>
<label>
<input type="radio" name="domainFilterMode" value="exclude" id="radioExclude" />
Excludeモード (ブラックリスト)
Excludeモード (ブラックリスト: すべてのドメインで拡張機能が機能しますが、指定したドメインのみ機能しないようにします)
</label>
<label>
<input type="radio" name="domainFilterMode" value="include" id="radioInclude" checked/>
Includeモード (ホワイトリスト)
Includeモード (ホワイトリスト: 指定したドメインのみ拡張機能が機能します)
</label>
</div>

<!-- ドメインブロック -->
<h2>ドメインブロック設定</h2>
<div>
<input type="text" id="excludedDomainInput" placeholder="example.com" />
<button id="addExcludedDomainButton">ドメインを追加</button>
<!-- Excludeモード設定 -->
<div id="excludeSettings" style="display: none;">
<h2>ドメインブロック設定</h2>
<div>
<input type="text" id="excludedDomainInput" placeholder="example.com" />
<button id="addExcludedDomainButton">ドメインを追加</button>
</div>
<ul id="excludedDomainList"></ul>
</div>
<ul id="excludedDomainList"></ul>

<h2>ドメイン限定設定 (Included)</h2>
<div>
<input type="text" id="includedDomainInput" placeholder="example.org" />
<button id="addIncludedDomainButton">ドメインを追加</button>
<!-- Includeモード設定 -->
<div id="includeSettings" style="display: none;">
<h2>ドメイン限定設定 (Included)</h2>
<div>
<input type="text" id="includedDomainInput" placeholder="example.org" />
<button id="addIncludedDomainButton">ドメインを追加</button>
</div>
<ul id="includedDomainList"></ul>
</div>
<ul id="includedDomainList"></ul>

<!-- フィルタ -->
<div>
Expand Down
2 changes: 1 addition & 1 deletion dist/options/options.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions dist/options/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,38 @@ function setupDomainFilterModeListeners() {
});
}


function initializeSettings() {
const storedMode = localStorage.getItem("domainFilterMode") || "include";
if (storedMode === "exclude") {
radioExclude.checked = true;
toggleSettings("exclude");
} else {
radioInclude.checked = true;
toggleSettings("include");
}
}

const excludeSettings = document.getElementById("excludeSettings") as HTMLDivElement;
const includeSettings = document.getElementById("includeSettings") as HTMLDivElement;

function toggleSettings(mode: "exclude" | "include") {
if (mode === "exclude") {
excludeSettings.style.display = "block";
includeSettings.style.display = "none";
} else {
excludeSettings.style.display = "none";
includeSettings.style.display = "block";
}
// モードを保存
localStorage.setItem("domainFilterMode", mode);
}

// ラジオボタンのイベントリスナー
radioExclude.addEventListener("change", () => toggleSettings("exclude"));
radioInclude.addEventListener("change", () => toggleSettings("include"));

initializeSettings();
renderExcludedDomains();
loadData();
loadDomainFilterMode();
Expand Down
Loading

0 comments on commit 1bc6f7d

Please sign in to comment.