mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-10 07:24:37 +08:00
fix: 导入命令后标签跳转
This commit is contained in:
parent
fc53baa581
commit
cec3fdfcae
@ -33,7 +33,7 @@
|
|||||||
return utoolsFull.db.allDocs(key)
|
return utoolsFull.db.allDocs(key)
|
||||||
}
|
}
|
||||||
// 获取所有 qc,等效于 1.6 版本 getDB('customFts')
|
// 获取所有 qc,等效于 1.6 版本 getDB('customFts')
|
||||||
window.getAllQuickCommands = () => {
|
let getAllQuickCommands = () => {
|
||||||
let allQcs = {}
|
let allQcs = {}
|
||||||
getDocs(QC_PREFIX).forEach(x => allQcs[x.data.features.code] = x.data)
|
getDocs(QC_PREFIX).forEach(x => allQcs[x.data.features.code] = x.data)
|
||||||
return allQcs
|
return allQcs
|
||||||
@ -328,14 +328,15 @@
|
|||||||
if (pushData.single) {
|
if (pushData.single) {
|
||||||
var code = pushData.qc.features.code;
|
var code = pushData.qc.features.code;
|
||||||
putDB(pushData.qc, QC_PREFIX + code);
|
putDB(pushData.qc, QC_PREFIX + code);
|
||||||
|
return { tags: pushData.qc.tags, code: code }
|
||||||
// 多个命令导入
|
// 多个命令导入
|
||||||
} else {
|
} else {
|
||||||
for (var code of Object.keys(pushData.qc)) {
|
for (var code of Object.keys(pushData.qc)) {
|
||||||
putDB(pushData.qc[code], QC_PREFIX + code);
|
putDB(pushData.qc[code], QC_PREFIX + code);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 全部导出
|
// 全部导出
|
||||||
let exportAll = (copy = false) => {
|
let exportAll = (copy = false) => {
|
||||||
@ -917,8 +918,14 @@
|
|||||||
break;
|
break;
|
||||||
case 'import':
|
case 'import':
|
||||||
var success = importCommand()
|
var success = importCommand()
|
||||||
if (success) showOptions() || quickcommand.showMessageBox("导入成功")
|
if (success) {
|
||||||
else if (success == false) quickcommand.showMessageBox("导入失败,格式错误", "error")
|
if (success instanceof Object) locateToCode(success.tags, success.code)
|
||||||
|
else showOptions()
|
||||||
|
quickcommand.showMessageBox("导入成功")
|
||||||
|
}
|
||||||
|
else if (success == false) {
|
||||||
|
quickcommand.showMessageBox("导入失败,格式错误", "error")
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'enableAll': $(".checked-switch:not(:checked)").click();
|
case 'enableAll': $(".checked-switch:not(:checked)").click();
|
||||||
break;
|
break;
|
||||||
@ -1391,19 +1398,7 @@
|
|||||||
if ($('#customize').data('returnShare')) {
|
if ($('#customize').data('returnShare')) {
|
||||||
getSharedQCFromYuQue()
|
getSharedQCFromYuQue()
|
||||||
} else {
|
} else {
|
||||||
// 保存后标签跳转处理
|
locateToCode(pushData.tags, code)
|
||||||
var redirectTag, currentTag = $('.currentTag').text()
|
|
||||||
if (tags.length) {
|
|
||||||
if (pushData.tags.includes(currentTag)) {
|
|
||||||
redirectTag = currentTag
|
|
||||||
} else {
|
|
||||||
redirectTag = pushData.tags[0]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
redirectTag = "未分类"
|
|
||||||
}
|
|
||||||
showOptions(redirectTag);
|
|
||||||
location.href = '#' + code
|
|
||||||
let checkSwitch = $(`#${code} .checked-switch`)
|
let checkSwitch = $(`#${code} .checked-switch`)
|
||||||
checkSwitch.click()
|
checkSwitch.click()
|
||||||
checkSwitch.is(':checked') || checkSwitch.click()
|
checkSwitch.is(':checked') || checkSwitch.click()
|
||||||
@ -1412,6 +1407,24 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存后标签跳转处理
|
||||||
|
let locateToCode = (tags, code) => {
|
||||||
|
let redirectTag
|
||||||
|
let currentTag = $('.currentTag').text()
|
||||||
|
// let AllTags = Array.from($('.sidebar li')).map(x => x.innerText)
|
||||||
|
if (tags.length) {
|
||||||
|
if (tags.includes(currentTag)) {
|
||||||
|
redirectTag = currentTag
|
||||||
|
} else {
|
||||||
|
redirectTag = tags[0]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
redirectTag = "未分类"
|
||||||
|
}
|
||||||
|
showOptions(redirectTag);
|
||||||
|
location.href = '#' + code
|
||||||
|
}
|
||||||
|
|
||||||
// 显示运行结果
|
// 显示运行结果
|
||||||
let showRunResult = (content, raw, success) => {
|
let showRunResult = (content, raw, success) => {
|
||||||
var options, position, showClass, hideClass, maxlength = 100000
|
var options, position, showClass, hideClass, maxlength = 100000
|
||||||
|
Loading…
x
Reference in New Issue
Block a user