Skip to content

Commit

Permalink
support to temp enable the plug in via browser action for pages that …
Browse files Browse the repository at this point in the history
…dyamically display pop ups
  • Loading branch information
codemonkey-uk committed Nov 29, 2021
1 parent 976ae45 commit 3eebdbc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions content.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var annotations_local_enable = false;

// Now monitor the DOM for additions and substitute emoji into new nodes.
// @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver.
Expand All @@ -6,7 +7,7 @@ const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (childOfId(mutation.target,"local_time_popup")==false)
updateSelection = true;
if (settings.feature_annotations)
if (settings.feature_annotations || annotations_local_enable)
{
if (mutation.addedNodes && mutation.addedNodes.length > 0) {
// This DOM change was new nodes being added. Run our substitution
Expand Down Expand Up @@ -110,7 +111,11 @@ function begin()
// listen for background script and trigger full replace
browser.runtime.onMessage.addListener(request => {
if (request.greeting)
replaceAllText();
{
annotations_local_enable = !annotations_local_enable;
if (annotations_local_enable)
replaceAllText();
}
return Promise.resolve({response: "background.js message received"});
});
}
Expand Down
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = local_time
VERSION = 0_4_5
VERSION = 0_4_6
BUILD_DIR = release
BUILD_FILE = $(BUILD_DIR)/$(NAME)_$(VERSION).zip
FILES = browser-polyfill.js core.js content.js background.js manifest.json LICENSE icon-512.png icon-128.png options.js options.html popup.css
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Localise Timezones",
"description": "Converts times to your local time zone",
"version": "0.4.5",
"version": "0.4.6",
"icons": {
"128": "icon-128.png",
"512": "icon-512.png"
Expand Down

0 comments on commit 3eebdbc

Please sign in to comment.