Compare commits

..

No commits in common. "95f9fc86fe850a81f1c83d51ce20cbde819eaea9" and "af4f2965ab4484cbc734539de07bac7a99e1d256" have entirely different histories.

4 changed files with 1 additions and 144 deletions

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "渠道应用开发部知识库", "name": "渠道应用开发部知识库",
"version": "1.3.3", "version": "1.3.2",
"description": "通过关键词快速搜索内部文档", "description": "通过关键词快速搜索内部文档",
"permissions": ["storage"], "permissions": ["storage"],
"host_permissions": [ "host_permissions": [

View File

@ -53,8 +53,6 @@
</div> </div>
</div> </div>
</div> </div>
<script src="popup.js"></script> <script src="popup.js"></script>
</body> </body>
</html> </html>

View File

@ -1,59 +1,4 @@
document.addEventListener("DOMContentLoaded", async () => { document.addEventListener("DOMContentLoaded", async () => {
// 标签页/弹窗自适应:宽大则自动全屏自适应
if (window.innerWidth > 900 && window.innerHeight > 700) {
document.body.classList.add('fullscreen');
// 禁用拖拽
const panel = document.getElementById('draggablePanel');
if (panel) {
panel.style.left = '';
panel.style.top = '';
panel.style.position = 'fixed';
}
} else {
// 弹窗环境支持拖拽
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 = '';
});
}
}
// 标签页打开按钮
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");
}
};
}
const input = document.getElementById("searchInput"); const input = document.getElementById("searchInput");
const searchBtn = document.getElementById("searchBtn"); const searchBtn = document.getElementById("searchBtn");
const clearHistoryBtn = document.getElementById("clearHistoryBtn"); const clearHistoryBtn = document.getElementById("clearHistoryBtn");
@ -570,49 +515,3 @@ 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 = '';
});
}
});

View File

@ -5,23 +5,6 @@ body {
background-color: #fefefe; background-color: #fefefe;
} }
/* 新增:标签页下自动全屏自适应,内容居中不可拖拽 */
body.fullscreen .draggable-panel {
position: fixed !important;
left: 50% !important;
top: 50% !important;
transform: translate(-50%, -50%) !important;
width: 90vw !important;
max-width: 1200px !important;
height: 94vh !important;
max-height: 98vh !important;
min-width: 360px !important;
min-height: 320px !important;
box-shadow: 0 10px 40px #3070ed22;
resize: none !important;
}
.header { .header {
display: flex; display: flex;
align-items: center; align-items: center;
@ -420,22 +403,6 @@ 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;
}
.tab-bar { .tab-bar {
display: flex; display: flex;
margin-bottom: 8px; margin-bottom: 8px;
@ -471,10 +438,3 @@ h1 {
margin-bottom: 0; margin-bottom: 0;
} }
body.fullscreen #tabContentAi .llm-result-container {
resize: vertical;
overflow: auto;
min-height: 160px;
max-height: 80vh;
}