Skip to content

Commit

Permalink
feat[WIP]: handle tab's URL change, need a way to remove current tab'…
Browse files Browse the repository at this point in the history
…s setting for #292
  • Loading branch information
ffoodd committed May 9, 2019
1 parent e7ef404 commit 1322db8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Binary file modified a11ycss-webextension-chrome.zip
Binary file not shown.
Binary file modified a11ycss-webextension-firefox.zip
Binary file not shown.
17 changes: 16 additions & 1 deletion webextension/scripts/textspacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,28 @@ btnTextspacing.addEventListener('click', function () {
storeTextSpacingStatus(!checked);
});

function textSpacingOnUpdated(tabId, changeInfo, tabInfo) {
if (changeInfo.url) {
let getStatus = browser.storage.local.get("textSpacingStatus");
getStatus.then(
// when we got something
(item) => {
if (item && item.textSpacingStatus && item.textSpacingStatus[tabId]) {
// Need to find a way to only remove current tab's value
}
}, onError
);
}
}

browser.tabs.onUpdated.addListener(textSpacingOnUpdated);

function textSpacingOnload() {
let getStatus = browser.storage.local.get("textSpacingStatus");
getStatus.then(
// when we got something
(item) => {
if (item && item.textSpacingStatus) {
console.log(item.textSpacingStatus);
browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => {
// If a setting is found for this tab
if (item.textSpacingStatus[tabs[0].id]) {
Expand Down

0 comments on commit 1322db8

Please sign in to comment.