diff --git a/src/assets/index.js b/src/assets/index.js index ccd2bee..ab00e14 100644 --- a/src/assets/index.js +++ b/src/assets/index.js @@ -1209,14 +1209,18 @@ icon: d.cover ? d.cover.replace(yuQueShareVars.yuQueImgBedBaseLink, yuQueShareVars.imgBedBaseLink) : `logo/${description.program}.png` } }) - let choise = await quickcommand.showSelectList(docs, { optionType: 'json' }) - let doc = await yuQueClient(`repos/${yuQueShareVars.releaseRepo}/docs/${choise.slug}?raw=1`) - let body = doc.data.data.body - let stringifyQc = body.match(/```json([\s\S]*)```/)[1] - let qc = JSON.parse(stringifyQc) - $('#options').show() - qc.fromShare = true - editCurrentCommand(qc) + let choise = await quickcommand.showSelectList(docs, { optionType: 'json', showCancelButton: true }) + if (choise) { + let doc = await yuQueClient(`repos/${yuQueShareVars.releaseRepo}/docs/${choise.slug}?raw=1`) + let body = doc.data.data.body + let stringifyQc = body.match(/```json([\s\S]*)```/)[1] + let qc = JSON.parse(stringifyQc) + qc.fromShare = true + $('#options').show() + editCurrentCommand(qc) + } else { + $('#options').show() + } utools.setExpendHeight(600) } @@ -1371,23 +1375,27 @@ } putDB(code, pushData, 'customFts'); $("#customize").animate({ top: '100%' }, () => { - // 保存后标签跳转处理 - 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 $("#customize").empty() - let checkSwitch = $(`#${code} .checked-switch`) - checkSwitch.click() - checkSwitch.is(':checked') || checkSwitch.click() + if (extraInfo && extraInfo.fromShare) { + getSharedQCFromYuQue() + } else { + // 保存后标签跳转处理 + 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`) + checkSwitch.click() + checkSwitch.is(':checked') || checkSwitch.click() + } }); } } @@ -1497,6 +1505,8 @@ if ($("#customize").is(":parent") && $("#featureList").is(":parent")) { $("#customize").animate({ top: '100%' }); $("#customize").empty() + var extraInfo = $('#customize').data('extraInfo') + if (extraInfo && extraInfo.fromShare) getSharedQCFromYuQue() } } diff --git a/src/assets/style/options.css b/src/assets/style/options.css index 3d969e2..6512bcd 100644 --- a/src/assets/style/options.css +++ b/src/assets/style/options.css @@ -845,21 +845,34 @@ li.CodeMirror-hint { border-radius: 6px; } -#quicktextarea button { +.circleButton { position: absolute; + border: 0; + border-radius: 50%; + color: white; + cursor: pointer; + outline: none; +} + +#quicktextarea .circleButton{ right: 20px; bottom: 20px; height: 40px; width: 40px; - border: 0; - border-radius: 50%; background: #2196F3; - color: white; - cursor: pointer; } -#quicktextarea button:hover { - background: #6ab4f0; +#quickselect .circleButton{ + right: 10px; + bottom: 10px; + height: 25px; + width: 25px; + background: #db4d14; + z-index: 1060; +} + +.circleButton:hover { + filter: brightness(1.2); } /*quicktextarea*/ diff --git a/src/preload.js b/src/preload.js index 3bbb507..a0b2b6e 100644 --- a/src/preload.js +++ b/src/preload.js @@ -167,7 +167,8 @@ quickcommand = { typeof opt.placeholder == 'undefined' && (opt.placeholder = "搜索,支持拼音") typeof opt.enableSearch == 'undefined' && (opt.enableSearch = true) if ($('#quickselect').length) $('#quickselect').remove() - $("body").append(`
`) + let cancelButton = opt.showCancelButton ? '' : '' + $("body").append(`