mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-22 07:23:03 +02:00
Fix clearAllData() not working properly (#708)
This commit is contained in:
parent
4da2cfaf49
commit
67fdf5ea12
4
dist/better-xcloud.pretty.user.js
vendored
4
dist/better-xcloud.pretty.user.js
vendored
@ -2760,7 +2760,7 @@ function parseDetailsPath(path) {
|
|||||||
return { titleSlug, productId };
|
return { titleSlug, productId };
|
||||||
}
|
}
|
||||||
function clearAllData() {
|
function clearAllData() {
|
||||||
for (let i = 0;i < localStorage.length; i++) {
|
for (let i = localStorage.length - 1;i >= 0; i--) {
|
||||||
let key = localStorage.key(i);
|
let key = localStorage.key(i);
|
||||||
if (!key) continue;
|
if (!key) continue;
|
||||||
if (key.startsWith("BetterXcloud") || key.startsWith("better_xcloud")) localStorage.removeItem(key);
|
if (key.startsWith("BetterXcloud") || key.startsWith("better_xcloud")) localStorage.removeItem(key);
|
||||||
@ -7387,7 +7387,7 @@ class SettingsDialog extends NavigationDialog {
|
|||||||
($parent) => {
|
($parent) => {
|
||||||
$parent.appendChild(createButton({
|
$parent.appendChild(createButton({
|
||||||
label: t("clear-data"),
|
label: t("clear-data"),
|
||||||
style: 8 | 128 | 64,
|
style: 4 | 16 | 128 | 64,
|
||||||
onClick: (e) => {
|
onClick: (e) => {
|
||||||
if (confirm(t("clear-data-confirm"))) clearAllData();
|
if (confirm(t("clear-data-confirm"))) clearAllData();
|
||||||
}
|
}
|
||||||
|
4
dist/better-xcloud.user.js
vendored
4
dist/better-xcloud.user.js
vendored
File diff suppressed because one or more lines are too long
@ -373,7 +373,7 @@ export class SettingsDialog extends NavigationDialog {
|
|||||||
$parent => {
|
$parent => {
|
||||||
$parent.appendChild(createButton({
|
$parent.appendChild(createButton({
|
||||||
label: t('clear-data'),
|
label: t('clear-data'),
|
||||||
style: ButtonStyle.GHOST | ButtonStyle.FULL_WIDTH | ButtonStyle.FOCUSABLE,
|
style: ButtonStyle.DANGER | ButtonStyle.FROSTED | ButtonStyle.FULL_WIDTH | ButtonStyle.FOCUSABLE,
|
||||||
onClick: e => {
|
onClick: e => {
|
||||||
if (confirm(t('clear-data-confirm'))) {
|
if (confirm(t('clear-data-confirm'))) {
|
||||||
clearAllData();
|
clearAllData();
|
||||||
|
@ -136,7 +136,8 @@ export function parseDetailsPath(path: string) {
|
|||||||
|
|
||||||
export function clearAllData() {
|
export function clearAllData() {
|
||||||
// Delete localStorage items
|
// Delete localStorage items
|
||||||
for (let i = 0; i < localStorage.length; i++) {
|
|
||||||
|
for (let i = localStorage.length - 1; i >= 0; i--) {
|
||||||
const key = localStorage.key(i);
|
const key = localStorage.key(i);
|
||||||
if (!key) {
|
if (!key) {
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user