mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-09 23:16:18 +08:00
旧版本兼容处理
This commit is contained in:
parent
b0ff86fd47
commit
e771a34fb3
@ -91,7 +91,7 @@
|
|||||||
if (db.hasSubInput) {
|
if (db.hasSubInput) {
|
||||||
// 启动子命令输入
|
// 启动子命令输入
|
||||||
// 清空输出
|
// 清空输出
|
||||||
$("#out").empty();
|
// $("#out").empty();
|
||||||
var subinput = '';
|
var subinput = '';
|
||||||
var setSubInput = () => {
|
var setSubInput = () => {
|
||||||
utools.setSubInput(({text}) => {
|
utools.setSubInput(({text}) => {
|
||||||
@ -202,9 +202,25 @@
|
|||||||
// 替换上个版本弃用的功能
|
// 替换上个版本弃用的功能
|
||||||
let oldVersionFix = () => {
|
let oldVersionFix = () => {
|
||||||
var customFts = getDB('customFts');
|
var customFts = getDB('customFts');
|
||||||
Object.keys(customFts).forEach(x => {
|
Object.keys(customFts).forEach((x, i) => {
|
||||||
|
// 旧版的 program
|
||||||
if (customFts[x].program == 'simulation') customFts[x].program = 'quickcommand';
|
if (customFts[x].program == 'simulation') customFts[x].program = 'quickcommand';
|
||||||
|
// 旧版的 sleep
|
||||||
if (customFts[x].cmd.includes('await sleep')) customFts[x].cmd = customFts[x].cmd.replace(/await sleep/g, 'quickcommand.sleep')
|
if (customFts[x].cmd.includes('await sleep')) customFts[x].cmd = customFts[x].cmd.replace(/await sleep/g, 'quickcommand.sleep')
|
||||||
|
// 不规范的 code
|
||||||
|
let code = customFts[x].features.code
|
||||||
|
if (!/^(window|key|regex|files|default)_/.test(code)) {
|
||||||
|
console.log(code);
|
||||||
|
utools.removeFeature(code)
|
||||||
|
let uid = Number(Math.random().toString().substr(3, 3) + (Date.now() + i * 10000)).toString(36)
|
||||||
|
let type = customFts[x].features.cmds[0].type
|
||||||
|
type || (type = 'key')
|
||||||
|
let newCode = type + '_' + uid
|
||||||
|
let newFts = customFts[x]
|
||||||
|
newFts.features.code = newCode
|
||||||
|
delete customFts[x]
|
||||||
|
customFts[newCode] = newFts
|
||||||
|
}
|
||||||
putDB(x, customFts[x], 'customFts');
|
putDB(x, customFts[x], 'customFts');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user