Skip to content

Commit

Permalink
Merge pull request #53 from jdi-testing/issue_313
Browse files Browse the repository at this point in the history
При закрытии плагина убирать со страницы добавленные плагином элементы
  • Loading branch information
marusyaganza authored Nov 8, 2021
2 parents a32a349 + 942761f commit 30ec740
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "JDN",
"description": "",
"devtools_page": "index.html",
"version": "3.0.70",
"version": "3.0.71",
"permissions": [
"activeTab",
"tabs",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jdi-react-extension",
"version": "3.0.70",
"version": "3.0.71",
"description": "jdi react extension",
"scripts": {
"start": "npm run webpack",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ export const runContextMenu = () => {

// ACTION: CLOSE MODAL
modalCloseLink.addEventListener("click", () => modal.remove());
chrome.storage.onChanged.addListener((event) => {
if (event?.IS_DISCONNECTED?.newValue === true && modal) {
modal.remove();
}
});
};

// <-----
Expand Down
1 change: 1 addition & 0 deletions src/js/blocks/autoFind/contentScripts/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ export const highlightOnPage = () => {

const disconnectHandler = () => {
removeHighlight(() => console.log("JDN highlight has been killed"))();
chrome.storage.sync.set({ IS_DISCONNECTED: true });
};

chrome.runtime.onConnect.addListener((p) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,9 @@ export const reportProblemPopup = () => {
backgroundModal.append(modal);

document.body.append(backgroundModal);
chrome.storage.onChanged.addListener((event) => {
if (event?.IS_DISCONNECTED?.newValue === true && modal) {
removePopup();
}
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,10 @@ export const settingsPopup = () => {
modal.appendChild(form);
backgroundModal.append(modal);
document.body.append(backgroundModal);
chrome.storage.onChanged.addListener((event) => {
if (event?.IS_DISCONNECTED?.newValue === true) {
removePopup();
};
});
});
};
1 change: 1 addition & 0 deletions src/js/blocks/autoFind/utils/connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class Connector {
attachStaticScripts() {
this.attachContentScript(highlightOnPage).then(() => {
this.createPort();
chrome.storage.sync.set({ IS_DISCONNECTED: false });
});
this.attachContentScript(runContextMenu);
this.attachContentScript(highlightOrder);
Expand Down

0 comments on commit 30ec740

Please sign in to comment.