diff --git a/Overleaf-Bib-Helper.js b/Overleaf-Bib-Helper.js index 16d65a6..8d7d0a7 100644 --- a/Overleaf-Bib-Helper.js +++ b/Overleaf-Bib-Helper.js @@ -34,7 +34,12 @@ })(); function injectScript() { + // 实际注入前再检查一遍图标,避免异步注入导致出现两个图标 waitUtil('div.ol-cm-toolbar-button-group.ol-cm-toolbar-end', el => { + if (document.getElementById('toggleIcon')) { + return; + } + let iconBox = createToggleIcon(); el.appendChild(iconBox); @@ -215,7 +220,8 @@ function createToggleIcon() { iconBox.style.justifyContent = 'center'; iconBox.style.alignItems = 'center'; iconBox.id = "toggleIcon"; - iconBox.innerHTML = ''; + iconBox.title = "Overleaf Bib Helper (点击打开/关闭搜索)"; + iconBox.innerHTML = ''; return iconBox; } @@ -225,6 +231,13 @@ function createBox() { box.style = 'width:300px;background:#eef;padding:10px;border:1px solid #ccc;border-radius:5px;position:absolute;display:none;top:0px;left:0px'; box.innerHTML = `