Skip to content
Snippets Groups Projects
Commit 7f1393ea authored by RANWEZ Pierre's avatar RANWEZ Pierre :anchor:
Browse files

:sparkles: feat: CSSLSD without parameters

parent 601b1ff2
No related branches found
No related tags found
1 merge request!1✨ feat: CSSLSD V2
......@@ -75,6 +75,8 @@ You need to use a custom CSS template, like below to map your audio or MIDI even
You can extend parameter by heritage with template `[<parameter> <type> <option> <audio or midi control>]`. This is not mandatory to type all heritage, but you need to restect the direction. This is allowed : `[<parameter> <type> <option>]` or `[<parameter> <type>]`. This is **not** allowed : `[<parameter> <audio or midi control>]`.
You can use without CSSLSD code without any parameters, use same template like above. How to use : `[<type> <option> <audio or midi control>]`.
Code example:
```css
......@@ -86,6 +88,7 @@ body {
h1 {
/* Simple parameter usage */
opacity: [opacité];
font-size:[0:20 d loud];
color: #000000;
}
```
......
......@@ -180,6 +180,7 @@ function saveParameters() {
}
function analyseAll() {
var isParameter = false;
chrome.storage.local.get(['parameters', 'css'], function (result) {
var all = [];
var parser = new CSSParser();
......@@ -193,15 +194,19 @@ function analyseAll() {
count = css.valueText.split("[").length;
if (count > 1) {
for (let index = 0; index < count - 1; index++) {
isParameter = false;
template = cssValue.substring(
cssValue.indexOf("[") + 1,
cssValue.indexOf("]")
);
console.log(template);
cssValue = cssValue.replace("[" + template + "]", "");
var parameters = JSON.parse(result.parameters);
parameters.forEach(p => {
templateSplited = template.split(' ');
if (p[1] == templateSplited[0]) {
isParameter = true;
console.log(isParameter);
if (p[4] != "") {
p[4].split(' ').forEach(midiE => {
var obj = {
......@@ -262,7 +267,27 @@ function analyseAll() {
}
}
});
if (isParameter == false) {
if (templateSplited.length > 2) {
if (templateSplited[2].includes('cc') || templateSplited[2].includes('note') || templateSplited[2].includes('pb')) {
var audioOrMidi = 'midi';
} else {
var audioOrMidi = 'audio';
}
var obj = {
type: audioOrMidi,
name: templateSplited[0],
templateFull: template,
eventType: templateSplited.length > 2 ? (templateSplited[2].includes(':') ? templateSplited[2].split(':')[0] : templateSplited[2]) : '',
eventName: templateSplited.length > 2 ? (templateSplited[2].includes(':') ? templateSplited[2].split(':')[1] : '') : '',
options: templateSplited.length > 1 ? (templateSplited[1]) : '',
array: templateSplited.length > 0 ? (templateSplited[0].includes(';') ? templateSplited[0].split(';') : '') : '',
min: templateSplited.length > 0 ? (templateSplited[0].includes(':') ? templateSplited[0].split(':')[0] : '') : '',
max: templateSplited.length > 0 ? (templateSplited[0].includes(':') ? templateSplited[0].split(':')[1] : '') : '',
}
templates.push(obj);
}
}
}
} else {
templates.push({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment