mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-23 05:10:27 +01:00
Fixed options standalone detection.
This commit is contained in:
parent
dfc613db04
commit
635912c8b9
@ -34,8 +34,22 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (window === window.top){
|
new Promise(function(resolve){
|
||||||
|
const port = browser.runtime.connect();
|
||||||
|
port.onMessage.addListener(function(data){
|
||||||
|
if (data.hasOwnProperty("tabId")){
|
||||||
|
logging.notice("my tab id is", data.tabId);
|
||||||
|
port.disconnect();
|
||||||
|
resolve(data.tabId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).then(function(tabId){
|
||||||
|
return browser.tabs.get(tabId);
|
||||||
|
}).then(function(tab){
|
||||||
let head = document.createElement("header");
|
let head = document.createElement("header");
|
||||||
|
document.body.insertBefore(head, document.body.firstChild);
|
||||||
|
|
||||||
|
if (tab.url === window.location.href){
|
||||||
let heading = document.createElement("h1");
|
let heading = document.createElement("h1");
|
||||||
heading.textContent = browser.i18n.getMessage("options");
|
heading.textContent = browser.i18n.getMessage("options");
|
||||||
head.appendChild(heading);
|
head.appendChild(heading);
|
||||||
@ -55,9 +69,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.body.appendChild(head);
|
|
||||||
document.body.classList.add("standalone");
|
document.body.classList.add("standalone");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var table = document.createElement("table");
|
var table = document.createElement("table");
|
||||||
table.className = "settings " + (settings.displayDescriptions? "display": "hide") + "Descriptions";
|
table.className = "settings " + (settings.displayDescriptions? "display": "hide") + "Descriptions";
|
||||||
|
@ -6,7 +6,8 @@ Version 0.5.3:
|
|||||||
- display version in options page
|
- display version in options page
|
||||||
|
|
||||||
fixes:
|
fixes:
|
||||||
-
|
- CSP did not work properly for worker-src
|
||||||
|
- detection if the options page was displayed in a separate tab did not work reliably
|
||||||
|
|
||||||
known issues:
|
known issues:
|
||||||
- if a data URL is blocked the page action button does not appear
|
- if a data URL is blocked the page action button does not appear
|
||||||
|
Loading…
x
Reference in New Issue
Block a user