Skip to content

Commit e2814ff

Browse files
committed
Rename presets attributes
1 parent de11b24 commit e2814ff

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

docs/configuration.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,26 +268,26 @@ Track presets allow you to define different solo configurations that can be quic
268268

269269
**Defining Presets**
270270

271-
To use presets, add a `data-preset-names` attribute to the player div with comma-separated preset names:
271+
To use presets, add a `preset-names` attribute to the player div with comma-separated preset names:
272272

273273
```html
274-
<div class="player" data-preset-names="Full Mix,Vocals,Drums + Bass">
275-
<ts-track title="Vocals" data-presets="0,1">
274+
<div class="player" preset-names="Full Mix,Vocals,Drums + Bass">
275+
<ts-track title="Vocals" presets="0,1">
276276
<ts-source src="vocals.mp3"></ts-source>
277277
</ts-track>
278-
<ts-track title="Drums" data-presets="0,2">
278+
<ts-track title="Drums" presets="0,2">
279279
<ts-source src="drums.mp3"></ts-source>
280280
</ts-track>
281-
<ts-track title="Bass" data-presets="0,2">
281+
<ts-track title="Bass" presets="0,2">
282282
<ts-source src="bass.mp3"></ts-source>
283283
</ts-track>
284-
<ts-track title="Guitar" data-presets="0">
284+
<ts-track title="Guitar" presets="0">
285285
<ts-source src="guitar.mp3"></ts-source>
286286
</ts-track>
287287
</div>
288288
```
289289

290-
Each `ts-track` element uses the `data-presets` attribute to define which presets it belongs to (as comma-separated preset indices, 0-indexed).
290+
Each `ts-track` element uses the `presets` attribute to define which presets it belongs to (as comma-separated preset indices, 0-indexed).
291291

292292
In the example above:
293293
- **Preset 0** (Full Mix): All tracks are soloed (Vocals, Drums, Bass, Guitar)
@@ -296,17 +296,17 @@ In the example above:
296296

297297
**Auto-Generated Preset Names**
298298

299-
If you don't define `data-preset-names`, preset names will be auto-generated as "Preset 0", "Preset 1", etc.:
299+
If you don't define `preset-names`, preset names will be auto-generated as "Preset 0", "Preset 1", etc.:
300300

301301
```html
302302
<div class="player">
303-
<ts-track title="Vocals" data-presets="0,1">
303+
<ts-track title="Vocals" presets="0,1">
304304
<ts-source src="vocals.mp3"></ts-source>
305305
</ts-track>
306-
<ts-track title="Drums" data-presets="0,2">
306+
<ts-track title="Drums" presets="0,2">
307307
<ts-source src="drums.mp3"></ts-source>
308308
</ts-track>
309-
<ts-track title="Bass" data-presets="0,2">
309+
<ts-track title="Bass" presets="0,2">
310310
<ts-source src="bass.mp3"></ts-source>
311311
</ts-track>
312312
</div>
@@ -317,8 +317,8 @@ If you don't define `data-preset-names`, preset names will be auto-generated as
317317
Preset 0 is automatically created from tracks that have the `solo` attribute. If no tracks explicitly define their preset membership, they won't appear in any preset except those they're assigned to:
318318

319319
```html
320-
<div class="player" data-preset-names="With Drums,Without Drums">
321-
<ts-track title="Drums" solo data-presets="0">
320+
<div class="player" preset-names="With Drums,Without Drums">
321+
<ts-track title="Drums" solo presets="0">
322322
<ts-source src="drums.mp3"></ts-source>
323323
</ts-track>
324324
<ts-track title="Bass">

examples/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515
</head>
1616
<body>
1717

18-
<div class="player" data-preset-names="All Tracks,Violins & Synths,Rhythm Section,Drums Only">
18+
<div class="player" preset-names="All Tracks,Violins & Synths,Rhythm Section,Drums Only">
1919
<img style="margin: 20px auto;" src="data/cover.png">
2020
<img data-style="margin: auto;" class="seekable" data-seek-margin-left="4" data-seek-margin-right="4" src="data/mix.png">
21-
<ts-track title="Violins" data-img="data/violins.png" data-presets="0,1">
21+
<ts-track title="Violins" data-img="data/violins.png" presets="0,1">
2222
<ts-source src="data/violins.mp3"></ts-source>
2323
</ts-track>
24-
<ts-track title="Synths" data-img="data/synth.png" data-presets="0,1">
24+
<ts-track title="Synths" data-img="data/synth.png" presets="0,1">
2525
<ts-source src="data/synth.mp3"></ts-source>
2626
</ts-track>
27-
<ts-track title="Bass" data-img="data/bass.png" data-presets="0,2">
27+
<ts-track title="Bass" data-img="data/bass.png" presets="0,2">
2828
<ts-source src="data/bass.mp3"></ts-source>
2929
</ts-track>
30-
<ts-track title="Drums" data-img="data/drums.png" data-presets="0,2,3">
30+
<ts-track title="Drums" data-img="data/drums.png" presets="0,2,3">
3131
<ts-source src="data/drums.mp3"></ts-source>
3232
</ts-track>
3333
</div>

js/trackswitch.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ Plugin.prototype.init = function() {
116116
this.element.addClass("jquery-trackswitch");
117117

118118
// Parse preset configuration early so we can conditionally include preset dropdown
119-
// Read preset names from data-preset-names attribute (comma-separated)
120-
var presetNamesAttr = this.element.attr('data-preset-names');
119+
// Read preset names from preset-names attribute (comma-separated)
120+
var presetNamesAttr = this.element.attr('preset-names');
121121
var maxPresetIndex = -1;
122122

123123
// First pass: scan all ts-track elements to find max preset index
124124
this.element.find('ts-track').each(function() {
125-
var presetsAttr = $(this).attr('data-presets');
125+
var presetsAttr = $(this).attr('presets');
126126
if (presetsAttr) {
127127
var presets = presetsAttr.split(',').map(function(p) { return parseInt(p.trim()); });
128128
presets.forEach(function(preset) {
@@ -266,11 +266,11 @@ Plugin.prototype.init = function() {
266266

267267
this.element.find('ts-track').each(function(i) {
268268

269-
// Parse data-presets attribute (comma-separated list of preset indices)
270-
var presetsAttr = $(this).attr('data-presets');
269+
// Parse presets attribute (comma-separated list of preset indices)
270+
var presetsAttr = $(this).attr('presets');
271271
var presetsForTrack = [];
272272

273-
// If data-presets is not specified, check if track has solo attribute for Preset 0
273+
// If presets is not specified, check if track has solo attribute for Preset 0
274274
if (presetsAttr) {
275275
presetsForTrack = presetsAttr.split(',').map(function(p) { return parseInt(p.trim()); });
276276
} else if (this.hasAttribute('solo')) {

0 commit comments

Comments
 (0)