From 12bbf416936f0705d3aafe196bd6a7a6faf0632b Mon Sep 17 00:00:00 2001 From: rainerosion Date: Wed, 9 Mar 2022 22:55:25 +0800 Subject: [PATCH] Optimize code. --- skyBadge.js | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/skyBadge.js b/skyBadge.js index f14373e..cd45440 100644 --- a/skyBadge.js +++ b/skyBadge.js @@ -171,8 +171,8 @@ function startSky() { // let len = Object.keys(menu_map).length; console.log("len => " + len + " menuLen => " + Object.keys(getMenu()).length); if (len - 1 > Object.keys(getMenu()).length) { - sort_options = []; - storage_map = global_option;//初始化 + let sort_options = []; + let storage_map = global_option;//初始化 Object.keys(menu_map).map(function (key, index) { console.log("key => " + key, "index => " + index); if (!isOptions(key, menu_map)) { @@ -181,25 +181,29 @@ function startSky() { }); let befor_index = dialogs.select("请选择需要变更位置的徽章", sort_options); let after_index = dialogs.select("请选择变更后的位置", sort_options); - if(befor_index==after_index){toast("两次选项一样。");return;} - for(var x=0;x