mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
chrome extensions (#4308)
Build chrome extensions that allow interaction with browser content
This commit is contained in:
24
intergrations/extension_chrome/popup.js
Normal file
24
intergrations/extension_chrome/popup.js
Normal file
@ -0,0 +1,24 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
chrome.storage.sync.get(["baseURL", "from", "auth", "sharedID"], (result) => {
|
||||
if (result.baseURL && result.sharedID && result.from && result.auth) {
|
||||
const iframeSrc = `${result.baseURL}chat/share?shared_id=${result.sharedID}&from=${result.from}&auth=${result.auth}`;
|
||||
const iframe = document.querySelector("iframe");
|
||||
iframe.src = iframeSrc;
|
||||
}
|
||||
});
|
||||
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
|
||||
chrome.scripting.executeScript(
|
||||
{
|
||||
target: { tabId: tabs[0].id },
|
||||
files: ["content.js"],
|
||||
},
|
||||
(results) => {
|
||||
if (results && results[0]) {
|
||||
const getHtml = document.getElementById("getHtml");
|
||||
getHtml.value = results[0].result;
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user