diff --git a/background.js b/background.js index 9ef359df31b9f1d5bf7cf55386717388df593a9b..6da0cbd904645e38f634c09eb4be1fae72e523ed 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 689f598b1fe24d405fb48b03ab26ac37fd2b8577..60c18dbd1fb7bd2ed36efcc5afbc196529b2e183 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) {