From 2c676f5bf91133764f34b012d7283514f7c7eea8 Mon Sep 17 00:00:00 2001
From: Pierre Ranwez <pierre.ranwez.etu@univ-lille.fr>
Date: Thu, 10 Feb 2022 12:18:44 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20bug:=20fixs?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 background.js | 23 +++++++++++++++++++++--
 content.js    |  2 ++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/background.js b/background.js
index 9ef359d..6da0cbd 100644
--- a/background.js
+++ b/background.js
@@ -1,5 +1,13 @@
-let css = "body {\n\tbackground-color: [couleur];\n}\nh1, h2 {\n    opacity: [opacité];\n\tfont-family: [typo];\n\tcolor: rgb([chiffre 0:255],255,255);\n}";
-let parameters = '[[\"       \",\"typo\",\"sans-serif;serif;cursive;fantasy\",\"r\",\"note:10\",\"onset:E\"],[\"       \",\"chiffre\",\"0:1000\",\"i:100\",\"cc:60\",\"onset:D\"],[\"       \",\"couleur\",\"#000:#fff\",\"d\",\"cc:60\",\"loud\"],[\"       \",\"opacité\",\"0:1\",\"d\",\"cc:60\",\"hi\"]]';
+let css = `body {
+	background-color: [couleur];
+}
+h1, h2 {
+	opacity: [opacité];
+	font-family: [typo];
+	font-size: [chiffre2 20:100]px;
+	color: rgb([chiffre 0:255],255,255);
+}`;
+let parameters = `[[\"       \",\"typo\",\"sans-serif;serif;cursive;fantasy\",\"r\",\"note:10\",\"onset:E\"],[\"       \",\"chiffre\",\"0:1000\",\"i:100\",\"cc:60\",\"onset:D\"],[\"       \",\"chiffre2\",\"0:200\",\"i:10\",\"cc:60\",\"onset:E\"],[\"       \",\"couleur\",\"#000:#fff\",\"d\",\"cc:60\",\"loud\"],[\"       \",\"opacité\",\"0:1\",\"d\",\"cc:60\",\"hi\"]]`;
 let activate = false;
 let activateFav = "ressources/icon256.png";
 let audioB = false;
@@ -34,4 +42,15 @@ chrome.runtime.onConnect.addListener(function (port) {
 			chrome.storage.sync.set({ popup: false });
 		});
 	}
+});
+
+function loopPlay2() {
+	console.log('looooop');
+}
+
+chrome.runtime.onMessage.addListener((message, callback) => {
+	// const tabId = getForegroundTabId();
+	// if (message.data === "loop") {
+	// 	chrome.scripting.executeScript({ func: loopPlay2, tabId });
+	// }
 });
\ No newline at end of file
diff --git a/content.js b/content.js
index 689f598..60c18db 100644
--- a/content.js
+++ b/content.js
@@ -185,6 +185,8 @@ function midiEvent(type, data) {
 
 // Function that play recorded midi loop
 function playMidiLoop(loopId) {
+
+    chrome.runtime.sendMessage({ data: 'loop' });
     // if (records[loopId]) {
     //     playLoopInfo = true;
     //     while (playLoopInfo && playLoop && records[loopId]['events'].length > 0) {
-- 
GitLab