1
0
mirror of https://github.com/XFox111/TabsAsideExtension.git synced 2026-04-22 07:58:01 +03:00

Done extension UI and basic interactions

This commit is contained in:
Michael Gordeev
2020-03-10 19:41:05 +03:00
commit 1480e88081
30 changed files with 559 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
chrome.runtime.onMessage.addListener(function(sender, request, sendResponse)
{
var pane = document.querySelector("#aside-pane");
if (pane.style.transform == "translateX(110%)")
{
pane.style.transform = "translateX(0%)";
}
else
{
pane.style.transform = "translateX(110%)";
}
UpdateTheme();
sendResponse();
});
var xhr = new XMLHttpRequest();
xhr.open('GET', chrome.extension.getURL("collections.html"), true);
xhr.onreadystatechange = function ()
{
if (this.status !== 200 || document.querySelector("#aside-pane") != null)
return;
document.body.innerHTML += this.responseText.split("%EXTENSION_PATH%").join(chrome.extension.getURL(""));
};
xhr.send();
function UpdateTheme()
{
var css = document.querySelector("#aside-pane #darkCSS")
if (window.matchMedia("(prefers-color-scheme: dark)").matches)
{
css.removeAttribute("disabled");
}
else
{
css.setAttribute("disabled", true);
}
}