增加在标签页打开
This commit is contained in:
parent
df177dff58
commit
a339130105
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "渠道应用开发部知识库",
|
"name": "渠道应用开发部知识库",
|
||||||
"version": "1.3.2",
|
"version": "1.3.3",
|
||||||
"description": "通过关键词快速搜索内部文档",
|
"description": "通过关键词快速搜索内部文档",
|
||||||
"permissions": ["storage"],
|
"permissions": ["storage"],
|
||||||
"host_permissions": [
|
"host_permissions": [
|
||||||
|
|||||||
@ -6,11 +6,12 @@
|
|||||||
<link rel="stylesheet" href="styles.css" />
|
<link rel="stylesheet" href="styles.css" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="draggable-panel" id="draggablePanel">
|
||||||
|
<div class="header">
|
||||||
<img src="../assets/icon.png" alt="logo" class="logo" />
|
<img src="../assets/icon.png" alt="logo" class="logo" />
|
||||||
<h1>渠道应用开发部知识库</h1>
|
<h1>渠道应用开发部知识库</h1>
|
||||||
<a href="https://oa.ahrcu.com/sys/portal/page.jsp" target="_blank" class="oa-link">跳转OA</a>
|
<a href="https://oa.ahrcu.com/sys/portal/page.jsp" target="_blank" class="oa-link">跳转OA</a>
|
||||||
|
<button class="open-tab-btn" id="openTabBtn" title="以标签页方式打开">↗</button>
|
||||||
<div class="user-menu">
|
<div class="user-menu">
|
||||||
<div class="user-avatar" id="userAvatar">👤</div>
|
<div class="user-avatar" id="userAvatar">👤</div>
|
||||||
<div class="user-dropdown hidden" id="userDropdown">
|
<div class="user-dropdown hidden" id="userDropdown">
|
||||||
@ -18,14 +19,12 @@
|
|||||||
<div id="logoutBtn" class="logout-option">退出登录</div>
|
<div id="logoutBtn" class="logout-option">退出登录</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="container">
|
||||||
<div class="container">
|
|
||||||
<div class="search-bar">
|
<div class="search-bar">
|
||||||
<input id="searchInput" type="text" autocomplete="off" placeholder="请输入关键词(空格分隔)..." />
|
<input id="searchInput" type="text" autocomplete="off" placeholder="请输入关键词(空格分隔)..." />
|
||||||
<button id="searchBtn">搜索</button>
|
<button id="searchBtn">搜索</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="history-wrapper hidden" id="historyWrapper">
|
<div class="history-wrapper hidden" id="historyWrapper">
|
||||||
<div class="history-header">
|
<div class="history-header">
|
||||||
<span>历史搜索:</span>
|
<span>历史搜索:</span>
|
||||||
@ -33,7 +32,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="historyTags" class="tag-history"></div>
|
<div id="historyTags" class="tag-history"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- AnythingLLM结果区域 -->
|
<!-- AnythingLLM结果区域 -->
|
||||||
<div id="llmResultContainer" class="llm-result-container hidden">
|
<div id="llmResultContainer" class="llm-result-container hidden">
|
||||||
<div class="llm-title">智能助手答案</div>
|
<div class="llm-title">智能助手答案</div>
|
||||||
@ -43,12 +41,9 @@
|
|||||||
<button id="llmSendBtn">发送</button>
|
<button id="llmSendBtn">发送</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<ul id="results"></ul>
|
<ul id="results"></ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script src="popup.js"></script>
|
<script src="popup.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -483,3 +483,49 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
document.body.style.userSelect = '';
|
document.body.style.userSelect = '';
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
// 标签页打开按钮事件
|
||||||
|
const openTabBtn = document.getElementById('openTabBtn');
|
||||||
|
if (openTabBtn) {
|
||||||
|
openTabBtn.onclick = function () {
|
||||||
|
if (window.chrome && chrome.runtime && chrome.runtime.id && chrome.tabs && chrome.runtime.getURL) {
|
||||||
|
try {
|
||||||
|
chrome.tabs.create({ url: chrome.runtime.getURL("pages/popup.html") });
|
||||||
|
} catch (e) {
|
||||||
|
window.open("popup.html", "_blank");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
window.open("popup.html", "_blank");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拖拽功能(如你的页面有 .draggable-panel)
|
||||||
|
const panel = document.getElementById('draggablePanel');
|
||||||
|
const header = document.querySelector('.header');
|
||||||
|
let dragging = false, offsetX = 0, offsetY = 0;
|
||||||
|
if (panel && header) {
|
||||||
|
header.addEventListener('mousedown', function(e) {
|
||||||
|
dragging = true;
|
||||||
|
offsetX = e.clientX - panel.offsetLeft;
|
||||||
|
offsetY = e.clientY - panel.offsetTop;
|
||||||
|
document.body.style.userSelect = 'none';
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('mousemove', function(e) {
|
||||||
|
if (dragging) {
|
||||||
|
let left = Math.max(0, e.clientX - offsetX);
|
||||||
|
let top = Math.max(0, e.clientY - offsetY);
|
||||||
|
panel.style.left = left + 'px';
|
||||||
|
panel.style.top = top + 'px';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('mouseup', function() {
|
||||||
|
dragging = false;
|
||||||
|
document.body.style.userSelect = '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|||||||
@ -403,4 +403,20 @@ h1 {
|
|||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.open-tab-btn {
|
||||||
|
margin-left: 8px;
|
||||||
|
padding: 2px 10px;
|
||||||
|
background: #f8f8f8;
|
||||||
|
border: 1px solid #c9dafc;
|
||||||
|
color: #2560de;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 15px;
|
||||||
|
cursor: pointer;
|
||||||
|
vertical-align: middle;
|
||||||
|
transition: background 0.2s;
|
||||||
|
}
|
||||||
|
.open-tab-btn:hover {
|
||||||
|
background: #eaf1fb;
|
||||||
|
color: #1e40af;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user