From 7fd80ab93d841cd6834e3931c40a172244caf41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Tue, 14 Sep 2021 16:54:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AE=B1=E5=AD=90=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E7=9A=84=E5=8F=96=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- multi.html | 2 +- script.js | 12 ++++++++++-- solo.html | 2 +- triple.html | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/multi.html b/multi.html index 70bea4c6..348432da 100644 --- a/multi.html +++ b/multi.html @@ -933,6 +933,7 @@ var formation = new Formation(teamsCount,5);
+
@@ -1261,7 +1262,6 @@ var formation = new Formation(teamsCount,5); -
diff --git a/script.js b/script.js index 10817c3e..e9f8606f 100644 --- a/script.js +++ b/script.js @@ -1853,8 +1853,16 @@ function initialize(event) { { const table = this.parentNode.parentNode.parentNode.parentNode; currentPlayerData = table.data; - localStorage.setItem(cfgPrefix + "default-player-name", table.getAttribute("data-player-name")); - table.parentNode.querySelector("[name=default-player-data]").checked = true; + const cfgName = cfgPrefix + "default-player-name"; + const dataPlayerName = table.getAttribute("data-player-name"); + const checkInput = table.parentNode.querySelector("[name=default-player-data]"); + if (localStorage.getItem(cfgName) === dataPlayerName) { + localStorage.removeItem(cfgName); + checkInput.checked = false; + } else { + localStorage.setItem(cfgName, dataPlayerName); + checkInput.checked = true; + } } playerDataFrame.playerList.add = function(data) { this.appendChild(this.newPlayerData(data)); diff --git a/solo.html b/solo.html index a4d89514..05e2952c 100644 --- a/solo.html +++ b/solo.html @@ -790,6 +790,7 @@ var formation = new Formation(teamsCount,6);
+
@@ -1118,7 +1119,6 @@ var formation = new Formation(teamsCount,6); -
    diff --git a/triple.html b/triple.html index 5f2f1882..cd0f392a 100644 --- a/triple.html +++ b/triple.html @@ -1729,6 +1729,7 @@ var formation = new Formation(teamsCount,6);
    +
    @@ -2057,7 +2058,6 @@ var formation = new Formation(teamsCount,6); -