Created
November 3, 2018 01:13
-
-
Save Astrian/ac3d1003375897ca70fb401964b7cc88 to your computer and use it in GitHub Desktop.
IITC 数据迁移脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 访问 https://www.ingress.com (记得一定要带 HTTPS,默认访问不带)然后启动控制台工具,复制以下代码。 | |
// 控制台会将旧 IITC 中的所有数据输出,将它复制到剪贴板中再继续下一步(或是启动新的标签页来进行下一步) | |
function exp() { | |
let getKey, i = 0, res = {} | |
do { | |
getKey = localStorage.key(i++) | |
let keyres = localStorage.getItem(getKey) | |
if (getKey) { | |
try { | |
res[getKey] = JSON.parse(keyres) | |
} catch (e) { | |
res[getKey] = keyres | |
} | |
} | |
} while (getKey) | |
console.log(JSON.stringify(res)) | |
} | |
exp() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 将刚才导出步骤复制的代码粘贴至下方 `let impdata = ''` 语句右侧两个引号中间 | |
// 然后访问新 Intel(https://intel.ingress.com/intel),也是启动控制台,复制以下代码并回车 | |
// 注意!为了防止数据混乱,该脚本将会清空新 Intel 下的所有已有数据,你在新 Intel 中画的图和其他 IITC 操作都将会被清空! | |
// 完成后请刷新 Intel 以加载导入后的数据 | |
let impdata = '{"key": "value"}' | |
function imp() { | |
localStorage.clear() | |
impdata = JSON.parse(impdata) | |
for (let i in impdata) { | |
if (typeof impdata[i] === 'object') impdata[i] = JSON.stringify(impdata[i]) | |
localStorage.setItem(i, impdata[i]) | |
} | |
} | |
imp() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment