Fix background colour in popup

This commit is contained in:
Ajay Ramachandran
2020-10-26 00:08:32 -04:00
parent b6e5fe461f
commit 637dcbee00
2 changed files with 13 additions and 11 deletions

View File

@@ -1,5 +1,3 @@
<html>
<head>
<title>__MSG_openPopup__</title>
<link id="sponsorBlockPopupFont" rel="stylesheet" type="text/css" href="/libs/Source+Sans+Pro.css">
@@ -138,5 +136,3 @@
<script src="./js/vendor.js" async></script>
<script src="./js/popup.js" async></script>
</body>
</html>

View File

@@ -1273,9 +1273,19 @@ function openInfoMenu() {
sendRequestToCustomServer('GET', chrome.extension.getURL("popup.html"), function(xmlhttp) {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var popup = document.createElement("div");
let popup = document.createElement("div");
popup.id = "sponsorBlockPopupContainer";
popup.innerHTML = xmlhttp.responseText
let htmlData = xmlhttp.responseText;
// Hack to replace head data (title, favicon)
htmlData = htmlData.replace(/<head>[\S\s]*<\/head>/gi, "");
// Hack to replace body tag with div
htmlData = htmlData.replace(/<body/gi, "<div");
htmlData = htmlData.replace(/<\/body/gi, "</div");
console.log(htmlData)
popup.innerHTML = htmlData;
//close button
let closeButton = document.createElement("div");
@@ -1313,10 +1323,6 @@ function openInfoMenu() {
check.src = chrome.extension.getURL("icons/check.svg");
check.src = chrome.extension.getURL("icons/thumb.svg");
//remove the style sheet and font that are not necessary
popup.querySelector("#sponsorBlockPopupFont").remove();
popup.querySelector("#sponsorBlockStyleSheet").remove();
parentNode.insertBefore(popup, parentNode.firstChild);
//run the popup init script