From 9110632526b4613290c9e441491af3d275aef135 Mon Sep 17 00:00:00 2001 From: Stian Aune Date: Mon, 28 Oct 2019 21:54:46 +0100 Subject: [PATCH] I tworks --- background.js | 2 +- contentScript.js | 8 +++++++- manifest.json | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index 14b3bdc..c6839d4 100644 --- a/background.js +++ b/background.js @@ -6,7 +6,7 @@ chrome.runtime.onInstalled.addListener(function () { chrome.declarativeContent.onPageChanged.removeRules(undefined, function () { chrome.declarativeContent.onPageChanged.addRules([{ conditions: [new chrome.declarativeContent.PageStateMatcher({ - pageUrl: {hostEquals: 'youtube.com'}, + pageUrl: {hostEquals: 'www.youtube.com'}, }) ], actions: [new chrome.declarativeContent.ShowPageAction()] diff --git a/contentScript.js b/contentScript.js index 41c38ff..a6699c8 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1,9 +1,14 @@ function applyDefaultStyle(element) { element.style.position = "fixed"; - element.style.zIndex = 1000; + element.style.zIndex = 99999999; + element.style.color = "#FFF"; + element.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; + element.style.padding = "0.25em 0.5ch"; + element.style.fontSize = "3vmax"; } let mCalorieCount = document.createElement("div"); +mCalorieCount.id = "ykonsole-calorie-count"; applyDefaultStyle(mCalorieCount); mCalorieCount.style.left = 0; mCalorieCount.style.top = 0; @@ -15,6 +20,7 @@ mCalorieCount.innerHTML = ` document.body.append(mCalorieCount); let mResults = document.createElement("div"); +mResults.id = "ykonsole-result"; applyDefaultStyle(mResults); mResults.style.right = 0; mResults.style.bottom = 0; diff --git a/manifest.json b/manifest.json index e4bb8ea..936f99c 100644 --- a/manifest.json +++ b/manifest.json @@ -18,6 +18,7 @@ "storage", "activeTab", "declarativeContent", + "https://www.youtube.com/", "https://indigo.stian-aune.com/" ] } \ No newline at end of file