diff --git a/README.html b/README.html index f3f4c4f42e71e324a7f388603e5aa834654ac462..06badabed6dc53a2e142838c9b3b99037235457d 100644 --- a/README.html +++ b/README.html @@ -1430,7 +1430,8 @@ You can put "element" tab to bottom by right-clicking on it. For deported devtool, click on more (top-right) and then click on separate devtool dock.</p> <p><img src="file:///d:\Cours\M2S4\PFE\csslsd\doc\devtool.gif" alt="Devtool view"></p> <h3 id="csslsd-code">CSSLSD Code</h3> -<p>You need to use a custom CSS template, like below to map your audio or MIDI events to some CSSLSD properties. All parameters are between <strong>square brackets</strong> you can extend parameter by heritage with a range like bellow (this is not mandatory). You can use multiple parameters in a line. You can also type pure CSS in code editor, this CSS wil be apply on code auto-save (each time your type something in editor).</p> +<p>You need to use a custom CSS template, like below to map your audio or MIDI events to some CSSLSD properties. All parameters are between <strong>square brackets</strong>. You can use multiple parameters in a line. You can also type pure CSS in code editor, this CSS wil be apply on code auto-save (each time your type something in editor).</p> +<p>You can extend parameter by heritage with template <code>[<parameter> <type> <option> <audio or midi control>]</code>. This is not mandatory to type all heritage, but you need to restect the direction. This is allowed : <code>[<parameter> <type> <option>]</code> or <code>[<parameter> <type>]</code>. This is <strong>not</strong> allowed : <code>[<parameter> <audio or midi control>]</code>.</p> <p>Code example:</p> <pre><code class="language-css"><div><span class="hljs-selector-tag">body</span> { <span class="hljs-comment">/* Tip : You can use comments */</span> diff --git a/README.md b/README.md index 14ff80edce800fc6a3417bc867b43f03cfa3e696..bf1c26ae3c941e861567bfed88f5056b002eb8b7 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,9 @@ For deported devtool, click on more (top-right) and then click on separate devto ### CSSLSD Code -You need to use a custom CSS template, like below to map your audio or MIDI events to some CSSLSD properties. All parameters are between **square brackets** you can extend parameter by heritage with a range like bellow (this is not mandatory). You can use multiple parameters in a line. You can also type pure CSS in code editor, this CSS wil be apply on code auto-save (each time your type something in editor). +You need to use a custom CSS template, like below to map your audio or MIDI events to some CSSLSD properties. All parameters are between **square brackets**. You can use multiple parameters in a line. You can also type pure CSS in code editor, this CSS wil be apply on code auto-save (each time your type something in editor). + +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>]`. Code example: diff --git a/main.js b/main.js index b3482feed0b3c8b122fb61d38a94c01862b33051..642e5f22286a4e2541ae097be45d8dda6e54cfaa 100644 --- a/main.js +++ b/main.js @@ -208,23 +208,23 @@ function analyseAll() { type: '', name: templateSplited[0], templateFull: template, - eventType: '', - eventName: '', - options: '', + eventType: templateSplited.length > 3 ? (templateSplited[3].includes(':')?templateSplited[3].split(':')[0]:templateSplited[3]) : '', + eventName: templateSplited.length > 3 ? (templateSplited[3].includes(':')?templateSplited[3].split(':')[1]:'') : '', + options: templateSplited.length > 2 ? (templateSplited[2]) : '', array: templateSplited.length > 1 ? (templateSplited[1].includes(';') ? templateSplited[1].split(';') : '') : '', min: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[0] : '') : '', max: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[1] : '') : '', } obj.type = 'midi'; if (midiE.includes(':')) { - obj.eventType = midiE.split(':')[0]; - obj.eventName = midiE.split(':')[1]; + obj.eventType = ((obj.eventType == '') ? midiE.split(':')[0] : obj.eventType); + obj.eventName = ((obj.eventName == '') ? midiE.split(':')[1] : obj.eventName); } else { - obj.eventType = midiE; - obj.eventName = ''; + obj.eventType = ((obj.eventType == '') ? midiE : obj.eventType); + obj.eventName = ((obj.eventName == '') ? '' : obj.eventName); } - obj.options = p[3]; + obj.options = ((obj.options == '') ? (p[3]) : obj.options); obj.array = ((obj.array == '') ? (p[2].includes(';') ? p[2].split(';') : '') : obj.array); obj.min = ((obj.min == '') ? (p[2].includes(':') ? p[2].split(':')[0] : 0) : obj.min); obj.max = ((obj.max == '') ? (p[2].includes(':') ? p[2].split(':')[1] : 1) : obj.max); @@ -237,23 +237,23 @@ function analyseAll() { type: '', name: templateSplited[0], templateFull: template, - eventType: '', - eventName: '', - options: '', + eventType: templateSplited.length > 3 ? (templateSplited[3].includes(':')?templateSplited[3].split(':')[0]:templateSplited[3]) : '', + eventName: templateSplited.length > 3 ? (templateSplited[3].includes(':')?templateSplited[3].split(':')[1]:'') : '', + options: templateSplited.length > 2 ? (templateSplited[2]) : '', array: templateSplited.length > 1 ? (templateSplited[1].includes(';') ? templateSplited[1].split(';') : '') : '', min: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[0] : '') : '', max: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[1] : '') : '', } obj.type = 'audio'; if (audioE.includes(':')) { - obj.eventType = audioE.split(':')[0]; - obj.eventName = audioE.split(':')[1]; + obj.eventType = ((obj.eventType == '') ? audioE.split(':')[0] : obj.eventType); + obj.eventName = ((obj.eventName == '') ? audioE.split(':')[1] : obj.eventName); } else { - obj.eventType = audioE; - obj.eventName = ''; + obj.eventType = ((obj.eventType == '') ? audioE : obj.eventType); + obj.eventName = ((obj.eventName == '') ? '' : obj.eventName); } - obj.options = p[3]; + obj.options = ((obj.options == '') ? (p[3]) : obj.options); obj.array = ((obj.array == '') ? (p[2].includes(';') ? p[2].split(';') : '') : obj.array); obj.min = ((obj.min == '') ? (p[2].includes(':') ? p[2].split(':')[0] : 0) : obj.min); obj.max = ((obj.max == '') ? (p[2].includes(':') ? p[2].split(':')[1] : 1) : obj.max);