new changes in extension
This commit is contained in:
parent
34efe64f3b
commit
dd2d3b1d97
25
extension/background.ts
Normal file
25
extension/background.ts
Normal file
@ -0,0 +1,25 @@
|
||||
export {};
|
||||
|
||||
const toogle = () => {
|
||||
const iframe = document.getElementById("pageassist-iframe");
|
||||
const widget = document.getElementById("pageassist-icon");
|
||||
if (iframe) {
|
||||
const display = iframe.style.display;
|
||||
if (display === "none") {
|
||||
if (widget) {
|
||||
widget.style.display = "none";
|
||||
}
|
||||
iframe.style.display = "block";
|
||||
} else {
|
||||
iframe.style.display = "none";
|
||||
// if user enabled show widget in settings and close from action then show widget will be disappear inorder to show widget again we need to reload the page
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
chrome.action.onClicked.addListener((tab) => {
|
||||
chrome.scripting.executeScript({
|
||||
target: { tabId: tab.id },
|
||||
func: toogle,
|
||||
});
|
||||
});
|
@ -83,8 +83,10 @@ const main = async () => {
|
||||
window.addEventListener("message", function (event) {
|
||||
if (event.data === "pageassist-close") {
|
||||
iframe.style.display = "none";
|
||||
toggleIcon.style.display = "block";
|
||||
toggleIcon.classList.remove("hidden");
|
||||
if (!isChatWidgetEnabled) {
|
||||
toggleIcon.style.display = "block";
|
||||
toggleIcon.classList.remove("hidden");
|
||||
}
|
||||
} else if (event.data === "pageassist-html") {
|
||||
console.log("pageassist-html");
|
||||
let html = document.documentElement.outerHTML;
|
||||
|
@ -52,7 +52,9 @@
|
||||
}
|
||||
],
|
||||
"permissions": [
|
||||
"storage"
|
||||
"storage",
|
||||
"activeTab",
|
||||
"scripting"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user